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);
            }
        }
    }
예제 #2
0
    private bool OnFindGameEvent(FindGameEventData eventData, object userData)
    {
        switch (eventData.m_state)
        {
        case FindGameState.CLIENT_CANCELED:
            if (SceneMgr.Get().GetMode() == SceneMgr.Mode.TOURNAMENT)
            {
                Network.TrackClient(Network.TrackLevel.LEVEL_INFO, Network.TrackWhat.TRACK_CANCEL_MATCHMAKER);
            }
            DeckPickerTrayDisplay.Get().HandleGameStartupFailure();
            break;

        case FindGameState.CLIENT_ERROR:
        case FindGameState.BNET_ERROR:
            DeckPickerTrayDisplay.Get().HandleGameStartupFailure();
            break;

        case FindGameState.SERVER_GAME_STARTED:
            DeckPickerTrayDisplay.Get().OnServerGameStarted();
            break;

        case FindGameState.SERVER_GAME_CANCELED:
            DeckPickerTrayDisplay.Get().OnServerGameCanceled();
            break;
        }
        return(false);
    }
 public override void PreUnload()
 {
     if (DeckPickerTrayDisplay.Get() != null)
     {
         DeckPickerTrayDisplay.Get().PreUnload();
     }
 }
 private void Awake()
 {
     s_instance = this;
     AssetLoader.Get().LoadActor((UniversalInputManager.UsePhoneUI == null) ? "DeckPickerTray" : "DeckPickerTray_phone", delegate(string name, GameObject go, object data) {
         if (go == null)
         {
             Debug.LogError("Unable to load DeckPickerTray.");
         }
         else
         {
             this.m_deckPickerTray = go.GetComponent <DeckPickerTrayDisplay>();
             if (this.m_deckPickerTray == null)
             {
                 Debug.LogError("DeckPickerTrayDisplay component not found in DeckPickerTray object.");
             }
             else
             {
                 GameUtils.SetParent(this.m_deckPickerTray, this.m_deckPickerTrayContainer, false);
                 this.m_deckPickerTray.SetHeaderText(GameStrings.Get(!FriendChallengeMgr.Get().IsChallengeTavernBrawl() ? "GLOBAL_FRIEND_CHALLENGE_TITLE" : "GLOBAL_TAVERN_BRAWL"));
                 this.m_deckPickerTray.Init();
                 this.DisableOtherModeStuff();
                 NetCache.Get().RegisterScreenFriendly(new NetCache.NetCacheCallback(this.OnNetCacheReady));
                 MusicManager.Get().StartPlaylist(!FriendChallengeMgr.Get().IsChallengeTavernBrawl() ? MusicPlaylistType.UI_Friendly : MusicPlaylistType.UI_TavernBrawl);
             }
         }
     }, null, false);
 }
예제 #5
0
        public static long GetSelectedDeckId()
        {
            var config = new XmlDocument();
            var fs     =
                new FileStream(
                    (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) +
                     "\\LogicBreakers\\Resources\\HearthStone\\config.xml"), FileMode.Open, FileAccess.Read);

            config.Load(fs);
            var list    = config.GetElementsByTagName("selectedDeck");
            var xmlNode = list[0].ChildNodes.Item(0);

            if (xmlNode == null)
            {
                return(DeckPickerTrayDisplay.Get().GetSelectedDeckID());
            }
            var name = xmlNode.InnerText.Trim();

            fs.Close();
            using (var enumerator = CollectionManager.Get().GetDecks().Values.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    var current = enumerator.Current;
                    if (name == current.Name)
                    {
                        return(current.ID);
                    }
                }
            }
            return(DeckPickerTrayDisplay.Get().GetSelectedDeckID());
        }
예제 #6
0
        // Play against AI
        // Found at: PracticePickerTrayDisplay search for StartGame
        private void pratice_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;
            }
            // Delay 5 seconds for loading and such
            // TODO: Smarter delaying
            Delay(5000);

            Log.log("Joining game in practice mode, expert = " + expert);

            // Get the ID of the current Deck
            long selectedDeckID = DeckPickerTrayDisplay.Get().GetSelectedDeckID();
            // Get a random mission, of selected difficulty
            MissionID missionID = getRandomAIMissionID(expert);

            // Start up the game
            GameMgr.Get().StartGame(GameMode.PRACTICE, missionID, selectedDeckID);
            // Set status
            GameMgr.Get().UpdatePresence();

            just_joined = true;
        }
예제 #7
0
 private void DeckPickerTrayLoaded(string name, GameObject go, object callbackData)
 {
     this.m_deckPickerTray = go.GetComponent <DeckPickerTrayDisplay>();
     this.m_deckPickerTray.SetHeaderText(GameStrings.Get("GLUE_TOURNAMENT"));
     this.m_deckPickerTray.transform.parent        = base.transform;
     this.m_deckPickerTray.transform.localPosition = (Vector3)this.m_deckPickerPosition;
     this.m_deckPickerTrayLoaded = true;
 }
예제 #8
0
        // Found at: DeckPickerTrayDisplay search for RankedMatch
        private void tournament_mode(bool ranked)
        {
            if (just_joined)
            {
                return;
            }

            // Don't do this, if we're currently in a game, or matching a game
            // TODO: Change to an assertion
            if (SceneMgr.Get().IsInGame() || Network.IsMatching())
            {
                return;
            }
            // Delay 5 seconds for loading and such
            // TODO: Smarter delaying
            Delay(5000);

            // If we're not set to the right mode, now is the time to do so
            // Note; This does not update the GUI, only the internal state
            bool is_ranked = Options.Get().GetBool(Option.IN_RANKED_PLAY_MODE);

            if (is_ranked != ranked)
            {
                Options.Get().SetBool(Option.IN_RANKED_PLAY_MODE, ranked);
                return;
            }

            Log.log("Joining game in tournament mode, ranked = " + ranked);

            // Get the ID of the current Deck
            long selectedDeckID = DeckPickerTrayDisplay.Get().GetSelectedDeckID();
            // We want to play vs other players
            MissionID missionID = MissionID.MULTIPLAYER_1v1;
            // Ranked or unranked?
            GameMode mode = ranked ? GameMode.RANKED_PLAY : GameMode.UNRANKED_PLAY;

            // Setup up the game
            GameMgr.Get().SetNextGame(mode, missionID);
            // Do network join
            if (ranked)
            {
                Network.TrackClient(Network.TrackLevel.LEVEL_INFO,
                                    Network.TrackWhat.TRACK_PLAY_TOURNAMENT_WITH_CUSTOM_DECK);
                Network.RankedMatch(selectedDeckID);
            }
            else
            {
                Network.TrackClient(Network.TrackLevel.LEVEL_INFO,
                                    Network.TrackWhat.TRACK_PLAY_CASUAL_WITH_CUSTOM_DECK);
                Network.UnrankedMatch(selectedDeckID);
            }
            // Set status
            FriendChallengeMgr.Get().OnEnteredMatchmakerQueue();
            GameMgr.Get().UpdatePresence();

            just_joined = true;
        }
    protected override void OnRelease()
    {
        base.OnRelease();
        long selectedDeckID = DeckPickerTrayDisplay.Get().GetSelectedDeckID();

        HasUsedDebugMenu = true;
        GameMgr.Get().FindGame(GameType.GT_TAVERNBRAWL, this.m_missionId, selectedDeckID, 0L);
        UnityEngine.Object.Destroy(base.transform.parent.gameObject);
    }
예제 #10
0
        private void ButtonPlay_Click(object sender, EventArgs e)
        {
            DeckPickerTrayDisplay deckPickerTrayDisplay = DeckPickerTrayDisplay.Get();
            PlayButton            playButton            = deckPickerTrayDisplay.m_playButton;
            UberText newPlayButtonText2 = playButton.m_newPlayButtonText;
            Vector3  center             = newPlayButtonText2.m_TextMeshGameObject.Renderer.Bounds.m_Center;

            //DefaultBot.ilog_0.InfoFormat("[TournamentScene_DeckPicker] Now clicking the \"{0}\" button.", newPlayButtonText2.Text);
            Client.LeftClickAt(center);
        }
예제 #11
0
 private void DeckPickerTrayLoaded(string name, GameObject go, object callbackData)
 {
     this.m_deckPickerTray = go.GetComponent <DeckPickerTrayDisplay>();
     this.m_deckPickerTray.SetHeaderText(GameStrings.Get((SceneMgr.Get().GetMode() != SceneMgr.Mode.TAVERN_BRAWL) ? "GLUE_CREATE_DECK" : "GLOBAL_TAVERN_BRAWL"));
     this.m_deckPickerTray.transform.parent        = base.transform;
     this.m_deckPickerTray.transform.localScale    = this.m_deckPickerBone.transform.localScale;
     this.m_deckPickerTray.transform.localPosition = this.m_deckPickerBone.transform.localPosition;
     this.m_deckPickerTray.Init();
     this.ShowTray();
 }
예제 #12
0
 /// <summary>
 /// Get the SubsceneState in TournamentScene
 /// </summary>
 /// <returns>The RockPegasusSubsceneState.</returns>
 private RockPegasusSubsceneState GetPegasusTournamentSubsceneState()
 {
     if (DeckPickerTrayDisplay.Get() == null)
     {
         return(RockPegasusSubsceneState.None);
     }
     else
     {
         return(RockPegasusSubsceneState.Ready);
     }
 }
예제 #13
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);
        }
    public void UpdateMode()
    {
        bool @bool = Options.Get().GetBool(Option.IN_RANKED_PLAY_MODE);

        NetCache.NetCacheFeatures netObject = NetCache.Get().GetNetObject <NetCache.NetCacheFeatures>();
        if (((netObject != null) && (netObject.Games != null)) && !netObject.Games.Casual)
        {
            this.m_casualButton.SetEnabled(false);
            if (!@bool)
            {
                @bool = true;
                Options.Get().SetBool(Option.IN_RANKED_PLAY_MODE, true);
            }
        }
        else
        {
            this.m_casualButton.SetEnabled(true);
        }
        if (@bool)
        {
            DeckPickerTrayDisplay.Get().SetPlayButtonText(GameStrings.Get("GLOBAL_PLAY_RANKED"));
            if (UniversalInputManager.UsePhoneUI != null)
            {
                DeckPickerTrayDisplay.Get().ToggleRankedDetailsTray(true);
            }
            this.m_casualButton.AddEventListener(UIEventType.RELEASE, new UIEvent.Handler(this.OnCasualButtonRelease));
            this.m_rankedButton.RemoveEventListener(UIEventType.RELEASE, new UIEvent.Handler(this.OnRankedButtonRelease));
            this.m_casualButton.Up();
            this.m_rankedButton.Down();
        }
        else
        {
            DeckPickerTrayDisplay.Get().SetPlayButtonText(GameStrings.Get("GLOBAL_PLAY"));
            if (UniversalInputManager.UsePhoneUI != null)
            {
                DeckPickerTrayDisplay.Get().ToggleRankedDetailsTray(false);
            }
            this.m_casualButton.RemoveEventListener(UIEventType.RELEASE, new UIEvent.Handler(this.OnCasualButtonRelease));
            this.m_rankedButton.AddEventListener(UIEventType.RELEASE, new UIEvent.Handler(this.OnRankedButtonRelease));
            this.m_casualButton.Down();
            this.m_rankedButton.Up();
        }
        if (DeckPickerTrayDisplay.Get().m_playButton.IsEnabled())
        {
            DeckPickerTrayDisplay.Get().m_playButton.m_newPlayButtonText.TextAlpha = 1f;
        }
        else
        {
            DeckPickerTrayDisplay.Get().m_playButton.m_newPlayButtonText.TextAlpha = 0f;
        }
        DeckPickerTrayDisplay.Get().UpdateRankedClassWinsPlate();
    }
예제 #15
0
 private void Awake()
 {
     s_instance = this;
     this.m_practicePickerTray = ((GameObject)GameUtils.Instantiate((GameObject)this.m_practicePickerTrayPrefab, this.m_practicePickerTrayContainer, false)).GetComponent <PracticePickerTrayDisplay>();
     if (UniversalInputManager.UsePhoneUI != null)
     {
         SceneUtils.SetLayer(this.m_practicePickerTray, GameLayer.IgnoreFullScreenEffects);
     }
     AssetLoader.Get().LoadActor((UniversalInputManager.UsePhoneUI == null) ? "DeckPickerTray" : "DeckPickerTray_phone", delegate(string name, GameObject go, object data) {
         if (go == null)
         {
             Debug.LogError("Unable to load DeckPickerTray.");
         }
         else
         {
             this.m_deckPickerTray = go.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);
                 }
                 AdventureSubScene component = base.GetComponent <AdventureSubScene>();
                 if (component != null)
                 {
                     this.m_practicePickerTray.AddTrayLoadedListener(delegate {
                         this.OnTrayPartLoaded();
                         this.m_practicePickerTray.gameObject.SetActive(false);
                     });
                     this.m_deckPickerTray.AddDeckTrayLoadedListener(new DeckPickerTrayDisplay.DeckTrayLoaded(this.OnTrayPartLoaded));
                     if (this.m_practicePickerTray.IsLoaded() && this.m_deckPickerTray.IsLoaded())
                     {
                         component.SetIsLoaded(true);
                     }
                 }
                 this.InitializeTrays();
                 CheatMgr.Get().RegisterCheatHandler("replaymissions", new CheatMgr.ProcessCheatCallback(this.OnProcessCheat_replaymissions), null, null, null);
                 CheatMgr.Get().RegisterCheatHandler("replaymission", new CheatMgr.ProcessCheatCallback(this.OnProcessCheat_replaymissions), null, null, null);
                 NetCache.Get().RegisterScreenPractice(new NetCache.NetCacheCallback(this.OnNetCacheReady));
             }
         }
     }, null, false);
 }
예제 #16
0
        public void MainLoop()
        {
            var curMode = SceneMgr.Get().GetMode();

            switch (curMode)
            {
            case SceneMgr.Mode.HUB:
                SceneMgr.Get().SetNextMode(SceneMgr.Mode.PRACTICE);
                Thread.Sleep(1000 * 2);
                break;

            case SceneMgr.Mode.PRACTICE:
                //TODO: make deck and mission id configurable
                long myDeckId = DeckPickerTrayDisplay.Get().GetSelectedDeckID();
                var  mission  = MissionID.AI_NORMAL_MAGE;
                GameMgr.Get().StartGame(GameMode.PRACTICE, mission, myDeckId);
                Thread.Sleep(1000 * 5);
                break;

            case SceneMgr.Mode.GAMEPLAY:
                Init_Game();
                if (gs.IsMulliganPhase())
                {
                    DoMulligan();
                }
                else if (gs.IsLocalPlayerTurn())
                {
                    // should we wait until also gs.IsMainPhase() ?
                    Log.log("Start our turn");
                    BruteHand();        // drops minions until out of mana
                    Thread.Sleep(1000);
                    BruteAttack();      // attacks enemies with minions randomly
                    Thread.Sleep(1000);
                    DoEndTurn();
                }
                else if (gs.IsGameOver())
                {
                    Log.say("Game over");
                }
                else
                {
                    //Log.log("Unimplemented game state");
                }
                break;
            }
            Thread.Sleep(1000 * 2);
        }
예제 #17
0
파일: AIBot.cs 프로젝트: linuxaged/hsbot
        // 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);
            }
        }
    protected override void OnRelease()
    {
        if (!string.IsNullOrEmpty(this.m_introline))
        {
            if (string.IsNullOrEmpty(this.m_characterPrefabName))
            {
                NotificationManager.Get().CreateKTQuote(this.m_introline, this.m_introline, true);
            }
            else
            {
                NotificationManager.Get().CreateCharacterQuote(this.m_characterPrefabName, GameStrings.Get(this.m_introline), this.m_introline, true, 0f, CanvasAnchor.BOTTOM_LEFT);
            }
        }
        base.OnRelease();
        long selectedDeckID = DeckPickerTrayDisplay.Get().GetSelectedDeckID();

        GameMgr.Get().FindGame(GameType.GT_VS_AI, this.m_missionId, selectedDeckID, 0L);
        UnityEngine.Object.Destroy(base.gameObject);
    }
예제 #19
0
파일: AIBot.cs 프로젝트: linuxaged/hsbot
        // Found at: DeckPickerTrayDisplay search for RankedMatch
        private void tournament_mode(bool ranked)
        {
            if (just_joined)
            {
                return;
            }

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

            // If we're not set to the right mode, now is the time to do so
            // Note; This does not update the GUI, only the internal state
            bool is_ranked = Options.Get().GetBool(Option.IN_RANKED_PLAY_MODE);

            if (is_ranked != ranked)
            {
                Options.Get().SetBool(Option.IN_RANKED_PLAY_MODE, ranked);
                Delay(3000);
                return;
            }

            // Get the ID of the current Deck
            long selectedDeckID = DeckPickerTrayDisplay.Get().GetSelectedDeckID();
            // We want to play vs other players
            int mission = (int)MissionId.MULTIPLAYER_1v1;
            // Ranked or unranked?
            GameType mode = ranked ? GameType.GT_RANKED : GameType.GT_UNRANKED;

            // Find the game
            Log.log("Joining game in tournament mode, ranked = " + ranked);
            DeckPickerTrayDisplay.Get().ShowMatchingPopup();
            GameMgr.Get().FindGame(mode, mission, selectedDeckID);

            just_joined = true;
        }
예제 #20
0
        void Update()
        {
            Reflection.SetField(InactivePlayerKicker.Get(), "m_activityDetected", true);

            SceneMgr.Mode mode = SceneMgr.Get().GetMode();

            if (mode != lastmode)
            {
                if (lastmode != SceneMgr.Mode.GAMEPLAY && mode == SceneMgr.Mode.GAMEPLAY)
                {
                    bot.Reset();
                }
                lastmode = mode;
                ZConsole.Get().HandleLog(mode.ToString(), "SceneMode", LogType.Log);
                clickplaygame = false;
            }
            if (mode == SceneMgr.Mode.TOURNAMENT)
            {
                if (SceneMgr.Get().IsInGame() || DeckPickerTrayDisplay.Get() == null || DeckPickerTrayDisplay.Get().GetSelectedDeckID() == 0)
                {
                    return;
                }
                if (!clickplaygame)
                {
                    Reflection.InvokeMethod(DeckPickerTrayDisplay.Get(), "PlayGame");
                    clickplaygame = true;
                }
            }
            if (mode == SceneMgr.Mode.GAMEPLAY)
            {
                GameState state     = GameState.Get();
                string    gamestate = "invalid";
                if (state != null)
                {
                    if (state.IsBlockingServer())
                    {
                        return;
                    }
                    if (state.IsMulliganPhase())
                    {
                        gamestate = "mulligan";
                    }
                    //else if (state.IsLocalPlayerTurn())
                    //	gamestate = "turn";
                    else if (state.IsGameOver())
                    {
                        gamestate = "over";
                    }
                    else
                    {
                        gamestate = "invalid";
                    }
                }
                if (gamestate != lastgamestate)
                {
                    if (gamestate == "turn")
                    {
                        bot.TurnBegin();
                    }
                    lastgamestate = gamestate;
                }
                ZConsole.LogLog(gamestate);
                switch (gamestate)
                {
                case "mulligan":
                    if (GameState.Get().IsMulliganManagerActive() && MulliganManager.Get() != null &&
                        MulliganManager.Get().GetMulliganButton() != null &&
                        MulliganManager.Get().GetMulliganButton().IsEnabled() &&
                        (bool)Reflection.GetField(MulliganManager.Get(), "m_waitingForUserInput"))
                    {
                        bot.MulliganUpdate();
                    }
                    break;

                case "turn":
                    if (GameState.Get().IsMainPhase() &&
                        ((GameEntity)Reflection.GetField(GameState.Get(), "m_gameEntity")).GetTag <TAG_STEP>(GAME_TAG.STEP) == TAG_STEP.MAIN_ACTION)
                    {
                        bot.TurnUpdate();
                    }
                    break;

                case "over":
                    CleanUp();
                    break;

                case "invalid":
                    //CleanUp();
                    break;
                }
            }
        }
예제 #21
0
        private void ManageModes(SceneMgr.Mode Mode)
        {
            switch (Mode)
            {
            case SceneMgr.Mode.LOGIN:
                if (WelcomeQuests.Get() != null)
                {
                    // Releases Quests
                    Graphics.AddInfoMsg("Released Quests");
                    WelcomeQuests.Get().m_clickCatcher.TriggerRelease();
                }
                break;

            case SceneMgr.Mode.HUB:
                //Graphics.AddInfoMsg("Seting Adventure Mode");
                //SceneMgr.Get().SetNextMode(SceneMgr.Mode.ADVENTURE);
                break;

            case SceneMgr.Mode.TOURNAMENT:
                if (!starting)
                {
                    Game.Delay(2000);
                    Graphics.AddInfoMsg("Starting Game");
                    Game.FindGame(PegasusShared.GameType.GT_UNRANKED, (int)MissionId.MULTIPLAYER_1v1, DeckPickerTrayDisplay.Get().GetSelectedDeckID());
                    starting = true;
                }
                break;

            case SceneMgr.Mode.ADVENTURE:
                if (!starting)
                {
                    Game.Delay(2000);
                    Graphics.AddInfoMsg("Starting Game");
                    Game.FindGame(PegasusShared.GameType.GT_VS_AI, (int)MissionId.PRACTICE_EXPERT_PRIEST, DeckPickerTrayDisplay.Get().GetSelectedDeckID());
                    starting = true;
                }
                break;

            case SceneMgr.Mode.GAMEPLAY:
                if (!GameStarted)
                {
                    Graphics.AddInfoMsg("Starting GameHandler");
                    GameStarted = true;
                    NintendoBot.GameHandler.Init();
                }

                break;

            default:
                Graphics.AddErrorMsg("Cant Find Mode:" + Mode);
                break;
            }
        }
예제 #22
0
        private void OnRockTournamentMode(bool ranked)
        {
            if (SingletonOnGameRequest)
            {
                return;
            }
            SingletonOnGameRequest = true;

            if (SceneMgr.Get().IsInGame() || Network.Get().IsFindingGame())
            {
                HoldBack(1000);
                return;
            }
            if (DeckPickerTrayDisplay.Get() == null)
            {
                HoldBack(1000);
                SingletonOnGameRequest = false;
                return;
            }
            long deck = DeckPickerTrayDisplay.Get().GetSelectedDeckID();

            if (deck == 0)
            {
                HoldBack(1000);
                SingletonOnGameRequest = false;
                return;
            }

            /*
             * DeckPickerTrayDisplay.Get().GetSelectedDeckID();
             *
             * HoldBack(5000);
             * MissionID mission = HearthRockEngine.RandomAIMissionID(expert);
             *
             * Notify("PraticeMode: Deck " + deck + "Mission " + mission);
             * GameMgr.Get().StartGame(GameMode.PRACTICE, mission, deck);
             * GameMgr.Get().UpdatePresence();
             * */

            bool is_ranked = Options.Get().GetBool(Option.IN_RANKED_PLAY_MODE);

            if (is_ranked != ranked)
            {
                Options.Get().SetBool(Option.IN_RANKED_PLAY_MODE, ranked);
                SingletonOnGameRequest = false;
                return;
            }

            long selectedDeckID = DeckPickerTrayDisplay.Get().GetSelectedDeckID();


            //        Network.TrackWhat what;
            //          Network.


            PegasusShared.GameType type;
            if (ranked)
            {
                //              what = Network.TrackWhat.TRACK_PLAY_TOURNAMENT_WITH_CUSTOM_DECK;
                type = PegasusShared.GameType.GT_RANKED;
            }
            else
            {
                //                what = Network.TrackWhat.TRACK_PLAY_CASUAL_WITH_CUSTOM_DECK;
                //  type = PegasusShared.GameType.GT_UNRANKED;
                type = PegasusShared.GameType.GT_CASUAL;
            }
            //      Network.TrackClient(Network.TrackLevel.LEVEL_INFO, what);



            GameMgr.Get().FindGame(type, PegasusShared.FormatType.FT_STANDARD, 2, selectedDeckID, 0L);


            Enum[] args = new Enum[] { PresenceStatus.PLAY_QUEUE };
            PresenceMgr.Get().SetStatus(args);
        }
예제 #23
0
 /// <summary>
 /// Get selected DeckID
 /// </summary>
 /// <returns>The DeckId.</returns>
 public long GetSelectedDeckID()
 {
     // DeckPickerTrayDisplay is used on both Tournament and Practice
     return(DeckPickerTrayDisplay.Get().GetSelectedDeckID());
 }
예제 #24
0
 /// <summary>
 /// Start a tournament (PVP) game.
 /// </summary>
 public void PlayTournamentGame()
 {
     DeckPickerTrayDisplay.Get().m_playButton.TriggerRelease();
 }
예제 #25
0
 /* long Utils.GetSelectedDeckID()
  * returns the ID of the deck currently selected
  */
 public static long GetSelectedDeckID()
 {
     return(DeckPickerTrayDisplay.Get().GetSelectedDeckID());
 }