public override void OnInitialize() { int checkboxesHeight = 30; mainPanel = new UIPanel(); mainPanel.SetPadding(0); mainPanel.Left.Set(300f, 0f); mainPanel.Top.Set(300f, 0f); mainPanel.Width.Set(200f, 0f); mainPanel.Height.Set(300f + checkboxesHeight, 0f); mainPanel.BackgroundColor = new Color(73, 94, 171); mainPanel.OnMouseDown += DragStart; mainPanel.OnMouseUp += DragEnd; Texture2D closeTexture = AutoTrash.instance.GetTexture("closeButton"); UIImageButton closeButton = new UIImageButton(closeTexture); closeButton.Left.Set(-32, 1f); closeButton.Top.Set(10, 0f); closeButton.Width.Set(22, 0f); closeButton.Height.Set(22, 0f); closeButton.OnClick += new MouseEvent(CloseButtonClicked); mainPanel.Append(closeButton); UIText label = new UIText("Click to remove"); label.Left.Set(8, 0f); label.Top.Set(8, 0f); mainPanel.Append(label); autoTrashGrid = new UIGrid(4); autoTrashGrid.Top.Pixels = 32f + spacing; autoTrashGrid.Left.Pixels = spacing; autoTrashGrid.Width.Set(-25f, 1f); autoTrashGrid.Height.Set(-55f - checkboxesHeight, 1f); autoTrashGrid.ListPadding = 12f; autoTrashGrid.OnScrollWheel += OnScrollWheel_FixHotbarScroll; mainPanel.Append(autoTrashGrid); autoTrashGridScrollbar = new FixedUIScrollbar(); autoTrashGridScrollbar.SetView(100f, 1000f); autoTrashGridScrollbar.Top.Pixels = 32f + spacing; autoTrashGridScrollbar.Height.Set(-50f - spacing - checkboxesHeight, 1f); autoTrashGridScrollbar.HAlign = 1f; mainPanel.Append(autoTrashGridScrollbar); autoTrashGrid.SetScrollbar(autoTrashGridScrollbar); NoValueCheckbox = new UICheckbox("No Value", "Trash all Items with No Value"); NoValueCheckbox.Top.Set(300, 0f); NoValueCheckbox.Left.Set(12, 0f); NoValueCheckbox.OnSelectedChanged += (a, b) => Main.LocalPlayer.GetModPlayer <AutoTrashPlayer>().NoValue = NoValueCheckbox.Selected; mainPanel.Append(NoValueCheckbox); Append(mainPanel); }
public override void OnInitialize() { mainPanel = new UIPanel(); mainPanel.SetPadding(0); mainPanel.Left.Set(300f, 0f); mainPanel.Top.Set(300f, 0f); mainPanel.Width.Set(200f, 0f); mainPanel.Height.Set(300f, 0f); mainPanel.BackgroundColor = new Color(73, 94, 171); mainPanel.OnMouseDown += DragStart; mainPanel.OnMouseUp += DragEnd; Texture2D closeTexture = AutoTrash.instance.GetTexture("closeButton"); UIImageButton closeButton = new UIImageButton(closeTexture); closeButton.Left.Set(-32, 1f); closeButton.Top.Set(10, 0f); closeButton.Width.Set(22, 0f); closeButton.Height.Set(22, 0f); closeButton.OnClick += new MouseEvent(CloseButtonClicked); mainPanel.Append(closeButton); UIText label = new UIText("Click to remove"); label.Left.Set(8, 0f); label.Top.Set(8, 0f); mainPanel.Append(label); autoTrashGrid = new UIGrid(4); autoTrashGrid.Top.Pixels = 32f + spacing; autoTrashGrid.Left.Pixels = spacing; autoTrashGrid.Width.Set(-25f, 1f); autoTrashGrid.Height.Set(-55f, 1f); autoTrashGrid.ListPadding = 12f; mainPanel.Append(autoTrashGrid); autoTrashGridScrollbar = new FixedUIScrollbar(); autoTrashGridScrollbar.SetView(100f, 1000f); autoTrashGridScrollbar.Top.Pixels = 32f + spacing; autoTrashGridScrollbar.Height.Set(-50f - spacing, 1f); autoTrashGridScrollbar.HAlign = 1f; mainPanel.Append(autoTrashGridScrollbar); autoTrashGrid.SetScrollbar(autoTrashGridScrollbar); Append(mainPanel); }