public override void OnInitialize() { base.OnInitialize(); ItemModifier instance = ModContent.GetInstance <ItemModifier>(); CategoryName = new UIText("There's a problem") { SkipDescenderCheck = true, HorizontalAlign = 0.5f }; CategoryName.Parent = this; PreviousCategory = new UIImageButton(ModContent.GetTexture("ItemModifier/UI/LeftArrow")) { ColorTint = new Color(0, 100, 255), Parent = this }; PreviousCategory.OnLeftClick += (source, e) => changeIndex(CategoryIndex - 1); PreviousCategory.OnRightClick += (source, e) => changeIndex(CategoryIndex + 1); PreviousCategory.WhileMouseHover += (source, e) => instance.Tooltip = "Previous Category"; NextCategory = new UIImageButton(ModContent.GetTexture("ItemModifier/UI/RightArrow")) { ColorTint = new Color(255, 100, 0) }; NextCategory.XOffset = new SizeDimension(InnerWidth - NextCategory.OuterWidth); NextCategory.Parent = this; NextCategory.OnLeftClick += (source, e) => changeIndex(CategoryIndex + 1); NextCategory.OnRightClick += (source, e) => changeIndex(CategoryIndex - 1); NextCategory.WhileMouseHover += (source, e) => instance.Tooltip = "Next Category"; void changeIndex(int newIndex) { CategoryIndex = newIndex < 0 ? Categories.Count - 1 : newIndex >= Categories.Count ? 0 : newIndex; } AutoReuse = new UIBool(); AutoReuse.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.autoReuse = e.Value; AutoReuse.OnRightClick += (source, e) => Main.LocalPlayer.HeldItem.autoReuse = DefaultItem.autoReuse; PAutoReuse = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/AutoReuse"), "Auto Use", AutoReuse); Consumable = new UIBool(); Consumable.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.consumable = e.Value; Consumable.OnRightClick += (source, e) => Main.LocalPlayer.HeldItem.consumable = DefaultItem.consumable; PConsumable = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/Consumable"), "Consumable", Consumable); Potion = new UIBool(); Potion.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.potion = e.Value; Potion.OnRightClick += (source, e) => Main.LocalPlayer.HeldItem.potion = DefaultItem.potion; PPotion = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/PotionSickness"), "Potion Sickness", Potion); DamageType = new UIRadioButtonContainer(); RMelee = new UIRadioButton("Melee") { Parent = DamageType }; RMelee.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.melee = e.Value; RMagic = new UIRadioButton("Magic") { Parent = DamageType }; RMagic.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.magic = e.Value; RRanged = new UIRadioButton("Ranged") { Parent = DamageType }; RRanged.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.ranged = e.Value; RSummon = new UIRadioButton("Summon") { Parent = DamageType }; RSummon.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.summon = e.Value; RThrown = new UIRadioButton("Thrown") { Parent = DamageType }; RThrown.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.thrown = e.Value; float dTypeWidth = 0f; for (int i = 0; i < DamageType.ChildrenCount; i++) { UIElement child = DamageType[i]; if (child.InnerWidth > dTypeWidth) { dTypeWidth = child.InnerWidth; } child.YOffset = new SizeDimension(RMelee.InnerHeight * i); } DamageType.Width = new SizeDimension(dTypeWidth); DamageType.Height = new SizeDimension(RMelee.InnerHeight * DamageType.ChildrenCount); DamageType.OnRightClick += (source, e) => { Main.LocalPlayer.HeldItem.melee = DefaultItem.melee; Main.LocalPlayer.HeldItem.magic = DefaultItem.magic; Main.LocalPlayer.HeldItem.ranged = DefaultItem.ranged; Main.LocalPlayer.HeldItem.summon = DefaultItem.summon; Main.LocalPlayer.HeldItem.thrown = DefaultItem.thrown; }; PDamageType = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/DamageType"), "Damage Type", DamageType); Accessory = new UIBool(); Accessory.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.accessory = e.Value; Accessory.OnRightClick += (source, e) => Main.LocalPlayer.HeldItem.accessory = DefaultItem.accessory; PAccessory = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/Accessory"), "Accessory", Accessory); Damage = new UIIntTextbox(); Damage.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.damage = e.Value; Damage.OnRightClick += (source, e) => Main.LocalPlayer.HeldItem.damage = DefaultItem.damage; PDamage = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/Damage"), "Damage", Damage); Critical = new UIIntTextbox(); Critical.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.crit = e.Value; Critical.OnRightClick += (source, e) => Main.LocalPlayer.HeldItem.crit = DefaultItem.crit; PCritical = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/CritChance"), "Crit Chance", Critical); KnockBack = new UIFloatTextbox(); KnockBack.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.knockBack = e.Value; KnockBack.OnRightClick += (source, e) => Main.LocalPlayer.HeldItem.knockBack = DefaultItem.knockBack; PKnockBack = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/Knockback"), "KnockBack", KnockBack); Shoot = new UIIntTextbox(0, ProjectileLoader.ProjectileCount - 1); Shoot.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.shoot = e.Value; Shoot.OnRightClick += (source, e) => Main.LocalPlayer.HeldItem.shoot = DefaultItem.shoot; PShoot = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/ProjectileShot"), "Projectile Shot", Shoot); ShootSpeed = new UIFloatTextbox(); ShootSpeed.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.shootSpeed = e.Value; ShootSpeed.OnRightClick += (source, e) => Main.LocalPlayer.HeldItem.shootSpeed = DefaultItem.shootSpeed; PShootSpeed = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/ProjectileSpeed"), "Shoot Speed", ShootSpeed); Tile = new UIIntTextbox(-1, TileLoader.TileCount - 1); Tile.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.createTile = e.Value; Tile.OnRightClick += (source, e) => Main.LocalPlayer.HeldItem.createTile = DefaultItem.createTile; PTile = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/CreateTile"), "Place Tile", Tile); TileBoost = new UIIntTextbox(); TileBoost.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.tileBoost = e.Value; TileBoost.OnRightClick += (source, e) => Main.LocalPlayer.HeldItem.tileBoost = DefaultItem.tileBoost; PTileBoost = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/AddedRange"), "Added Range", TileBoost); BuffContainer = new UIContainer() { Width = new SizeDimension(144f), Height = new SizeDimension(130f), OverflowHidden = true }; BuffTypes = new UIBuffTextbox[22]; BuffTimes = new UIIntTextbox[22]; BuffTypes[0] = new UIBuffTextbox() { Width = new SizeDimension(26f), Height = new SizeDimension(26f), Parent = BuffContainer }; BuffTypes[0].OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.buffType = e.Value; BuffTypes[0].OnRightClick += (source, e) => Main.LocalPlayer.HeldItem.buffType = DefaultItem.buffType; BuffTimes[0] = new UIIntTextbox(); BuffTimes[0].XOffset = new SizeDimension(BuffTypes[0].OuterWidth + 4); BuffTimes[0].Parent = BuffContainer; BuffTimes[0].OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.buffTime = e.Value; BuffTimes[0].OnRightClick += (source, e) => Main.LocalPlayer.HeldItem.buffTime = DefaultItem.buffTime; for (int i = 1; i < BuffTypes.Length; i++) { int id = i - 1; BuffTypes[i] = new UIBuffTextbox() { Width = new SizeDimension(26f), Height = new SizeDimension(26f), YOffset = new SizeDimension(i * 26f), Parent = BuffContainer }; BuffTypes[i].OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.GetGlobalItem <CustomProperties>().BuffTypes[id] = e.Value; BuffTypes[i].OnRightClick += (source, e) => Main.LocalPlayer.HeldItem.GetGlobalItem <CustomProperties>().BuffTypes[id] = DefaultItem.GetGlobalItem <CustomProperties>().BuffTypes[id]; BuffTimes[i] = new UIIntTextbox(); BuffTimes[i].XOffset = new SizeDimension(BuffTypes[i].OuterWidth + 4); BuffTimes[i].YOffset = new SizeDimension(i * 26f); BuffTimes[i].Parent = BuffContainer; BuffTimes[i].OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.GetGlobalItem <CustomProperties>().BuffTimes[id] = e.Value; BuffTimes[i].OnRightClick += (source, e) => Main.LocalPlayer.HeldItem.GetGlobalItem <CustomProperties>().BuffTimes[id] = DefaultItem.GetGlobalItem <CustomProperties>().BuffTimes[id]; } PBuff = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/BuffType"), "Buff", BuffContainer); HealHP = new UIIntTextbox(); HealHP.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.healLife = e.Value; HealHP.OnRightClick += (source, e) => Main.LocalPlayer.HeldItem.healLife = DefaultItem.healLife; PHealHP = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/HealHP"), "HP Healed", HealHP); HealMP = new UIIntTextbox(); HealMP.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.healMana = e.Value; HealMP.OnRightClick += (source, e) => Main.LocalPlayer.HeldItem.healMana = DefaultItem.healMana; PHealMP = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/HealMP"), "Mana Healed", HealMP); AxePower = new UIIntTextbox(); AxePower.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.axe = e.Value; AxePower.OnRightClick += (source, e) => Main.LocalPlayer.HeldItem.axe = DefaultItem.axe; PAxePower = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/AxePower"), "Axe Power", AxePower); PickaxePower = new UIIntTextbox(); PickaxePower.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.pick = e.Value; PickaxePower.OnRightClick += (source, e) => Main.LocalPlayer.HeldItem.pick = DefaultItem.pick; PPickaxePower = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/PickaxePower"), "Pickaxe Power", PickaxePower); HammerPower = new UIIntTextbox(); HammerPower.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.hammer = e.Value; HammerPower.OnRightClick += (source, e) => Main.LocalPlayer.HeldItem.hammer = DefaultItem.hammer; PHammerPower = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/HammerPower"), "Hammer Power", HammerPower); Stack = new UIIntTextbox(); Stack.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.stack = e.Value; Stack.OnRightClick += (source, e) => Main.LocalPlayer.HeldItem.stack = DefaultItem.stack; PStack = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/Stack"), "Amount", Stack); MaxStack = new UIIntTextbox(); MaxStack.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.maxStack = e.Value; MaxStack.OnRightClick += (source, e) => Main.LocalPlayer.HeldItem.maxStack = DefaultItem.maxStack; PMaxStack = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/MaxStack"), "Max Stack", MaxStack); UseAnimation = new UIIntTextbox(); UseAnimation.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.useAnimation = e.Value; UseAnimation.OnRightClick += (source, e) => Main.LocalPlayer.HeldItem.useAnimation = DefaultItem.useAnimation; PUseAnimation = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/UseAnimation"), "Animation Span", UseAnimation); UseTime = new UIIntTextbox(); UseTime.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.useTime = e.Value; UseTime.OnRightClick += (source, e) => Main.LocalPlayer.HeldItem.useTime = DefaultItem.useTime; PUseTime = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/UseTime"), "Use Span", UseTime); Defense = new UIIntTextbox(); Defense.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.defense = e.Value; Defense.OnRightClick += (source, e) => Main.LocalPlayer.HeldItem.defense = DefaultItem.defense; PDefense = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/Defense"), "Defense", Defense); FishingPower = new UIIntTextbox(); FishingPower.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.fishingPole = e.Value; FishingPower.OnRightClick += (source, e) => Main.LocalPlayer.HeldItem.fishingPole = DefaultItem.fishingPole; PFishingPower = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/FishingPower"), "Fishing Power", FishingPower); Scale = new UIFloatTextbox(); Scale.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.scale = e.Value; Scale.OnRightClick += (source, e) => Main.LocalPlayer.HeldItem.scale = DefaultItem.scale; PScale = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/Scale"), "Item Scale", Scale); UseStyleRadio = new UIRadioButtonContainer(); RSwing = new UIRadioButton("Swing") { Parent = UseStyleRadio }; RSwing.OnValueChanged += (source, e) => { if (e.Value) { Main.LocalPlayer.HeldItem.useStyle = ItemUseStyleID.SwingThrow; } }; RDrink = new UIRadioButton("Drink") { Parent = UseStyleRadio }; RDrink.OnValueChanged += (source, e) => { if (e.Value) { Main.LocalPlayer.HeldItem.useStyle = ItemUseStyleID.EatingUsing; } }; RStab = new UIRadioButton("Stab") { Parent = UseStyleRadio }; RStab.OnValueChanged += (source, e) => { if (e.Value) { Main.LocalPlayer.HeldItem.useStyle = ItemUseStyleID.Stabbing; } }; RAboveHead = new UIRadioButton("Above Head") { Parent = UseStyleRadio }; RAboveHead.OnValueChanged += (source, e) => { if (e.Value) { Main.LocalPlayer.HeldItem.useStyle = ItemUseStyleID.HoldingUp; } }; RHeld = new UIRadioButton("Held") { Parent = UseStyleRadio }; RHeld.OnValueChanged += (source, e) => { if (e.Value) { Main.LocalPlayer.HeldItem.useStyle = ItemUseStyleID.HoldingOut; } }; float uStyleWidth = 0f; for (int i = 0; i < UseStyleRadio.ChildrenCount; i++) { UIElement child = UseStyleRadio[i]; if (child.InnerWidth > uStyleWidth) { uStyleWidth = child.InnerWidth; } child.YOffset = new SizeDimension(RSwing.InnerHeight * i); } UseStyleRadio.Width = new SizeDimension(uStyleWidth); UseStyleRadio.Height = new SizeDimension(RSwing.InnerHeight * UseStyleRadio.ChildrenCount); UseStyleRadio.OnRightClick += (source, e) => Main.LocalPlayer.HeldItem.useStyle = DefaultItem.useStyle; UseStyleRadio.OnDeselected += (source, e) => { Item heldItem = Main.LocalPlayer.HeldItem; if (UseStyleRadio.Selected.Count < 1 && heldItem.useStyle <= ItemUseStyleID.HoldingOut) { heldItem.useStyle = 0; } }; UseStyle = new UIIntTextbox(); UseStyle.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.useStyle = e.Value; UseStyle.OnRightClick += (source, e) => Main.LocalPlayer.HeldItem.useStyle = DefaultItem.useStyle; PUseStyle = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/UseStyle"), "Use Style", UseStyleRadio, UseStyle); CostMP = new UIIntTextbox(); CostMP.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.mana = e.Value; CostMP.OnRightClick += (source, e) => Main.LocalPlayer.HeldItem.mana = DefaultItem.mana; PCostMP = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/CostMP"), "Mana Cost", CostMP); ToggleLiveSync = new UIImageButton(ModContent.GetTexture("ItemModifier/UI/Sync"), false, new Color(20, 255, 20)) { Width = new SizeDimension(16f), Height = new SizeDimension(16f), YOffset = CloseButton.YOffset }; ToggleLiveSync.Recalculate(); ToggleLiveSync.XOffset = new SizeDimension(CloseButton.CalculatedXOffset - ToggleLiveSync.OuterWidth - 3); // -3 spacing ToggleLiveSync.Parent = this; ToggleLiveSync.OnLeftClick += (source, e) => { LiveSync = !LiveSync; if (!LiveSync) { GrayBG.Visible = false; } }; ToggleLiveSync.WhileMouseHover += (source, e) => instance.Tooltip = "Toggle Live Sync"; ClearModifications = new UIImageButton(ModContent.GetTexture("ItemModifier/UI/ClearModifications"), false) { Width = new SizeDimension(16f), Height = new SizeDimension(16f), YOffset = CloseButton.YOffset }; ClearModifications.Recalculate(); ClearModifications.XOffset = new SizeDimension(ToggleLiveSync.CalculatedXOffset - ClearModifications.OuterWidth - 3); // -3 spacing ClearModifications.Parent = this; ClearModifications.OnLeftClick += (source, e) => Main.LocalPlayer.HeldItem.SetDefaults(Main.LocalPlayer.HeldItem.type); ClearModifications.WhileMouseHover += (source, e) => instance.Tooltip = "Clear Modifications"; /*SaveItemConfig = new UIImageButton(ModContent.GetTexture("ItemModifier/UI/Globe"), false) * { * Width = new SizeDimension(16f), * Height = new SizeDimension(16f), * YOffset = CloseButton.YOffset * }; * SaveItemConfig.Recalculate(); * SaveItemConfig.XOffset = new SizeDimension(ClearModifications.CalculatedXOffset - SaveItemConfig.OuterWidth - 3); * SaveItemConfig.Parent = this; * SaveItemConfig.OnLeftClick += (source, e) => * { * Item heldItem = Main.LocalPlayer.HeldItem; * if (heldItem.type == 0) * { * Main.NewText("Cannot modify air!"); * return; * } * List<ItemProperties> itemConfig = ItemConfig.Instance.ItemChanges; * int index = itemConfig.FindIndex(prop => prop.Type == heldItem.type); * if (index == -1) * { * ItemProperties props = new ItemProperties(heldItem.type); * props.FromItem(heldItem); * itemConfig.Add(props); * } * else * { * itemConfig[index].FromItem(heldItem); * } * Main.NewText("Global Change Added! Reload Required", Color.Green); * }; * SaveItemConfig.WhileMouseHover += (source, e) => instance.Tooltip = "Add to Item Config";*/ AllCategory = new UICategory("All", new List <UICategory.UIProperty> { PAutoReuse, PAxePower, PPickaxePower, PHammerPower, PDamageType, PDamage, PCritical, PKnockBack, PShoot, PShootSpeed, PAccessory, PDefense, PTileBoost, PTile, PConsumable, PPotion, PBuff, PHealHP, PHealMP, PCostMP, PStack, PMaxStack, PUseAnimation, PUseTime, PUseStyle, PFishingPower, PScale }); ToolsCategory = new UICategory("Tools", new List <UICategory.UIProperty> { PAutoReuse, PAxePower, PPickaxePower, PHammerPower, PCostMP, PUseAnimation, PUseTime, PUseStyle, PFishingPower }); WeaponsCategory = new UICategory("Weapons", new List <UICategory.UIProperty> { PAutoReuse, PDamageType, PDamage, PCritical, PKnockBack, PConsumable, PShoot, PShootSpeed, PCostMP, PUseAnimation, PUseAnimation, PUseStyle }); PotionsCategory = new UICategory("Potions", new List <UICategory.UIProperty> { PConsumable, PPotion, PBuff, PHealHP, PHealMP, PUseStyle }); ArmorCategory = new UICategory("Armor", new List <UICategory.UIProperty> { PDefense }); AccessoriesCategory = new UICategory("Accessories", new List <UICategory.UIProperty> { PAccessory, PDefense }); Categories = new List <UICategory> { AllCategory, ToolsCategory, WeaponsCategory, PotionsCategory, ArmorCategory, AccessoriesCategory }; CategoryContainer = new UIContainer() { Width = new SizeDimension(290f), Height = new SizeDimension(450f), XOffset = new SizeDimension(5f), YOffset = new SizeDimension(30f), OverflowHidden = true, Parent = this }; GrayBG = new UIContainer(new Color(47, 79, 79, 150)) { Width = CategoryContainer.Width, Height = CategoryContainer.Height, XOffset = CategoryContainer.XOffset, YOffset = CategoryContainer.YOffset, Parent = this }; GrayBG.OnVisibilityChanged += (source) => LockImage.Visible = source.Visible; LockImage = new UIImage(ModContent.GetTexture("ItemModifier/UI/Lock")); LockImage.XOffset = new SizeDimension((GrayBG.InnerWidth - LockImage.OuterWidth) * 0.5f); LockImage.YOffset = new SizeDimension((GrayBG.InnerHeight - LockImage.OuterHeight) * 0.5f); LockImage.Parent = GrayBG; CategoryIndex = 0; SetLimits(); }
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); } }; }