Exemplo n.º 1
0
        void AddToCurrentScene()
        {
            //シーンを開く
            string scenePath = GetSceneRelativePath();

            EditorApplication.OpenSceneAdditive(scenePath);

            //余分なオブジェクトを削除
            UtageUguiTitle title = UtageEditorToolKit.FindComponentAllInTheScene <UtageUguiTitle>();

            GameObject.DestroyImmediate(title.transform.root.gameObject);
            SystemUi systemUi = UtageEditorToolKit.FindComponentAllInTheScene <SystemUi>();

            GameObject.DestroyImmediate(systemUi.gameObject);

            //シーンのアセットを削除
            AssetDatabase.DeleteAsset(scenePath);

            //「宴」エンジンの初期化
            InitUtageEngine();

            //エンジン休止状態に
            AdvEngine engine = GameObject.FindObjectOfType <AdvEngine>();

            engine.gameObject.SetActive(false);

            Selection.activeObject = AssetDatabase.LoadAssetAtPath(scenePath, typeof(Object));
        }
Exemplo n.º 2
0
        //ファイルの読み込み
        public void Import(AdvScenarioDataProject project)
        {
            if (project.ChapterDataList.Count <= 0)
            {
                Debug.LogError("ChapterDataList is zeo");
                return;
            }

            AssetFileManager.IsEditorErrorCheck = true;
            AdvCommand.IsEditorErrorCheck       = true;

            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));
            EditorUtility.SetDirty(this.scenariosAsset);
            AssetDatabase.Refresh();
            AdvCommand.IsEditorErrorCheck       = false;
            AssetFileManager.IsEditorErrorCheck = false;
        }
Exemplo n.º 3
0
        // 全シナリオの文字数をカウントしてチェック
        internal bool TryCheckCharacterCount(List <AdvScenarioData> scenarioList, out int count)
        {
            count  = 0;
            Engine = UtageEditorToolKit.FindComponentAllInTheScene <AdvEngine>();
            if (Engine == null)
            {
                return(false);
            }

            AdvUiManager uiManager = UtageEditorToolKit.FindComponentAllInTheScene <AdvUiManager>();

            if (uiManager == null)
            {
                return(false);
            }

            bool isActive = uiManager.gameObject.activeSelf;

            if (!isActive)
            {
                uiManager.gameObject.SetActive(true);
            }
            Windows.Clear();
            foreach (var keyValue in Engine.MessageWindowManager.AllWindows)
            {
                var window = keyValue.Value.MessageWindow as IAdvMessageWindowCaracterCountChecker;
                if (window != null)
                {
                    Windows.Add(keyValue.Key, window);
                }
            }
            if (Windows.Count == 0)
            {
                Debug.LogWarning("文字数カウント可能なメッセージウィンドがありません");
            }
            else
            {
                Dictionary <IAdvMessageWindowCaracterCountChecker, string> logStrings = new Dictionary <IAdvMessageWindowCaracterCountChecker, string>();
                foreach (var keyValue in Windows)
                {
                    logStrings.Add(keyValue.Value, keyValue.Value.StartCheckCaracterCount());
                }
                foreach (AdvScenarioData data in scenarioList)
                {
                    count += CheckCharacterCount(data);
                }
                foreach (var keyValue in logStrings)
                {
                    keyValue.Key.EndCheckCaracterCount(keyValue.Value);
                }
            }
            if (!isActive)
            {
                uiManager.gameObject.SetActive(false);
            }
            return(true);
        }
Exemplo n.º 4
0
        //宴2.5対応
        static void VersionUpSceneToUtage25(AdvEngine engine)
        {
            if (engine.MessageWindowManager == null)
            {
            }
            AdvUguiManager uguiManager = UtageEditorToolKit.FindComponentAllInTheScene <AdvUguiManager>();

            if (uguiManager == null)
            {
                return;
            }
            uguiManager.GetMessageWindowManagerCreateIfMissing();
        }
Exemplo n.º 5
0
        protected override void OnGUISub()
        {
            AdvEngine engine = UtageEditorToolKit.FindComponentAllInTheScene <AdvEngine>();

            if (engine == null)
            {
                UtageEditorToolKit.BoldLabel("Not found AdvEngine");
            }
            else
            {
                OnGuiParam(engine);
            }
        }
Exemplo n.º 6
0
 protected override void OnGUISub()
 {
     this.engine = UtageEditorToolKit.FindComponentAllInTheScene <AdvEngine>();
     if (engine == null)
     {
         UtageEditorToolKit.BoldLabel("Not found AdvEngine");
         return;
     }
     else
     {
         OnGuiCurrentScenario();
     }
 }
        void AddToCurrentScene()
        {
            //すでにカメラがある場合は、宴関係のレイヤー設定を無効化する
            ChangeCameraMaskInScene();

            //すでにイベントシステムがある場合は、新しいほうを削除するために
            UnityEngine.EventSystems.EventSystem eventSystem = UtageEditorToolKit.FindComponentAllInTheScene <UnityEngine.EventSystems.EventSystem>();

            //シーンを開く
            string scenePath = GetSceneRelativePath();

            WrapperUnityVersion.OpenSceneAdditive(scenePath);


            //余分なオブジェクトを削除
            UtageUguiTitle title = UtageEditorToolKit.FindComponentAllInTheScene <UtageUguiTitle>();

            GameObject.DestroyImmediate(title.transform.root.gameObject);
            SystemUi systemUi = UtageEditorToolKit.FindComponentAllInTheScene <SystemUi>();

            GameObject.DestroyImmediate(systemUi.gameObject);

            //シーンのアセットを削除
            AssetDatabase.DeleteAsset(scenePath);

            //「宴」エンジンの初期化
            InitUtageEngine();

            //エンジン休止状態に
            AdvEngine engine = GameObject.FindObjectOfType <AdvEngine>();

            engine.gameObject.SetActive(false);

            ChangeLayerInCurrentScene();

            //すでにイベントシステムがある場合は、新しいほうを削除する
            if (eventSystem != null)
            {
                UnityEngine.EventSystems.EventSystem[] eventSystems = UtageEditorToolKit.FindComponentsAllInTheScene <UnityEngine.EventSystems.EventSystem>();
                foreach (var item in eventSystems)
                {
                    if (item != eventSystem)
                    {
                        GameObject.DestroyImmediate(item.gameObject);
                        break;
                    }
                }
            }
            Selection.activeObject = AssetDatabase.LoadAssetAtPath(scenePath, typeof(Object));
            FontChange(false);
        }
        void ChangeLayerInCurrentScene()
        {
            //レイヤー設定を変える
            AdvEngine engine = UtageEditorToolKit.FindComponentAllInTheScene <AdvEngine>();

            SwapLayerInChildren(engine.gameObject, OldLayerName, layerName);
            SwapLayerInChildren(engine.gameObject, OldLayerNameUI, layerNameUI);
            BootCustomProjectSetting projectSetting = UtageEditorToolKit.FindComponentAllInTheScene <BootCustomProjectSetting>();

            SwapLayerInChildren(projectSetting.gameObject, OldLayerNameUI, layerNameUI);

            foreach (Camera camera in projectSetting.GetComponentsInChildren <Camera>())
            {
                ChangeCameraLayer(camera);
            }
        }
Exemplo n.º 9
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;
        }
Exemplo n.º 10
0
        // 文字数オーバー チェック
        internal bool TryCheckCharacterCount(List <AdvScenarioData> scenarioList, out int count)
        {
            count = 0;
            AdvEngine engine = UtageEditorToolKit.FindComponentAllInTheScene <AdvEngine>();

            if (engine == null)
            {
                return(false);
            }

            AdvUguiManager uguiManager = UtageEditorToolKit.FindComponentAllInTheScene <AdvUguiManager>();

            if (uguiManager == null)
            {
                return(false);
            }

            bool isActive = uguiManager.gameObject.activeSelf;

            if (!isActive)
            {
                uguiManager.gameObject.SetActive(true);
                //				UguiLetterBoxCanvasScaler scaler = uguiManager.GetComponent<UguiLetterBoxCanvasScaler>();
                //				if (scaler != null)					scaler.SetLayoutHorizontal();
            }
            AdvUguiMessageWindow[] messageWindows             = uguiManager.GetComponentsInChildren <AdvUguiMessageWindow>(true);
            Dictionary <string, AdvUguiMessageWindow> windows = new Dictionary <string, AdvUguiMessageWindow>();

            foreach (var window in messageWindows)
            {
                windows.Add(window.name, window);
            }

            foreach (AdvScenarioData data in scenarioList)
            {
                count += data.EditorCheckCharacterCount(engine, windows);
            }
            if (!isActive)
            {
                uguiManager.gameObject.SetActive(false);
            }
            return(true);
        }
Exemplo n.º 11
0
        internal bool CheckAutoImportType()
        {
            switch (autoImportType)
            {
            case AutoImportType.None:
                return(false);

            case AutoImportType.OnUtageScene:
                if (UtageEditorToolKit.FindComponentAllInTheScene <AdvEngine>() == null)
                {
                    return(false);
                }
                return(true);

            case AutoImportType.Always:
            default:
                return(true);
            }
        }
Exemplo n.º 12
0
        //宴2.5対応
        static bool CheckVersionUpSceneToUtage25(AdvEngine engine)
        {
            AdvMessageWindowManager manager = UtageEditorToolKit.FindComponentAllInTheScene <AdvMessageWindowManager>();

            if (manager == null)
            {
                return(true);
            }

            AdvUguiManager uguiManager = UtageEditorToolKit.FindComponentAllInTheScene <AdvUguiManager>();

            if (uguiManager == null)
            {
                return(false);
            }

            AdvUguiMessageWindowManager mangaer = UtageEditorToolKit.FindComponentAllInTheScene <AdvUguiMessageWindowManager>();

            return(mangaer == null);
        }
        //ファイルの読み込み
        public bool Import(List <string> pathList)
        {
            //対象のエクセルファイルを全て読み込み
            Dictionary <string, StringGridDictionary> bookDictionary = new Dictionary <string, StringGridDictionary>();

            foreach (string path in pathList)
            {
                if (!string.IsNullOrEmpty(path))
                {
                    StringGridDictionary book = ExcelParser.Read(path);
                    if (book.List.Count > 0)
                    {
                        bookDictionary.Add(path, book);
                    }
                }
            }

            if (bookDictionary.Count <= 0)
            {
                return(false);
            }

            AdvEngine engine = UtageEditorToolKit.FindComponentAllInTheScene <AdvEngine>();

            if (engine != null)
            {
                engine.BootInitCustomCommand();
            }
            assetSetting = null;
            //設定データをインポート
            foreach (string path in bookDictionary.Keys)
            {
                ImportSettingBook(bookDictionary[path], path);
                if (assetSetting != null)
                {
                    break;
                }
            }
            if (assetSetting == null)
            {
                return(false);
            }

            AssetFileManager.IsEditorErrorCheck = true;
            AdvCommand.IsEditorErrorCheck       = true;
            GraphicInfo.CallbackExpression      = assetSetting.DefaultParam.CalcExpressionBoolean;
            TextParser.CallbackCalcExpression   = assetSetting.DefaultParam.CalcExpressionNotSetParam;
            iTweenData.CallbackGetValue         = assetSetting.DefaultParam.GetParameter;

            //シナリオデータをインポート
            foreach (string path in bookDictionary.Keys)
            {
                ImportScenarioBook(bookDictionary[path], path);
            }
            GraphicInfo.CallbackExpression    = null;
            TextParser.CallbackCalcExpression = null;
            iTweenData.CallbackGetValue       = null;

            //シナリオラベルのリンクチェック
            ErroeCheckScenarioLabel();

            AdvCommand.IsEditorErrorCheck       = false;
            AssetFileManager.IsEditorErrorCheck = false;
            return(true);
        }
Exemplo n.º 14
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();
                        }
                    }
                }
            }
        }