Esempio n. 1
0
        /**
         * Ignore execution of the PauseGameToggle method if represents an unpause due to UI elements
         * overlapping the pause menu
         */
        private IEnumerator GameManagerOnPauseGameToggle(
            On.GameManager.orig_PauseGameToggle orig,
            global::GameManager self
            )
        {
            if (!_netClient.IsConnected)
            {
                yield return(orig(self));

                yield break;
            }

            var stackTrace = new StackTrace();

            var frames = stackTrace.GetFrames();

            if (frames == null)
            {
                yield return(orig(self));

                yield break;
            }

            var methodName = frames[1].GetMethod().Name;

            if (methodName.Equals("MoveNext"))
            {
                yield break;
            }

            yield return(orig(self));
        }
 private void OnWarpToDG(On.GameManager.orig_WarpToDreamGate orig, global::GameManager gm)
 {
     try
     {
         orig(gm);
     }
     catch (Exception e)
     {
         Log("Could not warp to DG: " + e);
     }
 }
Esempio n. 3
0
 private void SetupRefs()
 {
     if (this.actionSet != null)
     {
         this.gm   = GameManager.instance;
         this.ui   = this.gm.ui;
         this.uibs = (UIButtonSkins)this.ui.uiButtonSkins;
         this.ih   = this.gm.inputHandler;
         this.gs   = this.gm.gameSettings;
         base.HookUpAudioPlayer();
         this.SetupUnmappableKeys();
         this.uibs.AddMappableKey(this);
     }
     else
     {
         orig_SetupRefs();
     }
 }
Esempio n. 4
0
        /**
         * If the timescale changes due to the game going to the pause menu, we prevent it from doing so
         */
        private void GameManagerOnSetTimeScale_float(
            On.GameManager.orig_SetTimeScale_float orig,
            global::GameManager self,
            float scale
            )
        {
            // Get the stack trace and check whether a specific frame contains a method that is responsible
            // for pausing the game while going to menu
            var stackTrace = new StackTrace();

            var frames = stackTrace.GetFrames();

            if (frames == null)
            {
                orig(self, scale);
                return;
            }

            var name = frames[2].GetMethod().Name;

            if (!name.Contains("PauseGameToggle"))
            {
                orig(self, scale);
                return;
            }

            if (!_netClient.IsConnected)
            {
                orig(self, scale);
            }
            else
            {
                // Always put the time scale to 1.0, thus never allowing the game to change speed
                // This is to prevent desyncs in multiplayer
                orig(self, 1.0f);
            }
        }