Exemple #1
0
 private void DrawDialogueGroup(DialogueGroup dialogueGroup)
 {
     if (dialogueGroup == null)
     {
         return;
     }
     if (show = GUILayoutTools.Header("对白明细", show, null))
     {
         GUILayout.BeginVertical("helpbox");
         dialogueGroup.Id   = EditorGUILayout.IntField("id", dialogueGroup.Id);
         dialogueGroup.Desc = EditorGUILayout.TextField("对白组的简单描述", dialogueGroup.Desc);
         GUILayout.EndVertical();
         dialoguePos = GUILayout.BeginScrollView(dialoguePos, "box");
         GUILayoutTools.Separator_SingleLine();
         foreach (var dia in dialogueGroup.dialogues)
         {
             DrawDialogue(dia);
             GUILayoutTools.Separator_SingleLine();
         }
         GUILayout.EndScrollView();
         using (new GUILayout.HorizontalScope())
         {
             GUILayout.FlexibleSpace();
             if (GUILayout.Button("新增一条对白", GUILayout.Width(100)))
             {
                 dialogueGroup.dialogues.Add(new Dialogue());
             }
             GUILayout.FlexibleSpace();
         }
     }
 }
Exemple #2
0
        public void OnGUI()
        {
            GUILayoutTools.DrawTitle("演示板");
            GUILayoutTools.Separator_NoSpaceDoubleLine();
            ToolBar();
            GUILayout.Label("当前已有对白", StyleTools.MiddleCenterLab);
            var dgs = MainWinodws.Instance.dialogueGroups;

            using (new GUILayout.HorizontalScope())
            {
                foreach (var dg in dgs)
                {
                    if (GUILayout.Button(dg.Id + ":" + dg.Desc))
                    {
                        if (curShow != dg)
                        {
                            curShow = dg;
                            auto    = false;
                        }
                    }
                }
            }
            GUILayoutTools.Separator_SingleLine();
            ShowDialogue();
            Repaint();
        }
Exemple #3
0
 private void DrawList()
 {
     search = searchField.OnGUI(search);
     using (new GUILayout.VerticalScope(StyleTools.Skin.box))
     {
         var r = GUILayoutUtility.GetRect(position.width * 0.4f, 20);
         r.width /= 2;
         GUI.Label(r, "对白组ID", EditorStyles.toolbarButton);
         r.x += r.width;
         GUI.Label(r, "对白组简单描述", EditorStyles.toolbarButton);
         scPos = GUILayout.BeginScrollView(scPos);
         foreach (var dialogue in dialogueGroups)
         {
             if (dialogue.Id.ToString().Contains(search) || dialogue.Desc.ToLower().Contains(search.ToLower()))
             {
                 var evt     = Event.current;
                 var rect    = GUILayoutUtility.GetRect(position.width * 0.4f, 20);
                 var newRect = new Rect(rect);
                 rect.width /= 2;
                 GUI.Label(rect, " " + dialogue.Id, curDialogueGroup == dialogue ? "SelectionRect" : "Tooltip");
                 rect.x += rect.width;
                 GUI.Label(rect, dialogue.Desc, curDialogueGroup == dialogue ? "SelectionRect" : "Tooltip");
                 var style = curDialogueGroup == dialogue ? StyleTools.Skin.box : "box";
                 if (newRect.Contains(evt.mousePosition))
                 {
                     if (evt.button == 0)
                     {
                         if (evt.type == EventType.MouseDown)
                         {
                             GUI.FocusControl(null);
                             curDialogueGroup = dialogue;
                             GUIUtility.ExitGUI();
                         }
                     }
                     if (evt.button == 1)
                     {
                         if (evt.type == EventType.MouseDown)
                         {
                             GUI.FocusControl(null);
                             ShowRightClick(dialogue);
                         }
                     }
                     if (dialogue != curDialogueGroup)
                     {
                         style = "box";
                         GUI.Label(newRect, "", style);
                     }
                 }
             }
         }
         GUILayout.EndScrollView();
     }
 }
Exemple #4
0
        private void ToolBar()
        {
            GUILayout.BeginHorizontal(EditorStyles.toolbar);
            GUILayout.Space(5);

            if (GUILayout.Button("新建一组对白", EditorStyles.toolbarButton, GUILayout.Width(140)))
            {
                var d = new DialogueGroup();
                dialogueGroups.Add(d);
            }

            GUILayout.Label("");
            GUILayout.Space(3);
            GUILayout.EndHorizontal();
        }
Exemple #5
0
 public void InitDialogueGorupData()
 {
     dialogueGroups = new List <DialogueGroup>();
     if (File.Exists(string.Format(Const.DATA_PATH, Const.DIALOGUE_GROUP_DATA)))
     {
         var datas = JsonMapper.ToObject(File.ReadAllText(string.Format(Const.DATA_PATH, Const.DIALOGUE_GROUP_DATA)));
         foreach (var key in datas.Keys)
         {
             var id = int.Parse(key);
             var ch = new DialogueGroup();
             ch.FromJson(datas[key]);
             dialogueGroups.Add(ch);
         }
     }
 }
Exemple #6
0
 private void ShowRightClick(DialogueGroup dialogue)
 {
 }