Beispiel #1
0
 protected override void Awake()
 {
     base.Awake();
     AssetLoader.Get().LoadUIScreen("Credits", new AssetLoader.GameObjectCallback(this.OnUIScreenLoaded), null, false);
     if (InactivePlayerKicker.Get() != null)
     {
         InactivePlayerKicker.Get().SetShouldCheckForInactivity(false);
     }
 }
Beispiel #2
0
 public override void Unload()
 {
     this.m_unloading = true;
     CreditsDisplay.Get().Unload();
     if (InactivePlayerKicker.Get() != null)
     {
         InactivePlayerKicker.Get().SetShouldCheckForInactivity(true);
     }
     this.m_unloading = false;
 }
Beispiel #3
0
        /// <summary>
        /// called every frame
        /// </summary>
        public void Tick()
        {
            InactivePlayerKicker ipk = InactivePlayerKicker.Get();

            if (ipk == null)
            {
                Log("InactivePlayerKicker NA");
                return;
            }
            FieldInfo fieldinfo = ipk.GetType().GetField("m_activityDetected", BindingFlags.NonPublic | BindingFlags.Instance);

            fieldinfo.SetValue(ipk, true);
        }
Beispiel #4
0
        /// <summary>
        /// Trigger some activity to make user looks active.
        /// </summary>
        public void TriggerUserActive()
        {
            InactivePlayerKicker ipk = InactivePlayerKicker.Get();

            if (ipk == null)
            {
                // InactivePlayerKicker seesm to be used to make sure use is alive, but still need to confirm this.
                this.tracer.Verbose("InactivePlayerKicker is not available.");
                return;
            }

            ipk.SetActivityDetected(true);
        }
 private void OnDestroy()
 {
     ApplicationMgr.Get().WillReset -= new System.Action(s_instance.WillReset);
     if (SceneMgr.Get() != null)
     {
         SceneMgr.Get().UnregisterScenePreUnloadEvent(new SceneMgr.ScenePreUnloadCallback(this.OnScenePreUnload));
     }
     if (ApplicationMgr.IsInternal())
     {
         Options.Get().UnregisterChangedListener(Option.IDLE_KICK_TIME, new Options.ChangedCallback(this.OnOptionChanged));
         Options.Get().UnregisterChangedListener(Option.IDLE_KICKER, new Options.ChangedCallback(this.OnOptionChanged));
     }
     s_instance = null;
 }
Beispiel #6
0
 private void AssetsVersionCheckCompleted()
 {
     if (!string.IsNullOrEmpty(UpdateManager.Get().GetError()) && UpdateManager.Get().UpdateIsRequired())
     {
         Error.AddFatalLoc("GLUE_PATCHING_ERROR", new object[0]);
     }
     else
     {
         if (Network.ShouldBeConnectedToAurora())
         {
             BnetPresenceMgr.Get().Initialize();
             BnetFriendMgr.Get().Initialize();
             BnetChallengeMgr.Get().Initialize();
             BnetWhisperMgr.Get().Initialize();
             BnetNearbyPlayerMgr.Get().Initialize();
             FriendChallengeMgr.Get().OnLoggedIn();
             SpectatorManager.Get().Initialize();
             if (!Options.Get().GetBool(Option.CONNECT_TO_AURORA))
             {
                 Options.Get().SetBool(Option.CONNECT_TO_AURORA, true);
             }
             TutorialProgress progress = Options.Get().GetEnum <TutorialProgress>(Option.LOCAL_TUTORIAL_PROGRESS);
             if (progress > TutorialProgress.NOTHING_COMPLETE)
             {
                 this.m_waitingForSetProgress = true;
                 ConnectAPI.SetProgress((long)progress);
             }
             if (WebAuth.GetIsNewCreatedAccount())
             {
                 AdTrackingManager.Get().TrackAccountCreated();
                 WebAuth.SetIsNewCreatedAccount(false);
             }
         }
         ConnectAPI.RequestAccountLicenses();
         ConnectAPI.RequestGameLicenses();
         Box.Get().OnLoggedIn();
         BaseUI.Get().OnLoggedIn();
         InactivePlayerKicker.Get().OnLoggedIn();
         HealthyGamingMgr.Get().OnLoggedIn();
         DefLoader.Get().Initialize();
         CollectionManager.Init();
         AdventureProgressMgr.Init();
         Tournament.Init();
         GameMgr.Get().OnLoggedIn();
         if (Network.ShouldBeConnectedToAurora())
         {
             StoreManager.Get().Init();
         }
         Network.TrackClient(Network.TrackLevel.LEVEL_INFO, Network.TrackWhat.TRACK_LOGIN_FINISHED);
         Network.ResetConnectionFailureCount();
         if (Network.ShouldBeConnectedToAurora())
         {
             ConnectAPI.DoLoginUpdate();
         }
         else
         {
             this.m_waitingForUpdateLoginComplete = false;
         }
         Enum[] args = new Enum[] { PresenceStatus.LOGIN };
         PresenceMgr.Get().SetStatus(args);
         if (SplashScreen.Get() != null)
         {
             SplashScreen.Get().StopPatching();
             SplashScreen.Get().ShowRatings();
         }
         this.PreloadActors();
         if (!Network.ShouldBeConnectedToAurora())
         {
             base.StartCoroutine(this.RegisterScreenWhenReady());
         }
         SceneMgr.Get().LoadShaderPreCompiler();
     }
 }
 private void Awake()
 {
     s_instance = this;
     ApplicationMgr.Get().WillReset += new System.Action(s_instance.WillReset);
 }
        /// <summary>
        /// Set the value of ActivityDetected of InactivePlayerKicker.
        /// </summary>
        /// <param name="inactivePlayerKicker">The InactivePlayerKicker</param>
        /// <param name="value">The Value of ActivityDetected</param>
        public static void SetActivityDetected(this InactivePlayerKicker inactivePlayerKicker, bool value)
        {
            FieldInfo fieldInfo = inactivePlayerKicker.GetType().GetField("m_activityDetected", BindingFlags.NonPublic | BindingFlags.Instance);

            fieldInfo.SetValue(inactivePlayerKicker, value);
        }
Beispiel #9
0
 public static void set_m_activityDetected(bool val)
 {
     set_private_field(InactivePlayerKicker.Get(), "m_activityDetected", val);
 }
Beispiel #10
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;
                }
            }
        }