Ejemplo n.º 1
0
        //現在の宴プロジェクトをチェック
        static void CheckCurrentProject(AdvEngine engine, AdvEngineStarter starter)
        {
            AdvScenarioDataProject project = starter.ScenarioDataProject as AdvScenarioDataProject;

            if (project == null)
            {
                Selection.activeObject = starter;
                Debug.LogWarning("Set using project asset to 'Editor > Scenario Data Project' ", starter);
                return;
            }

            if (AdvScenarioDataBuilderWindow.ProjectData != project)
            {
                AdvScenarioDataBuilderWindow.ProjectData = project;
            }
        }
Ejemplo n.º 2
0
        //ファイルの読み込み
        void ImportSub(AdvScenarioDataProject project)
        {
            Project = project;
            if (project.ChapterDataList.Count <= 0)
            {
                Debug.LogError("ChapterDataList is zeo");
                return;
            }

            AssetFileManager.ClearCheckErrorInEditor();
            AssetFileManager.IsEditorErrorCheck   = true;
            AdvCommand.IsEditorErrorCheck         = true;
            AdvCommand.IsEditorErrorCheckWaitType = project.CheckWaitType;

            UnityEngine.Profiling.Profiler.BeginSample("Import Scenarios");
            AdvEngine engine = UtageEditorToolKit.FindComponentAllInTheScene <AdvEngine>();

            if (engine != null)
            {
                engine.BootInitCustomCommand();
            }
            this.scenarioDataTbl = new Dictionary <string, AdvScenarioData>();
            this.macroManager    = new AdvMacroManager();

            AdvScenarioDataBuilderWindow.ProjectData.CreateScenariosIfMissing();
            this.scenariosAsset = project.Scenarios;

            this.scenariosAsset.ClearOnImport();
            //チャプターデータのインポート
            project.ChapterDataList.ForEach(x => ImportChapter(x.chapterName, x.ExcelPathList));

            //ファイルが存在しているかチェック
            if (project.RecourceDir != null)
            {
                string path = new MainAssetInfo(project.RecourceDir).FullPath;
                AssetFileManager.CheckErrorInEditor(path, project.CheckExt);
            }
            UnityEngine.Profiling.Profiler.EndSample();



            EditorUtility.SetDirty(this.scenariosAsset);
            AssetDatabase.Refresh();
            AdvCommand.IsEditorErrorCheck         = false;
            AdvCommand.IsEditorErrorCheckWaitType = false;
            AssetFileManager.IsEditorErrorCheck   = false;
        }
Ejemplo n.º 3
0
        //新たなプロジェクトを作成
        void Create()
        {
            switch (createType)
            {
            case Type.CreateNewAdvScene:
                if (!EditorApplication.SaveCurrentSceneIfUserWantsTo())
                {
                    return;
                }
                break;

            default:
                break;
            }

            //テンプレートをコピー
            CopyTemplate();
            string dir = ToProjectDirPath(newProjectName);

            //プロジェクトファイルを作成
            string path = FileUtil.GetProjectRelativePath(dir + newProjectName + ".project.asset");
            AdvScenarioDataProject ProjectData = UtageEditorToolKit.CreateNewUniqueAsset <AdvScenarioDataProject>(path);

            //プロジェクトにエクセルファイルを設定
            ProjectData.AddExcelAsset(UtageEditorToolKit.LoadAssetAtPath <Object>(GetExcelRelativePath()));
            //プロジェクトファイルを設定してインポート
            AdvScenarioDataBuilderWindow.ProjectData = ProjectData;
            AdvScenarioDataBuilderWindow.Import();

            switch (createType)
            {
            case Type.CreateNewAdvScene:
                //ADV用新規シーンを作成
                CreateNewAdvScene();
                break;

            case Type.AddToCurrentScene:
                //テンプレートシーンをコピー
                AddToCurrentScene();
                break;
            }
        }
        void DrawNewProject()
        {
            GUIStyle style = new GUIStyle();

            GUILayout.Space(4f);
            GUILayout.Label("<b>" + "Input New Project Name" + "</b>", style, GUILayout.Width(80f));
            newProjectName = GUILayout.TextField(newProjectName);

            EditorGUI.BeginDisabledGroup(string.IsNullOrEmpty(newProjectName));
            if (GUILayout.Button("Create", GUILayout.Width(80f)))
            {
                isOpenNewProject       = false;
                ProjectData            = UtageEditorToolKit.CreateNewUniqueAsset <AdvScenarioDataProject>(excelProjectPath + newProjectName + ".project.asset");
                Selection.activeObject = ProjectData;
            }
            EditorGUI.EndDisabledGroup();
            if (GUILayout.Button("Cancel", GUILayout.Width(80f)))
            {
                isOpenNewProject = false;
            }
        }
Ejemplo n.º 5
0
        static void OnChangeScene()
        {
            AdvEditorSettingWindow editorSetting = AdvEditorSettingWindow.GetInstance();

            if (UnityEngine.Object.ReferenceEquals(editorSetting, null))
            {
                return;
            }
            AdvEngine        engine  = null;
            AdvEngineStarter starter = null;

            //宴のシーンが切り替わったら、自動でプロジェクトを変更するか
            if (editorSetting.AutoChangeProject)
            {
                if (engine == null)
                {
                    engine = UtageEditorToolKit.FindComponentAllInTheScene <AdvEngine>();
                }
                starter = UtageEditorToolKit.FindComponentAllInTheScene <AdvEngineStarter>();
                if (engine == null || starter == null)
                {
                    return;
                }

                CheckCurrentProject(engine, starter);
            }

            //宴のシーンが切り替わったら、自動でシーンのチェックをするか
            if (editorSetting.AutoCheckScene)
            {
                engine = UtageEditorToolKit.FindComponentAllInTheScene <AdvEngine>();
                if (engine == null)
                {
                    return;
                }

                //Unityのバージョンアップによる致命的な不具合をチェックする
                if (editorSetting.AutoCheckUnityVersionUp && CheckVersionUpScene(engine))
                {
                    if (EditorUtility.DisplayDialog(
                            "UTAGE Version Up Scene"
                            , LanguageSystemText.LocalizeText(SystemText.VersionUpScene)
                            , LanguageSystemText.LocalizeText(SystemText.Yes)
                            , "Cancel")
                        )
                    {
                        VersionUpScene(engine);
                    }
                }

                if (starter != null && !starter.EditorCheckVersion())
                {
                    AdvScenarioDataProject project = starter.ScenarioDataProject as AdvScenarioDataProject;
                    if (project != null)
                    {
                        if (EditorUtility.DisplayDialog(
                                "UTAGE Version Up Sccenario"
                                , LanguageSystemText.LocalizeText(SystemText.VersionUpScenario)
                                , LanguageSystemText.LocalizeText(SystemText.Yes)
                                , "Cancel")
                            )
                        {
                            AdvScenarioDataBuilderWindow.Import();
                            starter.Scenarios = project.Scenarios;
                            starter.EditorVersionUp();
                        }
                    }
                }
            }
        }
Ejemplo n.º 6
0
 //ファイルの読み込み
 public void Import(AdvScenarioDataProject project, string[] importedAssets)
 {
     this.allImport      = false;
     this.importedAssets = new List <string>(importedAssets);
     ImportSub(project);
 }
Ejemplo n.º 7
0
 //ファイルの読み込み
 public void ImportAll(AdvScenarioDataProject project)
 {
     this.allImport = true;
     ImportSub(project);
 }
		void DrawDefault()
		{
			GUILayout.Space(4f);
			EditorGUILayout.BeginHorizontal();
			GUIStyle style = new GUIStyle();
			style.richText = true;
			GUILayout.Label("<b>" + "Project" + "</b>", style, GUILayout.Width(80f) );
			if (GUILayout.Button("Create New", GUILayout.Width(80f)))
			{
				isOpenNewProject = true;
			}
			EditorGUILayout.EndHorizontal();
			GUILayout.Space(4f);

			AdvScenarioDataProject project = EditorGUILayout.ObjectField("", ProjectData, typeof(AdvScenarioDataProject), false) as AdvScenarioDataProject;
			if (project != ProjectData)
			{
				ProjectData = project;
			}

			if (ProjectData != null)
			{
				DrawProject();
			}
		}
		void DrawNewProject()
		{
			GUIStyle style = new GUIStyle();
			GUILayout.Space(4f);
			GUILayout.Label("<b>" + "Input New Project Name" + "</b>", style, GUILayout.Width(80f));
			newProjectName = GUILayout.TextField(newProjectName);

			EditorGUI.BeginDisabledGroup(string.IsNullOrEmpty(newProjectName));
			if (GUILayout.Button("Create", GUILayout.Width(80f)))
			{
				isOpenNewProject = false;
				ProjectData = UtageEditorToolKit.CreateNewUniqueAsset<AdvScenarioDataProject>(excelProjectPath + newProjectName + ".project.asset");
				Selection.activeObject = ProjectData;
			}
			EditorGUI.EndDisabledGroup();
			if (GUILayout.Button("Cancel", GUILayout.Width(80f)))
			{
				isOpenNewProject = false;
			}
		}