/// <summary> /// Goes through all sections and activates the current section. /// </summary> public void ReactivateTriggers() { Constants.CHAPTER chapter = (Constants.CHAPTER)currentChapter.value; Constants.OverworldArea index = (Constants.OverworldArea)currentScene.value; Constants.ROOMNUMBER roomNumber = (Constants.ROOMNUMBER)currentRoomNumber.value; for (int i = 0; i < sectionList.Length; i++) { sectionList[i].ActivateSection(chapter, index, roomNumber); } }
/// <summary> /// Renders the frames and dialogues available and dialogue creation. /// </summary> void DrawDialogues() { GUILayout.BeginArea(dialogueRect); EditorGUIUtility.labelWidth = 60; GUILayout.Label("Dialogues", EditorStyles.boldLabel); //Filter GUILayout.BeginHorizontal(); filter = (Constants.CHAPTER)EditorGUILayout.EnumPopup("Filter", filter, GUILayout.Width(dialogueRect.width / 2 - 10)); filterEnum = (filter == Constants.CHAPTER.DEFAULT) ? "" : filter.ToString(); filterString = EditorGUILayout.TextField("Search", filterString, GUILayout.Width(dialogueRect.width / 2 - 10)); GUILayout.EndHorizontal(); // Dialogue scroll dialogueScrollPos = GUILayout.BeginScrollView(dialogueScrollPos, GUILayout.Width(dialogueRect.width), GUILayout.Height(dialogueRect.height - 90)); int oldSelected = hub.selDialogue; GUIContent[] guic = dialogueLibrary.GetRepresentations(filterEnum, filterString); if (guic.Length > 0) { hub.selDialogue = GUILayout.SelectionGrid(hub.selDialogue, guic, 2); } if (oldSelected != hub.selDialogue) { GUI.FocusControl(null); hub.SelectDialogue(); daw.Repaint(); // daw.Focus(); } GUILayout.EndScrollView(); GUILayout.Space(5); //Dialogue creation EditorGUIUtility.labelWidth = 120; hub.dialogueUuid = EditorGUILayout.TextField("Dialogue uuid", hub.dialogueUuid); GUILayout.BeginHorizontal(); if (GUILayout.Button("Create dialogue")) { hub.InstansiateDialogue(); } if (GUILayout.Button("Copy dialogue")) { } if (GUILayout.Button("Delete dialogue")) { hub.DeleteDialogue(); } GUILayout.EndHorizontal(); GUILayout.EndArea(); }
/// <summary> /// Initializes all the window specific variables. /// </summary> void InitializeWindow() { cheatMenu = (CheatMenu)ScriptableObject.CreateInstance("CheatMenu"); dialogueMenu = (DialogueSceneEditorWindow)ScriptableObject.CreateInstance("DialogueSceneEditorWindow"); battleMenu = (BattleSceneEditorWindow)ScriptableObject.CreateInstance("BattleSceneEditorWindow"); _currentChapter = (Constants.CHAPTER)currentChapter.value; _currentArea = (Constants.SCENE_INDEXES)currentArea.value; _playerArea = (Constants.SCENE_INDEXES)playerArea.value; _currentRoom = (Constants.ROOMNUMBER)currentRoom.value; Debug.Log("Init"); }
public override void OnInspectorGUI() { ChapterString chapterString = target as ChapterString; if (!System.Enum.IsDefined(typeof(Constants.CHAPTER), chapterString.value)) { chapterString.value = Constants.CHAPTER.DEFAULT.ToString(); } GUILayout.Label("Value : " + chapterString.value.ToString()); chapter = (Constants.CHAPTER)EditorGUILayout.EnumPopup("Chapter", (Constants.CHAPTER)System.Enum.Parse(typeof(Constants.CHAPTER), chapterString.value)); chapterString.value = chapter.ToString(); }
/// <summary> /// Activates the chapter with the given id and deactivates the rest. /// </summary> /// <param name="chapterID"></param> public void ActivateSection(Constants.CHAPTER chapter, Constants.OverworldArea sceneIndex, Constants.ROOMNUMBER number) { string chapterID = chapter.ToString().ToLower(); if (containers.Count == 0) { Debug.LogWarning("Empty area"); return; } bool state = (sceneIndex == activeArea && roomNumber == number); containers[0].gameObject.SetActive(state); for (int i = 1; i < containers.Count; i++) { // Debug.Log("Checking " + chapterIDs[i] + ", object pos " + i + ", Index: " + activeArea); containers[i].gameObject.SetActive(state && chapterID == chapterIDs[i]); } }
void DrawAreaValues() { GUILayout.Label("Area values", EditorStyles.boldLabel); _currentChapter = (Constants.CHAPTER)EditorGUILayout.EnumPopup("Current Chapter", _currentChapter); _currentArea = (Constants.SCENE_INDEXES)EditorGUILayout.EnumPopup("Current Scene Index", _currentArea); _playerArea = (Constants.SCENE_INDEXES)EditorGUILayout.EnumPopup("Current OW Scene Index", _playerArea); _currentRoom = (Constants.ROOMNUMBER)EditorGUILayout.EnumPopup("Current Room", _currentRoom); GUILayout.Label("Player values", EditorStyles.boldLabel); totalExp.value = EditorGUILayout.IntField("Total EXP", totalExp.value); totalMoney.value = EditorGUILayout.IntField("Total Money", totalMoney.value); GUILayout.Label("Player values", EditorStyles.boldLabel); EditorGUILayout.LabelField("Max health", playerMaxHealth.value.ToString()); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Android Attack", playerAttack.value.ToString()); EditorGUILayout.LabelField("Soldier Attack", playerSAttack.value.ToString()); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Android Defense", playerDefense.value.ToString()); EditorGUILayout.LabelField("Soldier Defense", playerSDefense.value.ToString()); GUILayout.EndHorizontal(); }
public override void OnInspectorGUI() { TriggerController controller = target as TriggerController; DrawDefaultInspector(); if (GUILayout.Button("Update Triggers")) { UpdateTriggers(controller); } GUILayout.Space(20); Constants.CHAPTER cChapter = (Constants.CHAPTER)controller.currentChapter.value; cChapter = (Constants.CHAPTER)EditorGUILayout.EnumPopup("Current Chapter", (Constants.CHAPTER)cChapter); controller.currentChapter.value = (int)cChapter; Constants.SCENE_INDEXES cArea = (Constants.SCENE_INDEXES)controller.currentScene.value; cArea = (Constants.SCENE_INDEXES)EditorGUILayout.EnumPopup("Current Area", (Constants.SCENE_INDEXES)cArea); controller.currentScene.value = (int)cArea; controller.currentPlayerArea.value = controller.currentScene.value; Constants.ROOMNUMBER cRoom = (Constants.ROOMNUMBER)controller.currentRoomNumber.value; cRoom = (Constants.ROOMNUMBER)EditorGUILayout.EnumPopup("Room Number", (Constants.ROOMNUMBER)cRoom); controller.currentRoomNumber.value = (int)cRoom; GUILayout.Space(20); if (GUILayout.Button("Reactivate", GUILayout.Height(50))) { ReactivateTriggers(controller); } if (GUILayout.Button("Verify trigger IDs")) { VerifyTriggers(controller); } }
/// <summary> /// Renders the frames and dialogues available and dialogue creation. /// </summary> void RightStuff() { GUILayout.BeginArea(d.rightRect); //Dialogue Info EditorGUILayout.SelectableLabel("Selected Dialogue UUID: " + 1234, EditorStyles.boldLabel, GUILayout.Height(20)); if (selFrame != -1) { dialogueValues.entryName = EditorGUILayout.TextField("Dialogue name", dialogueValues.entryName, GUILayout.Width(400)); dialogueValues.TagEnum = (Constants.CHAPTER)EditorGUILayout.EnumPopup("Tag", dialogueValues.TagEnum); } GUILayout.Space(5); // Frame scroll GUILayout.Label("Frames", EditorStyles.boldLabel); frameScrollPos = GUILayout.BeginScrollView(frameScrollPos, GUILayout.Width(d.rightRect.width), GUILayout.Height(d.rightRect.height * 0.35f)); if (selFrame != -1) { int oldFrame = selFrame; selFrame = GUILayout.SelectionGrid(selFrame, dialogueValues.GenerateFrameRepresentation(), 1); if (oldFrame != selFrame) { GUI.FocusControl(null); int tIndex = dialogueValues.frames[selFrame].talkingIndex; selectTalker = (tIndex != -1) ? reverseIndexList[dialogueValues.frames[selFrame].talkingIndex] : -1; talkName = dialogueValues.frames[selFrame].talkingName; backupFrame.CopyValues(dialogueValues.frames[selFrame]); } } GUILayout.EndScrollView(); GUILayout.Space(10); // Dialogue scroll GUILayout.Label("Dialogues", EditorStyles.boldLabel); GUILayout.BeginHorizontal(); filter = (Constants.CHAPTER)EditorGUILayout.EnumPopup("Filter", filter); filterEnum = (filter == Constants.CHAPTER.DEFAULT) ? "" : filter.ToString(); filterString = EditorGUILayout.TextField("Search", filterString, GUILayout.Width(d.rightRect.width / 2)); GUILayout.EndHorizontal(); dialogueScrollPos = GUILayout.BeginScrollView(dialogueScrollPos, GUILayout.Width(d.rightRect.width), GUILayout.Height(d.rightRect.height * 0.3f)); int oldSelected = selDialogue; selDialogue = GUILayout.SelectionGrid(selDialogue, dialogueLibrary.GetRepresentations(filterEnum, filterString), 2); if (oldSelected != selDialogue) { GUI.FocusControl(null); SelectDialogue(); } GUILayout.EndScrollView(); dialogueUuid = EditorGUILayout.TextField("Dialogue uuid", dialogueUuid); if (GUILayout.Button("Create dialogue")) { InstansiateDialogue(); } if (GUILayout.Button("Delete dialogue")) { DeleteDialogue(); } GUILayout.EndArea(); }