private void AddAppModule() { if (AiukAppsSetting.IsExist(m_NewModuleName)) { EditorUtility.DisplayDialog("模块已存在", string.Format("所要添加的模块{0}已存在,添加模块失败!", m_NewModuleName), "知道了"); return; } if (string.IsNullOrEmpty(m_NewModuleName)) { EditorUtility.DisplayDialog("模块名为空", "不能添加名字为空的模块,添加模块失败!", "知道了"); return; } var newModule = new AiukAppModuleSetting(m_AppsSetting.CurrentApp, m_NewModuleName); m_AppsSetting.CurrentApp.AddModule(newModule); m_NewModuleName = null; AiukAppsSetting.Save(AiukAppsSetting.Instance); AssetDatabase.Refresh(); InitContext(); }
/// <summary> /// 初始化脚手架工具运行所需的上下文环境。 /// 加载及更新AppsSetting。 /// </summary> private void InitContext() { m_AppRootDir = Application.dataPath + "/"; // 初始化AppsSetting实例。 m_AppsSetting = AiukAppsSetting.Instance; if (m_AppsSetting.AppSetings.Count == 0) { return; } var currentAppName = m_AppsSetting.CurrentAppName; m_AppArray = m_AppsSetting.AppSetings.Select(app => app.Name).ToArray(); m_AppIndex = m_AppsSetting.AppSetings.FindIndex(app => app.Name == currentAppName); var currentApp = m_AppsSetting.CurrentApp; if (currentApp.AppModules.Count == 0) { return; } var currentModuleName = currentApp.CurrentModule.Name; m_ModuleArray = currentApp.AppModules.Select(m => m.Name).ToArray(); m_AppModuleIndex = currentApp.AppModules.FindIndex(m => m.Name == currentModuleName); AssetDatabase.Refresh(); }
private void DrawDeleteAllAppsSetting() { if (GUILayout.Button("删除沙盒及StreamAssets下的Apps设置文件")) { AiukAppsSetting.DeleteAllAppsSetting(); InitContext(); AssetDatabase.Refresh(); EditorUtility.DisplayDialog("删除成功", "沙盒及StreaAssets目录下的Apps设置文件已删除。", "知道了"); } }
/// <summary> /// 创建一个新的应用集合设置文件。 /// </summary> /// <param name="organizationName">Organization name.</param> /// <param name="newAppName">New app name.</param> /// <param name="newModuleName">New module name.</param> public static void CreateAppsSetting ( string organizationName, string newAppName, string newModuleName, string rootDir ) { var appSetting = new AiukAppSetting(organizationName, newAppName, rootDir); var appModule = new AiukAppModuleSetting(appSetting, newModuleName); appSetting.AddModule(appModule); // 添加各应用模块共享的Share模块。 var shareModule = new AiukAppModuleSetting(appSetting, "Share"); appSetting.AddModule(shareModule); var appsSetting = new AiukAppsSetting(); }
private void AddApp() { if (AiukAppsSetting.IsExist(m_NewAppName)) { EditorUtility.DisplayDialog("应用已存在", string.Format("所要添加的应用{0}已存在,添加应用失败!", m_NewAppName), "知道了"); return; } if (string.IsNullOrEmpty(m_NewAppName)) { EditorUtility.DisplayDialog("应用名为空", "不能添加名字为空的应用,添加应用失败!", "知道了"); return; } if (string.IsNullOrEmpty(m_OrganizationName)) { EditorUtility.DisplayDialog("组织名为空", "请先填写应用的组织名,添加应用失败!", "知道了"); return; } if (string.IsNullOrEmpty(m_NewModuleName)) { EditorUtility.DisplayDialog("新应用模块名为空", "请先填写新应用模块名,添加应用失败!", "知道了"); return; } var newApp = new AiukAppSetting(m_OrganizationName, m_NewAppName, m_AppRootDir + "/" + m_NewAppName + "/"); AiukAppsSetting.AddApp(newApp); AiukAppsSetting.Instance.CurrentApp.AddModule(m_NewModuleName); m_NewAppName = null; m_OrganizationName = null; m_AppRootDir = null; m_NewModuleName = null; AiukAppsSetting.Save(AiukAppsSetting.Instance); AssetDatabase.Refresh(); InitContext(); }
private void OnDestroy() { AiukAppsSetting.SetInstanceNull(); }