コード例 #1
0
    /// <summary>
    /// 当前技能block
    /// </summary>
    private void OnGUI_DrawSkillBlock()
    {
        GUILayout.BeginVertical(GUILayout.Width(300), GUILayout.Height(800));

        GUILayout.Label("技能块列表:");
        if (curSkillblockList != null)
        {
            int count = curSkillblockList.Count;
            for (int i = 0; i < count; i++)
            {
                GUILayout.BeginVertical();
                if (curSkillblockIndex == i)
                {
                    GUI.color = Color.green;
                }
                else
                {
                    GUI.color = Color.white;
                }

                var sb = this.curSkillblockList[i];
                GUILayout.BeginHorizontal();
                if (GUILayout.Button(string.Format("[{0}] -" + sb.AniName, i)))
                {
                    curSkillblockIndex  = i;
                    curAniClip          = ani.GetClip(sb.AniName);
                    curSkillblock       = sb;
                    curSkillEventList   = EditorSkillTool.GetCurFrameEventList(this.curframe, curSkillblock);
                    curSkillEvnetIndex  = -1;
                    curSkillEventEditor = null;
                    GUI.FocusControl("RefreshFocus");
                }

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

                    GUI.FocusControl("RefreshFocus");
                }

                GUILayout.EndHorizontal();

                GUILayout.EndVertical();
            }
        }

        GUILayout.Space(20);
        if (curSkillblockList != null)
        {
            if (GUILayout.Button("创建skillBlock"))
            {
                Window_SelectAniClip window =
                    (Window_SelectAniClip)EditorWindow.GetWindow(typeof(Window_SelectAniClip), false, "SelectAniClip");
                window.Show(this.curSkillblockList, this.ani);
            }
        }

        GUILayout.EndVertical();

        TableToolMenu.Layout_DrawSeparatorV(Color.gray, 2);
    }
コード例 #2
0
    private void ShowBlockList(List <SkillBlock> blocks)
    {
        int count = blocks.Count;

        if (count == 0)
        {
            curblock = null;
            if (GUILayout.Button("新建一个Block", GUILayout.Width(300)))
            {
                Window_SelectAniClip window =
                    (Window_SelectAniClip)EditorWindow.GetWindow(typeof(Window_SelectAniClip), false, "SelectAniClip");
                window.Show(blocks, 0, this.ani);
            }
        }
        else
        {
            for (int i = 0; i < count; i++)
            {
                SkillBlock sb = blocks[i];
                if (!EditorSkillTool.CheckAniExist(this.ani.clips, sb.AniName))
                {
                    GUIStyle titleStyle2 = new GUIStyle();
                    titleStyle2.normal.textColor = new Color(1, 0, 0, 1);
                    GUILayout.Label("ani不存在动作:" + sb.AniName, titleStyle2);
                }

                GUILayout.BeginHorizontal(GUILayout.Width(300));
                if (this.blockIndex == i)
                {
                    GUI.color = Color.green;
                    curblock  = sb;
                }
                else
                {
                    GUI.color = Color.white;
                }

                if (GUILayout.Button(sb.AniName + " index:" + i))
                {
                    blockIndex = i;
                    curblock   = sb;
                    eventIndex = 0;
                    curEvent   = null;

                    GUI.FocusControl("RefreshFocus");
                }

                GUI.color = GUI.backgroundColor;
                if (GUILayout.Button("add", GUILayout.Width(50)))
                {
                    Window_SelectAniClip window =
                        (Window_SelectAniClip)EditorWindow.GetWindow(typeof(Window_SelectAniClip), false,
                                                                     "SelectAniClip");
                    window.Show(blocks, i + 1, this.ani);
                }

                if (GUILayout.Button("del", GUILayout.Width(50)))
                {
                    blocks.Remove(sb);
                    count = blocks.Count;
                    if (blockIndex == i)
                    {
                        curblock   = null;
                        blockIndex = 0;
                    }
                    else if (blockIndex > i)
                    {
                        blockIndex--;
                    }
                }

                GUILayout.EndHorizontal();
            }
        }
    }