public override void OnInitialize() { ManualGeneratorMenu.SetDims(ruleElements, -200, 0.5f, 0, 0.1f, 400, 0, 0, 0.8f); ManualGeneratorMenu.SetDims(scrollBar, 232, 0.5f, 0, 0.1f, 32, 0, 0, 0.8f); ruleElements.SetScrollbar(scrollBar); Append(ruleElements); Append(scrollBar); ManualGeneratorMenu.SetDims(NewGuaranteed, -200, 0.5f, -50, 0.1f, 32, 0, 32, 0); NewGuaranteed.OnClick += (n, m) => ruleElements.Add(new GuaranteedRuleElement()); Append(NewGuaranteed); ManualGeneratorMenu.SetDims(NewChance, -160, 0.5f, -50, 0.1f, 32, 0, 32, 0); NewChance.OnClick += (n, m) => ruleElements.Add(new ChanceRuleElement()); Append(NewChance); ManualGeneratorMenu.SetDims(NewPool, -120, 0.5f, -50, 0.1f, 32, 0, 32, 0); NewPool.OnClick += (n, m) => ruleElements.Add(new PoolRuleElement()); Append(NewPool); ManualGeneratorMenu.SetDims(NewPoolChance, -80, 0.5f, -50, 0.1f, 32, 0, 32, 0); NewPoolChance.OnClick += (n, m) => ruleElements.Add(new PoolChanceRuleElement()); Append(NewPoolChance); ManualGeneratorMenu.SetDims(closeButton, 200 - 32, 0.5f, -50, 0.1f, 32, 0, 32, 0); closeButton.OnClick += (n, m) => Visible = false; Append(closeButton); }
public override void Load() { GeneratorMenuUI = new UserInterface(); GeneratorMenu = new ManualGeneratorMenu(); GeneratorMenuUI.SetState(GeneratorMenu); ChestMenuUI = new UserInterface(); ChestCustomizer = new ChestCustomizerState(); ChestMenuUI.SetState(ChestCustomizer); }
public override void Draw(SpriteBatch spriteBatch) { Recalculate(); var color = new Color(49, 84, 141); ManualGeneratorMenu.DrawBox(spriteBatch, NewGuaranteed.GetDimensions().ToRectangle(), NewGuaranteed.IsMouseHovering ? color : color * 0.8f); ManualGeneratorMenu.DrawBox(spriteBatch, NewChance.GetDimensions().ToRectangle(), NewChance.IsMouseHovering ? color : color * 0.8f); ManualGeneratorMenu.DrawBox(spriteBatch, NewPool.GetDimensions().ToRectangle(), NewPool.IsMouseHovering ? color : color * 0.8f); ManualGeneratorMenu.DrawBox(spriteBatch, NewPoolChance.GetDimensions().ToRectangle(), NewPoolChance.IsMouseHovering ? color : color * 0.8f); ManualGeneratorMenu.DrawBox(spriteBatch, closeButton.GetDimensions().ToRectangle(), closeButton.IsMouseHovering ? color : color * 0.8f); var rect = ruleElements.GetDimensions().ToRectangle(); rect.Inflate(30, 10); ManualGeneratorMenu.DrawBox(spriteBatch, rect, new Color(20, 40, 60) * 0.8f); if (rect.Contains(Main.MouseScreen.ToPoint())) { Main.LocalPlayer.mouseInterface = true; } if (NewGuaranteed.IsMouseHovering) { Main.hoverItemName = "Add New Guaranteed Rule"; Main.LocalPlayer.mouseInterface = true; } if (NewChance.IsMouseHovering) { Main.hoverItemName = "Add New Chance Rule"; Main.LocalPlayer.mouseInterface = true; } if (NewPool.IsMouseHovering) { Main.hoverItemName = "Add New Pool Rule"; Main.LocalPlayer.mouseInterface = true; } if (NewPoolChance.IsMouseHovering) { Main.hoverItemName = "Add New Pool + Chance Rule"; Main.LocalPlayer.mouseInterface = true; } if (closeButton.IsMouseHovering) { Main.hoverItemName = "Close"; Main.LocalPlayer.mouseInterface = true; } base.Draw(spriteBatch); }
public override void Draw(SpriteBatch spriteBatch) { Vector2 pos = GetDimensions().ToRectangle().TopLeft(); var target = new Rectangle((int)pos.X, (int)pos.Y, (int)GetDimensions().Width, 32); var color = Color.White; if (Parent.Parent.Parent is ChestRuleElement) { color = (Parent.Parent.Parent as ChestRuleElement).color; } if (removeButton.IsMouseHovering) { Main.hoverItemName = "Remove item"; } ManualGeneratorMenu.DrawBox(spriteBatch, target, color); int xOff = 0; if (weight is null) { xOff += 16; } spriteBatch.Draw(Helper.GetItemTexture(loot.LootItem), new Rectangle((int)pos.X + 8 + xOff, (int)pos.Y + 8, 16, 16), Color.White); string name = loot.LootItem.Name.Length > 25 ? loot.LootItem.Name.Substring(0, 23) + "..." : loot.LootItem.Name; Utils.DrawBorderString(spriteBatch, name, pos + new Vector2(28 + xOff, 10), Color.White, 0.7f); if (min.Value > max.Value) { min.Value = max.Value; } if (max.Value < min.Value) { max.Value = min.Value; } loot.min = min.Value; loot.max = max.Value; if (weight != null) { loot.weight = weight.Value; } base.Draw(spriteBatch); }
public override void Draw(SpriteBatch spriteBatch) { var pos = GetDimensions().ToRectangle().TopLeft(); var target = new Rectangle((int)pos.X, (int)pos.Y, (int)GetDimensions().Width, 32); ManualGeneratorMenu.DrawBox(spriteBatch, target, color); if (target.Contains(Main.MouseScreen.ToPoint())) { Main.hoverItemName = rule.Tooltip + "\nLeft click this while holding an item to add it"; } if (removeButton.IsMouseHovering) { Main.hoverItemName = "Remove rule"; } if (upButton.IsMouseHovering) { Main.hoverItemName = "Move Up"; } if (downButton.IsMouseHovering) { Main.hoverItemName = "Move Down"; } if (hideButton.IsMouseHovering) { Main.hoverItemName = storedHeight > 0 ? "Show Items" : "Hide Items"; } Utils.DrawBorderString(spriteBatch, rule.Name, pos + new Vector2(32, 8), Color.White, 0.8f); if (storedHeight == 0) { base.Draw(spriteBatch); } else { removeButton.Draw(spriteBatch); upButton.Draw(spriteBatch); downButton.Draw(spriteBatch); hideButton.Draw(spriteBatch); } }