Exemplo n.º 1
0
 public override void OnInspectorGUI()
 {
     if (GUILayout.Button("技設定画面を開く"))
     {
         PlayerSkillEditor.Open((FighterSkill)target);
     }
 }
Exemplo n.º 2
0
    private void OnGUI()
    {
        roleIndex = EditorGUILayout.Popup("选择模型", roleIndex, roleName);
        if (GUILayout.Button("创建角色"))
        {
            if (roleName[roleIndex] == "Null")
            {
                Debug.Log("创建角色不能为空");
                return;
            }

            if (playerSkillEditor == null)
            {
                playerSkillEditor = GetWindow <PlayerSkillEditor>("角色控制中心");//, typeof(SkilledEditor)
            }

            //确保只能编辑一个模型
            if (playerName != roleName[roleIndex])
            {
                // 将已创建的角色删除
                if (player != null)
                {
                    player.Unload();
                    Destroy(player.gameObject);
                    player = null;
                }
                //创建新的角色
                GameObject obj = Instantiate(Resources.Load <GameObject>("Role/" + roleName[roleIndex]));
                player = obj.GetComponent <Player>();
                PlayerSkillEditor.player = player;
                playerName           = roleName[roleIndex];
                player.data.roleName = playerName;
            }
            playerSkillEditor.Show();
        }
    }