コード例 #1
0
        private void searchBox_KeyPressed(object sender, char key)
        {
            if (category != npcList)
            {
                category = npcList;
            }
            UITextbox textbox = (UITextbox)sender;

            if (textbox.Text.Length > 0)
            {
                List <NPCStats> matches = new List <NPCStats>();
                foreach (var npc in category)
                {
                    if (npc.Name.ToLower().IndexOf(textbox.Text.ToLower(), System.StringComparison.Ordinal) != -1)
                    {
                        matches.Add(npc);
                    }
                }
                if (matches.Count > 0)
                {
                    searchResults = matches;
                    BuildList();
                }
                else
                {
                    textbox.Text = textbox.Text.Substring(0, textbox.Text.Length - 1);
                }
            }
            else
            {
                searchResults = category;
                BuildList();
            }
        }
コード例 #2
0
        public ItemBrowser(CheatSheet mod)
        {
            categories.Clear();
            this.itemView          = new ItemView();
            this.mod               = mod;
            this.CanMove           = true;
            base.Width             = this.itemView.Width + this.spacing * 2f;
            base.Height            = 420f;
            this.itemView.Position = new Vector2(this.spacing, base.Height - this.spacing - this.itemView.Height);
            this.AddChild(this.itemView);
            this.ParseList2();
            Texture2D texture = mod.GetTexture("UI/closeButton");
            UIImage   uIImage = new UIImage(texture /*UIView.GetEmbeddedTexture("Images.closeButton.png")*/);

            uIImage.Anchor       = AnchorPosition.TopRight;
            uIImage.Position     = new Vector2(base.Width - this.spacing, this.spacing);
            uIImage.onLeftClick += new EventHandler(this.bClose_onLeftClick);
            this.AddChild(uIImage);
            this.textbox          = new UITextbox();
            this.textbox.Width    = 100;
            this.textbox.Anchor   = AnchorPosition.TopRight;
            this.textbox.Position = new Vector2(base.Width - this.spacing * 2f - uIImage.Width, this.spacing + 40);
            //	this.textbox.Position = new Vector2(base.Width - this.spacing * 2f - uIImage.Width, this.spacing * 2f + uIImage.Height);
            this.textbox.KeyPressed += new UITextbox.KeyPressedHandler(this.textbox_KeyPressed);
            this.AddChild(this.textbox);
            for (int j = 0; j < ItemBrowser.categoryIcons.Length; j++)
            {
                UIImage uIImage2 = new UIImage(ItemBrowser.categoryIcons[j]);
                Vector2 position = new Vector2(this.spacing, this.spacing);
                uIImage2.Scale = 32f / Math.Max(categoryIcons[j].Width, categoryIcons[j].Height);

                position.X += (float)(j % 12 * 40);
                position.Y += (float)(j / 12 * 40);

                if (categoryIcons[j].Height > categoryIcons[j].Width)
                {
                    position.X += (32 - categoryIcons[j].Width) / 2;
                }
                else if (categoryIcons[j].Height < categoryIcons[j].Width)
                {
                    position.Y += (32 - categoryIcons[j].Height) / 2;
                }

                uIImage2.Position        = position;
                uIImage2.Tag             = j;
                uIImage2.onLeftClick    += new EventHandler(this.button_onLeftClick);
                uIImage2.ForegroundColor = ItemBrowser.buttonColor;
                if (j == 0)
                {
                    uIImage2.ForegroundColor = ItemBrowser.buttonSelectedColor;
                }
                uIImage2.Tooltip           = ItemBrowser.categNames[j];
                ItemBrowser.bCategories[j] = uIImage2;
                this.AddChild(uIImage2);
            }
            itemView.selectedCategory = ItemBrowser.categories[0].ToArray();
            itemView.activeSlots      = itemView.selectedCategory;
            itemView.ReorderSlots();
        }
コード例 #3
0
ファイル: Login.cs プロジェクト: xPanini/HEROsMod
        public LoginWindow()
        {
            UIView.exclusiveControl = this;

            Width       = 600;
            this.Anchor = AnchorPosition.Center;

            lUsername              = new UILabel(HEROsMod.HeroText("Username"));
            tbUsername             = new UITextbox();
            lPassword              = new UILabel(HEROsMod.HeroText("Password"));
            tbPassword             = new UITextbox();
            tbPassword.PasswordBox = true;
            UIButton bLogin    = new UIButton(HEROsMod.HeroText("Login"));
            UIButton bCancel   = new UIButton(HEROsMod.HeroText("Cancel"));
            UIButton bRegister = new UIButton(HEROsMod.HeroText("Register"));

            bRegister.AutoSize = false;
            bRegister.Width    = 100;

            lUsername.Scale = .5f;
            lPassword.Scale = .5f;

            bLogin.Anchor  = AnchorPosition.TopRight;
            bCancel.Anchor = AnchorPosition.TopRight;

            lUsername.X  = spacing;
            lUsername.Y  = spacing;
            tbUsername.X = lUsername.X + lUsername.Width + spacing;
            tbUsername.Y = lUsername.Y;
            lPassword.X  = lUsername.X;
            lPassword.Y  = lUsername.Y + lUsername.Height + spacing;
            tbPassword.X = tbUsername.X;
            tbPassword.Y = lPassword.Y;

            bCancel.Position = new Vector2(this.Width - spacing, tbPassword.Y + tbPassword.Height + spacing);
            bLogin.Position  = new Vector2(bCancel.Position.X - bCancel.Width - spacing, bCancel.Position.Y);
            bRegister.X      = spacing;
            bRegister.Y      = bCancel.Y;
            this.Height      = bCancel.Y + bCancel.Height + spacing;

            bCancel.onLeftClick     += bCancel_onLeftClick;
            bLogin.onLeftClick      += bLogin_onLeftClick;
            bRegister.onLeftClick   += bRegister_onLeftClick;
            tbUsername.OnEnterPress += bLogin_onLeftClick;
            tbPassword.OnEnterPress += bLogin_onLeftClick;
            tbUsername.OnTabPress   += tbUsername_OnTabPress;
            tbPassword.OnTabPress   += tbPassword_OnTabPress;

            AddChild(lUsername);
            AddChild(tbUsername);
            AddChild(lPassword);
            AddChild(tbPassword);
            AddChild(bLogin);
            AddChild(bCancel);
            AddChild(bRegister);

            tbUsername.Focus();
        }
コード例 #4
0
    // ***********************************************
    // SetFocus
    // -----------------------------------------------
    public void SetFocus(bool inShowTouchKeyboard = false)
    {
#if UNITY_IOS || UNITY_ANDROID
        
        if (FocusedTextbox)
        {
            FocusedTextbox.mFocused = false;
            if (FocusedTextbox.mKeyboard != null)
                FocusedTextbox.mKeyboard = null;
			FocusedTextbox = null;
        }
		
        mFocused = true;
        if (inShowTouchKeyboard)
            mKeyboard = TouchScreenKeyboard.Open("", TouchScreenKeyboardType.Default, false, false, Secure);
		
#else

        if (!mCarotInitSaved)
        {
            mCarotInitPos = Carot.transform.localPosition;
            mCarotInitSaved = true;
        }

        // select all
        mCarotIndex = 0;
        Carot.transform.localPosition = mCarotInitPos;
        
        if (Carot)
            Carot.SetActive(true);

        mFocused = true;
        SelectAll();
     
#endif
		
		// assign in GUI -VM
        Gui.FocusControl = this.transform;
        FocusedTextbox = this;
    }
コード例 #5
0
        public NameWaypointWindow(Vector2 waypointPos)
        {
            this.waypointPos        = waypointPos;
            UIView.exclusiveControl = this;

            Width       = 600;
            Height      = 100;
            this.Anchor = AnchorPosition.Center;

            label   = new UILabel("Waypoint Name");
            textbox = new UITextbox();
            UIButton bSave   = new UIButton("Ok");
            UIButton bCancel = new UIButton("Cancel");

            label.Scale = .5f;

            label.Anchor   = AnchorPosition.Left;
            textbox.Anchor = AnchorPosition.Left;
            bSave.Anchor   = AnchorPosition.BottomRight;
            bCancel.Anchor = AnchorPosition.BottomRight;

            float tby = textbox.Height / 2 + spacing;

            label.Position   = new Vector2(spacing, tby);
            textbox.Position = new Vector2(label.Position.X + label.Width + spacing, tby);
            bCancel.Position = new Vector2(this.Width - spacing, this.Height - spacing);
            bSave.Position   = new Vector2(bCancel.Position.X - bCancel.Width - spacing, bCancel.Position.Y);

            bCancel.onLeftClick  += bCancel_onLeftClick;
            bSave.onLeftClick    += bSave_onLeftClick;
            textbox.OnEnterPress += bSave_onLeftClick;

            AddChild(label);
            AddChild(textbox);
            AddChild(bSave);
            AddChild(bCancel);

            textbox.Focus();
        }
コード例 #6
0
ファイル: GroupInspector.cs プロジェクト: xPanini/HEROsMod
        public NewGroupWindow()
        {
            UIView.exclusiveControl = this;

            Width       = 600;
            Height      = 100;
            this.Anchor = AnchorPosition.Center;

            label   = new UILabel(HEROsMod.HeroText("GroupName") + ":");
            textbox = new UITextbox();
            UIButton bSave   = new UIButton(HEROsMod.HeroText("Create"));
            UIButton bCancel = new UIButton(HEROsMod.HeroText("Cancel"));

            label.Scale = .5f;

            label.Anchor   = AnchorPosition.Left;
            textbox.Anchor = AnchorPosition.Left;
            bSave.Anchor   = AnchorPosition.BottomRight;
            bCancel.Anchor = AnchorPosition.BottomRight;

            float tby = textbox.Height / 2 + spacing;

            label.Position   = new Vector2(spacing, tby);
            textbox.Position = new Vector2(label.Position.X + label.Width + spacing, tby);
            bCancel.Position = new Vector2(this.Width - spacing, this.Height - spacing);
            bSave.Position   = new Vector2(bCancel.Position.X - bCancel.Width - spacing, bCancel.Position.Y);

            bCancel.onLeftClick  += bCancel_onLeftClick;
            bSave.onLeftClick    += bSave_onLeftClick;
            textbox.OnEnterPress += bSave_onLeftClick;

            AddChild(label);
            AddChild(textbox);
            AddChild(bSave);
            AddChild(bCancel);

            textbox.Focus();
        }
コード例 #7
0
        public SliderWithTextbox(float startValue, float minValue, float maxValue)
        {
            textbox              = new UITextbox();
            textbox.Width        = 125;
            textbox.KeyPressed  += textbox_KeyPressed;
            textbox.OnLostFocus += textbox_OnLostFocus;
            textbox.Numeric      = true;
            textbox.HasDecimal   = true;
            slider = new UISlider();
            slider.valueChanged += slider_valueChanged;

            slider.X = textbox.X + textbox.Width + Spacing;
            AddChild(textbox);
            AddChild(slider);

            slider.MinValue = minValue;
            slider.MaxValue = maxValue;
            slider.Value    = startValue;

            textbox.Text = slider.Value.ToString();

            this.Height = textbox.Height;
            this.Width  = slider.X + slider.Width;
        }
コード例 #8
0
ファイル: PaintToolsUI.cs プロジェクト: brianide/CheatSheet
        public PaintToolsUI(CheatSheet mod)
        {
            categories.Clear();
            this.view          = new PaintToolsView();
            this.mod           = mod;
            this.CanMove       = true;
            base.Width         = this.view.Width + this.spacing * 2f;
            base.Height        = 35f + this.view.Height + this.spacing * 2f;
            this.view.Position = new Vector2(this.spacing, 55f);
            this.AddChild(this.view);

            Texture2D texture = mod.GetTexture("UI/closeButton");
            UIImage   uIImage = new UIImage(texture);

            uIImage.Anchor       = AnchorPosition.TopRight;
            uIImage.Position     = new Vector2(base.Width - this.spacing, this.spacing);
            uIImage.onLeftClick += new EventHandler(this.bClose_onLeftClick);
            this.AddChild(uIImage);

            var snaptexture = mod.GetTexture("UI/Snap");

            btnSnap = new UIImageListButton(
                (new ImageList(mod.GetTexture("UI/Snap"), 28, 28)).listTexture,
                new List <object>()
            {
                SnapType.TopLeft, SnapType.TopCenter, SnapType.TopRight,
                SnapType.LeftCenter, SnapType.Center, SnapType.RightCenter,
                SnapType.BottomLeft, SnapType.BottomCenter, SnapType.BottomRight,
            },
                new List <string>()
            {
                CSText("SnapTopLeft"), CSText("SnapTopCenter"), CSText("SnapTopRight"),
                CSText("SnapLeftCenter"), CSText("SnapCenter"), CSText("SnapRightCenter"),
                CSText("SnapBottomLeft"), CSText("SnapBottomCenter"), CSText("SnapBottomRight"),
            },
                4);
            btnSnap.onLeftClick  += (a, b) => btnSnap.NextIamge();
            btnSnap.onRightClick += (a, b) => btnSnap.PrevIamge();
            btnSnap.Position      = new Vector2(this.spacing, this.spacing);
            this.AddChild(btnSnap);

            var position = btnSnap.Position;

            uIImage              = new UIImage(Main.itemTexture[ItemID.TrashCan]);
            position             = position.Offset(btnSnap.Width + this.spacing, 0);
            uIImage.Position     = position;
            uIImage.onLeftClick += (a, b) => view.RemoveSelectedItem();
            uIImage.Tooltip      = CSText("DeleteSelection");
            this.AddChild(uIImage);

            uIImage              = new UIImage(Main.itemTexture[ItemID.AlphabetStatueI]);
            position             = position.Offset(uIImage.Width + this.spacing, 0);
            uIImage.Position     = position;
            uIImage.onLeftClick += (a, b) => PaintToolsEx.Import(this.view);
            uIImage.Tooltip      = CSText("ImportData");
            this.AddChild(uIImage);

            uIImage              = new UIImage(Main.itemTexture[ItemID.AlphabetStatueE]);
            position             = position.Offset(uIImage.Width + this.spacing, 0);
            uIImage.Position     = position;
            uIImage.onLeftClick += (a, b) => PaintToolsEx.Export(this.view);
            uIImage.Tooltip      = CSText("ExportData");
            this.AddChild(uIImage);

            uIImage              = new UIImage(Main.itemTexture[ItemID.AlphabetStatueW]);
            position             = position.Offset(uIImage.Width + this.spacing, 0);
            uIImage.Position     = position;
            uIImage.onLeftClick += (a, b) => PaintToolsEx.OnlineImport(this.view);
            uIImage.Tooltip      = "Load Online Schematics Database";
            this.AddChild(uIImage);

            infoPanel                 = new UIView();
            position                  = position.Offset(uIImage.Width + this.spacing, 0);
            infoPanel.Position        = position;
            infoPanel.Y               = 6;
            infoPanel.Width           = 210;
            infoPanel.Height          = 44;
            infoPanel.ForegroundColor = Color.Thistle;
            AddChild(infoPanel);

            infoMessage          = new UILabel("Message Here");
            infoMessage.Scale    = 0.35f;
            infoMessage.Position = new Vector2(30, 10);
            infoPanel.AddChild(infoMessage);

            upVoteButton              = new UIImage(CheatSheet.instance.GetTexture("UI/VoteUp"));
            upVoteButton.Position     = new Vector2(0, 0);
            upVoteButton.onLeftClick += (a, b) => Vote(true);
            upVoteButton.Tooltip      = "Vote Up";
            infoPanel.AddChild(upVoteButton);

            downVoteButton              = new UIImage(CheatSheet.instance.GetTexture("UI/VoteDown"));
            downVoteButton.Position     = new Vector2(0, 24);
            downVoteButton.onLeftClick += (a, b) => Vote(false);
            downVoteButton.Tooltip      = "Vote Down";
            infoPanel.AddChild(downVoteButton);

            infoPanel.Visible = false;

            submitPanel          = new UIView();
            submitPanel.Position = position;
            submitPanel.Y        = 6;
            submitPanel.Width    = 210;
            submitPanel.Height   = 44;
            AddChild(submitPanel);

            submitLabel          = new UILabel("Submit Name:");
            submitLabel.Scale    = 0.35f;
            submitLabel.Position = new Vector2(0, 0);
            submitPanel.AddChild(submitLabel);

            submitInput          = new UITextbox();
            submitInput.Position = new Vector2(0, 20);
            submitInput.Width    = 200;
            submitPanel.AddChild(submitInput);

            submitButton              = new UIImage(Terraria.Graphics.TextureManager.Load("Images/UI/ButtonCloudActive"));
            submitButton.Position     = new Vector2(178, -2);
            submitButton.onLeftClick += (a, b) => Submit();
            submitButton.Tooltip      = "Submit to Schematics Browser";
            submitPanel.AddChild(submitButton);

            submitPanel.Visible = false;
        }
コード例 #9
0
        // 270 : 16 40 ?? 16

        public RecipeBrowserWindow(Mod mod)
        {
            categories.Clear();
            recipeView          = new RecipeView();
            this.mod            = mod;
            this.CanMove        = true;
            base.Width          = recipeView.Width + this.spacing * 2f;
            base.Height         = 420f;
            recipeView.Position = new Vector2(this.spacing, this.spacing + 40);
            this.AddChild(recipeView);
            this.InitializeRecipeCategories();
            Texture2D texture = mod.GetTexture("UI/closeButton");
            UIImage   uIImage = new UIImage(texture);

            uIImage.Anchor       = AnchorPosition.TopRight;
            uIImage.Position     = new Vector2(base.Width - this.spacing, this.spacing);
            uIImage.onLeftClick += new EventHandler(this.bClose_onLeftClick);
            this.AddChild(uIImage);
            this.textbox             = new UITextbox();
            this.textbox.Anchor      = AnchorPosition.TopRight;
            this.textbox.Position    = new Vector2(base.Width - this.spacing * 2f - uIImage.Width, this.spacing /** 2f + uIImage.Height*/);
            this.textbox.KeyPressed += new UITextbox.KeyPressedHandler(this.textbox_KeyPressed);
            this.AddChild(this.textbox);

            //lookupItemSlot = new Slot(0);
            lookupItemSlot          = new RecipeQuerySlot();
            lookupItemSlot.Position = new Vector2(spacing, halfspacing);
            lookupItemSlot.Scale    = .85f;
            //lookupItemSlot.functionalSlot = true;
            this.AddChild(lookupItemSlot);

            for (int j = 0; j < RecipeBrowserWindow.categoryIcons.Length; j++)
            {
                UIImage uIImage2 = new UIImage(RecipeBrowserWindow.categoryIcons[j]);
                Vector2 position = new Vector2(this.spacing + 48, this.spacing);
                uIImage2.Scale = 32f / Math.Max(categoryIcons[j].Width, categoryIcons[j].Height);

                position.X += (float)(j % 6 * 40);
                position.Y += (float)(j / 6 * 40);

                if (categoryIcons[j].Height > categoryIcons[j].Width)
                {
                    position.X += (32 - categoryIcons[j].Width) / 2;
                }
                else if (categoryIcons[j].Height < categoryIcons[j].Width)
                {
                    position.Y += (32 - categoryIcons[j].Height) / 2;
                }

                uIImage2.Position        = position;
                uIImage2.Tag             = j;
                uIImage2.onLeftClick    += new EventHandler(this.button_onLeftClick);
                uIImage2.ForegroundColor = RecipeBrowserWindow.buttonColor;
                if (j == 0)
                {
                    uIImage2.ForegroundColor = RecipeBrowserWindow.buttonSelectedColor;
                }
                uIImage2.Tooltip = RecipeBrowserWindow.categNames[j];
                RecipeBrowserWindow.bCategories[j] = uIImage2;
                this.AddChild(uIImage2);
            }

            for (int j = 0; j < Recipe.maxRequirements; j++)
            {
                GenericItemSlot genericItemSlot = new GenericItemSlot();
                Vector2         position        = new Vector2(this.spacing, this.spacing);

                //position.X += j * 60 + 120;
                //position.Y += 250;

                position.X += 166 + (j % cols * 51);
                position.Y += 244 + (j / cols * 51);

                genericItemSlot.Position           = position;
                genericItemSlot.Tag                = j;
                RecipeBrowserWindow.ingredients[j] = genericItemSlot;
                this.AddChild(genericItemSlot, false);
            }

            recipeView.selectedCategory = RecipeBrowserWindow.categories[0].ToArray();
            recipeView.activeSlots      = recipeView.selectedCategory;
            recipeView.ReorderSlots();
        }
コード例 #10
0
ファイル: ItemBrowser.cs プロジェクト: Itorius/CheatSheet
        public ItemBrowser(CheatSheet mod)
        {
            Main.instance.LoadItem(ItemID.AlphabetStatueA);
            Main.instance.LoadItem(ItemID.SilverBroadsword);
            Main.instance.LoadItem(ItemID.SilverPickaxe);
            Main.instance.LoadItem(ItemID.SilverChainmail);
            Main.instance.LoadItem(ItemID.HermesBoots);
            Main.instance.LoadItem(ItemID.DirtBlock);
            Main.instance.LoadItem(ItemID.FlamingArrow);
            Main.instance.LoadItem(ItemID.GreaterHealingPotion);
            Main.instance.LoadItem(ItemID.WormScarf);
            Main.instance.LoadItem(ItemID.Dresser);
            Main.instance.LoadItem(ItemID.ZephyrFish);
            Main.instance.LoadItem(ItemID.SlimySaddle);
            Main.instance.LoadItem(ItemID.AlphabetStatueM);

            Texture2D[] categoryIcons =
            {
                TextureAssets.Item[ItemID.AlphabetStatueA].Value,
                TextureAssets.Item[ItemID.SilverBroadsword].Value,
                TextureAssets.Item[ItemID.SilverPickaxe].Value,
                TextureAssets.Item[ItemID.SilverChainmail].Value,
                TextureAssets.Item[ItemID.HermesBoots].Value,
                TextureAssets.Item[ItemID.DirtBlock].Value,
                TextureAssets.Item[ItemID.FlamingArrow].Value,
                TextureAssets.Item[ItemID.GreaterHealingPotion].Value,
                TextureAssets.Item[ItemID.WormScarf].Value,
                TextureAssets.Item[ItemID.Dresser].Value,
                TextureAssets.Item[ItemID.ZephyrFish].Value,
                TextureAssets.Item[ItemID.SlimySaddle].Value,
                //    TextureAssets.Item[ItemID.FallenStar].Value,
                TextureAssets.Item[ItemID.AlphabetStatueM].Value,
            };

            categories.Clear();
            bCategories       = new UIImage[categoryIcons.Length];
            itemView          = new ItemView();
            this.mod          = mod;
            CanMove           = true;
            Width             = itemView.Width + spacing * 2f;
            Height            = 420f;
            itemView.Position = new Vector2(spacing, Height - spacing - itemView.Height);
            AddChild(itemView);
            ParseList2();
            Texture2D texture = mod.GetTexture("UI/closeButton").Value;
            UIImage   uIImage = new UIImage(texture /*UIView.GetEmbeddedTexture("Images.closeButton.png")*/);

            uIImage.Anchor       = AnchorPosition.TopRight;
            uIImage.Position     = new Vector2(Width - spacing, spacing);
            uIImage.onLeftClick += bClose_onLeftClick;
            AddChild(uIImage);
            textbox          = new UITextbox();
            textbox.Width    = 100;
            textbox.Anchor   = AnchorPosition.TopRight;
            textbox.Position = new Vector2(Width - spacing * 2f - uIImage.Width, spacing + 40);
            //	this.textbox.Position = new Vector2(base.Width - this.spacing * 2f - uIImage.Width, this.spacing * 2f + uIImage.Height);
            textbox.KeyPressed += textbox_KeyPressed;
            AddChild(textbox);
            for (int j = 0; j < categoryIcons.Length; j++)
            {
                UIImage uIImage2 = new UIImage(categoryIcons[j]);
                Vector2 position = new Vector2(spacing, spacing);
                uIImage2.Scale = 32f / Math.Max(categoryIcons[j].Width, categoryIcons[j].Height);

                position.X += j % 12 * 40;
                position.Y += j / 12 * 40;

                if (categoryIcons[j].Height > categoryIcons[j].Width)
                {
                    position.X += (32 - categoryIcons[j].Width) / 2;
                }
                else if (categoryIcons[j].Height < categoryIcons[j].Width)
                {
                    position.Y += (32 - categoryIcons[j].Height) / 2;
                }

                uIImage2.Position        = position;
                uIImage2.Tag             = j;
                uIImage2.onLeftClick    += (s, e) => buttonClick(s, e, true);
                uIImage2.onRightClick   += (s, e) => buttonClick(s, e, false);
                uIImage2.ForegroundColor = buttonColor;
                if (j == 0)
                {
                    uIImage2.ForegroundColor = buttonSelectedColor;
                }

                uIImage2.Tooltip = categNames[j];
                bCategories[j]   = uIImage2;
                AddChild(uIImage2);
            }

            itemView.selectedCategory = categories[0].ToArray();
            itemView.activeSlots      = itemView.selectedCategory;
            itemView.ReorderSlots();
        }
コード例 #11
0
ファイル: NPCBrowser.cs プロジェクト: Itorius/CheatSheet
        // 270 : 16 40 ?? 16

        public NPCBrowser(CheatSheet mod)
        {
            categories.Clear();
            ModToNPCs.Clear();
            npcView          = new NPCView();
            this.mod         = mod;
            CanMove          = true;
            Width            = npcView.Width + spacing * 2f;
            Height           = 300f;   // 272f
            npcView.Position = new Vector2(spacing, Height - npcView.Height - spacing * 3f);
            AddChild(npcView);
            ParseList2();
            Texture2D texture = mod.GetTexture("UI/closeButton").Value;
            UIImage   uIImage = new UIImage(texture);

            uIImage.Anchor       = AnchorPosition.TopRight;
            uIImage.Position     = new Vector2(Width - spacing, spacing);
            uIImage.onLeftClick += bClose_onLeftClick;
            AddChild(uIImage);
            textbox        = new UITextbox();
            textbox.Anchor = AnchorPosition.BottomLeft;
            //this.textbox.Position = new Vector2(base.Width - this.spacing * 2f + uIImage.Width * numWidth * 2, this.spacing /** 2f + uIImage.Height*/);
            textbox.Position    = new Vector2(spacing, Height - spacing);
            textbox.KeyPressed += textbox_KeyPressed;
            AddChild(textbox);

            Main.instance.LoadItem(ItemID.AlphabetStatueA);
            Main.instance.LoadItem(ItemID.AlphabetStatueB);
            Main.instance.LoadItem(ItemID.AlphabetStatueT);
            Main.instance.LoadItem(ItemID.AlphabetStatueN);
            Main.instance.LoadItem(ItemID.AlphabetStatueF);
            Main.instance.LoadItem(ItemID.AlphabetStatueM);

            Texture2D[] categoryIcons =
            {
                TextureAssets.Item[ItemID.AlphabetStatueA].Value,
                TextureAssets.Item[ItemID.AlphabetStatueB].Value,
                TextureAssets.Item[ItemID.AlphabetStatueT].Value,
                TextureAssets.Item[ItemID.AlphabetStatueN].Value,
                TextureAssets.Item[ItemID.AlphabetStatueF].Value,
                TextureAssets.Item[ItemID.AlphabetStatueM].Value,
            };

            bCategories = new UIImage[categoryIcons.Length];
            for (int j = 0; j < categoryIcons.Length; j++)
            {
                UIImage uIImage2 = new UIImage(categoryIcons[j]);
                Vector2 position = new Vector2(spacing, spacing);
                uIImage2.Scale = 32f / Math.Max(categoryIcons[j].Width, categoryIcons[j].Height);

                position.X += j % 6 * 40;
                position.Y += j / 6 * 40;

                if (categoryIcons[j].Height > categoryIcons[j].Width)
                {
                    position.X += (32 - categoryIcons[j].Width) / 2;
                }
                else if (categoryIcons[j].Height < categoryIcons[j].Width)
                {
                    position.Y += (32 - categoryIcons[j].Height) / 2;
                }

                uIImage2.Position        = position;
                uIImage2.Tag             = j;
                uIImage2.onLeftClick    += (s, e) => buttonClick(s, e, true);
                uIImage2.onRightClick   += (s, e) => buttonClick(s, e, false);
                uIImage2.ForegroundColor = buttonColor;
                if (j == 0)
                {
                    uIImage2.ForegroundColor = buttonSelectedColor;
                }

                uIImage2.Tooltip = categNames[j];
                bCategories[j]   = uIImage2;
                AddChild(uIImage2);
            }

            npcView.selectedCategory = categories[0].ToArray();
            npcView.activeSlots      = npcView.selectedCategory;
            npcView.ReorderSlots();
            textures = new Texture2D[]
            {
                mod.GetTexture("UI/NPCLifeIcon").Value,
                mod.GetTexture("UI/NPCDamageIcon").Value,
                mod.GetTexture("UI/NPCDefenseIcon").Value,
                mod.GetTexture("UI/NPCKnockbackIcon").Value,
            };
        }
コード例 #12
0
ファイル: ItemBrowser.cs プロジェクト: NluzzG/HEROsMod
        //internal Sort[] DefaultSorts;

        public ItemBrowser()
        {
            this.CanMove = true;
            //Height = 420;

            _expandTexture   = HEROsMod.instance.GetTexture("Images/ExpandIcon");
            _collapseTexture = HEROsMod.instance.GetTexture("Images/CollapseIcon");
            _spacerTexture   = HEROsMod.instance.GetTexture("Images/spacer");

            //UILabel lTitle = new UILabel("Item Browser");
            //lTitle.Scale = .6f;
            //lTitle.X = LargeSpacing;
            //lTitle.Y = LargeSpacing;
            //lTitle.OverridesMouse = false;
            //AddChild(lTitle);

            _itemView   = new ItemCollectionView();
            Height      = LargeSpacing * 2 + _itemView.Height + 32;
            _itemView.X = LargeSpacing;
            _itemView.Y = Height - LargeSpacing - _itemView.Height;
            AddChild(_itemView);

            _categoryView        = new UIScrollView();
            _categoryView.X      = _itemView.X + _itemView.Width + LargeSpacing;
            _categoryView.Y      = _itemView.Y;
            _categoryView.Width  = 45 + numberCategoryColumns * 100;
            _categoryView.Height = _itemView.Height;
            AddChild(_categoryView);

            Width = _categoryView.X + _categoryView.Width + LargeSpacing;

            _bClose              = new UIImage(HEROsMod.instance.GetTexture("Images/closeButton"));
            _bClose.Anchor       = AnchorPosition.TopRight;
            _bClose.Position     = new Vector2(Width - LargeSpacing, LargeSpacing);
            _bClose.onLeftClick += bClose_onLeftClick;
            AddChild(_bClose);

            SearchBox             = new UITextbox();
            SearchBox.Width       = 125;
            SearchBox.X           = _itemView.X + _itemView.Width - SearchBox.Width;
            SearchBox.Y           = _itemView.Y - SearchBox.Height - Spacing - 4;
            SearchBox.KeyPressed += textbox_KeyPressed;
            AddChild(SearchBox);

            _filterView          = new UIView();
            _filterView.Position = new Vector2(LargeSpacing, Spacing);
            //_filterView.onLeftClick += _bViewAllItems_onLeftClick;
            //{
            //	UIImage test = new UIImage(HEROsMod.instance.GetTexture("Images/closeButton"));
            //	test.onLeftClick += bClose_onLeftClick;
            //	_filterView.AddChild(test);
            //	UIImage test2 = new UIImage(HEROsMod.instance.GetTexture("Images/closeButton"));
            //	test2.onLeftClick += bClose_onLeftClick;
            //	test2.Position = test.Position;
            //	test2.X += test.Width;
            //	test2.ForegroundColor = Color.Azure;
            //	_filterView.AddChild(test2);
            //}
            //	_filterView.ForegroundColor = Color.Red;
            //	_filterView.BackgroundColor = Color.Pink;
            //	_filterView.Width = 100;
            _filterView.Height = 40;
            AddChild(_filterView);

            _spacer          = new UIImage(_spacerTexture);
            _spacer.Position = new Vector2(Spacing, LargeSpacing);
            _spacer.Height   = 40;
            AddChild(_spacer);

            _sortView          = new UIView();
            _sortView.Position = new Vector2(Spacing, Spacing);
            //_sortView.onLeftClick += _bViewAllItems_onLeftClick;
            //	_sortView.ForegroundColor = Color.Red;
            //	_sortView.BackgroundColor = Color.Red;
            //	_sortView.Width = 30;
            _sortView.Height = 40;
            AddChild(_sortView);

            //_trashCan = new Slot(0);
            //_trashCan.IsTrachCan = true;
            //_trashCan.X = _itemView.X;
            //_trashCan.Y = _itemView.Y - _trashCan.Height - SmallSpacing/2;
            //AddChild(_trashCan);

            _bBack              = new UIButton(Language.GetTextValue("UI.Back"));
            _bBack.X            = _categoryView.X;
            _bBack.Y            = _categoryView.Y - _bBack.Height - Spacing;
            _bBack.onLeftClick += _bViewAllItems_onLeftClick;
            AddChild(_bBack);

            _bCollapseCategories              = new UIImage(_collapseTexture);
            _bCollapseCategories.X            = this.Width - _bCollapseCategories.Width - LargeSpacing;
            _bCollapseCategories.Y            = _categoryView.Y - _bCollapseCategories.Height - Spacing;
            _bCollapseCategories.onLeftClick += _bCollapseCategories_onLeftClick;
            AddChild(_bCollapseCategories);

            shownWidth  = _categoryView.X + _categoryView.Width + LargeSpacing;
            hiddenWidth = _itemView.X + _itemView.Width + LargeSpacing;

            //ParseList2();
            SelectedCategory = null;
        }
コード例 #13
0
ファイル: BuffService.cs プロジェクト: xPanini/HEROsMod
        public BuffWindow()
        {
            this.CanMove = true;
            UILabel lTitle   = new UILabel(HEROsMod.HeroText("Buffs"));
            UILabel lSeconds = new UILabel(HEROsMod.HeroText("Seconds"));

            tbSeconds = new UITextbox();
            UIScrollView scrollView = new UIScrollView();
            UIImage      bClose     = new UIImage(closeTexture);

            lTitle.Scale          = .6f;
            lTitle.X              = Spacing;
            lTitle.Y              = Spacing;
            lTitle.OverridesMouse = false;

            bClose.Y            = Spacing;
            bClose.onLeftClick += bClose_onLeftClick;

            tbSeconds.Text          = "60";
            tbSeconds.Numeric       = true;
            tbSeconds.MaxCharacters = 5;
            tbSeconds.Width         = 75;
            tbSeconds.Y             = lTitle.Y + lTitle.Height;

            scrollView.X      = lTitle.X;
            scrollView.Y      = tbSeconds.Y + tbSeconds.Height + Spacing;
            scrollView.Width  = 300;
            scrollView.Height = 250;

            float yPos = Spacing;

            for (int i = 0; i < Main.debuff.Length /*BuffService.Buffs.Length*/; i++)
            {
                if ((Main.debuff[i] && i != BuffID.Wet) || Main.lightPet[i] || Main.vanityPet[i] || i == 0 || BuffService.SkipBuffs.Contains(i))
                {
                    continue;
                }
                //if (i >= BuffID.Count) ;
                int buffType = i;                /*BuffService.Buffs[i];*/

                UIRect bg = new UIRect();
                bg.ForegroundColor = i % 2 == 0 ? Color.Transparent : Color.Blue * .1f;
                bg.X     = Spacing;
                bg.Y     = yPos;
                bg.Width = scrollView.Width - 20 - Spacing * 2;
                bg.Tag   = buffType;
                string buffDescription = Lang.GetBuffDescription(buffType);
                bg.Tooltip      = (buffDescription == null ? "" : buffDescription);
                bg.onLeftClick += bg_onLeftClick;

                UIImage buffImage = new UIImage(Main.buffTexture[buffType]);
                buffImage.X = Spacing;
                buffImage.Y = SmallSpacing / 2;
                buffImage.OverridesMouse = false;

                bg.Height = buffImage.Height + SmallSpacing;
                yPos     += bg.Height;

                UILabel label = new UILabel(Lang.GetBuffName(buffType));
                label.Scale          = .4f;
                label.Anchor         = AnchorPosition.Left;
                label.X              = buffImage.X + buffImage.Width + Spacing;
                label.Y              = buffImage.Y + buffImage.Height / 2;
                label.OverridesMouse = false;

                bg.AddChild(buffImage);
                bg.AddChild(label);
                scrollView.AddChild(bg);
            }

            scrollView.ContentHeight = yPos;

            this.Width  = scrollView.X + scrollView.Width + Spacing;
            this.Height = scrollView.Y + scrollView.Height + Spacing;

            tbSeconds.X = Width - tbSeconds.Width - Spacing;
            bClose.X    = Width - bClose.Width - Spacing;

            lSeconds.Scale  = .4f;
            lSeconds.Anchor = AnchorPosition.Right;
            lSeconds.X      = tbSeconds.X - Spacing;
            lSeconds.Y      = tbSeconds.Y + tbSeconds.Height / 2;

            AddChild(lTitle);
            AddChild(lSeconds);
            AddChild(tbSeconds);
            AddChild(scrollView);
            AddChild(bClose);
        }
コード例 #14
0
ファイル: NewItemUIW.cs プロジェクト: KryptonIon/ItemModifier
        public override void OnInitialize()
        {
            base.OnInitialize();
            ItemModifier instance = ModContent.GetInstance <ItemModifier>();

            ItemDisplay = new UIItemDisplay(1, 32f)
            {
                Parent = this
            };

            ItemNameTextbox = new UITextbox()
            {
                Text    = "Iron Pickaxe",
                Width   = new SizeDimension(309f),
                XOffset = new SizeDimension(ItemDisplay.OuterWidth + 4f),
                YOffset = new SizeDimension(4f),
                Parent  = this
            };
            ItemNameTextbox.WhileMouseHover += (source, e) => instance.Tooltip = "Name";
            ItemNameTextbox.OnFocused       += (source) => Matches.Visible = true;
            ItemNameTextbox.OnUnfocused     += (source) => Matches.Visible = false;
            ItemNameTextbox.OnTextChanged   += (source, e) =>
            {
                string value = e.Value;
                if (string.IsNullOrEmpty(value))
                {
                    Matches.Visible = false;
                }
                else
                {
                    Matches.RemoveAllChildren();
                    int[] ids = FindItemsByName(value);
                    if (ids.Length > 0)
                    {
                        for (int i = 0, j = 0, k = 0; i < ids.Length; i++)
                        {
                            UIItemDisplay item = new UIItemDisplay(ids[i], 32f)
                            {
                                XOffset = new SizeDimension(36f * j),
                                YOffset = new SizeDimension(36f * k),
                                Parent  = Matches
                            };
                            item.OnLeftClick += (source2, e2) =>
                            {
                                if (item.Item.type != ItemIDTextbox.Value)
                                {
                                    ItemIDTextbox.Value = item.Item.type;
                                }
                                else
                                {
                                    UpdateTextboxes();
                                }
                                Matches.Visible = false;
                            };
                            if (++j > 13)
                            {
                                j = 0;
                                k++;
                            }
                        }
                    }
                    else
                    {
                        NoMatches.Parent = Matches;
                    }
                    Matches.Recalculate();
                    Matches.Visible = true;
                }
            };

            ItemIDTextbox = new UIIntTextbox(1, ItemLoader.ItemCount - 1)
            {
                Width   = new SizeDimension(51f),
                XOffset = new SizeDimension(ItemNameTextbox.CalculatedXOffset + ItemNameTextbox.OuterWidth + 4f),
                YOffset = ItemNameTextbox.YOffset,
                Parent  = this
            };
            ItemIDTextbox.WhileMouseHover += (source, e) => instance.Tooltip = "ID";
            ItemIDTextbox.OnValueChanged  += (source, value) => UpdateTextboxes();

            ItemStackTextbox = new UIIntTextbox(1)
            {
                XOffset = new SizeDimension(ItemIDTextbox.CalculatedXOffset + ItemIDTextbox.OuterWidth + 4f),
                YOffset = ItemNameTextbox.YOffset,
                Parent  = this
            };
            ItemStackTextbox.WhileMouseHover += (source, e) => instance.Tooltip = "Stack";

            Matches = new UIContainer(UIBackgroundColor)
            {
                Visible        = false,
                Width          = new SizeDimension(ItemStackTextbox.CalculatedXOffset + ItemStackTextbox.OuterWidth - 4),
                Height         = new SizeDimension(InnerHeight - ItemNameTextbox.CalculatedYOffset - ItemNameTextbox.OuterHeight - 8),
                XOffset        = new SizeDimension(4f),
                YOffset        = new SizeDimension(ItemNameTextbox.CalculatedYOffset + ItemNameTextbox.OuterHeight + 4f),
                OverflowHidden = true,
                Parent         = this
            };
            Matches.OnFocused   += (source) => Matches.Visible = true;
            Matches.OnUnfocused += (source) => Matches.Visible = false;

            UIItemDisplay ironPickaxe = new UIItemDisplay(1, 32f)
            {
                Parent = Matches
            };

            ironPickaxe.OnLeftClick += (source, e) =>
            {
                if (ironPickaxe.Item.type != ItemIDTextbox.Value)
                {
                    ItemIDTextbox.Value = ironPickaxe.Item.type;
                }
                else
                {
                    UpdateTextboxes();
                }
                Matches.Visible = false;
            };

            NoMatches = new UIText("No items found.");

            Generate = new UIImageButton(ModContent.GetTexture("ItemModifier/UI/NewItem"))
            {
                Width   = new SizeDimension(22f),
                Height  = new SizeDimension(22f),
                XOffset = new SizeDimension(ItemStackTextbox.CalculatedXOffset + ItemStackTextbox.OuterWidth + 4f),
                YOffset = ItemNameTextbox.YOffset,
                Parent  = this
            };
            Generate.WhileMouseHover += (source, e) => instance.Tooltip = "New Item";
            Generate.OnLeftClick     += (source, e) =>
            {
                if (Main.mouseItem.IsAir)
                {
                    Main.mouseItem = new Item();
                    Main.mouseItem.SetDefaults(ItemIDTextbox.Value);
                    Main.mouseItem.stack = ItemStackTextbox.Value;
                    if (UseModifiedProperties.Check)
                    {
                        instance.MainUI.ItemModifierWindow.CopyToItem(Main.mouseItem);
                    }
                }
                else
                {
                    Main.NewText("Can't place item on mouse", new Color(255, 0, 0));
                }
            };

            UseModifiedProperties = new UICheckbox()
            {
                XOffset = new SizeDimension(Generate.CalculatedXOffset + 2f),
                YOffset = Matches.YOffset,
                Parent  = this
            };
            UseModifiedProperties.WhileMouseHover += (source, e) => instance.Tooltip = "Use Modified Properties";
            UseModifiedProperties.OnValueChanged  += (source, e) =>
            {
                if (!e.Value)
                {
                    ItemDisplay.Item = new Item();
                    ItemDisplay.Item.SetDefaults(ItemIDTextbox.Value);
                }
            };
        }
コード例 #15
0
        // 270 : 16 40 ?? 16

        public RecipeBrowserWindow(CheatSheet mod)
        {
            Main.instance.LoadItem(ItemID.AlphabetStatueA);
            Main.instance.LoadItem(ItemID.AlphabetStatueM);

            Texture2D[] categoryIcons =
            {
                TextureAssets.Item[ItemID.AlphabetStatueA].Value,
                TextureAssets.Item[ItemID.AlphabetStatueM].Value,
            };

            categories.Clear();
            bCategories         = new UIImage[categoryIcons.Length];
            recipeView          = new RecipeView();
            this.mod            = mod;
            CanMove             = true;
            Width               = recipeView.Width + spacing * 2f;
            Height              = 420f;
            recipeView.Position = new Vector2(spacing, spacing + 40);
            AddChild(recipeView);
            InitializeRecipeCategories();
            Texture2D texture = mod.GetTexture("UI/closeButton").Value;
            UIImage   uIImage = new UIImage(texture);

            uIImage.Anchor       = AnchorPosition.TopRight;
            uIImage.Position     = new Vector2(Width - spacing, spacing);
            uIImage.onLeftClick += bClose_onLeftClick;
            AddChild(uIImage);
            textbox             = new UITextbox();
            textbox.Anchor      = AnchorPosition.TopRight;
            textbox.Position    = new Vector2(Width - spacing * 2f - uIImage.Width, spacing /** 2f + uIImage.Height*/);
            textbox.KeyPressed += textbox_KeyPressed;
            AddChild(textbox);

            //lookupItemSlot = new Slot(0);
            lookupItemSlot          = new RecipeQuerySlot();
            lookupItemSlot.Position = new Vector2(spacing, halfspacing);
            lookupItemSlot.Scale    = .85f;
            //lookupItemSlot.functionalSlot = true;
            AddChild(lookupItemSlot);

            for (int j = 0; j < categoryIcons.Length; j++)
            {
                UIImage uIImage2 = new UIImage(categoryIcons[j]);
                Vector2 position = new Vector2(spacing + 48, spacing);
                uIImage2.Scale = 32f / Math.Max(categoryIcons[j].Width, categoryIcons[j].Height);

                position.X += j % 6 * 40;
                position.Y += j / 6 * 40;

                if (categoryIcons[j].Height > categoryIcons[j].Width)
                {
                    position.X += (32 - categoryIcons[j].Width) / 2;
                }
                else if (categoryIcons[j].Height < categoryIcons[j].Width)
                {
                    position.Y += (32 - categoryIcons[j].Height) / 2;
                }

                uIImage2.Position        = position;
                uIImage2.Tag             = j;
                uIImage2.onLeftClick    += (s, e) => buttonClick(s, e, true);
                uIImage2.onRightClick   += (s, e) => buttonClick(s, e, false);
                uIImage2.ForegroundColor = buttonColor;
                if (j == 0)
                {
                    uIImage2.ForegroundColor = buttonSelectedColor;
                }

                uIImage2.Tooltip = categNames[j];
                bCategories[j]   = uIImage2;
                AddChild(uIImage2);
            }

            ingredients = new GenericItemSlot[Recipe.maxRequirements];
            for (int j = 0; j < Recipe.maxRequirements; j++)
            {
                GenericItemSlot genericItemSlot = new GenericItemSlot();
                Vector2         position        = new Vector2(spacing, spacing);

                //position.X += j * 60 + 120;
                //position.Y += 250;

                position.X += 166 + j % cols * 51;
                position.Y += 244 + j / cols * 51;

                genericItemSlot.Position = position;
                genericItemSlot.Tag      = j;
                ingredients[j]           = genericItemSlot;
                AddChild(genericItemSlot, false);
            }

            recipeView.selectedCategory = categories[0].ToArray();
            recipeView.activeSlots      = recipeView.selectedCategory;
            recipeView.ReorderSlots();
        }
コード例 #16
0
        //private bool _mobInfoAddToParent = false;

        public MobSpawnWindow()
        {
            //GetNPCList();

            this.CanMove = true;
            UILabel lTiltle = new UILabel(HEROsMod.HeroText("NPCSpawner"));

            lTiltle.OverridesMouse = false;
            scrollView             = new UIScrollView();
            searchBox             = new UITextbox();
            searchBox.KeyPressed += searchBox_KeyPressed;
            mobInfo         = new MobInfoPanel();
            mobInfo.Visible = false;

            AddChild(mobInfo);

            lTiltle.X              = Spacing;
            lTiltle.Y              = Spacing;
            lTiltle.Scale          = .6f;
            lTiltle.OverridesMouse = false;

            searchBox.Y = lTiltle.Y + lTiltle.Height;

            scrollView.X      = lTiltle.X;
            scrollView.Y      = searchBox.Y + searchBox.Height + Spacing;
            scrollView.Width  = 250;
            scrollView.Height = 300;

            //category = npcList;
            //searchResults = category;
            // BuildList();

            bAllNPCs              = new UIButton(HEROsMod.HeroText("All"));
            bAllNPCs.X            = scrollView.X + scrollView.Width + Spacing;
            bAllNPCs.Y            = scrollView.Y;
            bAllNPCs.onLeftClick += bAllNPCs_onLeftClick;
            bAllNPCs.SetTextColor(Color.Yellow);

            bTownNPCs              = new UIButton(HEROsMod.HeroText("TownNPCs"));
            bTownNPCs.X            = bAllNPCs.X;
            bTownNPCs.Y            = bAllNPCs.Y + bAllNPCs.Height + Spacing;
            bTownNPCs.onLeftClick += bTownNPCs_onLeftClick;

            bFriendly              = new UIButton(HEROsMod.HeroText("Friendly"));
            bFriendly.X            = bTownNPCs.X;
            bFriendly.Y            = bTownNPCs.Y + bTownNPCs.Height + Spacing;
            bFriendly.onLeftClick += bFriendly_onLeftClick;

            bBoss              = new UIButton(HEROsMod.HeroText("Boss"));
            bBoss.X            = bFriendly.X;
            bBoss.Y            = bFriendly.Y + bFriendly.Height + Spacing;
            bBoss.onLeftClick += bBoss_onLeftClick;

            bMod              = new UIButton(HEROsMod.HeroText("Mod"));
            bMod.X            = bBoss.X;
            bMod.Y            = bBoss.Y + bBoss.Height + Spacing;
            bMod.onLeftClick += bMod_onLeftClick;
            bMod.Tooltip      = "";

            bAllNPCs.AutoSize  = false;
            bTownNPCs.AutoSize = false;
            bFriendly.AutoSize = false;
            bBoss.AutoSize     = false;
            bMod.AutoSize      = false;
            bAllNPCs.Width     = 100;
            bTownNPCs.Width    = bAllNPCs.Width;
            bFriendly.Width    = bAllNPCs.Width;
            bBoss.Width        = bAllNPCs.Width;
            bMod.Width         = bAllNPCs.Width;

            //itemSlot = new Slot(0);
            //itemSlot.functionalSlot = true;
            //itemSlot.Y = bBoss.Y + bBoss.Height + Spacing;
            //itemSlot.X = bBoss.X + bBoss.Width / 2 - itemSlot.Width / 2;
            //itemSlot.ItemChanged += itemSlot_ItemChanged;

            AddChild(lTiltle);
            AddChild(scrollView);
            AddChild(searchBox);
            AddChild(bAllNPCs);
            AddChild(bTownNPCs);
            AddChild(bFriendly);
            AddChild(bBoss);
            AddChild(bMod);
            //AddChild(itemSlot);

            this.Width      = bTownNPCs.X + bTownNPCs.Width + Spacing;
            this.Height     = scrollView.Y + scrollView.Height + Spacing;
            searchBox.Width = Width - Spacing * 2;
            searchBox.X     = Spacing;

            bClose   = new UIImage(closeTexture);
            bClose.X = Width - bClose.Width - Spacing;
            bClose.Y = Spacing;
            AddChild(bClose);
            bClose.onLeftClick += bClose_onLeftClick;
        }
コード例 #17
0
        // 270 : 16 40 ?? 16

        public NPCBrowser(CheatSheet mod)
        {
            categories.Clear();
            this.npcView          = new NPCView();
            this.mod              = mod;
            this.CanMove          = true;
            base.Width            = this.npcView.Width + this.spacing * 2f;
            base.Height           = 300f;   // 272f
            this.npcView.Position = new Vector2(this.spacing, base.Height - this.npcView.Height - this.spacing * 3f);
            this.AddChild(this.npcView);
            this.ParseList2();
            Texture2D texture = mod.GetTexture("UI/closeButton");
            UIImage   uIImage = new UIImage(texture);

            uIImage.Anchor       = AnchorPosition.TopRight;
            uIImage.Position     = new Vector2(base.Width - this.spacing, this.spacing);
            uIImage.onLeftClick += new EventHandler(this.bClose_onLeftClick);
            this.AddChild(uIImage);
            this.textbox        = new UITextbox();
            this.textbox.Anchor = AnchorPosition.BottomLeft;
            //this.textbox.Position = new Vector2(base.Width - this.spacing * 2f + uIImage.Width * numWidth * 2, this.spacing /** 2f + uIImage.Height*/);
            this.textbox.Position    = new Vector2(this.spacing, base.Height - this.spacing);
            this.textbox.KeyPressed += new UITextbox.KeyPressedHandler(this.textbox_KeyPressed);
            this.AddChild(this.textbox);
            bCategories = new UIImage[categoryIcons.Length];
            for (int j = 0; j < NPCBrowser.categoryIcons.Length; j++)
            {
                UIImage uIImage2 = new UIImage(NPCBrowser.categoryIcons[j]);
                Vector2 position = new Vector2(this.spacing, this.spacing);
                uIImage2.Scale = 32f / Math.Max(categoryIcons[j].Width, categoryIcons[j].Height);

                position.X += (float)(j % 6 * 40);
                position.Y += (float)(j / 6 * 40);

                if (categoryIcons[j].Height > categoryIcons[j].Width)
                {
                    position.X += (32 - categoryIcons[j].Width) / 2;
                }
                else if (categoryIcons[j].Height < categoryIcons[j].Width)
                {
                    position.Y += (32 - categoryIcons[j].Height) / 2;
                }

                uIImage2.Position        = position;
                uIImage2.Tag             = j;
                uIImage2.onLeftClick    += new EventHandler(this.button_onLeftClick);
                uIImage2.ForegroundColor = NPCBrowser.buttonColor;
                if (j == 0)
                {
                    uIImage2.ForegroundColor = NPCBrowser.buttonSelectedColor;
                }
                uIImage2.Tooltip          = NPCBrowser.categNames[j];
                NPCBrowser.bCategories[j] = uIImage2;
                this.AddChild(uIImage2);
            }
            npcView.selectedCategory = NPCBrowser.categories[0].ToArray();
            npcView.activeSlots      = npcView.selectedCategory;
            npcView.ReorderSlots();
            textures = new Texture2D[]
            {
                mod.GetTexture("UI/NPCLifeIcon"),
                mod.GetTexture("UI/NPCDamageIcon"),
                mod.GetTexture("UI/NPCDefenseIcon"),
                mod.GetTexture("UI/NPCKnockbackIcon"),
            };
        }
コード例 #18
0
    // ***********************************************
    // OnDisable [Monobehavior]
    // -----------------------------------------------
    void OnDisable()
    {
        if (FocusedTextbox && FocusedTextbox == this)
            FocusedTextbox = null;

#if UNITY_IOS || UNITY_ANDROID
        if (mKeyboard != null)
        {
            // hide mobile keyboard when control is disabled (from hiding form its on)
            mKeyboard.active = false;
            mKeyboard = null;
        }
#endif
    }