Commit b940901b authored by 18김민수's avatar 18김민수

Critical event bug fix

parent 0d55d9e2
...@@ -28,11 +28,11 @@ public class EventLoader : MonoBehaviour // This script is attatched to event SD ...@@ -28,11 +28,11 @@ public class EventLoader : MonoBehaviour // This script is attatched to event SD
{ {
EventCore eventCore = UITownManager.instance.GetEventCoreFromEventSd(gameObject.transform); EventCore eventCore = UITownManager.instance.GetEventCoreFromEventSd(gameObject.transform);
SceneManager.LoadScene("EventScene", LoadSceneMode.Single); SceneManager.LoadScene("EventScene", LoadSceneMode.Single);
GameManager.instance.currentEventName = eventCore.eventName; GameManager.instance.currentEvent = eventCore;
} }
public void LoadEventScene(EventCore eventCore) public void LoadEventScene(EventCore eventCore)
{ {
SceneManager.LoadScene("EventScene", LoadSceneMode.Single); SceneManager.LoadScene("EventScene", LoadSceneMode.Single);
GameManager.instance.currentEventName = eventCore.eventName; GameManager.instance.currentEvent = eventCore;
} }
} }
...@@ -14,16 +14,24 @@ public class EventManager : MonoBehaviour ...@@ -14,16 +14,24 @@ public class EventManager : MonoBehaviour
public GameObject spritePeopleCenter; public GameObject spritePeopleCenter;
public GameObject sprtiePeopleRight; public GameObject sprtiePeopleRight;
public Image test;
public GameObject[] spritePeople; // use same location index from SpriteLocation
public Text textCharacterInfo; public Text textCharacterInfo;
public Text textScript; public Text textScript;
public Text textFullScript; public Text textFullScript;
void Start()
{
SetUpEventManager();
}
public EventManager(EventCore eventCore) // when playing new event, this instance should be made. public void SetUpEventManager() // when playing new event, this instance should be made.
{ {
this.eventCore = eventCore; eventCore = GameManager.instance.currentEvent;
scriptEnumerator = eventCore.script.GetEnumerator(); scriptEnumerator = GameManager.instance.currentEvent.script.GetEnumerator();
} }
public EventCore eventCore { get; private set; } // when event SD is clicked and scene changed, it should be set to that event. public EventCore eventCore { get; private set; } // when event SD is clicked and scene changed, it should be set to that event.
...@@ -32,7 +40,6 @@ public class EventManager : MonoBehaviour ...@@ -32,7 +40,6 @@ public class EventManager : MonoBehaviour
public void ExecuteOneScript() public void ExecuteOneScript()
{ {
Debug.Log("asdf");
// TODO: // TODO:
// when MoveNext() returns false, it must go back to TownScene. // when MoveNext() returns false, it must go back to TownScene.
scriptEnumerator.MoveNext(); scriptEnumerator.MoveNext();
...@@ -104,90 +111,117 @@ public class EventManager : MonoBehaviour ...@@ -104,90 +111,117 @@ public class EventManager : MonoBehaviour
} }
} }
private void _enableContainerConversation(bool i)
{
GameObject contianerTest = GameObject.Find("Canvas/ContainerConversation/ContainerCharacterInfo/BackgroundCharacterInfo");
Image testImage = contianerTest.GetComponent<Image>();
if (i == true)
{
testImage.enabled = false;
}
}
private void _Explanation(Explanation explanation) private void _Explanation(Explanation explanation)
{ {
containerChoice.SetActive(false); Debug.Log("explanation");
containerConversation.SetActive(false);
containerFullScript.SetActive(true); //if(GameObject.Find("Canvas/ContainerConversation") == null)
//{
// Debug.Log("안찾아짐");
//}
//_enableContainerConversation(true);
//containerChoice.SetActive(false);
//containerConversation.SetActive(false);
//containerFullScript.SetActive(true);
} }
private void _Conversation(Conversation conversation) private void _Conversation(Conversation conversation)
{ {
Debug.Log("conversation");
containerChoice.SetActive(false); containerChoice.SetActive(false);
containerConversation.SetActive(true); containerConversation.SetActive(true);
containerFullScript.SetActive(false); containerFullScript.SetActive(false);
textCharacterInfo.text = conversation.characterName; textCharacterInfo.text = conversation.characterName;
textScript.text = conversation.contents;
if (conversation.brightCharacter != SpriteLocation.None)
spritePeople[(int) conversation.brightCharacter].SetActive(true);
_setBright(conversation.brightCharacter);
} }
private void _LoadCharacter(LoadCharacter loadCharacter) private void _LoadCharacter(LoadCharacter loadCharacter)
{ {
Debug.Log("LoadCharacter");
} }
private void _UnloadCharacter(UnloadCharacter unloadCharacter) private void _UnloadCharacter(UnloadCharacter unloadCharacter)
{ {
Debug.Log("UnloadCharacter");
} }
private void _LoadBackground(LoadBackground loadBackground) private void _LoadBackground(LoadBackground loadBackground)
{ {
Debug.Log("LoadBackground");
} }
private void _PlayMusic(PlayMusic playMusic) private void _PlayMusic(PlayMusic playMusic)
{ {
Debug.Log("PlayMusic");
} }
private void _StopMusic(StopMusic stopMusic) private void _StopMusic(StopMusic stopMusic)
{ {
Debug.Log("StopMusic");
} }
private void _LoadCG(LoadCG loadCG) private void _LoadCG(LoadCG loadCG)
{ {
Debug.Log("LoadCG");
} }
private void _UnloadCG(UnloadCG unloadCG) private void _UnloadCG(UnloadCG unloadCG)
{ {
Debug.Log("UnloadCG");
} }
private void _VFXCamerashake(VFXCameraShake vfxCameraShake) private void _VFXCamerashake(VFXCameraShake vfxCameraShake)
{ {
Debug.Log("VFXCamerashake");
} }
private void _VFXLoadSprite(VFXLoadSprite vfxLoadSprite) private void _VFXLoadSprite(VFXLoadSprite vfxLoadSprite)
{ {
Debug.Log("VFXLoadSprite");
} }
private void _VFXUnloadSprite(VFXUnloadSprite vfxUnloadSprite) private void _VFXUnloadSprite(VFXUnloadSprite vfxUnloadSprite)
{ {
Debug.Log("VFXUnloadSprite");
} }
private void _VFXSound(VFXSound vfxSound) private void _VFXSound(VFXSound vfxSound)
{ {
Debug.Log("VFXSoun");
} }
private void _LoadMinigame(LoadMinigame loadMinigame) private void _LoadMinigame(LoadMinigame loadMinigame)
{ {
Debug.Log("LoadMinigame");
} }
private void _LoadVideo(LoadVideo loadVideo) private void _LoadVideo(LoadVideo loadVideo)
{ {
Debug.Log("LoadVideo");
} }
private void _Choice(Choice choice) private void _Choice(Choice choice)
{ {
Debug.Log("Choice");
containerChoice.SetActive(true); containerChoice.SetActive(true);
containerConversation.SetActive(false); containerConversation.SetActive(false);
containerFullScript.SetActive(false); containerFullScript.SetActive(false);
...@@ -195,11 +229,30 @@ public class EventManager : MonoBehaviour ...@@ -195,11 +229,30 @@ public class EventManager : MonoBehaviour
private void _VFXTransition(VFXTransition vfxTransition) private void _VFXTransition(VFXTransition vfxTransition)
{ {
Debug.Log("VFXTransition");
} }
private void _VFXPause(VFXPause vfxPause) private void _VFXPause(VFXPause vfxPause)
{ {
Debug.Log("VFXPause");
}
private void _setBright(SpriteLocation location)
{
SpriteRenderer temp;
int bright = (int)location;
for (int i = 1; i < 4; i++)
{
temp = spritePeople[i].GetComponent<SpriteRenderer>();
if(i == bright)
{
temp.color = new Color(255f, 255f, 255f, 255f);
continue;
}
temp.color = new Color(97f, 97f, 97f, 255f);
}
} }
} }
...@@ -8,7 +8,7 @@ using System.Linq; ...@@ -8,7 +8,7 @@ using System.Linq;
public class GameManager : MonoBehaviour public class GameManager : MonoBehaviour
{ {
public static GameManager instance; public static GameManager instance;
public string currentEventName; public EventCore currentEvent;
void Awake() void Awake()
{ {
if (instance == null) if (instance == null)
......
...@@ -19,19 +19,10 @@ public class UIEventManager : MonoBehaviour ...@@ -19,19 +19,10 @@ public class UIEventManager : MonoBehaviour
public Button buttonAuto; public Button buttonAuto;
public Button buttonNext; public Button buttonNext;
private EventManager _eventManager; public EventManager eventManager;
void OnEnable() void Start()
{ {
SceneManager.sceneLoaded += _InitEventManager;
}
private void _InitEventManager(Scene s, LoadSceneMode m)
{
Game game = GameManager.instance.game;
var eventList = game.allEventsList;
_eventManager = new EventManager(eventList.Find(e => e.eventName.Equals(GameManager.instance.currentEventName)));
containerChoice.SetActive(false); containerChoice.SetActive(false);
containerConversation.SetActive(false); containerConversation.SetActive(false);
containerFullScript.SetActive(false); containerFullScript.SetActive(false);
...@@ -53,6 +44,6 @@ public class UIEventManager : MonoBehaviour ...@@ -53,6 +44,6 @@ public class UIEventManager : MonoBehaviour
public void OnClickNextButton() public void OnClickNextButton()
{ {
_eventManager.ExecuteOneScript(); eventManager.ExecuteOneScript();
} }
} }
...@@ -127,7 +127,7 @@ GameObject: ...@@ -127,7 +127,7 @@ GameObject:
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 0 m_IsActive: 1
--- !u!224 &54311926 --- !u!224 &54311926
RectTransform: RectTransform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -570,12 +570,12 @@ MonoBehaviour: ...@@ -570,12 +570,12 @@ MonoBehaviour:
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData: m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} m_Font: {fileID: 12800000, guid: 8018e05d598d37e4f8ac6aff9632ccd6, type: 3}
m_FontSize: 50 m_FontSize: 70
m_FontStyle: 0 m_FontStyle: 0
m_BestFit: 0 m_BestFit: 0
m_MinSize: 0 m_MinSize: 0
m_MaxSize: 60 m_MaxSize: 80
m_Alignment: 0 m_Alignment: 0
m_AlignByGeometry: 0 m_AlignByGeometry: 0
m_RichText: 1 m_RichText: 1
...@@ -920,7 +920,7 @@ GameObject: ...@@ -920,7 +920,7 @@ GameObject:
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 0 m_IsActive: 1
--- !u!224 &1140836744 --- !u!224 &1140836744
RectTransform: RectTransform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -1822,6 +1822,12 @@ MonoBehaviour: ...@@ -1822,6 +1822,12 @@ MonoBehaviour:
spritePeopleLeft: {fileID: 1793098992} spritePeopleLeft: {fileID: 1793098992}
spritePeopleCenter: {fileID: 1227607383} spritePeopleCenter: {fileID: 1227607383}
sprtiePeopleRight: {fileID: 1419722515} sprtiePeopleRight: {fileID: 1419722515}
test: {fileID: 517689898}
spritePeople:
- {fileID: 0}
- {fileID: 1793098992}
- {fileID: 1227607383}
- {fileID: 1419722515}
textCharacterInfo: {fileID: 623449835} textCharacterInfo: {fileID: 623449835}
textScript: {fileID: 1126384283} textScript: {fileID: 1126384283}
textFullScript: {fileID: 902959466} textFullScript: {fileID: 902959466}
...@@ -2186,6 +2192,7 @@ MonoBehaviour: ...@@ -2186,6 +2192,7 @@ MonoBehaviour:
buttonSkip: {fileID: 1257526654} buttonSkip: {fileID: 1257526654}
buttonAuto: {fileID: 1692013385} buttonAuto: {fileID: 1692013385}
buttonNext: {fileID: 165578307} buttonNext: {fileID: 165578307}
eventManager: {fileID: 1800731943}
--- !u!1 &1973724594 --- !u!1 &1973724594
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment