Exemplo n.º 1
0
        public override void AfterInvoke(InvocationInfo info, ref object returnValue)
        {
            //if (info.target is EndGameScreen && info.targetMethod.Equals("GoToLobby")) { ntwrk.inbattle = false; } // user leaved a battle

            if (info.target is ChatUI && info.targetMethod.Equals("Show"))
            {
                helpf.chatisshown = (bool)info.arguments[0]; this.screenh = 0;
            }                                                                                                                                // so position will be calculatet new on next ongui

            if (info.target is ChatUI && info.targetMethod.Equals("Initiate"))
            {
                helpf.target = (ChatUI)info.target;
                helpf.setchatlogstyle((GUIStyle)this.chatLogStyleinfo.GetValue(info.target));
            }

            if (info.target is TradeSystem && info.targetMethod.Equals("StartTrade"))// user start a trade, show the buy-message
            {
                if (helpf.postmsgontrading == true)
                {
                    helpf.postmsgontrading        = false;
                    helpf.postmsggetnextroomenter = true;// the next RoomEnterMsg is the tradeRoom!
                }
            }

            if (info.target is Store && info.targetMethod.Equals("Start"))//user opened store
            {
                helpf.setlobbyskin((GUISkin)typeof(Store).GetField("lobbySkin", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(info.target));
                helpf.storeinfo       = (Store)info.target;
                helpf.showtradedialog = false;
                helpf.inauchouse      = false;
                helpf.generator       = false;
                helpf.settings        = false;
            }


            if (info.target is ChatRooms && info.targetMethod.Equals("SetRoomInfo")) //adding new users to userlist
            {
                RoomInfoMessage   roomInfo = (RoomInfoMessage)info.arguments[0];
                RoomInfoProfile[] profiles = roomInfo.updated;
                for (int i = 0; i < profiles.Length; i++)
                {
                    RoomInfoProfile p    = profiles[i];
                    ChatUser        user = ChatUser.FromRoomInfoProfile(p);
                    if (!helpf.globalusers.ContainsKey(user.name))
                    {
                        helpf.globalusers.Add(user.name, user);
                    }
                    ;
                }
            }

            if (info.target is Store && info.targetMethod.Equals("OnGUI")) // drawing our buttons and stuff in store
            {
                GUI.color        = Color.white;
                GUI.contentColor = Color.white;
                drawsubmenu.Invoke(info.target, null);
                Vector2 screenMousePos = GUIUtil.getScreenMousePos();

                if (!(Screen.height == screenh) || !(Screen.width == screenw) || helpf.chatLogStyle == null)  // if resolution was changed, recalc positions
                {
                    Console.WriteLine("change resolution");
                    screenh            = Screen.height;
                    screenw            = Screen.width;
                    helpf.chatLogStyle = (GUIStyle)chatLogStyleinfo.GetValue(helpf.target);
                    recto.setupPositions(helpf.chatisshown, sttngs.rowscale, helpf.chatLogStyle, helpf.cardListPopupSkin);    // need  it to calc fieldhight even if bothmenue=true
                    if ((helpf.bothmenue || (helpf.createAuctionMenu && !helpf.offerMenuSelectCardMenu)) && !helpf.generator)
                    {
                        recto.setupPositionsboth(helpf.chatisshown, sttngs.rowscale, helpf.chatLogStyle, helpf.cardListPopupSkin);
                    }
                    recto.setupsettingpositions(helpf.chatLogStyle, helpf.cardListPopupBigLabelSkin);
                }


                // delete picture on click!
                if ((Input.GetMouseButtonUp(0) || Input.GetMouseButtonUp(1)) && crdvwr.clicked >= 3)
                {
                    crdvwr.clearallpics();
                }

                //klick button AH
                //Console.WriteLine("draw buttons");
                if (LobbyMenu.drawButton(recto.ahbutton, "AH", helpf.lobbySkin) && !helpf.showtradedialog)
                {
                    if (this.deckchanged)
                    {
                        App.Communicator.sendRequest(new LibraryViewMessage()); this.deckchanged = false;
                    }
                    if (helpf.bothmenue || helpf.createAuctionMenu)
                    {
                        recto.setupPositionsboth(helpf.chatisshown, sttngs.rowscale, helpf.chatLogStyle, helpf.cardListPopupSkin);
                    }
                    else
                    {
                        recto.setupPositions(helpf.chatisshown, sttngs.rowscale, helpf.chatLogStyle, helpf.cardListPopupSkin);
                    }
                    ahui.ahbuttonpressed();
                }
                // klick button Gen
                if (LobbyMenu.drawButton(recto.genbutton, "Gen", helpf.lobbySkin) && !helpf.showtradedialog)
                {
                    if (this.deckchanged)
                    {
                        App.Communicator.sendRequest(new LibraryViewMessage()); this.deckchanged = false;
                    }
                    recto.setupPositions(helpf.chatisshown, sttngs.rowscale, helpf.chatLogStyle, helpf.cardListPopupSkin);
                    genui.genbuttonpressed();
                }
                //klick settings-button
                if (LobbyMenu.drawButton(recto.settingsbutton, "Settings", helpf.lobbySkin) && !helpf.showtradedialog)
                {
                    recto.setupsettingpositions(helpf.chatLogStyle, helpf.cardListPopupBigLabelSkin);
                    setui.setbuttonpressed();
                }


                // draw ah oder gen-menu

                if (helpf.inauchouse)
                {
                    ahui.drawAH();
                }
                if (helpf.generator)
                {
                    genui.drawgenerator();
                }
                if (helpf.settings)
                {
                    setui.drawsettings();
                }
                GUI.color        = Color.white;
                GUI.contentColor = Color.white;

                crdvwr.draw();    // drawing the card you have clicked
            }
            else if (info.target is Store && (info.targetMethod.Equals("showBuyMenu") || info.targetMethod.Equals("showSellMenu")))
            {
                //disable auc.house + generator
                Store.ENABLE_SHARD_PURCHASES = true;
                helpf.inauchouse             = false;
                helpf.generator               = false;
                helpf.settings                = false;
                helpf.showtradedialog         = false;
                helpf.makeOfferMenu           = false;
                helpf.offerMenuSelectCardMenu = false;
                helpf.showtradedialog         = false;
                if (info.targetMethod.Equals("showSellMenu"))
                {
                    this.deckchanged = false;
                }
            }

            if (info.target is ChatRooms && info.targetMethod.Equals("ChatMessage"))
            {
                //get trademessages from chatmessages
                RoomChatMessageMessage msg = (RoomChatMessageMessage)info.arguments[0];
                if (msg.from != "Scrolls")
                {
                    AuctionHouse.Instance.addAuctions(mssgprsr.GetAuctionsFromMessage(msg.text, msg.from, msg.roomName));
                }
            }

            return;
        }