Exemple #1
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();
        }
Exemple #2
0
        public Hotbar(CheatSheet mod)
        {
            this.mod        = mod;
            this.buttonView = new UIView();
            //	this.timeWindow = new TimeControlWindow();
            //	this.npcSpawnWindow = new NPCSpawnerWindow();
            //	this.weatherWindow = new WeatherControlWindow();
            //	this.timeWindow.Visible = false;
            //	this.npcSpawnWindow.Visible = false;
            //	this.weatherWindow.Visible = false;
            //	this.AddChild(this.timeWindow);
            //	this.AddChild(this.npcSpawnWindow);
            //	this.AddChild(this.weatherWindow);
            Hotbar.loginTexture  = mod.GetTexture("UI/Images.login");           // UIView.GetEmbeddedTexture("Images.login.png");
            Hotbar.logoutTexture = mod.GetTexture("UI/Images.logout");          //UIView.GetEmbeddedTexture("Images.logout.png");
            //	this.bLogin = new UIImage(Hotbar.loginTexture);
            //		bLogin = new UIImage(mod.GetTexture("UI/Images.login"));
            base.Visible = false;
            base.UpdateWhenOutOfBounds = true;
            //	Hotbar.groupWindow = new GroupManagementWindow();
            this.button = new UIImage(mod.GetTexture("UI/Images.CollapseBar.CollapseButtonHorizontal"));            //new UIImage(UIView.GetEmbeddedTexture("Images.CollapseBar.CollapseButtonHorizontal.png"));
            this.button.UpdateWhenOutOfBounds = true;
            this.arrow = new UIImage(mod.GetTexture("UI/Images.CollapseBar.CollapseArrowHorizontal"));              //new UIImage(UIView.GetEmbeddedTexture("Images.CollapseBar.CollapseArrowHorizontal.png"));

            //		bToggleEnemies = new UIImage(mod.GetTexture("UI/Images.npcIcon"));
            //		bToggleBlockReach = new UIImage(Main.itemTexture[407]);
            //		bFlyCamera = new UIImage(Main.itemTexture[493]);
            //		bRevealMap = new UIImage(mod.GetTexture("UI/Images.canIcon"));// Hotbar.mapTexture);
            //		bWaypoints = new UIImage(mod.GetTexture("UI/Images.waypointIcon"));
            //		bGroupManager = new UIImage(mod.GetTexture("UI/Images.manageGroups"));
            //		bOnlinePlayers = new UIImage(mod.GetTexture("UI/Images.connectedPlayers"));
            //		bTime = new UIImage(mod.GetTexture("UI/Images.sunIcon"));
            //		bWeatherWindow = new UIImage(Main.npcHeadTexture[2]);// WeatherControlWindow.rainTexture);
            //		bBackupWorld = new UIImage(mod.GetTexture("UI/Images.UIKit.saveIcon"));
            //		bCTFSettings = new UIImage(mod.GetTexture("UI/Images.CTF.redFlag"));

            //	Main.instance.LoadNPC(NPCID.KingSlime);

            bToggleItemBrowser        = new UIImage(Main.itemTexture[ItemID.WorkBench]);
            bToggleNPCBrowser         = new UIImage(mod.GetTexture("UI/Images.npcIcon"));
            bToggleClearMenu          = new UIImage(Main.itemTexture[ItemID.TrashCan]);
            bToggleRecipeBrowser      = new UIImage(Main.itemTexture[ItemID.CookingPot]);
            bToggleExtendedCheat      = new UIImage(Main.itemTexture[ItemID.CellPhone]);
            bTogglePaintTools         = new UIImage(Main.itemTexture[ItemID.Paintbrush]);
            bCycleExtraAccessorySlots = new UIImage(Main.itemTexture[ItemID.DemonHeart]);
            bVacuum              = new UIImage(mod.GetTexture("UI/Images.bVacuum"));
            bToggleNPCButcherer  = new UIImage(Main.itemTexture[ItemID.Skull]);
            bToggleQuickTeleport = new UIImage(Main.itemTexture[ItemID.WoodenDoor]);
            //bToggleEventManager = new UIImage(Main.itemTexture[ItemID.PirateMap]);

            this.arrow.UpdateWhenOutOfBounds = true;
            this.button.Anchor      = AnchorPosition.Top;
            this.arrow.Anchor       = AnchorPosition.Top;
            this.arrow.SpriteEffect = SpriteEffects.FlipVertically;
            this.AddChild(this.button);
            this.AddChild(this.arrow);
            this.button.Position = new Vector2(0f, -this.button.Height);
            this.button.CenterXAxisToParentCenter();
            //Do i need this?		this.button.X -= 40;
            this.arrow.Position     = this.button.Position;
            this.arrow.onLeftClick += new EventHandler(this.button_onLeftClick);
            //		this.bBackupWorld.onLeftClick += new EventHandler(this.bBackupWorld_onLeftClick);
            //		this.bToggleBlockReach.Tooltip = "Toggle Block Reach";
            //		this.bToggleEnemies.Tooltip = "Toggle Enemy Spawns";
            //		this.bFlyCamera.Tooltip = "Toggle Fly Cam";
            //		this.bRevealMap.Tooltip = "Reveal Map";
            //		this.bWaypoints.Tooltip = "Open Waypoints Window";
            //		this.bGroupManager.Tooltip = "Open Group Management";
            //		this.bOnlinePlayers.Tooltip = "View Connected Players";
            //		this.bTime.Tooltip = "Set Time";
            //		this.bWeatherWindow.Tooltip = "Control Rain";
            //		this.bLogin.Tooltip = "Login";
            //		this.bCTFSettings.Tooltip = "Capture the Flag Settings";
            //		this.bBackupWorld.Tooltip = "Backup World";
            this.bToggleItemBrowser.Tooltip   = CSText("ShowItemBrowser");
            this.bToggleClearMenu.Tooltip     = CSText("ShowClearMenu");
            this.bToggleNPCBrowser.Tooltip    = CSText("ShowNPCBrowser");
            bToggleRecipeBrowser.Tooltip      = CSText("ShowRecipeBrowser");
            bToggleExtendedCheat.Tooltip      = CSText("ShowModExtensionCheats");
            bTogglePaintTools.Tooltip         = CSText("ShowPaintTools");
            bCycleExtraAccessorySlots.Tooltip = CSText("ExtraAccessorySlots") + ": ?";
            bVacuum.Tooltip              = CSText("VacuumItems");
            bToggleNPCButcherer.Tooltip  = CSText("ShowNPCButcherer");
            bToggleQuickTeleport.Tooltip = CSText("ShowQuickWaypoints");
            //		bToggleEventManager.Tooltip = "Show Event Manager";

            //		this.bToggleBlockReach.Opacity = Hotbar.disabledOpacity;
            //		this.bFlyCamera.Opacity = Hotbar.disabledOpacity;
            //		this.bToggleEnemies.Opacity = Hotbar.disabledOpacity;
            //		this.bToggleBlockReach.onLeftClick += new EventHandler(this.bToggleBlockReach_onLeftClick);
            //		this.bFlyCamera.onLeftClick += new EventHandler(this.bFlyCamera_onLeftClick);
            //		this.bToggleEnemies.onLeftClick += new EventHandler(this.bToggleEnemies_onLeftClick);
            //			this.bRevealMap.onLeftClick += new EventHandler(this.bRevealMap_onLeftClick);
            //			this.bWaypoints.onLeftClick += new EventHandler(this.bWaypoints_onLeftClick);
            //		this.bGroupManager.onLeftClick += new EventHandler(this.bGroupManager_onLeftClick);
            //		this.bOnlinePlayers.onLeftClick += new EventHandler(this.bOnlinePlayers_onLeftClick);
            //		this.bCTFSettings.onLeftClick += new EventHandler(this.bCTFSettings_onLeftClick);
            //		this.bLogin.onLeftClick += new EventHandler(this.bLogin_onLeftClick);
            //		this.bTime.onLeftClick += new EventHandler(this.bTime_onLeftClick);
            //		this.bWeatherWindow.onLeftClick += new EventHandler(this.bWeatherWindow_onLeftClick);
            this.bToggleItemBrowser.onLeftClick += new EventHandler(this.bToggleItemBrowser_onLeftClick);
            this.bToggleClearMenu.onLeftClick   += new EventHandler(this.bClearItems_onLeftClick);
            this.bToggleClearMenu.onRightClick  += (s, e) =>
            {
                QuickClearHotbar.HandleQuickClear();
            };
            this.bToggleNPCBrowser.onLeftClick         += new EventHandler(this.bToggleNPCBrowser_onLeftClick);
            this.bToggleRecipeBrowser.onLeftClick      += new EventHandler(this.bToggleRecipeBrowser_onLeftClick);
            this.bToggleExtendedCheat.onLeftClick      += new EventHandler(this.bToggleExtendedCheat_onLeftClick);
            this.bTogglePaintTools.onLeftClick         += new EventHandler(this.bTogglePaintTools_onLeftClick);
            this.bCycleExtraAccessorySlots.onLeftClick += (s, e) =>
            {
                CheatSheetPlayer cheatSheetPlayer = Main.LocalPlayer.GetModPlayer <CheatSheetPlayer>();
                cheatSheetPlayer.numberExtraAccessoriesEnabled = (cheatSheetPlayer.numberExtraAccessoriesEnabled + 1) % (CheatSheetPlayer.MaxExtraAccessories + 1);
                bCycleExtraAccessorySlots.Tooltip = CSText("ExtraAccessorySlots") + ": " + cheatSheetPlayer.numberExtraAccessoriesEnabled;
            };
            this.bCycleExtraAccessorySlots.onRightClick += (s, e) =>
            {
                CheatSheetPlayer cheatSheetPlayer = Main.LocalPlayer.GetModPlayer <CheatSheetPlayer>();
                cheatSheetPlayer.numberExtraAccessoriesEnabled = cheatSheetPlayer.numberExtraAccessoriesEnabled == 0 ? 0 : (cheatSheetPlayer.numberExtraAccessoriesEnabled - 1) % (CheatSheetPlayer.MaxExtraAccessories + 1);
                bCycleExtraAccessorySlots.Tooltip = CSText("ExtraAccessorySlots") + ": " + cheatSheetPlayer.numberExtraAccessoriesEnabled;
            };
            this.bVacuum.onLeftClick              += new EventHandler(this.bVacuum_onLeftClick);
            this.bToggleNPCButcherer.onLeftClick  += new EventHandler(this.bButcher_onLeftClick);
            this.bToggleNPCButcherer.onRightClick += (s, e) =>
            {
                NPCButchererHotbar.HandleButcher();
            };
            this.bToggleQuickTeleport.onLeftClick  += new EventHandler(this.bToggleQuickTeleport_onLeftClick);
            this.bToggleQuickTeleport.onRightClick += (s, e) =>
            {
                //QuickTeleportHotbar.TeleportPlayer(Main.LocalPlayer, new Vector2(Main.spawnTileX, Main.spawnTileY), true);
                QuickTeleportHotbar.HandleTeleport();
            };
            //		this.bToggleEventManager.onLeftClick += new EventHandler(this.bToggleEventManager_onLeftClick);

            //		this.buttonView.AddChild(this.bToggleBlockReach);
            //		this.buttonView.AddChild(this.bFlyCamera);
            //		this.buttonView.AddChild(this.bToggleEnemies);
            //		this.buttonView.AddChild(this.bRevealMap);
            //		this.buttonView.AddChild(this.bWaypoints);
            //		this.buttonView.AddChild(this.bTime);
            //			this.buttonView.AddChild(this.bWeatherWindow);
            //			this.buttonView.AddChild(this.bGroupManager);
            //			this.buttonView.AddChild(this.bOnlinePlayers);
            //			this.buttonView.AddChild(this.bCTFSettings);
            //			this.buttonView.AddChild(this.bLogin);
            //			this.buttonView.AddChild(this.bBackupWorld);

            buttonView.AddChild(bToggleItemBrowser);
            buttonView.AddChild(bToggleNPCBrowser);
            buttonView.AddChild(bToggleRecipeBrowser);
            buttonView.AddChild(bToggleExtendedCheat);
            buttonView.AddChild(bToggleClearMenu);
            buttonView.AddChild(bTogglePaintTools);
            buttonView.AddChild(bCycleExtraAccessorySlots);
            buttonView.AddChild(bVacuum);
            buttonView.AddChild(bToggleNPCButcherer);
            buttonView.AddChild(bToggleQuickTeleport);
            //			buttonView.AddChild(bToggleEventManager);
            buttonView.AddChild(SpawnRateMultiplier.GetButton(mod));
            buttonView.AddChild(MinionSlotBooster.GetButton(mod));
            buttonView.AddChild(LightHack.GetButton(mod));
            buttonView.AddChild(GodMode.GetButton(mod));
            //	buttonView.AddChild(FullBright.GetButton(mod));
            //			buttonView.AddChild(BossDowner.GetButton(mod));
            buttonView.AddChild(ConfigurationTool.GetButton(mod));

            base.Width             = 200f;
            base.Height            = 55f;
            this.buttonView.Height = base.Height;
            base.Anchor            = AnchorPosition.Top;
            this.AddChild(this.buttonView);
            base.Position = new Vector2(Hotbar.xPosition, this.hiddenPosition);
            base.CenterXAxisToParentCenter();
            float num = this.spacing;

            for (int i = 0; i < this.buttonView.children.Count; i++)
            {
                this.buttonView.children[i].Anchor   = AnchorPosition.Left;
                this.buttonView.children[i].Position = new Vector2(num, 0f);
                this.buttonView.children[i].CenterYAxisToParentCenter();
                this.buttonView.children[i].Visible         = true;
                this.buttonView.children[i].ForegroundColor = buttonUnselectedColor;
                num += this.buttonView.children[i].Width + this.spacing;
            }
            //	Hotbar.groupWindow.Visible = false;
            //	MasterView.gameScreen.AddChild(Hotbar.groupWindow);
            ChangedConfiguration();
            //this.Resize();
            return;
        }
        // 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"),
            };
        }
Exemple #4
0
        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;
        }
Exemple #5
0
        public PaintToolsHotbar(CheatSheet mod)
        {
            this.mod = mod;
            //parentHotbar = mod.hotbar;

            this.buttonView = new UIView();
            base.Visible    = false;
            //base.UpdateWhenOutOfBounds = true;

            //		bDecreaseBrushSize = new UIImage(Main.itemTexture[ItemID.CopperShortsword]);
            //		bIncreaseBrushSize = new UIImage(Main.itemTexture[ItemID.CrossNecklace]);
            bStampTiles                 = new UIImage(Main.itemTexture[ItemID.Paintbrush]);
            bEyeDropper                 = new UIImage(Main.itemTexture[ItemID.EmptyDropper]);
            bFlipHorizontal             = new UIImage(mod.GetTexture("CustomUI/Horizontal"));
            bFlipVertical               = new UIImage(mod.GetTexture("CustomUI/Vertical"));
            bToggleTransparentSelection = new UIImage(Main.buffTexture[BuffID.Invisibility]);

            //		this.bIncreaseBrushSize.Tooltip = "    Increase Brush Size";
            //		this.bDecreaseBrushSize.Tooltip = "    Decrease Brush Size";
            bStampTiles.Tooltip                 = "    Paint Tiles";
            bEyeDropper.Tooltip                 = "    Eye Dropper";
            bFlipHorizontal.Tooltip             = "    Flip Horizontal";
            bFlipVertical.Tooltip               = "    Flip Vertical";
            bToggleTransparentSelection.Tooltip = "    Toggle Transparent Selection: Off";

            //		this.bIncreaseBrushSize.onLeftClick += (s, e) => brushSize = Math.Min(10, brushSize + 1);
            //		this.bDecreaseBrushSize.onLeftClick += (s, e) => brushSize = Math.Max(1, brushSize - 1);
            bStampTiles.onLeftClick   += new EventHandler(this.bTogglePaintTiles_onLeftClick);
            bEyeDropper.onLeftClick   += new EventHandler(this.bToggleEyeDropper_onLeftClick);
            bFlipVertical.onLeftClick += (s, e) =>
            {
                for (int i = 0; i < StampTiles.GetLength(0); i++)
                {
                    for (int j = 0; j < StampTiles.GetLength(1) / 2; j++)
                    {
                        Utils.Swap(ref StampTiles[i, j], ref StampTiles[i, StampTiles.GetLength(1) - 1 - j]);
                    }
                }
                if (stampInfo != null)
                {
                    stampInfo.bFlipVertical = !stampInfo.bFlipVertical;
                }
            };
            bFlipHorizontal.onLeftClick += (s, e) =>
            {
                for (int j = 0; j < StampTiles.GetLength(1); j++)
                {
                    for (int i = 0; i < StampTiles.GetLength(0) / 2; i++)
                    {
                        Utils.Swap(ref StampTiles[i, j], ref StampTiles[StampTiles.GetLength(0) - 1 - i, j]);
                    }
                }
                if (stampInfo != null)
                {
                    stampInfo.bFlipHorizontal = !stampInfo.bFlipHorizontal;
                }
            };
            bToggleTransparentSelection.onLeftClick += (s, e) => { TransparentSelectionEnabled = !TransparentSelectionEnabled; bToggleTransparentSelection.Tooltip = TransparentSelectionEnabled ? "    Toggle Transparent Selection: On" : "    Toggle Transparent Selection: Off"; };

            onMouseDown += (s, e) =>
            {
                if (!Main.LocalPlayer.mouseInterface && !mod.hotbar.MouseInside && !mod.hotbar.button.MouseInside && !UIView.MouseRightButton)
                {
                    leftMouseDown = true;
                    Main.LocalPlayer.mouseInterface = true;
                }
            };
            onMouseUp += (s, e) =>
            {
                if (!Main.LocalPlayer.mouseInterface && !mod.hotbar.MouseInside && !mod.hotbar.button.MouseInside && (!UIView.MousePrevRightButton || (UIView.MousePrevLeftButton && !UIView.MouseLeftButton)))
                {
                    justLeftMouseDown = true; leftMouseDown = false;                     /*startTileX = -1; startTileY = -1;*/
                }
            };

            //UpdateWhenOutOfBounds = true;

            //	buttonView.AddChild(bDecreaseBrushSize);
            //		buttonView.AddChild(bIncreaseBrushSize);
            buttonView.AddChild(bStampTiles);
            buttonView.AddChild(bEyeDropper);
            buttonView.AddChild(bFlipHorizontal);
            buttonView.AddChild(bFlipVertical);
            buttonView.AddChild(bToggleTransparentSelection);

            base.Width             = 200f;
            base.Height            = 55f;
            this.buttonView.Height = base.Height;
            base.Anchor            = AnchorPosition.Top;
            this.AddChild(this.buttonView);
            base.Position = new Vector2(Hotbar.xPosition, this.hiddenPosition);
            base.CenterXAxisToParentCenter();
            float num = this.spacing;

            for (int i = 0; i < this.buttonView.children.Count; i++)
            {
                this.buttonView.children[i].Anchor   = AnchorPosition.Left;
                this.buttonView.children[i].Position = new Vector2(num, 0f);
                this.buttonView.children[i].CenterYAxisToParentCenter();
                this.buttonView.children[i].Visible         = true;
                this.buttonView.children[i].ForegroundColor = buttonUnselectedColor;
                num += this.buttonView.children[i].Width + this.spacing;
            }
            this.Resize();
        }
Exemple #6
0
        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();
        }
Exemple #7
0
        // 270 : 16 40 ?? 16

        public RecipeBrowserWindow(CheatSheet 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();
        }
        public ExtendedCheatMenu(CheatSheet mod)
        {
            buttons  = new UIImage[CheatSheet.ButtonTexture.Count];
            this.mod = mod;
            CanMove  = true;
            Width    = spacing * 2;
            Height   = spacing * 2;

            if (CheatSheet.ButtonTexture.Count == 0)
            {
                UILabel none = new UILabel(CSText("NoExtensionCheatModsInstalled"));
                none.Scale = .3f;
                //none.OverridesMouse = false;
                //none.
                //none.MouseInside = (X => false);
                none.Position = new Vector2(spacing, spacing);
                AddChild(none);
                Height = 100;
                Width  = 140;
            }

            if (CheatSheet.ButtonTexture.Count > 0)
            {
                int count = CheatSheet.ButtonTexture.Count;

                int cols = (count + 4) / 5;
                int rows = count >= 5 ? 5 : count;

                for (int j = 0; j < CheatSheet.ButtonTexture.Count; j++)
                {
                    UIImage button   = new UIImage(CheatSheet.ButtonTexture[j]);
                    Vector2 position = new Vector2(spacing + 1, spacing + 1);
                    button.Scale = 38f / Math.Max(CheatSheet.ButtonTexture[j].Width, CheatSheet.ButtonTexture[j].Height);

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

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

                    button.Position     = position;
                    button.Tag          = j;
                    button.onLeftClick += button_onLeftClick;
                    button.onHover     += button_onHover;
                    //	button.ForegroundColor = RecipeBrowser.buttonColor;
                    //	uIImage2.Tooltip = RecipeBrowser.categNames[j];
                    buttons[j] = button;
                    AddChild(button);
                }

                Width  += 40 * cols;
                Height += 40 * rows;
            }

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

            uIImage.Anchor       = AnchorPosition.TopRight;
            uIImage.Position     = new Vector2(Width - spacing / 2, spacing / 2);
            uIImage.onLeftClick += bClose_onLeftClick;
            AddChild(uIImage);
        }
Exemple #9
0
        // 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,
            };
        }
        public ConfigurationWindow(CheatSheet mod)
        {
            this.mod     = mod;
            this.CanMove = true;
            base.Width   = 280;
            base.Height  = 358;

            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);

            //ConfigurationLoader.Initialized();

            string[] labels = new string[] { CSText("ItemBrowser"), CSText("NPCBrowser"), CSText("RecipeBrowser"), CSText("MinionBooster"), CSText("Butcher"), CSText("ClearMenu"),
                                             CSText("ExtraAccessorySlots"), CSText("ModExtensions"), CSText("PaintTools"), CSText("SpawnRate"), CSText("Vacuum"), CSText("Waypoints"), CSText("LightHack"), CSText("GodMode")
                                             /* "Boss Downer", "Event Manager"*/
            };
            Func <bool>[] selecteds = new Func <bool>[] {
                () => ConfigurationLoader.personalConfiguration.ItemBrowser,
                () => ConfigurationLoader.personalConfiguration.NPCBrowser,
                () => ConfigurationLoader.personalConfiguration.RecipeBrowser,
                () => ConfigurationLoader.personalConfiguration.MinionBooster,
                () => ConfigurationLoader.personalConfiguration.Butcher,
                () => ConfigurationLoader.personalConfiguration.ClearMenu,
                () => ConfigurationLoader.personalConfiguration.ExtraAccessorySlots,
                () => ConfigurationLoader.personalConfiguration.ModExtensions,
                () => ConfigurationLoader.personalConfiguration.PaintTools,
                () => ConfigurationLoader.personalConfiguration.SpawnRate,
                () => ConfigurationLoader.personalConfiguration.Vacuum,
                () => ConfigurationLoader.personalConfiguration.Waypoints,
                () => ConfigurationLoader.personalConfiguration.LightHack,
                () => ConfigurationLoader.personalConfiguration.GodMode,
                //  ConfigurationLoader.configuration.BossDowner,
                //  ConfigurationLoader.configuration.EventManager,
            };

            Action <bool>[] assignSelected = new Action <bool>[] {
                (bool a) => ConfigurationLoader.personalConfiguration.ItemBrowser         = a,
                (bool a) => ConfigurationLoader.personalConfiguration.NPCBrowser          = a,
                (bool a) => ConfigurationLoader.personalConfiguration.RecipeBrowser       = a,
                (bool a) => ConfigurationLoader.personalConfiguration.MinionBooster       = a,
                (bool a) => ConfigurationLoader.personalConfiguration.Butcher             = a,
                (bool a) => ConfigurationLoader.personalConfiguration.ClearMenu           = a,
                (bool a) => ConfigurationLoader.personalConfiguration.ExtraAccessorySlots = a,
                (bool a) => ConfigurationLoader.personalConfiguration.ModExtensions       = a,
                (bool a) => ConfigurationLoader.personalConfiguration.PaintTools          = a,
                (bool a) => ConfigurationLoader.personalConfiguration.SpawnRate           = a,
                (bool a) => ConfigurationLoader.personalConfiguration.Vacuum    = a,
                (bool a) => ConfigurationLoader.personalConfiguration.Waypoints = a,
                (bool a) => ConfigurationLoader.personalConfiguration.LightHack = a,
                (bool a) => ConfigurationLoader.personalConfiguration.GodMode   = a,
            };

            for (int i = 0; i < labels.Length; i++)
            {
                int        iClosure = i;
                UICheckbox cb       = new UICheckbox(labels[i]);
                cb.Selected = selecteds[i]();
                cb.X        = spacing;
                cb.Y        = i * 24 + spacing;
                //cb.SelectedChanged += new EventHandler(bCheckBoxTicked);
                cb.SelectedChanged += (a, b) =>
                {
                    assignSelected[iClosure](cb.Selected);
                    cb.Selected = selecteds[iClosure]();
                    ConfigurationLoader.SaveSetting();
                    ((CheatSheet)mod).hotbar.ChangedConfiguration();
                    ConfigurationTool.configurationWindow.selected = true;
                };

                //cb.label.ForegroundColor = Color.Red;
                AddChild(cb);
            }
        }
        public ConfigurationWindow(CheatSheet mod)
        {
            this.mod     = mod;
            this.CanMove = true;
            base.Width   = 280;
            base.Height  = 348;

            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);

            //ConfigurationLoader.Initialized();

            string[] labels = new string[] { CSText("ItemBrowser"), CSText("NPCBrowser"), CSText("RecipeBrowser"), CSText("MinionBooster"), CSText("Butcher"), CSText("ClearMenu"),
                                             CSText("ExtraAccessorySlots"), CSText("ModExtensions"), CSText("PaintTools"), CSText("SpawnRate"), CSText("Vacuum"), CSText("Waypoints"), CSText("LightHack")
                                             /* "Boss Downer", "Event Manager"*/
            };
            bool[] selecteds = new bool[] {
                ConfigurationLoader.personalConfiguration.ItemBrowser,
                ConfigurationLoader.personalConfiguration.NPCBrowser,
                ConfigurationLoader.personalConfiguration.RecipeBrowser,
                ConfigurationLoader.personalConfiguration.MinionBooster,
                ConfigurationLoader.personalConfiguration.Butcher,
                ConfigurationLoader.personalConfiguration.ClearMenu,
                ConfigurationLoader.personalConfiguration.ExtraAccessorySlots,
                ConfigurationLoader.personalConfiguration.ModExtensions,
                ConfigurationLoader.personalConfiguration.PaintTools,
                ConfigurationLoader.personalConfiguration.SpawnRate,
                ConfigurationLoader.personalConfiguration.Vacuum,
                ConfigurationLoader.personalConfiguration.Waypoints,
                ConfigurationLoader.personalConfiguration.LightHack,
                //  ConfigurationLoader.configuration.BossDowner,
                //  ConfigurationLoader.configuration.EventManager,
            };

            for (int i = 0; i < labels.Length; i++)
            {
                UICheckbox cb = new UICheckbox(labels[i]);
                cb.Selected         = selecteds[i];
                cb.X                = spacing;
                cb.Y                = i * 24 + spacing;
                cb.SelectedChanged += new EventHandler(bCheckBoxTicked);

                //cb.label.ForegroundColor = Color.Red;
                AddChild(cb);
            }

            //UICheckbox cb = new UICheckbox("Item Browser");
            //cb.Selected = ConfigurationLoader.configuration.ItemBrowser;
            //cb.X = 0;
            //cb.Y = 1 * 20;
            //cb.SelectedChanged += new EventHandler(bCheckBoxTicked);
            //AddChild(cb);

            //cb = new UICheckbox("NPC Browser");
            //cb.Selected = ConfigurationLoader.configuration.NPCBrowser;
            //cb.X = 0;
            //cb.Y = 2 * 20;
            //cb.SelectedChanged += new EventHandler(bCheckBoxTicked);
            //AddChild(cb);

            //cb = new UICheckbox("Recipe Browser");
            //cb.Selected = ConfigurationLoader.configuration.RecipeBrowser;
            //cb.X = 0;
            //cb.Y = 3 * 20;
            //cb.SelectedChanged += new EventHandler(bCheckBoxTicked);
            //AddChild(cb);

            //cb = new UICheckbox("Minion Booster");
            //cb.Selected = ConfigurationLoader.configuration.MinionBooster;
            //cb.X = 0;
            //cb.Y = 4 * 20;
            //cb.SelectedChanged += new EventHandler(bCheckBoxTicked);
            //AddChild(cb);

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

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

            //	genericItemSlot.Position = position;
            //	genericItemSlot.Tag = j;
            //	RecipeBrowser.ingredients[j] = genericItemSlot;
            //	this.AddChild(genericItemSlot, false);
            //}
        }
Exemple #12
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();
        }