コード例 #1
0
        private static TDAPI GetTDAPI()
        {
            if (towerApi == null)
            {
                towerApi = TDAPI.GetInstance();
            }

            return(towerApi);
        }
コード例 #2
0
        /// <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;
            }
        }