private Rect DrawCharacterItem(ScenarioDialogue.Character chara, int index) { //EditorGUILayout.PropertyField(sChara,true); // EditorGUILayout.LabelField(""); Rect subRect = EditorGUILayout.BeginVertical(GUILayout.ExpandWidth(true)); subRect.x -= 3; subRect.width += 6; GUI.Box(subRect, ""); //Rect menuRect = new Rect(subRect); //menuRect.height = 25; string name = "character " + index; if (chara.character != null && !string.IsNullOrEmpty(chara.character.GetCharaName(chara.customName))) { name = chara.character.GetCharaName(chara.customName); //value set } EditorGUILayout.LabelField(name, EditorStyles.centeredGreyMiniLabel); GUILayout.Space(5); PBEditorUtils.DrawCustomObject(ref chara.character, false, "Base", customLabelWith, m_target); PBEditorUtils.DrawCustomToggle(ref chara.isSpeaker, "Speeker", customLabelWith, m_target); PBEditorUtils.DrawCustomText(ref chara.portaritKey, "Portarit", customLabelWith, m_target); PBEditorUtils.DrawCustomText(ref chara.customName, "Name", customLabelWith, m_target); GUILayout.Space(5); EditorGUILayout.EndVertical(); return(subRect); }
private Rect DrawSelectionItem(ScenarioDialogue.Selection selection, int index) { //EditorGUILayout.PropertyField(sChara,true); // EditorGUILayout.LabelField(""); Rect subRect = EditorGUILayout.BeginVertical(GUILayout.ExpandWidth(true)); subRect.x -= 3; subRect.width += 6; GUI.Box(subRect, ""); string name = "selection " + index; if (!string.IsNullOrEmpty(selection.text)) { name = m_target.GetLocalText(selection.text); } EditorGUILayout.LabelField(name, EditorStyles.centeredGreyMiniLabel); GUILayout.Space(5); PBEditorUtils.DrawCustomText(ref selection.text, "Text", customLabelWith, m_target); PBEditorUtils.DrawCustomObject(ref selection.nextScenario, false, "Next", customLabelWith, m_target); PBEditorUtils.DrawCustomObject(ref selection.selectionAction, false, "Action", customLabelWith, m_target); GUILayout.Space(5); EditorGUILayout.EndVertical(); return(subRect); }
private Rect DrawCommandItem(ScenarioDialogue.Command command, int index) { //EditorGUILayout.PropertyField(sChara,true); // EditorGUILayout.LabelField(""); Rect subRect = EditorGUILayout.BeginVertical(GUILayout.ExpandWidth(true)); subRect.x -= 3; subRect.width += 6; GUI.Box(subRect, ""); string name = "command " + index; EditorGUILayout.LabelField(name, EditorStyles.centeredGreyMiniLabel); GUILayout.Space(5); PBEditorUtils.DrawCustomObject(ref command.command, false, "Command", customLabelWith, m_target); PBEditorUtils.DrawCustomText(ref command.message, "Message", customLabelWith, m_target); GUILayout.Space(5); EditorGUILayout.EndVertical(); return(subRect); }
/// <summary> /// 绘制子项 /// </summary> /// <param name="dialogue"></param> /// <param name="index"></param> private void DrawDialogueItem(ScenarioDialogue dialogue, int index) { bool foldOut = GetItemFoldOut(m_dialogueItemFoldOuts, index); if (foldOut) { GUILayout.Space(10); } GUILayout.Space(5); Rect rect = EditorGUILayout.BeginVertical(GUILayout.ExpandWidth(true)); rect.width += 12; rect.height += 10; rect.x -= 9; rect.y -= 4; GUI.Box(rect, ""); //是否展开 SetItemFoldOut(m_dialogueItemFoldOuts, index, EditorGUILayout.Foldout(GetItemFoldOut(m_dialogueItemFoldOuts, index), "", true, EditorStyles.label)); Rect dialogueDisplayRect = new Rect(rect); dialogueDisplayRect.x += 20; dialogueDisplayRect.width -= 30; dialogueDisplayRect.height = 18; dialogueDisplayRect.y += 5; GUI.Label(dialogueDisplayRect, new GUIContent(m_target.GetLocalText(dialogue.text), m_target.GetLocalText(dialogue.text))); Rect menuRect = new Rect(rect); menuRect.height = 25; PBEditorUtils.ShowContextMenu(menuRect, () => { GenericMenu menu = new GenericMenu(); menu.AddDisabledItem(new GUIContent("Dialogue")); menu.AddSeparator(""); menu.AddItem(new GUIContent("Add"), false, OnMenuAddDialogueItem, index + 1); menu.AddItem(new GUIContent("Insert"), false, OnMenuAddDialogueItem, index); menu.AddItem(new GUIContent("Duplicate"), false, OnMenuInsertDialogueItem, index); menu.AddItem(new GUIContent("Delete"), false, OnMenuDeleteDialogueItem, dialogue); menu.ShowAsContext(); }); if (foldOut) { //绘制内部内容 Rect subRect = new Rect(rect); subRect.width -= 3; //subRect.height += 10; subRect.x += 3; subRect.y += 32; subRect.height -= 50; GUI.Box(subRect, ""); GUILayout.Space(15); PBEditorUtils.DrawCustomText(ref dialogue.key, "Key", customLabelWith, m_target); Rect lineRect = new Rect(subRect); lineRect.height = 2; lineRect.y += 24; GUI.Box(lineRect, ""); DrawCharacterGroup(dialogue, index); DrawDialogueText(dialogue, index); DrawSelectionGroup(dialogue, index); DrawCommandGroup(dialogue, index); OnDialogueItemGUI(dialogue, index); GUILayout.Space(3); } EditorGUILayout.EndVertical(); GUILayout.Space(5); if (foldOut) { GUILayout.Space(10); } }