//ブックのインポート void ImportScenarioBook(StringGridDictionary book, string path) { //シナリオデータ用のスクリプタブルオブジェクトを宣言 string scenarioAssetPath = Path.ChangeExtension(path, ScenarioAssetExt); AdvScenarioDataExported assetScenario = null; foreach (var sheet in book.List) { StringGrid grid = sheet.Grid; //設定データか、シナリオデータかチェック if (!AdvSettingDataManager.IsBootSheet(sheet.Name) && !AdvSettingDataManager.IsSettingsSheet(sheet.Name)) { //シナリオデータのアセットを作成 if (assetScenario == null) { assetScenario = UtageEditorToolKit.GetImportedAssetCreateIfMissing <AdvScenarioDataExported>(scenarioAssetPath); assetScenario.Clear(); } assetScenario.hideFlags = HideFlags.NotEditable; assetScenario.ParseFromExcel(sheet.Name, grid); if (assetSetting != null) { AdvScenarioData scenarioData = assetScenario.ErrorCheck(sheet.Name, grid, assetSetting); scenarioDataTbl.Add(sheet.Name, scenarioData); } } } //変更を反映 if (assetScenario != null) { Debug.Log(LanguageAdvErrorMsg.LocalizeTextFormat(AdvErrorMsg.Import, scenarioAssetPath)); EditorUtility.SetDirty(assetScenario); } }
//シーン内のAdvエンジンの初期設定 void InitUtageEngine() { //シナリオデータの設定 AdvEngine engine = GameObject.FindObjectOfType <AdvEngine>(); AdvEngineStarter starter = GameObject.FindObjectOfType <AdvEngineStarter>(); AdvSettingDataManager settingDataAsset = UtageEditorToolKit.LoadAssetAtPath <AdvSettingDataManager>(GetSettingAssetRelativePath()); AdvScenarioDataExported exportedScenarioAsset = UtageEditorToolKit.LoadAssetAtPath <AdvScenarioDataExported>(GetScenarioAssetRelativePath()); AdvScenarioDataExported[] exportedScenarioDataTbl = { exportedScenarioAsset }; starter.InitOnCreate(engine, settingDataAsset, exportedScenarioDataTbl, newProjectName); UguiLetterBoxCamera[] cameras = GameObject.FindObjectsOfType <UguiLetterBoxCamera>(); foreach (UguiLetterBoxCamera camera in cameras) { camera.Width = camera.MaxWidth = gameScreenWidth; camera.Height = camera.MaxHeight = gameScreenHeight; } //セーブファイルの場所の設定 AdvSaveManager saveManager = GameObject.FindObjectOfType <AdvSaveManager>(); saveManager.DirectoryName = "Save" + newProjectName; AdvSystemSaveData systemSaveData = GameObject.FindObjectOfType <AdvSystemSaveData>(); systemSaveData.DirectoryName = "Save" + newProjectName; //シーン内の全てのテンプレートアセットをクローンアセットに置き換える ReplaceAssetsFromTempleateToCloneInSecne(); }
void InitUtageEngine() { //シナリオデータの設定 AdvEngine engine = GameObject.FindObjectOfType <AdvEngine>(); AdvEngineStarter starter = GameObject.FindObjectOfType <AdvEngineStarter>(); AdvSettingDataManager settingDataAsset = UtageEditorToolKit.LoadAssetAtPath <AdvSettingDataManager>(GetSettingAssetRelativePath()); AdvScenarioDataExported exportedScenarioAsset = UtageEditorToolKit.LoadAssetAtPath <AdvScenarioDataExported>(GetScenarioAssetRelativePath()); AdvScenarioDataExported[] exportedScenarioDataTbl = { exportedScenarioAsset }; starter.InitOnCreate(engine, settingDataAsset, exportedScenarioDataTbl, newProjectName); //カメラに画面サイズを設定 CameraManager cameraManager = GameObject.FindObjectOfType <CameraManager>(); cameraManager.InitOnCreate(gameScreenWidth, gameScreenHeight); //入力枠のサイズ調整 AdvInputManager inputManager = GameObject.FindObjectOfType <AdvInputManager>(); BoxCollider2D collider = inputManager.GetComponent <BoxCollider2D>(); collider.size = new Vector2(1.0f * gameScreenWidth / 100, 1.0f * gameScreenHeight / 100); }
/// <summary> /// 設定されたエクスポートデータからゲームを開始 /// </summary> /// <param name="rootDirResource">リソースディレクトリ</param> public void BootFromExportData(AdvSettingDataManager settingDataManager, AdvScenarioDataExported[] exportedScenarioDataTbl, string resourceDir ) { StopAllCoroutines(); Clear(); isStarted = true; isWaitBootLoading = true; onPreInit.Invoke(); DataManager.InitData( settingDataManager, exportedScenarioDataTbl); BootInit(resourceDir); isWaitBootLoading = false; }
//スクリプトから初期化 public void InitOnCreate(AdvEngine engine, AdvSettingDataManager settingDataManager, AdvScenarioDataExported[] exportedScenarioDataTbl, string rootResourceDir) { this.engine = engine; this.settingDataManager = settingDataManager; this.exportedScenarioDataTbl = exportedScenarioDataTbl; this.rootResourceDir = rootResourceDir; }
/// <summary> /// データを直接設定して初期化 /// </summary> public void InitData(AdvSettingDataManager settingDataManager, AdvScenarioDataExported[] exportedScenarioDataTbl) { this.settingDataManager = settingDataManager; this.exportedScenarioDataTbl = exportedScenarioDataTbl; }