public void PlayScene(string sceneTitle, Action newAfterCallBack = null) { if (currentDrama != null && !string.IsNullOrEmpty(currentDrama.scenarioName)) { Debug.Log("WARNING : ATTEMPTED TO PLAY : " + sceneTitle + " WHILE DRAMA : " + currentDrama.scenarioName + " IS PLAYING."); return; } currentlyPlayingDrama = true; // Drama Storage currentDrama = dramaStorage.ObtainDramaByTitle(sceneTitle); curActiveFrameIdx = 0; SetUpScene(); SummonActors(); AdjustScene(); PlayFrame(); afterCurrentSceneCallback = newAfterCallBack; if (!TransitionManager.GetInstance.isNewGame) { TransitionManager.GetInstance.currentSceneManager.interactionHandler.SwitchInteractableClickables(false); TransitionManager.GetInstance.currentSceneManager.scenePointHandler.SwitchScenePointsInteraction(false); } }
public DramaScenario ObtainDramaByTitle(string title) { DramaScenario tmp = new DramaScenario(); tmp = dramaSceneStorage.Find(x => x.scenarioName == title); return(tmp); }
public void NextFrame() { if (currentDrama == null) { return; } if (string.IsNullOrEmpty(currentDrama.scenarioName)) { return; } if (!currentDrama.CurrentFrameFinish()) { return; } int lessIdx = currentDrama.actionsPerFrame.Count - 1; if (curActiveFrameIdx < lessIdx) { curActiveFrameIdx += 1; currentDrama.currentFrameIdx += 1; if (currentDrama.currentFrameIdx > currentDrama.actionsPerFrame.Count - 1) { return; } if (currentDrama.actionsPerFrame[currentDrama.currentFrameIdx].actionsOnFrameList == null) { return; } if (currentDrama.actionsPerFrame[currentDrama.currentFrameIdx].actionsOnFrameList.Count <= 0) { return; } for (int i = 0; i < currentDrama.actionsPerFrame[currentDrama.currentFrameIdx].actionsOnFrameList.Count; i++) { EnactAction(currentDrama.actionsPerFrame[currentDrama.currentFrameIdx].actionsOnFrameList[i]); } } else if (curActiveFrameIdx >= lessIdx) { if (currentDrama.actionsPerFrame[currentDrama.currentFrameIdx].callNextStory) { PlayScene(currentDrama.actionsPerFrame[currentDrama.currentFrameIdx].nextDramaTitle); curActiveFrameIdx = 0; } else { curActiveFrameIdx = 0; currentDrama = null; currentlyPlayingDrama = false; if (!TransitionManager.GetInstance.isNewGame) { TransitionManager.GetInstance.currentSceneManager.interactionHandler.SwitchInteractableClickables(true); TransitionManager.GetInstance.currentSceneManager.scenePointHandler.SwitchScenePointsInteraction(true); } } if (afterCurrentSceneCallback != null) { afterCurrentSceneCallback(); afterCurrentSceneCallback = null; } } }
public void ClearDrama() { currentDrama = null; }
public void ShowDramaList() { if (curDramaStorage.dramaSceneStorage == null) { curDramaStorage.dramaSceneStorage = new List <DramaScenario>(); } bool addEvent = false; bool saveEvent = false; bool removeEvent = false; GUILayout.BeginArea(new Rect(680, 10, 400, position.height - 375)); GUILayout.BeginHorizontal(); GUILayout.Box("Drama Scene List", titleText, GUILayout.Width(295), GUILayout.Height(20)); GUILayout.EndHorizontal(); dramaListScrollPos = GUILayout.BeginScrollView(dramaListScrollPos, new GUIStyle("RL Background"), GUILayout.Width(300), GUILayout.Height(position.height - 400)); if (curDramaStorage.dramaSceneStorage != null && curDramaStorage.dramaSceneStorage.Count > 0) { for (int i = 0; i < curDramaStorage.dramaSceneStorage.Count; i++) { bool isClicked = false; string listName = ""; GUILayout.BeginHorizontal(); isClicked = GUILayout.Button(curDramaStorage.dramaSceneStorage[i].scenarioName, (selectedDrama != null && curDramaStorage.dramaSceneStorage[i].scenarioName == selectedDrama.scenarioName) ? selectedText : notSelectedText); if (curDramaStorage.dramaSceneStorage[i].actionsPerFrame != null && curDramaStorage.dramaSceneStorage[i].actionsPerFrame.Count > 0) { listName = "[Frames: " + curDramaStorage.dramaSceneStorage[i].actionsPerFrame.Count + "]"; GUILayout.Label(listName); } GUILayout.EndHorizontal(); if (isClicked) { GUI.FocusControl(null); if (curDramaStorage.dramaSceneStorage[i] != null) { selectedDrama = curDramaStorage.dramaSceneStorage[i]; selectedDramaIdx = i; curDrama = selectedDrama; } curAction = null; selectedFrame = null; isClicked = false; } } } GUILayout.EndArea(); GUILayout.EndScrollView(); GUILayout.BeginArea(new Rect(680, position.height - 360, 400, 225)); GUILayout.BeginHorizontal(); saveEvent = GUILayout.Button((curDrama == selectedDrama) ? "Modify" : "Save", GUILayout.MaxWidth(100)); if (curDramaStorage.dramaSceneStorage == null) { curDramaStorage.dramaSceneStorage = new List <DramaScenario>(); } if (curDrama == null) { curDrama = new DramaScenario(); } if (curDramaStorage.dramaSceneStorage.Count <= 0 || curDramaStorage.dramaSceneStorage.Find(x => x.scenarioName == curDrama.scenarioName) != null) { addEvent = GUILayout.Button("Create New", GUILayout.MaxWidth(100)); } if (curDramaStorage.dramaSceneStorage.Find(x => x.scenarioName == curDrama.scenarioName) != null) { removeEvent = GUILayout.Button("Remove", GUILayout.MaxWidth(100)); } GUILayout.EndHorizontal(); GUILayout.EndArea(); // ADD BUTTON if (addEvent) { curDrama = new DramaScenario(); selectedDrama = null; } // REMOVE BUTTON if (removeEvent) { GUI.FocusControl(null); removeEvent = false; if (selectedDrama != null) { curDramaStorage.dramaSceneStorage.RemoveAt(selectedDramaIdx); selectedDrama = null; curDrama = new DramaScenario(); } } // SAVE BUTTON if (saveEvent && !string.IsNullOrEmpty(curDrama.scenarioName)) { GUI.FocusControl(null); if (curDramaStorage.dramaSceneStorage == null) { curDramaStorage.dramaSceneStorage = new List <DramaScenario>(); } if (curDramaStorage.dramaSceneStorage.Find(x => x.scenarioName == curDrama.scenarioName) == null) { curDramaStorage.dramaSceneStorage.Add(curDrama); curDrama = new DramaScenario(); } else { // MODIFY CURRENT EVENT if ((curDrama == selectedDrama)) { curDramaStorage.dramaSceneStorage[selectedDramaIdx] = curDrama; curDrama = new DramaScenario(); selectedDrama = null; } else { Debug.LogError("MULTIPLE EVENTS WITH SAME TITLE OCCURRED, PLEACE CHECK LIST!"); } } saveEvent = false; Save(); } }