Example #1
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;
        }
Example #2
0
 void ImportBook(AdvImportBook book, AdvMacroManager macroManager)
 {
     foreach (var sheet in book.GridList)
     {
         ImportSheet(sheet, macroManager);
     }
 }
Example #3
0
 public void MakeScenarioImportData(AdvSettingDataManager dataManager, AdvMacroManager macroManager)
 {
     foreach (var book in DataList)
     {
         if (book.Reimport)
         {
             book.MakeImportData(dataManager, macroManager);
         }
     }
 }
Example #4
0
 /// <summary>
 /// シナリオ連続ロード時に使用.同名のラベルで連続再生をかけようとすると任意のラベルでロードできない事があるため. yoshida 2018/08/26
 /// </summary>
 public void ClearCache()
 {
     if (scenarioDataTbl != null)
     {
         scenarioDataTbl.Clear();
     }
     scenarioDataTbl    = new Dictionary <string, AdvScenarioData>();
     settingDataManager = new AdvSettingDataManager();
     macroManager       = new AdvMacroManager();
     Debug.Log("ClearCache : scenarioDataTbl=" + (scenarioDataTbl));
 }
Example #5
0
 public void ImportBooks(List <AdvImportBook> importDataList, AdvMacroManager macroManager)
 {
     this.DataList.Clear();
     this.SettingList.Clear();
     foreach (var book in importDataList)
     {
         this.DataList.Add(book);
         foreach (var sheet in book.GridList)
         {
             ImportSheet(sheet, macroManager);
         }
     }
 }
Example #6
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;
        }
Example #7
0
 //マクロを適用したインポートデータを作成
 public void MakeImportData(AdvSettingDataManager dataManager, AdvMacroManager macroManager)
 {
     Profiler.BeginSample("MakeImportData");
     foreach (var grid in GridList)
     {
         string sheetName = grid.SheetName;
         if (sheetName.Contains("."))
         {
             Debug.LogErrorFormat("Don't use '.' to sheetname in  {0}", grid.Name);
         }
         if (AdvSheetParser.IsScenarioSheet(sheetName) && !AdvMacroManager.IsMacroName(sheetName))
         {
             importGridList.Add(new AdvImportScenarioSheet(grid, dataManager, macroManager));
         }
     }
     Profiler.EndSample();
     Reimport = false;
 }
Example #8
0
        void ImportSheet(StringGrid sheet, AdvMacroManager macroManager)
        {
            sheet.InitLink();
            string sheetName = sheet.SheetName;

            if (AdvSheetParser.IsDisableSheetName(sheetName))
            {
                Debug.LogError(sheetName + " is invalid name");
                return;
            }

            if (AdvSheetParser.IsSettingsSheet(sheetName))
            {
                SettingList.Add(sheet);
            }
            else
            {
                macroManager.TryAddMacroData(sheet.SheetName, sheet);
            }
        }
Example #9
0
        //シナリオデータとして解析
        public void Init(AdvSettingDataManager dataManager, AdvMacroManager macroManger)
        {
            isInit = false;
            List <AdvCommand> commandList = new List <AdvCommand>();

            foreach (StringGridRow row in DataGrid.Rows)
            {
                if (row.RowIndex < DataGrid.DataTopRow)
                {
                    continue;                                                                           //データの行じゃない
                }
                if (row.IsEmptyOrCommantOut)
                {
                    continue;                                                                                                   //データがない
                }
                List <AdvCommand> macroCommnadList;
                AdvCommand.StartCheckEntity(dataManager.DefaultParam.GetParameter);
                bool isMacro = macroManger.TryParseMacro(row, dataManager, out macroCommnadList);
                AdvCommand.EndCheckEntity();
                if (isMacro)
                {
                    //マクロの場合
                    commandList.AddRange(macroCommnadList);
                }
                else
                {
                    //通常コマンド
                    AdvCommand command = AdvCommandParser.CreateCommand(row, dataManager);
                    if (null != command)
                    {
                        commandList.Add(command);
                    }
                }
            }
            //選択肢終了などの特別なコマンドを自動解析して追加
            AddExtraCommand(commandList, dataManager);
            //シナリオラベルデータを作成
            MakeScanerioLabelData(commandList);
            isInit = true;
        }
Example #10
0
        public void MakeSettingImportData(AdvMacroManager macroManager)
        {
            foreach (var book in DataList)
            {
                foreach (var sheet in book.GridList)
                {
                    string sheetName = sheet.SheetName;
                    if (AdvSheetParser.IsDisableSheetName(sheetName))
                    {
                        Debug.LogError(sheetName + " is invalid name");
                        continue;
                    }

                    if (AdvSheetParser.IsSettingsSheet(sheetName))
                    {
                        settingList.Add(sheet);
                    }
                    else
                    {
                        macroManager.TryAddMacroData(sheet.SheetName, sheet);
                    }
                }
            }
        }
Example #11
0
        public AdvImportScenarioSheet(StringGrid original, AdvSettingDataManager dataManager, AdvMacroManager macroManager) : base(original.Name, original.SheetName, original.Type)
        {
            this.entityIndexTbl = new List <int>();
            this.entityDataList = new List <AdvEntityData>();
            base.headerRow      = original.HeaderRow;
            for (int i = 0; i < original.DataTopRow; i++)
            {
                base.AddRow(original.Rows[i].Strings);
            }
            List <StringGridRow> outputList = new List <StringGridRow>();

            foreach (StringGridRow row in original.Rows)
            {
                if (((row.RowIndex >= original.DataTopRow) && !row.IsEmptyOrCommantOut) && !macroManager.TryMacroExpansion(row, outputList, string.Empty))
                {
                    outputList.Add(row);
                }
            }
            foreach (StringGridRow row2 in outputList)
            {
                string[] strings;
                if (AdvEntityData.ContainsEntitySimple(row2))
                {
                    string[] strArray2;
                    if (AdvEntityData.TryCreateEntityStrings(row2, new Func <string, object>(dataManager.DefaultParam.GetParameter), out strArray2))
                    {
                        AdvEntityData item = new AdvEntityData(row2.Strings);
                        strings = strArray2;
                        this.entityDataList.Add(item);
                        this.entityIndexTbl.Add(base.Rows.Count);
                    }
                    else
                    {
                        strings = row2.Strings;
                    }
                }
                else
                {
                    strings = row2.Strings;
                }
                StringGridRow row3 = base.AddRow(strings);
                row3.DebugIndex = row2.DebugIndex;
                row3.DebugInfo  = row2.DebugInfo;
            }
            base.InitLink();
        }
Example #12
0
        //インポート用の文字列グリッドを作成
        public AdvImportScenarioSheet(StringGrid original, AdvSettingDataManager dataManager, AdvMacroManager macroManager)
            : base(original.Name, original.SheetName, original.Type)
        {
            //ヘッダー(最初の一行目のはず)は、オリジナルを使う
            this.headerRow = original.HeaderRow;
            for (int i = 0; i < original.DataTopRow; ++i)
            {
                this.AddRow(original.Rows[i].Strings);
            }

            //マクロ展開
            List <StringGridRow> rowList = new List <StringGridRow>();

            foreach (StringGridRow row in original.Rows)
            {
                if (row.RowIndex < original.DataTopRow)
                {
                    continue;                                                           //データの行じゃない
                }
                if (row.IsEmptyOrCommantOut)
                {
                    continue;                                                           //データがない
                }
                //マクロ展開
                bool isMacro = macroManager.TryMacroExpansion(row, rowList, "");
                if (!isMacro)
                {
                    //マクロ展開がないので、普通に行を追加
                    rowList.Add(row);
                }
            }

            //データ部分はマクロ展開済みのもの
            foreach (var row in rowList)
            {
                StringGridRow data;

                string[] strings;
                //マクロの場合はエンティテイ処理のチェック
                //将来的にはマクロ展開抜きでいけそう
                if (AdvEntityData.ContainsEntitySimple(row))
                {
                    //エンティティ処理がある場合はそれをリストにいれてインデックスを
                    string[] entityStrings;
                    if (AdvEntityData.TryCreateEntityStrings(row, dataManager.DefaultParam.GetParameter, out entityStrings))
                    {
                        AdvEntityData entityData = new AdvEntityData(row.Strings);
                        strings = entityStrings;
                        entityDataList.Add(entityData);
                        entityIndexTbl.Add(this.Rows.Count);
                    }
                    else
                    {
                        strings = row.Strings;
                    }
                }
                else
                {
                    strings = row.Strings;
                }
                data            = this.AddRow(strings);
                data.DebugIndex = row.DebugIndex;
                data.DebugInfo  = row.DebugInfo;
            }
            this.InitLink();
        }