public override void AfterInvoke(InvocationInfo info, ref object returnValue)
 {
     if (info.target.GetType () == typeof(LobbyMenu) && info.targetMethod.Equals ("OnGUI")) {
         lobbyMenu.OnGUI ();
     } else if (info.target.GetType () == typeof(Popups) && info.targetMethod.Equals ("OnGUI")) {
         popups.OnGUI ();
     }/* else if (info.target.GetType () == typeof(Tile) && info.targetMethod.Equals ("FixedUpdate")) {
         // Custom, more clearly visable tile hover color.
         if (battleMode.InControlOfBoard() && selectedTile != null && selectedTile.Equals(info.target)) {
             Tile.SelectionType markerType = (Tile.SelectionType)typeof(Tile).GetField ("markerType", BindingFlags.Instance | BindingFlags.NonPublic).GetValue (selectedTile);
             if (markerType == Tile.SelectionType.Hover) {
                 GameObject referenceTile = (GameObject)typeof(Tile).GetField ("referenceTile", BindingFlags.Instance | BindingFlags.NonPublic).GetValue (selectedTile);
                 referenceTile.renderer.material.color = new Color(.3f, 1f, .3f, .6f);
             }
         }
     }*/
     else if (info.target.GetType () == typeof(SettingsMenu) && info.targetMethod.Equals ("OnGUI")) {
         if (settingsMenu == null) {
             settingsMenu = new SettingsMenuWrapper (configManager, configGUI);
         }
         if (lobbyMenu.GetCurrentSceneName () == "_Settings") {
             settingsMenu.OnGUI (true);
         }
     } else if (info.target.GetType () == typeof(BattleMode) && info.targetMethod.Equals ("OnGUI")) {
         if (battleMode.ShowingMenu () && battleModeMenu.GetMenuState() != GUIBattleModeMenuWrapper.EMenuState.HELP) {
             if (settingsMenu == null) {
                 settingsMenu = new SettingsMenuWrapper (configManager, configGUI);
             }
             if (!popups.IsShowingPopup ()) {
                 bool drawHighlight = (battleModeMenu.GetMenuState() == GUIBattleModeMenuWrapper.EMenuState.CONTROL_SCHEME);
                 settingsMenu.OnGUI (drawHighlight);
             }
         }
     }
     return;
 }
        public override void BeforeInvoke(InvocationInfo info)
        {
            if (info.target.GetType () == typeof(BattleMode) && info.targetMethod.Equals ("handleInput")) {
                if (info.target.GetType () == typeof(BattleMode) && battleMode == null) {
                    battleMode = new BattleModeWrapper ((BattleMode)info.target);
                    handManager = new HandManagerWrapper (battleMode.GetHandManager ());
                    battleModeMenu = new GUIBattleModeMenuWrapper (battleMode.GetMenu());
                }
                if (settingsMenu == null) {
                    settingsMenu = new SettingsMenuWrapper (configManager, configGUI);
                }
                if (battleMode.Validate ((BattleMode)info.target)) {
                    battleModeMenu.Initialize (battleMode.GetMenu ());
                }
                handManager.Validate (battleMode.GetHandManager ());

                if (popups.IsShowingPopup ()) {
                    HandlePopupsControls ();
                } else {
                    HandleBattleModeControls ();
                    if (battleMode.ShowingMenu()) {
                        HandleSettingsMenuControls ();
                        HandleBattleModeMenuControls ();
                    }
                }
                // Cache the currently selected tile (used to display a custom tinted hover indicator).
                //if (battleMode.InControlOfBoard ()) {
                //	selectedTile = battleMode.GetTile ();
                //}
            } else if (info.target.GetType () == typeof(EndGameScreen) && info.targetMethod.Equals ("OnGUI")) {
                if (endGameScreen == null) {
                    endGameScreen = new EndGameScreenWrapper ((EndGameScreen)info.target);
                }
                endGameScreen.Validate ((EndGameScreen)info.target);
                HandleEndGameScreenControls ();
            } else if (info.target.GetType () == typeof(LobbyMenu) && info.targetMethod.Equals ("Update")) {
                if (lobbyMenu == null) {
                    lobbyMenu = new LobbyMenuWrapper ();
                    if (configGUI == null) {
                        ShowConfigGUI ();
                    }
                }
                // Let popups leech of LobbyMenu's update function.
                if (popups.IsShowingPopup ()) {
                    HandlePopupsControls ();
                } else {
                    HandleLobbyMenuControls ();
                    if (lobbyMenu.GetCurrentSceneName () == "_Settings") {
                        HandleSettingsMenuControls ();
                    }
                }
            } else if (info.target.GetType () == typeof(LobbyMenu) && info.targetMethod.Equals ("fadeOutScene")) {
                if (lobbyMenu == null) {
                    lobbyMenu = new LobbyMenuWrapper ();
                }
                lobbyMenu.RegisterCurrentScene ();
            } else if (info.target.GetType () == typeof(Login) && info.targetMethod.Equals ("OnGUI")) {
                if (login == null) {
                    login = new LoginWrapper ((Login)info.target);
                }
                HandleLoginControls ();
            }
        }