예제 #1
0
        void SaveTemplate()
        {
            IList fsmStates       = FSM.FsmStates <XFsmStateComponent>();
            XTemplateComponent sc = XTemplateComponent.Create();


            string path = EditorUtility.SaveFilePanel("Create A Templete", XEditorSetting.ProjectPath, "123" + ".asset", "asset");

            if (path == "")
            {
                return;
            }

            path = FileUtil.GetProjectRelativePath(path);

            AssetDatabase.CreateAsset(sc, path);
            for (int pos = 0; pos < fsmStates.Count; pos++)
            {
                //  TODO loop in fsmStateS.Count
                XFsmStateComponent state = fsmStates[pos] as XFsmStateComponent;
                Debug.Log("pos is : " + pos);

                state.name = state.GetType().ToString();
                AssetDatabase.AddObjectToAsset(state, path);
            }
            // Refresh/Reimport
            AssetDatabase.Refresh();
            AssetDatabase.ImportAsset(path);
            AssetDatabase.SaveAssets();
        }
예제 #2
0
 public XFsmStateWindow(XFsmStateComponent state)
 {
     this.state = state;
 }