public override void AfterInvoke(InvocationInfo info, ref object returnValue)
        {
            if (info.targetMethod.Equals("OnGUI") && info.target.GetType().ToString() == "DeckBuilder2")
            {
                if (deckBuilder == null)
                {
                    deckBuilder = (DeckBuilder2)info.target;
                }

                GUI.skin = buttonSkin;
                GUIPositioner positioner4 = App.LobbyMenu.getSubMenuPositioner(1f, 6);

                var rect = positioner4.getButtonRect (4f);
                rect.x += 60;
                if (LobbyMenu.drawButton(rect, "Sync Collection"))
                {
                    FieldInfo initedInfo = deckBuilderType.GetField("inited", BindingFlags.NonPublic | BindingFlags.Instance);

                    inited = (bool)initedInfo.GetValue(deckBuilder);
                    if (inited)
                    {
                        FieldInfo deckListInfo = deckBuilderType.GetField("allCardsDict", BindingFlags.NonPublic | BindingFlags.Instance);
                        allCardsDict = (Dictionary<long, Card>)deckListInfo.GetValue(deckBuilder);
                    }

                    var writer = new JsonWriter();
                    string json = writer.Write(allCardsDict);

                    this.loadFromWeb(json);
                }
            }
        }
Beispiel #2
0
        public void OnGUI(DeckBuilder2 builder)
        {
            this.deckBuilder = builder;

            var skin = GUI.skin;
            GUI.skin = buttonSkin;

            GUIPositioner subMenuPositioner = App.LobbyMenu.getSubMenuPositioner(1f, 4);
            var rect = subMenuPositioner.getButtonRect(3f);

            rect.width *= 0.70f;
            rect.height *= 0.70f;
            rect.x += (rect.width * 3f);
            rect.y += rect.height * 0.40f;

            if( LobbyMenu.drawButton(rect, "Import Deck") ) {
                App.Popups.ShowTextInput(this, "", "Imports a deck from ScrollsPost or ScrollsGuide", "import", "Deck Import", "Enter an URL:", "Import");
            }

            rect.x += rect.width + 8f;
            if( LobbyMenu.drawButton(rect, "Export Deck") ) {
                ExportDeck();
            }

            GUI.skin = skin;
        }
Beispiel #3
0
        public string OnGUI_drawSearchPulldown(Rect searchbarRect)
        {
            float itemHeight = searchbarRect.height * 1.2f;

            GUIContent[] content = new GUIContent[]
            {
                new GUIContent("   Type"),
                new GUIContent("   Description"),
                new GUIContent("   Rarity"),
                new GUIContent("   Count"),
                new GUIContent("   Level"),
                new GUIContent("   Set"),
                new GUIContent("   Flavor"),
                new GUIContent("   Cost"),
                new GUIContent("   Attack"),
                new GUIContent("   Countdown"),
                new GUIContent("   Health")
            };
            string[] array = new string[]
            {
                "t:",
                "d:",
                "r:",
                "#:",
                "l:",
                "s:",
                "fl:",
                "c:",
                "ap:",
                "cd:",
                "hp:"
            };
            int num = DeckBuilder2.OnGUI_drawButtonList(this.pulldownSkin, searchbarRect, true, itemHeight, content, array, out this._searchDropdownBoundingRect);

            return((num < 0) ? null : array[num]);
        }
 public void setDeckbuilder(DeckBuilder2 d)
 { 
     this.db = d;
     mtMkr.setGui3d(d);
 }
        public override void AfterInvoke (InvocationInfo info, ref object returnValue)
        //public override bool BeforeInvoke(InvocationInfo info, out object returnValue)
        {
            if (info.target is DeckBuilder2 && info.targetMethod.Equals("Start") && !(info.target is Crafter))
            {
                imp.setDeckbuilder(info.target as DeckBuilder2);
                this.db = info.target as DeckBuilder2;
                this.buildmode = false;
                this.dcksrchui.showdecksearchUI = false;
                //make scrollbook clickable
                (this.scrollsBookinfo.GetValue(info.target) as ScrollBook).setRect((Rect)this.scrollsBookRect1info.GetValue(info.target));
                (this.scrollsBookinfo.GetValue(info.target) as ScrollBook).setBoundingRect((Rect)this.scrollsBookRect2info.GetValue(info.target));
            }
            /*
            if (info.target is DeckBuilder2 && info.targetMethod.Equals("handleMessage") && this.buildmode)
            {
                if(info.arguments[0] is LibraryViewMessage)
                this.dckcrtr.sendCheatLibraryView(this.imp);
            }*/

            if (info.target is ChatUI && info.targetMethod.Equals("Initiate"))
            {
                this.chatlogstye = (GUIStyle)this.chatLogStyleinfo.GetValue(info.target);
                this.dcksrchui.setChatlogStyle(this.chatlogstye);
                this.dcksrchui.setrecto(this.chatlogstye);
            }


            if (info.target is DeckBuilder2 && info.targetMethod.Equals("OnGUI") && !(info.target is Crafter))
            {
                
                GUI.depth = 21;
                if (this.oldscreenx != Screen.width || this.oldscreeny != Screen.height)
                {
                    this.dcksrchui.setrecto(this.chatlogstye);
                    this.dcksrchui.setrecto(this.chatlogstye);
                    this.oldscreenx = Screen.width;
                    this.oldscreeny = Screen.height;
                }
                if (this.buildmode)
                {
                    if (LobbyMenu.drawButton(this.dcksrchui.recto.guildbutton, "Normal Mode", this.lobbyskin))
                    {
                        
                        (this.scrollsBookinfo.GetValue(info.target) as ScrollBook).setRect((Rect)this.scrollsBookRect1info.GetValue(info.target));
                        (this.scrollsBookinfo.GetValue(info.target) as ScrollBook).setBoundingRect((Rect)this.scrollsBookRect2info.GetValue(info.target));
            
                        string link = this.createLink();
                        (info.target as DeckBuilder2).clearTable();
                        this.buildmode = false;
                        this.dcksrchui.showdecksearchUI = false;
                        this.dckcrtr.sendOrginalLibraryView(this.imp);
                        PopupOk("impdeckbuildmode", link);
                    }
                }
                else
                {

                    /*if (this.invalidDeck && LobbyMenu.drawButton(this.dcksrchui.recto.repairbutton, "Repair", this.lobbyskin))
                    {
                        this.invalidDeck = false;
                        string link = this.createLinkFromDCM(this.invalidDeckMessage);
                        imp.importFromURL(link);

                    }*/

                    if (LobbyMenu.drawButton(this.dcksrchui.recto.guildbutton, "Build Mode", this.lobbyskin))
                    {
                        //make scrollbook clickable
                        this.showMissing = false;
                        (this.scrollsBookinfo.GetValue(info.target) as ScrollBook).setRect((Rect)this.scrollsBookRect1info.GetValue(info.target));
                        (this.scrollsBookinfo.GetValue(info.target) as ScrollBook).setBoundingRect((Rect)this.scrollsBookRect2info.GetValue(info.target));
            
                        string link = this.createLink();
                        (info.target as DeckBuilder2).clearTable();
                        this.buildmode = true;
                        this.dcksrchui.showdecksearchUI = false;
                        this.dckcrtr.sendCheatLibraryView(this.imp);
                        PopupOk("impdeckbuildmode", link);
                        
                    }
                }

                if (LobbyMenu.drawButton(new Rect((float)Screen.height * 0.04f + (float)Screen.height * 0.11f, (float)Screen.height * 0.935f, (float)Screen.height * 0.1f, (float)Screen.height * 0.035f), "Import", this.lobbyskin) && !this.dcksrchui.showdecksearchUI)
                {
                    this.showImportMenu = !this.showImportMenu;
                    copydeck = (DeckSaveMessage)this.generateDeckSaveMessage.Invoke((info.target as DeckBuilder2), new object[] { "copycatt" });
                    (info.target as DeckBuilder2).clearTable();// have to delete the actual deck, or it will be buggy
                    //App.Popups.ShowTextInput(this, "", "", "impdeck", "Import deck", "Insert the link to your deck:", "Import");
                    App.Popups.ShowTextEntry(this, "impdeck", "Import deck","Insert the link to your deck:","Import", "Cancel" , "");
                }

                if (LobbyMenu.drawButton(new Rect((float)Screen.height * 0.04f + (float)Screen.height * 0.11f * 2f, (float)Screen.height * 0.935f, (float)Screen.height * 0.1f, (float)Screen.height * 0.035f), "Export", this.lobbyskin) && !this.dcksrchui.showdecksearchUI)
                {
                    string link = this.createLinkTheScrollsWay();// this.createLink();
                    systemCopyBufferProperty.SetValue(null, link, null);
                    App.Popups.ShowOk(this, "Export Deck", "A link to your Deck was created...", "...and copied to your clipboard.", "OK");
                }

                if (this.buildmode)
                {
                    GUI.skin = this.buttonSkin;
                    GUIPositioner p = App.LobbyMenu.getSubMenuPositioner(1f, 5, 140f);
                    float xIndex = -1f;
                    float blubb = 0;
                    if (AspectRatio.now.isWider(AspectRatio._4_3) && AspectRatio.now.isNarrower(AspectRatio._16_9))
                    {
                        blubb = -0.45f;
                    }
                    Func<Rect> func = () => p.getButtonRect((xIndex += 1f) + blubb - 1f);

                    if (LobbyMenu.drawButton(func(), "Save Deck") && !this.dcksrchui.showdecksearchUI)
                    {
                        string link = this.createLink();
                        if (link != "")
                        {
                            //App.Popups.ShowTextInput(this, "", "", "savedeck1", "Save deck", "Insert the name for your deck:", "Save");
                            App.Popups.ShowTextEntry(this, "savedeck1", "Save deck", "Insert the name for your deck:", "Save", "Cancel", "");
                        }
                        else
                        {
                            App.Popups.ShowOk(this, "Empty Deck", "Your deck is empty", "You cant save empty decks!", "OK");
                        }

                    }
                    if (LobbyMenu.drawButton(func(), "Share Deck") && !this.dcksrchui.showdecksearchUI)
                    {
                        string link = this.createLink();
                        if (link != "")
                        {
                            if (this.numberScrollsOnBoard>=50)
                            {
                                //App.Popups.ShowTextInput(this, "", "", "sharedeck1", "Share deck", "Insert the name for your deck:", "Next step");
                                App.Popups.ShowTextEntry(this, "sharedeck1", "Share deck", "Insert the name for your deck:", "Next step", "Cancel", "");
                            }
                            else {
                                App.Popups.ShowOk(this, "Invalid Deck", "Your deck is invalid", "You cant share invalid decks!", "OK");
                            }
                            
                        }
                        else {
                            App.Popups.ShowOk(this, "Empty Deck", "Your deck is empty", "You cant share empty decks!", "OK");
                        }
                        
                    }
                    if (LobbyMenu.drawButton(func(), "Import Deck")&& googleie.workthreadready )
                    { // get data from google
                        this.dcksrchui.infodeck.link = "";
                        this.dcksrchui.loadList = false;
                        new Thread(new ThreadStart(this.googleie.workthread)).Start();
                        this.dcksrchui.showdecksearchUI = true;
                        this.dcksrchui.setrecto(this.chatlogstye);

                        // load own decks
                        this.dcksrchui.setOwnList();
                        //make scrollbook UNclickable
                        
                        (this.scrollsBookinfo.GetValue(info.target) as ScrollBook).setBoundingRect(new Rect(0,0,0,0));
                        (this.scrollsBookinfo.GetValue(info.target) as ScrollBook).setRect(new Rect(0, 0, 0, 0));
                        
                    }

                    if (LobbyMenu.drawButton(func(), "Clear Table") && !this.dcksrchui.showdecksearchUI)
                    {
                        (info.target as DeckBuilder2).clearTable();
                    }
                    if (this.dckcrtr.ownMissing)
                    {
                        if (showMissing)
                        {
                            if (LobbyMenu.drawButton(func(), "Show All") && !this.dcksrchui.showdecksearchUI)
                            {
                                this.dckcrtr.sendCheatLibraryView(this.imp);
                                this.showMissing = false;
                            }

                        }
                        else
                        {
                            if (LobbyMenu.drawButton(func(), "Show Mis") && !this.dcksrchui.showdecksearchUI)
                            {
                                this.dckcrtr.sendMissingLibraryView(this.imp);
                                this.showMissing = true;
                            }
                        }
                    }

                    if (this.dcksrchui.showdecksearchUI)
                    {
                        if (this.dcksrchui.loadList == false && this.googleie.workthreadready)
                        {
                            this.dckcrtr.sendOrginalLibraryView(this.imp);
                            dcksrchui.setGoogleList();
                            this.dckcrtr.sendCheatLibraryView(this.imp);
                        }
                        bool oldval =dcksrchui.showdecksearchUI;
                        dcksrchui.drawUI();

                        if (dcksrchui.importme != "")
                        {
                            this.dcksrchui.showdecksearchUI = false;
                            string link = "http://www.UltimateDeckImporter.com/?l=" + dcksrchui.importme;
                            (info.target as DeckBuilder2).clearTable();
                            PopupOk("impdeckbuildmode", link);
                            dcksrchui.importme = "";
                        }

                        if (dcksrchui.showdecksearchUI != oldval)
                        {
                            //make scrollbook clickable again
                            (this.scrollsBookinfo.GetValue(info.target) as ScrollBook).setInputEnabled(true);
                            (this.scrollsBookinfo.GetValue(info.target) as ScrollBook).setRect((Rect)this.scrollsBookRect1info.GetValue(info.target));
                            (this.scrollsBookinfo.GetValue(info.target) as ScrollBook).setBoundingRect((Rect)this.scrollsBookRect2info.GetValue(info.target));
                        }

                        

                        if(dcksrchui.showDeleteMenu)
                        {
                            dcksrchui.showDeleteMenu = false;
                            if (dcksrchui.viewmode == 0)
                            {
                                //App.Popups.ShowTextInput(this, "", "", "deletedeck", "Delete deck", "If you want to delete your shared deck, please insert its name (" + this.dcksrchui.infodeck.deckname + "):", "Delete");
                                App.Popups.ShowTextEntry(this, "deletedeck", "Delete deck", "If you want to delete your shared deck, please insert its name (" + this.dcksrchui.infodeck.deckname + "):", "Delete", "Cancel", "");
                            }
                            else
                            {
                                App.Popups.ShowOkCancel(this,"deletedeckprivate", "Delete deck", "You really want to delete your private deck: " + this.dcksrchui.infodeck.deckname, "Ok","Cancel");
                            }

                        }
                    }

                }


            }

            return;//return false;
        }
 public void setGui3d(DeckBuilder2 d)
 {
     this.gui3d = (Gui.Gui3D)typeof(DeckBuilder2).GetField("gui3d", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(d);
 }