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
{
EventCore eventCore = UITownManager.instance.GetEventCoreFromEventSd(gameObject.transform);
SceneManager.LoadScene("EventScene", LoadSceneMode.Single);
GameManager.instance.currentEventName = eventCore.eventName;
GameManager.instance.currentEvent = eventCore;
}
public void LoadEventScene(EventCore eventCore)
{
SceneManager.LoadScene("EventScene", LoadSceneMode.Single);
GameManager.instance.currentEventName = eventCore.eventName;
GameManager.instance.currentEvent = eventCore;
}
}
......@@ -14,16 +14,24 @@ public class EventManager : MonoBehaviour
public GameObject spritePeopleCenter;
public GameObject sprtiePeopleRight;
public Image test;
public GameObject[] spritePeople; // use same location index from SpriteLocation
public Text textCharacterInfo;
public Text textScript;
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;
scriptEnumerator = eventCore.script.GetEnumerator();
eventCore = GameManager.instance.currentEvent;
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.
......@@ -32,7 +40,6 @@ public class EventManager : MonoBehaviour
public void ExecuteOneScript()
{
Debug.Log("asdf");
// TODO:
// when MoveNext() returns false, it must go back to TownScene.
scriptEnumerator.MoveNext();
......@@ -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)
{
containerChoice.SetActive(false);
containerConversation.SetActive(false);
containerFullScript.SetActive(true);
Debug.Log("explanation");
//if(GameObject.Find("Canvas/ContainerConversation") == null)
//{
// Debug.Log("안찾아짐");
//}
//_enableContainerConversation(true);
//containerChoice.SetActive(false);
//containerConversation.SetActive(false);
//containerFullScript.SetActive(true);
}
private void _Conversation(Conversation conversation)
{
Debug.Log("conversation");
containerChoice.SetActive(false);
containerConversation.SetActive(true);
containerFullScript.SetActive(false);
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)
{
Debug.Log("LoadCharacter");
}
private void _UnloadCharacter(UnloadCharacter unloadCharacter)
{
Debug.Log("UnloadCharacter");
}
private void _LoadBackground(LoadBackground loadBackground)
{
Debug.Log("LoadBackground");
}
private void _PlayMusic(PlayMusic playMusic)
{
Debug.Log("PlayMusic");
}
private void _StopMusic(StopMusic stopMusic)
{
Debug.Log("StopMusic");
}
private void _LoadCG(LoadCG loadCG)
{
Debug.Log("LoadCG");
}
private void _UnloadCG(UnloadCG unloadCG)
{
Debug.Log("UnloadCG");
}
private void _VFXCamerashake(VFXCameraShake vfxCameraShake)
{
Debug.Log("VFXCamerashake");
}
private void _VFXLoadSprite(VFXLoadSprite vfxLoadSprite)
{
Debug.Log("VFXLoadSprite");
}
private void _VFXUnloadSprite(VFXUnloadSprite vfxUnloadSprite)
{
Debug.Log("VFXUnloadSprite");
}
private void _VFXSound(VFXSound vfxSound)
{
Debug.Log("VFXSoun");
}
private void _LoadMinigame(LoadMinigame loadMinigame)
{
Debug.Log("LoadMinigame");
}
private void _LoadVideo(LoadVideo loadVideo)
{
Debug.Log("LoadVideo");
}
private void _Choice(Choice choice)
{
Debug.Log("Choice");
containerChoice.SetActive(true);
containerConversation.SetActive(false);
containerFullScript.SetActive(false);
......@@ -195,11 +229,30 @@ public class EventManager : MonoBehaviour
private void _VFXTransition(VFXTransition vfxTransition)
{
Debug.Log("VFXTransition");
}
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;
public class GameManager : MonoBehaviour
{
public static GameManager instance;
public string currentEventName;
public EventCore currentEvent;
void Awake()
{
if (instance == null)
......
......@@ -19,19 +19,10 @@ public class UIEventManager : MonoBehaviour
public Button buttonAuto;
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);
containerConversation.SetActive(false);
containerFullScript.SetActive(false);
......@@ -53,6 +44,6 @@ public class UIEventManager : MonoBehaviour
public void OnClickNextButton()
{
_eventManager.ExecuteOneScript();
eventManager.ExecuteOneScript();
}
}
......@@ -127,7 +127,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!224 &54311926
RectTransform:
m_ObjectHideFlags: 0
......@@ -570,12 +570,12 @@ MonoBehaviour:
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 50
m_Font: {fileID: 12800000, guid: 8018e05d598d37e4f8ac6aff9632ccd6, type: 3}
m_FontSize: 70
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 0
m_MaxSize: 60
m_MaxSize: 80
m_Alignment: 0
m_AlignByGeometry: 0
m_RichText: 1
......@@ -920,7 +920,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!224 &1140836744
RectTransform:
m_ObjectHideFlags: 0
......@@ -1822,6 +1822,12 @@ MonoBehaviour:
spritePeopleLeft: {fileID: 1793098992}
spritePeopleCenter: {fileID: 1227607383}
sprtiePeopleRight: {fileID: 1419722515}
test: {fileID: 517689898}
spritePeople:
- {fileID: 0}
- {fileID: 1793098992}
- {fileID: 1227607383}
- {fileID: 1419722515}
textCharacterInfo: {fileID: 623449835}
textScript: {fileID: 1126384283}
textFullScript: {fileID: 902959466}
......@@ -2186,6 +2192,7 @@ MonoBehaviour:
buttonSkip: {fileID: 1257526654}
buttonAuto: {fileID: 1692013385}
buttonNext: {fileID: 165578307}
eventManager: {fileID: 1800731943}
--- !u!1 &1973724594
GameObject:
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