/// <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(); }
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]); } }
/// <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(); }