Ejemplo n.º 1
0
    private void ShowSkillList()
    {
        if (this._skills == null)
        {
            Debug.LogError("DB不存在skill数据");
            return;
        }

        GUILayout.BeginScrollView(pos, GUILayout.Width(100), GUILayout.Height(800));
        foreach (Skill skill in _skills)
        {
            if (GUILayout.Button(skill.Id + ""))
            {
                Game.Battle.Skill.Skill sk = new Game.Battle.Skill.Skill();
                sk.Id = Convert.ToInt32(skill.Id);
                this._skill.SkillList.Insert(this._index, sk);
                this.Close();
            }
        }

        GUILayout.EndScrollView();
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 所有技能
    /// </summary>
    private void OnGUI_DrawSkillGroup()
    {
        if (skill == null)
        {
            return;
        }
        GUILayout.BeginVertical(GUILayout.Width(300), GUILayout.Height(800));
        //保存按钮
        {
            var oc = GUI.backgroundColor;
            GUI.color = Color.yellow;
            if (GUILayout.Button("保存", GUILayout.Width(100), GUILayout.Height(30)))
            {
                EditorUtility.SetDirty(skill);
                AssetDatabase.SaveAssets();
                AssetDatabase.Refresh();
            }
            // GUILayout.EndHorizontal();
            GUI.backgroundColor = oc;
        }
        GUILayout.Label("技能列表:");
        //显示所有按钮
        int count = skill.SkillList.Count;

        for (int i = 0; i < count; i++)
        {
            if (curSkillIndex == i)
            {
                GUI.color = Color.green;
            }
            else
            {
                GUI.color = Color.white;
            }

            var s = skill.SkillList[i];
            s.Id = i + 1;
            GUILayout.BeginHorizontal(); //每一个技能的横条
            {
                if (GUILayout.Button(s.Id.ToString()))
                {
                    curSkillIndex          = i;
                    curSkill               = s;
                    this.curSkillblockList = curSkill.Blocks;

                    curSkillblockIndex  = -1;
                    curSkillEvnetIndex  = -1;
                    curSkillblock       = null;
                    curSkillEventList   = null;
                    curAniClip          = null;
                    curSkillEventEditor = null;
                    GUI.FocusControl("RefreshFocus");
                }

                GUI.color = GUI.backgroundColor;

                if (GUILayout.Button("DEL", GUILayout.Width(35)))
                {
                    skill.SkillList.Remove(s);
                    curSkillIndex       = -1;
                    curSkillblockIndex  = -1;
                    curSkillEvnetIndex  = -1;
                    curSkillblock       = null;
                    curSkillEventList   = null;
                    curAniClip          = null;
                    curSkillEventEditor = null;
                    curSkillblockList   = null;
                    count = skill.SkillList.Count;

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

        GUILayout.Space(20);
        if (GUILayout.Button("创建skill"))
        {
            if (skill.SkillList == null || skill.SkillList.Count == 0)
            {
                skill.SkillList = new List <Game.Battle.Skill.Skill>();
            }

            var s = new Skill();
//            s.Id = skill.SkillList.Count;

            skill.SkillList.Add(s);
        }

        GUILayout.EndVertical();
        TableToolMenu.Layout_DrawSeparatorV(Color.gray, 2);
    }