示例#1
0
    private void DummySettings()
    {
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("Dummy Id", _myLabelStyle);
        GUILayout.FlexibleSpace();
        EditorGUI.BeginChangeCheck();
        int idx = EditorGUILayout.IntField((int)Hoster.ConfigData.Dummy);

        Hoster.SkillDataExtra.Dummy = XEditorLibrary.GetDummy((uint)idx);
        Hoster.ConfigData.Dummy     = idx;

        if (Hoster.SkillDataExtra.Dummy != null)
        {
            GUILayout.FlexibleSpace();
            EditorGUILayout.LabelField(Hoster.SkillDataExtra.Dummy.name, _myLabelStyle, new GUILayoutOption[] { GUILayout.MaxWidth(150) });

            if (GUILayout.Button("add"))
            {
                GameObject hitter = UnityEngine.Object.Instantiate(Hoster.SkillDataExtra.Dummy, Hoster.transform.position, Quaternion.identity) as GameObject;
                hitter.AddComponent <XHitHoster>().PresentID = (int)Hoster.ConfigData.Dummy;
                Selection.activeGameObject = hitter;
            }
        }
        EditorGUILayout.EndHorizontal();
    }
示例#2
0
        public void Load(string pathwithname)
        {
            try
            {
                string      path = XEditorLibrary.GetCfgFromSkp(pathwithname);
                XConfigData conf = XDataIO <XConfigData> .singleton.DeserializeData(path);

                GameObject prefab = XEditorLibrary.GetDummy((uint)conf.Player);
                if (prefab == null)
                {
                    XDebug.LogError("Prefab not found by id: ", conf.Player); return;
                }
                ColdBuild(prefab, conf);
                prefixPath = pathwithname.Substring(0, pathwithname.IndexOf("/Skill"));
                Time       = File.GetLastWriteTime(pathwithname);
            }
            catch (Exception e)
            {
                XDebug.LogError("Error occurred during loading config file: ", pathwithname, " with error:\n", e.StackTrace);
            }
        }
示例#3
0
    void OnGUI()
    {
        if (_labelstyle == null)
        {
            _labelstyle          = new GUIStyle(EditorStyles.boldLabel);
            _labelstyle.fontSize = 13;
        }

        GUILayout.Label(@"Create and edit a new skill:", _labelstyle);

        _name      = EditorGUILayout.TextField("*Skill Name:", _name);
        _directory = EditorGUILayout.TextField("*Directory:", _directory);
        if (_directory.Length > 0 && _directory[_directory.Length - 1] == '/')
        {
            _directory.Remove(_directory.Length - 1);
        }
        EditorGUILayout.Space();

        EditorGUI.BeginChangeCheck();
        _id = EditorGUILayout.IntField("*Dummy ID", _id);
        if (EditorGUI.EndChangeCheck())
        {
            _prefab = XEditorLibrary.GetDummy((uint)_id);
        }
        EditorGUILayout.ObjectField("*Dummy Prefab:", _prefab, typeof(GameObject), true);
        AnimationClip skillClip = null;

        if (!_combined)
        {
            skillClip = EditorGUILayout.ObjectField("*Skill Animation:", _skillClip, typeof(AnimationClip), true) as AnimationClip;
        }
        _combined = EditorGUILayout.Toggle("Combined Skill", _combined);

        if (skillClip != null)
        {
            string location = AssetDatabase.GetAssetPath(skillClip);
            if (skillClip == null || location.IndexOf(".anim") != -1)
            {
                _skillClip = skillClip;
            }
            else
            {
                EditorUtility.DisplayDialog("Confirm your selection.", "Please select extracted skill clip!", "Ok");
            }
        }

        EditorGUILayout.Space();

        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("Done"))
        {
            if (_prefab != null && (_combined || _skillClip != null))
            {
                Scene scene = EditorSceneManager.GetActiveScene();
                if (scene.name.Length > 0 && !EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo())
                {
                    Close();
                }
                else
                {
                    EditorSceneManager.NewScene(NewSceneSetup.DefaultGameObjects);
                    OnSkillPreGenerationDone();
                    return;
                }
            }
            else
            {
                EditorUtility.DisplayDialog("Confirm your selection.", "Please select prefab and skill clip!", "Ok");
            }
        }
        else if (GUILayout.Button("Cancel"))
        {
            Close();
        }

        EditorGUILayout.EndHorizontal();

        EditorGUILayout.Space();
        GUILayout.Label("* means this section can not be empty.", EditorStyles.foldout);
    }