//エンジンをロード IEnumerator LoadEngineAsync() { //シナリオやリソースのロードのまえに //アセットバンドルのファイルリストの初期化が必要 // //・宴が渡すファイルパスと、 //・実際にアセットバンドルが置いてあるサーバーのURL、 //・アセットバンドルのバージョン //これらの情報を設定する foreach (var versionInfo in assetBundleList) { AssetFileManager.GetInstance().AssetBundleInfoManager.AddAssetBundleInfo(versionInfo.resourcePath, versionInfo.url, versionInfo.version); } //開始ラベルを登録しておく if (!string.IsNullOrEmpty(startScenario)) { Engine.StartScenarioLabel = startScenario; } //ロードファイルタイプをサーバーに AssetFileManager.InitLoadTypeSetting(AssetFileManagerSettings.LoadType.Server); //シナリオのロード yield return(LoadScenariosAsync("Sample.scenarios.asset")); if (this.Scenarios == null) { Debug.LogError("Scenarios is Blank. Please set .scenarios Asset", this); yield break; } //シナリオとルートパスを指定して、エンジン起動 //カスタムしてスクリプトを書くときは、最終的にここにくればよい Engine.BootFromExportData(this.Scenarios, ""); //自動再生 StartEngine(); }
//エンジンをロード IEnumerator LoadEngineAsyncSub() { Debug.Log("[AdvEngineStarter] LoadEngineAsyncSub Load From " + Strage); //開始ラベルを登録しておく if (!string.IsNullOrEmpty(startScenario)) { Engine.StartScenarioLabel = startScenario; } //ストレージごとに、ロードタイプを設定しておく switch (Strage) { case StrageType.Local: case StrageType.LocalAndServerScenario: AssetFileManager.InitLoadTypeSetting(AssetFileManagerSettings.LoadType.Local); break; case StrageType.StreamingAssets: case StrageType.StreamingAssetsAndLocalScenario: AssetFileManager.InitLoadTypeSetting(AssetFileManagerSettings.LoadType.StreamingAssets); break; case StrageType.Server: case StrageType.ServerAndLocalScenario: AssetFileManager.InitLoadTypeSetting(AssetFileManagerSettings.LoadType.Server); break; default: Debug.LogError("Unkonw Strage" + Strage.ToString()); break; } //シナリオのロードが必要なものはロードする bool needsToLoadScenario = false; switch (Strage) { case StrageType.Local: case StrageType.ServerAndLocalScenario: case StrageType.StreamingAssetsAndLocalScenario: break; default: needsToLoadScenario = true; break; } if (needsToLoadScenario) { if (UseChapter) { yield return(LoadChaptersAsync(FilePathUtil.Combine(GetDynamicStrageRoot(), this.RootResourceDir + "_Root"))); // yield return LoadChaptersAsync(GetDynamicStrageRoot()); } else { yield return(LoadScenariosAsync(FilePathUtil.Combine(GetDynamicStrageRoot(), this.RootResourceDir + "_Root"))); // yield return LoadScenariosAsync(GetDynamicStrageRoot()); } } if (this.Scenarios == null) { Debug.LogError("Scenarios is Blank. Please set .scenarios Asset", this); yield break; } //シナリオとルートパスを指定して、エンジン起動 //カスタムしてスクリプトを書くときは、最終的にここにくればよい switch (Strage) { case StrageType.Local: case StrageType.LocalAndServerScenario: Engine.BootFromExportData(this.Scenarios, this.RootResourceDir); break; default: var root = FilePathUtil.Combine(GetDynamicStrageRoot(), this.RootResourceDir + "_Root"); Engine.BootFromExportData(this.Scenarios, root, this.RootResourceDir); // Engine.BootFromExportData(this.Scenarios, GetDynamicStrageRoot(), this.RootResourceDir ); break; } if (isAutomaticPlay) { //自動再生 StartEngine(); } }
//エンジンをロード IEnumerator LoadEngineAsyncSub() { //開始ラベルを登録しておく if (!string.IsNullOrEmpty(startScenario)) { Engine.StartScenarioLabel = startScenario; } //ストレージごとに、ロードタイプを設定しておく switch (Strage) { case StrageType.Local: case StrageType.LocalAndServerScenario: AssetFileManager.InitLoadTypeSetting(AssetFileManagerSettings.LoadType.Local); break; case StrageType.StreamingAssets: case StrageType.StreamingAssetsAndLocalScenario: AssetFileManager.InitLoadTypeSetting(AssetFileManagerSettings.LoadType.StreamingAssets); break; case StrageType.Server: case StrageType.ServerAndLocalScenario: AssetFileManager.InitLoadTypeSetting(AssetFileManagerSettings.LoadType.Server); break; default: Debug.LogError("Unkonw Strage" + Strage.ToString()); break; } //シナリオのロードが必要なものはロードする bool needsToLoadScenario = false; switch (Strage) { case StrageType.Local: case StrageType.ServerAndLocalScenario: case StrageType.StreamingAssetsAndLocalScenario: break; default: needsToLoadScenario = true; break; } if (needsToLoadScenario) { if (UseChapter) { //追加シナリオがDLがされないうちにオートセーブされると、未DLの部分のシステムセーブがない状態で上書きされしまうので //デフォルトの「AdvEnigne SystemSaveData IsAutoSaveOnQuit」はオフにしてある必要がある。 if (this.Engine.SystemSaveData.IsAutoSaveOnQuit) { Debug.LogError( "Check Off AdvEnigne SystemSaveData IsAutoSaveOnQuit\n" + "「AdvEnigne SystemSaveData IsAutoSaveOnQuit」のチェックをオフにして起動してください\n" + "チャプター機能を使う場合、追加シナリオをDLする前にシステムセーブデータを上書きされないように、アプリ終了・スリープでのオートセーブを無効にする必要があります"); //DL中はオートセーブを解除する this.Engine.SystemSaveData.IsAutoSaveOnQuit = false; } yield return(LoadChaptersAsync(GetDynamicStrageRoot())); } else { yield return(LoadScenariosAsync(GetDynamicStrageRoot())); } } if (this.Scenarios == null) { Debug.LogError("Scenarios is Blank. Please set .scenarios Asset", this); yield break; } //シナリオとルートパスを指定して、エンジン起動 //カスタムしてスクリプトを書くときは、最終的にここにくればよい switch (Strage) { case StrageType.Local: case StrageType.LocalAndServerScenario: Engine.BootFromExportData(this.Scenarios, this.RootResourceDir); break; default: Engine.BootFromExportData(this.Scenarios, GetDynamicStrageRoot()); break; } if (isAutomaticPlay) { //自動再生 StartEngine(); } }
public void LoadEngine(int version) { //ロードタイプの設定 if (isAutomaticInitFileLoadSetting) { switch (ResourceLoadType) { case LoadType.Local: AssetFileManager.InitLoadTypeSetting(localLoadSetting); break; case LoadType.Server: AssetFileManager.InitLoadTypeSetting(serverLoadSetting); break; } } LoadInitFileList(version); if (!string.IsNullOrEmpty(startScenario)) { Engine.StartScenarioLabel = startScenario; } //ADVエンジンの初期化を開始 switch (ScenarioDataLoadType) { case LoadType.Server: if (ScenarioDataLoadType != LoadType.Server) { Debug.LogError("ScenarioDataLoadType is Not Server"); } else { if (string.IsNullOrEmpty(urlScenarioData)) { Debug.LogError("Not set URL ScenarioData", this); return; } if (string.IsNullOrEmpty(ResourceDir)) { Debug.LogError("Not set ResourceData", this); return; } Engine.BootFromCsv(urlScenarioData, ResourceDir, version); } break; case LoadType.Local: if (scenarios == null) { Debug.LogError("Scenarios is Blank. Please set .scenarios Asset", this); return; } if (string.IsNullOrEmpty(ResourceDir)) { Debug.LogError("Not set ResourceData", this); return; } Engine.BootFromExportData(this.scenarios, ResourceDir); break; } if (isAutomaticPlay) { StartCoroutine(CoPlayEngine()); } }