Пример #1
0
        private void GenerateEventhandler()
        {
            try
            {
                if (AssetDatabase.DeleteAsset(DTaskEditorConst.Level_Path_Relative + SceneManager.GetActiveScene().name == "" ? "UnnamedScene" : SceneManager.GetActiveScene().name))
                {
                    this.DLog("Remove old level file!");
                }

                DTaskRouter _router = ExcuteGenerate(TBWindow.NodesRouter);

                if (_router != null)
                {
                    AssetsProjectEditor.GenerateConfig(DTaskEditorConst.Level_Path + SceneManager.GetActiveScene().name == "" ? "UnnamedScene" : SceneManager.GetActiveScene().name, _router);
                }
                else
                {
                    this.DLog("cannot generate router!");
                }
            }
            catch (Exception _error)
            {
                this.DLog("Generate failed");
                this.DLog(_error);
                // Do nothing
            }
        }
Пример #2
0
 private void OnSaveEventhandler()
 {
     try
     {
         AssetsProjectEditor.GenerateConfig(DTaskEditorConst.Level_Path_Editor + SceneManager.GetActiveScene().name == "" ? "UnnamedScene" : SceneManager.GetActiveScene().name, TBWindow.NodesRouter);
     }
     catch (Exception)
     {
         this.DLog("You have already saved");
     }
     //DXMLSerializer.SerializeObjectToXml(
     //        // Path
     //        SceneManager.GetActiveScene().name == "" ?
     //        Application.dataPath + "/Resources/Levels/" + "UnnamedScene.xml" :
     //        Application.dataPath + "/Resources/Levels/" + SceneManager.GetActiveScene().name + ".xml",
     //        // object
     //        TBWindow.NodesRouter,
     //        _drivedClasses
     //    );
 }