/// <summary> /// Launch the game! /// </summary> public void Launch() { // Stop ALl before loading into a game AkSoundEngine.StopAll(); // Audio - MAP_UI_GalaxyMap_SelectGame - playing selected game audio AudioEvent.Play(AudioEventName.GalaxyMap.SelectGame, gameObject); AudioEvent.Play(AudioEventName.GalaxyMap.TransitionStinger, gameObject); //track scene load time KpiTracking.TrackSceneLoadTime(); MenuController.ConfigToLoad = Config; if (SkipLevelType > 0) { if (SkipLevelType == 1) { switch (Config.Game) { case Game.Duel: DuelAPI api = ContainerAPI.GetDuelApi(); for (int i = 0; i < api.Progress.Battles.Length; i++) { if (api.Progress.Battles[i].DuelistIdentifier == Config.Duelist) { api.Inventory.ForcePowers.GiveAllItems(); api.Inventory.ForcePowers.SaveToDisk(); api.Inventory.PassiveAbilities.GiveAllItems(); api.Inventory.PassiveAbilities.SaveToDisk(); api.Progress.SetVictory(api.Progress.Battles[i], (int)MenuController.DifficultyToLoad); api.Progress.SaveToDisk(); break; } } break; case Game.Assault: AssaultAPI assaultApi = new AssaultAPI(); if (Config.IsBonusPlanet) { assaultApi.SetRatingForStage(Config.BonusPlanet, Config.PillarNumber, (int)MenuController.DifficultyToLoad, 1); } else { assaultApi.SetRatingForStage(Config.Planet, Config.PillarNumber, (int)MenuController.DifficultyToLoad, 1); } break; case Game.HoloChess: (new HolochessAPI()).CompleteLevel(Config, true); break; case Game.TowerDefense: TDAPI.GetInstance().DebugWinBattle(Config.Battle); break; } } (new ContainerAPI(Game.ForceVision)).FinishLevel(SkipLevelType == 1); return; } ForceVisionAnalytics.LogGameStart(); switch (Config.Game) { case Game.Duel: case Game.Assault: DuelAPI duelApi = ContainerAPI.GetDuelApi(); int force = duelApi.Inventory.ForcePowers.GetOwnedItems().Count; int passive = duelApi.Inventory.PassiveAbilities.GetOwnedItems().Count; // They have powers to equip if (force > 0 || passive > 0) { SceneManager.LoadScene("Equip"); } else { if (Config.Game == Game.Assault) { AssaultAPI assaultApi = new AssaultAPI(); if (MenuController.ConfigToLoad.IsBonusPlanet) { assaultApi.StartAssaultMode(MenuController.ConfigToLoad.BonusPlanet, MenuController.ConfigToLoad.PillarNumber, (int)MenuController.DifficultyToLoad); } else { assaultApi.StartAssaultMode(MenuController.ConfigToLoad.Planet, MenuController.ConfigToLoad.PillarNumber, (int)MenuController.DifficultyToLoad); } /* * assaultApi.StartAssaultMode(MenuController.ConfigToLoad.Planet, * MenuController.ConfigToLoad.PillarNumber, * (int)MenuController.DifficultyToLoad); */ } else { duelApi.Launch(MenuController.ConfigToLoad.Duelist, (int)MenuController.DifficultyToLoad); } } break; case Game.TowerDefense: TDAPI.GetInstance().LaunchBattle(Config.Battle); break; case Game.HoloChess: HolochessAPI holoChessApi = new HolochessAPI(); holoChessApi.StartHolochess(Config); break; } }
IEnumerator ChangeLanguage(string locale) { yield return(new WaitForEndOfFrame()); if (locale != Localizer.Locale) { #if SKU_CHINA OnAssetsReadyUseLanguage(locale); #else LoadingWindow.GetComponent <DownloadPanel>().StartWindow(DownloadController.InstanceIdCount + 1); DownloadControllerFactory.CancelAll(); DownloadControllerFactory factory = new DownloadControllerFactory(); DownloadController downloadController = factory.CreateDownloadController(this, (success, id) => { if (LoadingWindow != null && LoadingWindow.GetComponent <DownloadPanel>() != null) { LoadingWindow.GetComponent <DownloadPanel>().DownloadComplete(success, id); if (success == true) { Localizer.Load(true); OnAssetsReadyUseLanguage(locale); } } }, locale, (prog) => { if (LoadingWindow != null && LoadingWindow.GetComponent <DownloadPanel>() != null) { LoadingWindow.GetComponent <DownloadPanel>().UpdateProgress(prog); } }); yield return(new WaitForEndOfFrame()); downloadController.Init(); #endif } else { LanguageSelectionComplete(); //load prelaunch if first time selecting language PlayerPrefsStorage prefsStorage = new PlayerPrefsStorage(Game.ForceVision); if (prefsStorage.PrefKeyExists(Localizer.LanguagePrefKey) == false) { prefsStorage.SetPrefString(Localizer.LanguagePrefKey, locale); //only reload prelaunch if first language selected isnt first language in list. //First language means they selected the default language for the app so no reload is necessary. if (locale.Equals(Localizer.Locales[0])) { OnCloseButtonSelected(); if (TitleScreen != null) { TitleScreen.SetActive(true); } } else { UnityEngine.SceneManagement.SceneManager.LoadScene("PreLaunch"); } } } ForceVisionAnalytics.LogLanguageSelect(locale); }
/// <summary> /// Send the call. /// </summary> private void Send(PlatformConfig platformConfig, HmdPeripheral hmd) { if (hmd == null || !hmd.Connected) { return; } int handle = XDevicePlugin.GetInputDeviceHandle("VRDevice"); const string SDKVersion = "3.0"; const string DeviceIDType = "HMD SN"; string DeviceID = XDevicePlugin.GetString(handle, XDevicePlugin.kField_HMDSN8Object, "HMD-SerialNumber-MISSING"); string OsVersion = XDevicePlugin.GetString(handle, XDevicePlugin.kField_FirmwareRevisionObject, "HMD-FirmwareVersion-MISSING"); string Language = Application.systemLanguage.ToString(); string Country = Language; if (System.Globalization.RegionInfo.CurrentRegion != null) { Country = System.Globalization.RegionInfo.CurrentRegion.TwoLetterISORegionName; } string DeviceModel = hmd.GetModelName(); if (string.IsNullOrEmpty(DeviceModel)) { DeviceModel = "HMD-ModelName-MISSING"; } const string Manufacturer = "Lenovo"; string Resolution = Screen.width.ToString() + "x" + Screen.height.ToString(); string BundleID = BundleVersion.Get(); string BundleCode = Application.isEditor ? "1" : BundleVersion.Get(false); string Channel = (Application.platform == RuntimePlatform.Android) ? "Google Play" : "iTunes"; string message = "HLog" + separator + SDKVersion + separator + DeviceIDType + separator + DeviceID + separator + platformConfig.Key + separator + OsVersion + separator + Language + separator + Country + separator + DeviceModel + separator + Manufacturer + separator + Resolution + separator + "NULL" + separator + "NULL" + separator + "NULL" + separator + "NULL" + separator + "NULL" + separator + "NULL" + separator + "NULL" + "\n" + BundleID + separator + BundleCode + separator + Channel + // extra junk that OTC wants "\n" + "NULL" + separator + "0" + separator + "0" + separator + "0" + separator + "NULL" + separator + "NULL" + separator + "NULL" + separator + "NULL" + separator + "NULL" + separator + "NULL" + separator + "NULL" + separator + "NULL" + separator + "NULL" + separator + "NULL" + separator + "NULL" + separator + "NULL" + separator + "NULL" + separator + "NULL" + separator + "NULL" + separator + "NULL" + separator + "0" + separator + "0" + separator + "0" + separator + "0" + separator + "NULL\u0003" + "NULL\u0002" + "NULL\u0003" + "NULL"; if (testCall) { Log.Debug(message); } StartCoroutine(Upload(message, platformConfig)); ForceVisionAnalytics.LogOneTimeCall(DeviceID, Channel, Country, BundleCode, OsVersion, SDKVersion); }