public void LaunchGame(AssaultAPI assault) { leaving = true; CameraFader.Fade(Constants.SceneFadeOutTime, () => { switch (MenuController.ConfigToLoad.Game) { case Game.Assault: if (MenuController.ConfigToLoad.IsBonusPlanet) { assault.StartAssaultMode(MenuController.ConfigToLoad.BonusPlanet, MenuController.ConfigToLoad.PillarNumber, (int)MenuController.DifficultyToLoad); } else { assault.StartAssaultMode(MenuController.ConfigToLoad.Planet, MenuController.ConfigToLoad.PillarNumber, (int)MenuController.DifficultyToLoad); } break; case Game.Duel: ContainerAPI.GetDuelApi().Launch(MenuController.ConfigToLoad.Duelist, (int)MenuController.DifficultyToLoad); break; } }); }
private void Start() { duelApi = ContainerAPI.GetDuelApi(); assaultApi = new AssaultAPI(); allPassiveItems = duelApi.Inventory.PassiveAbilities.GetAllItems(); ownedPassiveItems = duelApi.Inventory.PassiveAbilities.GetOwnedItems(); allForceItems = duelApi.Inventory.ForcePowers.GetAllItems(); ownedForceItems = duelApi.Inventory.ForcePowers.GetOwnedItems(); if (PanelType == EquipItemType.ForcePower) { defaultLabel = Title.text; List <ForcePowerItem> equippedItems = duelApi.Inventory.ForcePowers.GetEquippedItems(); foreach (ForcePowerItem item in equippedItems) { OnItemSelected(item); break; } } else if (PanelType == EquipItemType.PassivePower1 || PanelType == EquipItemType.PassivePower2) { defaultLabel = Title.text; List <PassiveAbilityItem> equippedItems = duelApi.Inventory.PassiveAbilities.GetEquippedItems(); if (equippedItems.Count >= 1 && PanelType == EquipItemType.PassivePower1) { if (MenuController.ConfigToLoad.Game == Game.Assault) { if (IsAbilityUsableInAssault(equippedItems[0])) { OnItemSelected(equippedItems[0]); } } else { OnItemSelected(equippedItems[0]); } } if (equippedItems.Count >= 2 && PanelType == EquipItemType.PassivePower2) { if (MenuController.ConfigToLoad.Game == Game.Assault) { if (IsAbilityUsableInAssault(equippedItems[1])) { OnItemSelected(equippedItems[1]); } } else { OnItemSelected(equippedItems[1]); } } } }
private static AssaultAPI GetAssaultApi() { if (assaultApi == null) { assaultApi = new AssaultAPI(); } return(assaultApi); }
private int[] GeneratePillarRatings(out int nextPlanet, out int nextNode) { AssaultAPI assaultApi = new AssaultAPI(); DuelAPI duelApi = ContainerAPI.GetDuelApi(); int[] results = new int[PillarConfigs.Length]; int nextEasyConfig = -1; int nextMediumConfig = -1; for (int i = 0; i < PillarConfigs.Length; i++) { if (PillarConfigs[i].Game == Game.Duel) { int rating = 0; for (int difficulty = 1; difficulty <= (int)DifficultyComplete.Hard; difficulty++) { if (duelApi.Progress.HasCompleted(PillarConfigs[i].Duelist, difficulty)) { rating++; } } results[i] = rating; } else if (PillarConfigs[i].Game == Game.Assault) { int rating = 0; for (int difficulty = 1; difficulty <= (int)DifficultyComplete.Hard; difficulty++) { if (assaultApi.RatingForStage(PillarConfigs[i].Planet, PillarConfigs[i].PillarNumber, difficulty) > 0) { rating++; } } results[i] = rating; } // Next Level Not beat on easy if (results[i] == 0 && nextEasyConfig == -1) { nextEasyConfig = i; } // Next level not beat on medium if (results[i] == 1) { nextMediumConfig = i; } // Debug.LogWarning("= " + PillarConfigs[i].Game + ": [" + i + "]" + results[i]); } if (nextEasyConfig != -1) { nextPlanet = (int)Mathf.Floor((float)nextEasyConfig / Enum.GetNames(typeof(NodeName)).Length); nextNode = nextEasyConfig % Enum.GetNames(typeof(NodeName)).Length; } else { nextPlanet = (int)Mathf.Floor((float)nextMediumConfig / Enum.GetNames(typeof(NodeName)).Length); nextNode = nextMediumConfig % Enum.GetNames(typeof(NodeName)).Length; // Debug.LogError("Next Medium Config: " + nextPlanet + " | " + nextNode + PillarConfigs[nextMediumConfig].Game); } return(results); }
/// <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; } }