예제 #1
0
    /// <summary>
    /// 当前技能帧事件
    /// </summary>
    private void OnGUI_DrawSkillEvent()
    {
        GUILayout.BeginVertical(GUILayout.Width(300), GUILayout.Height(550));
        GUILayout.Label("技能事件列表:");
        if (curSkillEventList != null)
        {
            int count = curSkillEventList.Count;
            for (int i = 0; i < curSkillEventList.Count; i++)
            {
                GUILayout.BeginHorizontal();
                if (curSkillEvnetIndex == i)
                {
                    GUI.color = Color.green;
                }
                else
                {
                    GUI.color = Color.white;
                }

                var e = curSkillEventList[i];
                if (GUILayout.Button(string.Format("[{0}] " + e.EventName, i)))
                {
                    this.curSkillEvnetIndex = i;
                    //TODO 需要给Editor进行赋值
                    SkillEditorData data = skillEditorDict[e.EventName];
                    curSkillEventEditor =
                        (ISkillEventEditor)data.classdata.Assembly.CreateInstance(data.classdata.FullName);

                    GUI.FocusControl("RefreshFocus");
                }

                GUI.color = GUI.backgroundColor;
                if (GUILayout.Button("DEL", GUILayout.Width(35)))
                {
                    curSkillEventList.Remove(e);
                    curSkillblock.Events.Remove(e);
                    this.curSkillEvnetIndex = -1;
                    curSkillEventEditor     = null;
                    count = curSkillEventList.Count;

                    GUI.FocusControl("RefreshFocus");
                }
                GUILayout.EndHorizontal();
            }
        }

        GUILayout.Space(20);
        if (curSkillblock != null)
        {
            if (GUILayout.Button("添加事件"))
            {
                Window_SelectSkillEvent window =
                    (Window_SelectSkillEvent)EditorWindow.GetWindow(typeof(Window_SelectSkillEvent), false,
                                                                    "选择创建skillevent");
                window.Show(this.curframe, this.curSkillblock, this.curSkillEventList);
            }
        }

        GUILayout.EndVertical();
        TableToolMenu.Layout_DrawSeparatorV(Color.gray, 2);
    }
예제 #2
0
    private void ShowEventList()
    {
        GUILayout.BeginVertical(GUILayout.Width(400), GUILayout.Height(500));
        GUILayout.Label(string.Format("第{0}帧事件组", this.curframe));
        seList = null; //当前帧对应的事件列表
        if (!seDict.TryGetValue(this.curframe, out seList))
        {
            seList = new List <SkillEvent>();
            seDict.Add(this.curframe, seList);
        }

        if (GUILayout.Button("新建一个skillevent"))
        {
            Window_SelectSkillEvent window =
                (Window_SelectSkillEvent)EditorWindow.GetWindow(typeof(Window_SelectSkillEvent), false,
                                                                "选择创建skillevent");
            window.Show(this.curframe, this.curblock);
        }

        int count = seList.Count;

        if (count == 0)
        {
            curEvent   = null;
            eventIndex = 0;
        }

        for (int i = 0; i < count; i++)
        {
            GUILayout.BeginHorizontal();
            SkillEvent se = seList[i];

            if (eventIndex == i)
            {
                GUI.color = Color.green;
                curEvent  = se;
            }
            else
            {
                GUI.color = Color.white;
            }

            string des;
            if (!eventDesDict.TryGetValue(se.EventName, out des))
            {
                GUIStyle titleStyle2 = new GUIStyle();
                titleStyle2.normal.textColor = new Color(1, 0, 0, 1);
                GUILayout.Label("不存在标签:" + se.EventName, titleStyle2);
            }
            else
            {
                if (GUILayout.Button(des + ":" + i))
                {
                    this.eventIndex = i;
                    GUI.FocusControl("RefreshFocus");
                }
            }

            GUI.color = GUI.backgroundColor;
            if (GUILayout.Button("del", GUILayout.Width(100)))
            {
                seList.Remove(se);
                count = seList.Count;
                if (eventIndex == i)
                {
                    curEvent   = null;
                    eventIndex = 0;
                }
            }

            GUILayout.EndHorizontal();
        }

        GUILayout.EndVertical();
    }