private void Awake()
 {
     this.m_ChooseButton.Disable();
     this.m_BackButton.AddEventListener(UIEventType.RELEASE, e => this.OnBackButton());
     this.m_ChooseButton.AddEventListener(UIEventType.RELEASE, e => this.ChangeSubScene());
     AdventureConfig.Get().AddSelectedModeChangeListener(new AdventureConfig.SelectedModeChange(this.OnSelectedModeChange));
     if (this.m_ChooseElementsContainer == null)
     {
         UnityEngine.Debug.LogError("m_ChooseElementsContainer cannot be null. Unable to create button.", this);
     }
     else
     {
         foreach (AdventureDef def in AdventureScene.Get().GetSortedAdventureDefs())
         {
             if (AdventureScene.Get().IsAdventureOpen(def.GetAdventureId()))
             {
                 this.CreateAdventureChooserButton(def);
             }
         }
         if (this.m_ParentSubScene != null)
         {
             this.m_ParentSubScene.SetIsLoaded(true);
         }
         this.OnButtonVisualUpdated();
         Navigation.PushUnique(new Navigation.NavigateBackHandler(AdventureChooserTray.OnNavigateBack));
         Box.Get().AddTransitionFinishedListener(new Box.TransitionFinishedCallback(this.OnBoxTransitionFinished));
     }
 }
Beispiel #2
0
        /// <summary>
        /// Get the SubsceneState in AdventureScene
        /// </summary>
        /// <returns>The RockPegasusSubsceneState.</returns>
        private RockPegasusSubsceneState GetPegasusAdventureSubsceneState()
        {
            if (AdventureConfig.Get() == null)
            {
                return(RockPegasusSubsceneState.None);
            }

            AdventureSubScenes currentSubScene = AdventureConfig.Get().GetCurrentSubScene();

            if (currentSubScene == AdventureSubScenes.Chooser)
            {
                return(RockPegasusSubsceneState.WaitForChooseMode);
            }

            if (currentSubScene == AdventureSubScenes.Practice)
            {
                if (PracticePickerTrayDisplay.Get().IsShown() == false)
                {
                    return(RockPegasusSubsceneState.WaitForChooseDeck);
                }

                if (GetPrivateField <PracticeAIButton>(PracticePickerTrayDisplay.Get(), "m_selectedPracticeAIButton") == null)
                {
                    return(RockPegasusSubsceneState.WaitForChooseOpponent);
                }
                else
                {
                    return(RockPegasusSubsceneState.Ready);
                }
            }

            return(RockPegasusSubsceneState.None);
        }
Beispiel #3
0
    protected override void Awake()
    {
        base.Awake();
        s_instance                   = this;
        this.m_CurrentSubScene       = null;
        this.m_TransitionOutSubScene = null;
        AdventureConfig config = AdventureConfig.Get();

        config.OnAdventureSceneAwake();
        config.AddSubSceneChangeListener(new AdventureConfig.SubSceneChange(this.OnSubSceneChange));
        config.AddSelectedModeChangeListener(new AdventureConfig.SelectedModeChange(this.OnSelectedModeChanged));
        config.AddAdventureModeChangeListener(new AdventureConfig.AdventureModeChange(this.OnAdventureModeChanged));
        this.m_StartupAssetLoads++;
        bool @bool = Options.Get().GetBool(Option.HAS_SEEN_NAXX);

        if (!@bool)
        {
            this.m_StartupAssetLoads++;
        }
        this.LoadSubScene(config.GetCurrentSubScene(), new AssetLoader.GameObjectCallback(this.OnFirstSubSceneLoaded));
        if (!@bool)
        {
            SoundManager.Get().Load("VO_KT_INTRO_39");
            AssetLoader.Get().LoadGameObject("KT_Quote", new AssetLoader.GameObjectCallback(this.OnKTQuoteLoaded), null, false);
        }
        Options.Get().SetBool(Option.BUNDLE_JUST_PURCHASE_IN_HUB, false);
        if (ApplicationMgr.IsInternal())
        {
            CheatMgr.Get().RegisterCheatHandler("advdev", new CheatMgr.ProcessCheatCallback(this.OnDevCheat), null, null, null);
        }
        this.InitializeAllDefs();
    }
    private void Awake()
    {
        GameObject obj2 = AssetLoader.Get().LoadActor((UniversalInputManager.UsePhoneUI == null) ? "DeckPickerTray" : "DeckPickerTray_phone", false, false);

        if (obj2 == null)
        {
            Debug.LogError("Unable to load DeckPickerTray.");
        }
        else
        {
            this.m_deckPickerTray = obj2.GetComponent <DeckPickerTrayDisplay>();
            if (this.m_deckPickerTray == null)
            {
                Debug.LogError("DeckPickerTrayDisplay component not found in DeckPickerTray object.");
            }
            else
            {
                if (this.m_deckPickerTrayContainer != null)
                {
                    GameUtils.SetParent(this.m_deckPickerTray, this.m_deckPickerTrayContainer, false);
                }
                this.m_deckPickerTray.AddDeckTrayLoadedListener(new DeckPickerTrayDisplay.DeckTrayLoaded(this.OnTrayLoaded));
                this.m_deckPickerTray.Init();
                this.m_deckPickerTray.SetPlayButtonText(GameStrings.Get("GLOBAL_PLAY"));
                AdventureConfig   config            = AdventureConfig.Get();
                AdventureDbId     selectedAdventure = config.GetSelectedAdventure();
                AdventureModeDbId selectedMode      = config.GetSelectedMode();
                string            locString         = GameUtils.GetAdventureDataRecord((int)selectedAdventure, (int)selectedMode).GetLocString("NAME");
                this.m_deckPickerTray.SetHeaderText(locString);
            }
        }
    }
Beispiel #5
0
        /// <summary>
        /// Config deck for a game.
        /// </summary>
        /// <param name="index">The index of deck.</param>
        public void ConfigDeck(int index)
        {
            AdventureSubScenes currentSubScene = AdventureConfig.Get().GetCurrentSubScene();

            if (currentSubScene == AdventureSubScenes.Practice)
            {
                PracticePickerTrayDisplay.Get().Show();
            }
        }
Beispiel #6
0
    private void OnDestroy()
    {
        AdventureConfig config = AdventureConfig.Get();

        if (config != null)
        {
            config.RemoveAdventureMissionSetListener(new AdventureConfig.AdventureMissionSet(this.OnMissionSelected));
            config.RemoveSubSceneChangeListener(new AdventureConfig.SubSceneChange(this.OnSubsceneChanged));
        }
    }
Beispiel #7
0
        private void OnRockPraticeMode(bool expert)
        {
            if (SingletonOnGameRequest)
            {
                return;
            }
            SingletonOnGameRequest = true;

            if (SceneMgr.Get().IsInGame())
            {
                HoldBack(1000);
                return;
            }
            if (DeckPickerTrayDisplay.Get() == null)
            {
                HoldBack(1000);
                Log("DeckPickerTrayDisplay.Get() NULL");
                SingletonOnGameRequest = false;
                AdventureDbId     adventureId = Options.Get().GetEnum <AdventureDbId>(Option.SELECTED_ADVENTURE, AdventureDbId.PRACTICE);
                AdventureModeDbId modeId      = Options.Get().GetEnum <AdventureModeDbId>(Option.SELECTED_ADVENTURE_MODE, AdventureModeDbId.NORMAL);
                if (expert)
                {
                    modeId = Options.Get().GetEnum <AdventureModeDbId>(Option.SELECTED_ADVENTURE_MODE, AdventureModeDbId.EXPERT);
                }
                Log("AdventureConfig.Get().GetSelectedMode " + AdventureConfig.Get().GetSelectedMode());

                if (AdventureConfig.Get().CanPlayMode(adventureId, modeId))
                {
                    AdventureConfig.Get().SetSelectedAdventureMode(adventureId, modeId);
                    AdventureConfig.Get().ChangeSubSceneToSelectedAdventure();
                }
                else
                {
                    Log("AdventureConfig.Get().CanPlayMode FALSE");
                }

                return;
            }
            long deck = DeckPickerTrayDisplay.Get().GetSelectedDeckID();

            if (deck == 0)
            {
                HoldBack(1000);
                Log("DeckPickerTrayDisplay.Get() 0");
                SingletonOnGameRequest = false;
                return;
            }

            HoldBack(5000);
            ScenarioDbId mission = HearthrockUtils.RandomPracticeMission();

            GameMgr.Get().FindGame(PegasusShared.GameType.GT_VS_AI, PegasusShared.FormatType.FT_STANDARD, (int)mission, deck, 0L);
        }
Beispiel #8
0
    private void InitializeTrays()
    {
        int    selectedAdventure = (int)AdventureConfig.Get().GetSelectedAdventure();
        int    selectedMode      = (int)AdventureConfig.Get().GetSelectedMode();
        string locString         = GameUtils.GetAdventureDataRecord(selectedAdventure, selectedMode).GetLocString("NAME");

        this.m_deckPickerTray.SetHeaderText(locString);
        this.m_deckPickerTray.Init();
        this.m_practicePickerTray.Init();
        this.m_practicePickerTrayShowPos = this.m_practicePickerTray.transform.localPosition;
        this.m_practicePickerTray.transform.localPosition = this.GetPracticePickerHidePosition();
    }
Beispiel #9
0
    private void Awake()
    {
        AdventureConfig config = AdventureConfig.Get();

        config.AddAdventureMissionSetListener(new AdventureConfig.AdventureMissionSet(this.OnMissionSelected));
        config.AddSubSceneChangeListener(new AdventureConfig.SubSceneChange(this.OnSubsceneChanged));
        if (this.m_rewardsChest != null)
        {
            this.m_rewardsChest.AddEventListener(UIEventType.ROLLOVER, e => this.ShowCardRewards());
            this.m_rewardsChest.AddEventListener(UIEventType.ROLLOUT, e => this.HideCardRewards());
        }
    }
 private void ButtonModeSelected(AdventureChooserSubButton btn)
 {
     foreach (AdventureChooserButton button in this.m_AdventureButtons)
     {
         button.DisableSubButtonHighlights();
     }
     this.m_SelectedSubButton = btn;
     if (AdventureConfig.Get().MarkFeaturedMode(btn.GetAdventure(), btn.GetMode()))
     {
         btn.SetNewGlow(false);
     }
     AdventureConfig.Get().SetSelectedAdventureMode(btn.GetAdventure(), btn.GetMode());
     this.SetTitleText(btn.GetAdventure(), btn.GetMode());
 }
 private void ButtonExpanded(AdventureChooserButton button, bool expand)
 {
     if (expand)
     {
         AdventureConfig config = AdventureConfig.Get();
         foreach (AdventureChooserSubButton button2 in button.GetSubButtons())
         {
             if (config.IsFeaturedMode(button.GetAdventure(), button2.GetMode()))
             {
                 button2.Flash();
             }
         }
     }
 }
Beispiel #12
0
        /// <summary>
        /// Config mode for practice game.
        /// </summary>
        /// <param name="expert">If play expert mode.</param>
        public void ConfigPracticeMode(bool expert)
        {
            AdventureDbId     adventureId = Options.Get().GetEnum <AdventureDbId>(Option.SELECTED_ADVENTURE, AdventureDbId.PRACTICE);
            AdventureModeDbId modeId      = Options.Get().GetEnum <AdventureModeDbId>(Option.SELECTED_ADVENTURE_MODE, AdventureModeDbId.NORMAL);

            if (expert)
            {
                modeId = Options.Get().GetEnum <AdventureModeDbId>(Option.SELECTED_ADVENTURE_MODE, AdventureModeDbId.EXPERT);
            }

            if (AdventureConfig.Get().CanPlayMode(adventureId, modeId))
            {
                AdventureConfig.Get().SetSelectedAdventureMode(adventureId, modeId);
                AdventureConfig.Get().ChangeSubSceneToSelectedAdventure();
            }
        }
Beispiel #13
0
        // Play against AI
        // Found at: PracticePickerTrayDisplay search for StartGame
        private void practice_mode(bool expert)
        {
            if (just_joined)
            {
                return;
            }

            // Don't do this, if we're currently in a game
            // TODO: Change to an assertion
            if (SceneMgr.Get().IsInGame())
            {
                return;
            }

            if (!deck_initialized)
            {
                Log.log("Changing adventureconfig...");
                AdventureConfig.Get().SetSelectedAdventureMode(AdventureDbId.PRACTICE, expert ? AdventureModeDbId.EXPERT : AdventureModeDbId.NORMAL);
                AdventureConfig.Get().ChangeSubScene(AdventureSubScenes.MissionDeckPicker);

                deck_initialized = true;
                Delay(5000);
            }
            else
            {
                // Get the ID of the current Deck
                Log.log("Getting Deck id");
                long selectedDeckID = DeckPickerTrayDisplay.Get().GetSelectedDeckID();
                if (selectedDeckID == 0)
                {
                    Log.error("Invalid Deck ID 0!");
                    return;
                }

                // Get a random mission, of selected difficulty
                int mission = getRandomAIMissionId(expert);

                // Start up the game
                Log.log("Starting game in practice mode, expert = " + expert + ", mission = " + mission + ", deck = " + selectedDeckID);
                DeckPickerTrayDisplay.Get().GetLoadingPopup().Show();
                GameMgr.Get().FindGame(GameType.GT_VS_AI, mission, selectedDeckID);

                just_joined      = true;
                deck_initialized = false;
                Delay(5000);
            }
        }
Beispiel #14
0
        public static void FindGame()
        {
            var status = GetCurrentMode();

            switch (status)
            {
            case ModeStatus.Adventure:
                AdventureConfig.Get()
                .ChangeSubScene(AdventureConfig.GetSubSceneFromMode(AdventureDbId.PRACTICE,
                                                                    AdventureModeDbId.NORMAL));
                break;
            }
            var selectedDeck     = Client.GetSelectedDeckId();
            var selectedGameType = Client.GetSelectedGameType();
            var selectedMission  = Client.GetSelectedMission();

            FindGame(selectedGameType, selectedMission, selectedDeck);
        }
 private void OnBuyDungeonPressed(UIEvent e)
 {
     this.Close();
     Options.Get().SetInt(Option.LAST_SELECTED_STORE_ADVENTURE_ID, (int)AdventureConfig.Get().GetSelectedAdventure());
     StoreManager.Get().StartGeneralTransaction(GeneralStoreMode.ADVENTURE);
 }
Beispiel #16
0
    private void ShowCardRewards()
    {
        if (UniversalInputManager.UsePhoneUI != null)
        {
            NotificationManager.Get().DestroyActiveQuote(0.2f);
        }
        List <CardRewardData> immediateCardRewardsForDefeatingScenario = AdventureProgressMgr.Get().GetImmediateCardRewardsForDefeatingScenario((int)AdventureConfig.Get().GetMission());

        this.m_rewardsDisplay.ShowCardsNoFullscreen(immediateCardRewardsForDefeatingScenario, this.m_rewardsDisplayBone.position, new Vector3?(this.m_rewardsChest.transform.position));
    }