public override void OnInitialize() { keyboardPanel = new UIPanel(); keyboardPanel.SetPadding(8); keyboardPanel.Left.Set(-550f, 1f); keyboardPanel.Top.Set(-370f, 1f); keyboardPanel.Width.Set(500f, 0f); keyboardPanel.Height.Set(300f, 0f); keyboardPanel.BackgroundColor = new Color(73, 94, 171); codeTextBox = new NewUITextBox("Type code here", 1f); codeTextBox.SetUnfocusKeys(false, false); codeTextBox.BackgroundColor = Color.Transparent; codeTextBox.BorderColor = Color.Transparent; codeTextBox.Left.Pixels = 0; codeTextBox.Top.Pixels = 0; codeTextBox.Width.Set(-20, 1f); //filterTextBox.OnTextChanged += () => { filterText = filterTextBox.Text; updateneeded = true; }; codeTextBox.OnEnterPressed += EnterAction; codeTextBox.OnTabPressed += TabAction; codeTextBox.OnUpPressed += UpAction; keyboardPanel.Append(codeTextBox); replOutput = new UIList(); replOutput.Width.Set(-25f, 1f); // left spacing plus scrollbar replOutput.Height.Set(-codeTextBox.GetDimensions().Height - 32, 1f); replOutput.Left.Set(0, 0f); replOutput.Top.Set(codeTextBox.GetDimensions().Height, 0f); replOutput.ListPadding = 10f; keyboardPanel.Append(replOutput); keyboardScrollbar = new UIElements.FixedUIScrollbar(userInterface); keyboardScrollbar.SetView(100f, 1000f); keyboardScrollbar.Top.Pixels = codeTextBox.GetDimensions().Height; keyboardScrollbar.Height.Set(-32, 1f); keyboardScrollbar.Left.Set(-4, 0f); keyboardScrollbar.HAlign = 1f; keyboardPanel.Append(keyboardScrollbar); replOutput.SetScrollbar(keyboardScrollbar); UIImageButton eyeDropperButton = new UIImageButton(ModdersToolkit.instance.GetTexture("UIElements/eyedropper")); eyeDropperButton.OnClick += EyeDropperButton_OnClick; eyeDropperButton.Top.Set(-32, 1f); keyboardPanel.Append(eyeDropperButton); Append(keyboardPanel); }
public override void OnInitialize() { panel = new DragableUIPanel(); panel.SetPadding(0); panel.HAlign = panel.VAlign = .5f; panel.Width.Set(180, 0); panel.Height.Set(70, 0); textBox = new NewUITextBox("Enter stack"); textBox.SetPadding(0); textBox.Left.Set(20, 0); textBox.Top.Set(10, 0); textBox.Width.Set(140, 0); textBox.Height.Set(20, 0); panel.Append(textBox); Append(panel); }
//static string modSourcespath = ModLoader.ModSourcePath public override void OnInitialize() { mainPanel = new UIPanel(); mainPanel.Left.Set(-350f, 1f); mainPanel.Top.Set(-620f, 1f); mainPanel.Width.Set(310f, 0f); mainPanel.Height.Set(520f, 0f); mainPanel.SetPadding(12); mainPanel.BackgroundColor = Color.PeachPuff * 0.8f; int top = 0; UIText text = new UIText("Textures:", 0.85f); text.Top.Set(top, 0f); mainPanel.Append(text); top += 20; modList = new UIList(); modList.Top.Pixels = top; modList.Width.Set(-25f, 1f); modList.Height.Set(140, 0f); modList.ListPadding = 0f; mainPanel.Append(modList); var modListScrollbar = new UIElements.FixedUIScrollbar(userInterface); modListScrollbar.SetView(100f, 1000f); modListScrollbar.Top.Pixels = top + 10; // + spacing; modListScrollbar.Height.Set(120, 0f); modListScrollbar.HAlign = 1f; mainPanel.Append(modListScrollbar); modList.SetScrollbar(modListScrollbar); top += 140; watchModSources = new UICheckbox("Watch Mod Sources", "Automatically Watch Mod Sources for Changes", false); watchModSources.Top.Set(top, 0); watchModSources.OnSelectedChanged += WatchModSources_OnSelectedChanged; mainPanel.Append(watchModSources); top += 20; UIText text2 = new UIText("Filter:", 0.85f); text2.Top.Set(top, 0f); mainPanel.Append(text2); searchFilter = new NewUITextBox("Search", 0.85f); searchFilter.SetPadding(0); searchFilter.OnTextChanged += () => { updateneeded = true; }; searchFilter.Top.Set(top, 0f); searchFilter.Left.Set(text2.GetInnerDimensions().Width + 6, 0f); searchFilter.Width.Set(-(text2.GetInnerDimensions().Width + 6), 1f); searchFilter.Height.Set(20, 0f); mainPanel.Append(searchFilter); top += 20; currentTexture = new UIText("Current: None selected", 0.85f); currentTexture.Top.Set(top, 0f); currentTexture.Left.Set(0, 0f); currentTexture.Width.Set(0, 1); currentTexture.HAlign = 0; mainPanel.Append(currentTexture); top += 20; textureList = new UIList(); textureList.Top.Pixels = top; textureList.Width.Set(-25f, 1f); textureList.Height.Set(250, 0f); textureList.ListPadding = 6f; mainPanel.Append(textureList); var textureListScrollbar = new UIElements.FixedUIScrollbar(userInterface); textureListScrollbar.SetView(100f, 1000f); textureListScrollbar.Top.Pixels = top + 10; // + spacing; textureListScrollbar.Height.Set(230, 0f); textureListScrollbar.HAlign = 1f; mainPanel.Append(textureListScrollbar); textureList.SetScrollbar(textureListScrollbar); top += 250; //UIHoverImageButton exportImageButton = new UIHoverImageButton(ModdersToolkit.instance.GetTexture("UIElements/CopyCodeButton"), "Export Image for Editing"); //exportImageButton.OnClick += ExportImageButton_OnClick; //exportImageButton.Top.Set(top + 5, 0f); //exportImageButton.Left.Set(0, 0f); //mainPanel.Append(exportImageButton); UIHoverImageButton editImageButton = new UIHoverImageButton(ModdersToolkit.instance.GetTexture("UIElements/eyedropper"), "Open Exported Image in Default Editor"); editImageButton.OnClick += EditImageButton_OnClick; editImageButton.Top.Set(top + 5, 0f); editImageButton.Left.Set(0, 0f); mainPanel.Append(editImageButton); updateneeded = true; Append(mainPanel); }
public override void OnInitialize() { base.OnInitialize(); mainPanel = new UIPanel(); width = 310; height = 610; mainPanel.SetPadding(6); mainPanel.BackgroundColor = Color.Orange * 0.7f; int top = 0; UIText text = new UIText("Projectiles:", 0.85f); text.Top.Set(top, 0f); mainPanel.Append(text); UITextPanel <string> clearProjectilesButton = new UITextPanel <string>("Clear Projectiles"); clearProjectilesButton.OnClick += (a, b) => { for (int i = 0; i < Main.maxProjectiles; i++) { if (Main.projectile[i].active) { Main.projectile[i].Kill(); if (Main.netMode == 1) { NetMessage.SendData(27, -1, -1, null, i, 0f, 0f, 0f, 0); } } } }; clearProjectilesButton.Top.Set(top, 0f); clearProjectilesButton.Width.Set(-10, 0.5f); clearProjectilesButton.HAlign = 1; clearProjectilesButton.SetPadding(4); mainPanel.Append(clearProjectilesButton); top += 20; UIText text2 = new UIText("Filter:", 0.85f); text2.Top.Set(top, 0f); mainPanel.Append(text2); searchFilter = new NewUITextBox("Search", 0.85f); searchFilter.SetPadding(0); searchFilter.OnTextChanged += () => { ValidateInput(); updateNeeded = true; }; searchFilter.Top.Set(top, 0f); searchFilter.Left.Set(text2.GetInnerDimensions().Width, 0f); searchFilter.Width.Set(-text2.GetInnerDimensions().Width, 1f); searchFilter.Height.Set(20, 0f); //searchFilter.VAlign = 0.5f; mainPanel.Append(searchFilter); top += 20; speedXDataProperty = new UIFloatRangedDataValue("SpeedX:", 0, -10, 10); speedYDataProperty = new UIFloatRangedDataValue("SpeedY:", 0, -10, 10); var ui2DRange = new UI2DRange <float>(speedXDataProperty, speedYDataProperty); ui2DRange.Top.Set(top, 0f); mainPanel.Append(ui2DRange); top += 30; ai0DataProperty = new UIFloatRangedDataValue("ai0:", 0, -10, 10); var uiRange = new UIRange <float>(ai0DataProperty); uiRange.Top.Set(top, 0f); uiRange.Width.Set(0, 1f); mainPanel.Append(uiRange); top += 30; ai1DataProperty = new UIFloatRangedDataValue("ai1:", 0, -10, 10); uiRange = new UIRange <float>(ai1DataProperty); uiRange.Top.Set(top, 0f); uiRange.Width.Set(0, 1f); mainPanel.Append(uiRange); top += 30; knockbackDataProperty = new UIFloatRangedDataValue("Knockback:", 0, 0, 20); uiRange = new UIRange <float>(knockbackDataProperty); uiRange.Top.Set(top, 0f); uiRange.Width.Set(0, 1f); mainPanel.Append(uiRange); top += 30; damageDataProperty = new UIIntRangedDataValue("Damage:", 20, 0, 200); var uiRangeI = new UIRange <int>(damageDataProperty); uiRangeI.Top.Set(top, 0f); uiRangeI.Width.Set(0, 1f); mainPanel.Append(uiRangeI); top += 30; aiStyleDataProperty = new UIIntRangedDataValue("AIStyle:", -1, -1, 145); uiRangeI = new UIRange <int>(aiStyleDataProperty); uiRangeI.Top.Set(top, 0f); uiRangeI.Width.Set(0, 1f); mainPanel.Append(uiRangeI); top += 30; drawOffsetXDataProperty = new UIIntRangedDataValue("drawOffsetX:", 0, -30, 30); uiRangeI = new UIRange <int>(drawOffsetXDataProperty); uiRangeI.Top.Set(top, 0f); uiRangeI.Width.Set(0, 1f); mainPanel.Append(uiRangeI); top += 30; drawOriginOffsetXDataProperty = new UIIntRangedDataValue("drawOriginOffsetX:", 0, -30, 30); uiRangeI = new UIRange <int>(drawOriginOffsetXDataProperty); uiRangeI.Top.Set(top, 0f); uiRangeI.Width.Set(0, 1f); mainPanel.Append(uiRangeI); top += 30; drawOriginOffsetYDataProperty = new UIIntRangedDataValue("drawOriginOffsetY:", 0, -30, 30); uiRangeI = new UIRange <int>(drawOriginOffsetYDataProperty); uiRangeI.Top.Set(top, 0f); uiRangeI.Width.Set(0, 1f); mainPanel.Append(uiRangeI); top += 30; hostile = new UIBoolNDataValue("Hostile"); var hostileCheckbox = new UITriStateCheckbox(hostile); hostileCheckbox.Top.Set(top, 0f); mainPanel.Append(hostileCheckbox); top += 30; friendly = new UIBoolNDataValue("Friendly"); var friendlyCheckbox = new UITriStateCheckbox(friendly); friendlyCheckbox.Top.Set(top, 0f); mainPanel.Append(friendlyCheckbox); top += 25; pause = new UICheckbox("Pause", "Pauses All Projectiles (Prevent AI from running)"); pause.Top.Set(top, 0f); mainPanel.Append(pause); UIHoverImageButton stepButton = new UIHoverImageButton(ModdersToolkit.Instance.GetTexture("UIElements/next"), "Step"); stepButton.OnClick += (s, e) => step = true; stepButton.Top.Set(top - 6, 0f); stepButton.Left.Set(80, 0f); mainPanel.Append(stepButton); top += 25; freeze = new UICheckbox("Freeze", "Zero out velocity during PreAI for All Projectiles"); freeze.Top.Set(top, 0f); mainPanel.Append(freeze); top += 25; projectileGrid = new UIGrid(7); projectileGrid.Top.Pixels = top; //autoTrashGrid.Left.Pixels = spacing; projectileGrid.Width.Set(-25f, 1f); // leave space for scroll? projectileGrid.Height.Set(-top, 1f); projectileGrid.ListPadding = 6f; mainPanel.Append(projectileGrid); // this will initialize grid updateNeeded = true; var projectileGridScrollbar = new UIElements.FixedUIScrollbar(_userInterface); projectileGridScrollbar.SetView(100f, 1000f); projectileGridScrollbar.Top.Pixels = top; // + spacing; projectileGridScrollbar.Height.Set(-top /*- spacing*/, 1f); projectileGridScrollbar.HAlign = 1f; mainPanel.Append(projectileGridScrollbar); projectileGrid.SetScrollbar(projectileGridScrollbar); AdjustMainPanelDimensions(mainPanel); Append(mainPanel); }
public override void OnInitialize() { TabPanel Menu = new TabPanel(450, 500, new Tab("Custom NPC", this), new Tab(" Custom Item", new CustomItemUI())); Menu.VAlign = 0.6f; Menu.HAlign = 0.2f; Menu.OnCloseBtnClicked += () => GetInstance <Creativetools>().UserInterface.SetState(new MainUI()); Append(Menu); UITextPanel <string> CreateButton = new UITextPanel <string>(Language.GetTextValue("Create NPC")); CreateButton.SetPadding(4); CreateButton.HAlign = 0.05f; CreateButton.MarginTop = 460; CreateButton.OnClick += CreateButtonButtonClicked; Menu.Append(CreateButton); UITextPanel <string> CodeButton = new UITextPanel <string>(Language.GetTextValue("Copy Code")); CodeButton.SetPadding(4); CodeButton.HAlign = 0.5f; CodeButton.MarginTop = 460; CodeButton.OnClick += CodeButtonClicked; Menu.Append(CodeButton); UITextPanel <string> FileButton = new UITextPanel <string>(Language.GetTextValue("Select Texture")); FileButton.SetPadding(4); FileButton.HAlign = 0.9f; FileButton.MarginTop = 460; FileButton.OnClick += FileButtonClicked; Menu.Append(FileButton); nametext = new NewUITextBox("Enter name here"); nametext.HAlign = 0.5f; nametext.MarginTop = 50; nametext.Width.Set(-40f, 1f); Menu.Append(nametext); MakeSlider(new UIIntRangedDataValue("Life: ", 0, 0, 999), out LifeDataProperty, Menu, top: 100); MakeSlider(new UIIntRangedDataValue("Damage: ", 0, 0, 999), out DamageDataProperty, Menu, top: 150); MakeSlider(new UIIntRangedDataValue("Defense: ", 0, 0, 999), out DefenseDataProperty, Menu, top: 200); MakeSlider(new UIIntRangedDataValue("AiStyle: ", 1, 0, 111), out AiSyleDataProperty, Menu, top: 250); MakeSlider(new UIFloatRangedDataValue("Knockback resist: ", 0, 0, 1), out KnockbackDataProperty, Menu, 300); MakeSlider(new UIFloatRangedDataValue("Scale: ", 1, 0, 10), out ScaleDataProperty, Menu, top: 350); FrameDataProperty = new UIIntRangedDataValue("", 1, 1, 20); UIElement FrameSlider = new UIRange <int>(FrameDataProperty) { MarginTop = 410, HAlign = 0.35f }; FrameSlider.Width.Set(0, 0.4f); FrameSlider.Append(new UIText("Frame count:") { HAlign = 0.9f, MarginTop = -15 }); Menu.Append(FrameSlider); UITextPanel <string> NoCollideButton = new UITextPanel <string>("Collision: true") { HAlign = 0.05f, MarginTop = 400 }; NoCollideButton.OnClick += (evt, elm) => { CustomNPC.cNoCollide = !CustomNPC.cNoCollide; NoCollideButton.SetText("Collision: " + !CustomNPC.cNoCollide); }; Menu.Append(NoCollideButton); UITextPanel <string> ImmortalButton = new UITextPanel <string>("Immortal: false") { HAlign = 0.95f, MarginTop = 400 }; ImmortalButton.OnClick += (evt, elm) => { CustomNPC.cImmortal = !CustomNPC.cImmortal; ImmortalButton.SetText("Immortal: " + CustomNPC.cImmortal); }; Menu.Append(ImmortalButton); }
public override void OnInitialize() { mainPanel = new UIPanel(); mainPanel.Left.Set(-350f, 1f); mainPanel.Top.Set(-740f, 1f); mainPanel.Width.Set(310f, 0f); mainPanel.Height.Set(640f, 0f); mainPanel.SetPadding(6); mainPanel.BackgroundColor = Color.PeachPuff * 0.8f; int top = 0; UIText text = new UIText("Shaders:", 0.85f); text.Top.Set(top, 0f); mainPanel.Append(text); top += 20; int topModSourcesPanel = 0; var modSourcesPanel = new UIPanel(); modSourcesPanel.Top.Set(top, 0f); modSourcesPanel.Width.Set(0, 1f); modSourcesPanel.Height.Set(370f, 0f); modSourcesPanel.SetPadding(6); modSourcesPanel.BackgroundColor = Color.Blue * 0.7f; top += 376; text = new UIText("Mod Sources:", 0.85f); text.Top.Set(topModSourcesPanel, 0f); modSourcesPanel.Append(text); topModSourcesPanel += 20; var modListBackPanel = new UIPanel(); modListBackPanel.Top.Set(topModSourcesPanel, 0); modListBackPanel.Width.Set(0, 1f); modListBackPanel.Height.Set(120f, 0f); modListBackPanel.SetPadding(6); modListBackPanel.BackgroundColor = Color.Green * 0.7f; modList = new UIList(); modList.Width.Set(-25f, 1f); modList.Height.Set(0, 1f); modList.ListPadding = 0f; modListBackPanel.Append(modList); var modListScrollbar = new UIElements.FixedUIScrollbar(userInterface); modListScrollbar.SetView(100f, 1000f); modListScrollbar.Top.Pixels = 4; modListScrollbar.Height.Set(-8, 1f); modListScrollbar.HAlign = 1f; modListBackPanel.Append(modListScrollbar); modList.SetScrollbar(modListScrollbar); modSourcesPanel.Append(modListBackPanel); mainPanel.Append(modSourcesPanel); topModSourcesPanel += 130; text = new UIText("Filter:", 0.85f); text.Top.Set(topModSourcesPanel, 0f); modSourcesPanel.Append(text); searchFilter = new NewUITextBox("Search", 0.85f); searchFilter.SetPadding(0); searchFilter.OnTextChanged += () => { updateneeded = true; }; searchFilter.Top.Set(topModSourcesPanel, 0f); searchFilter.Left.Set(text.GetInnerDimensions().Width + 6, 0f); searchFilter.Width.Set(-(text.GetInnerDimensions().Width + 6), 1f); searchFilter.Height.Set(20, 0f); modSourcesPanel.Append(searchFilter); topModSourcesPanel += 26; currentShader = new UIText("Current: None selected", 0.85f); currentShader.Top.Set(topModSourcesPanel, 0f); currentShader.Left.Set(0, 0f); currentShader.Width.Set(0, 1); currentShader.HAlign = 0; modSourcesPanel.Append(currentShader); topModSourcesPanel += 20; var shaderListBackPanel = new UIPanel(); shaderListBackPanel.Top.Set(topModSourcesPanel, 0); shaderListBackPanel.Width.Set(0, 1f); shaderListBackPanel.Height.Set(140f, 0f); shaderListBackPanel.SetPadding(6); shaderListBackPanel.BackgroundColor = Color.Green * 0.7f; shaderList = new UIList(); shaderList.Width.Set(-25f, 1f); shaderList.Height.Set(0, 1f); shaderList.ListPadding = 0f; shaderListBackPanel.Append(shaderList); var shaderListScrollbar = new UIElements.FixedUIScrollbar(userInterface); shaderListScrollbar.SetView(100f, 1000f); shaderListScrollbar.Top.Pixels = 4; shaderListScrollbar.Height.Set(-8, 1f); shaderListScrollbar.HAlign = 1f; shaderListBackPanel.Append(shaderListScrollbar); shaderList.SetScrollbar(shaderListScrollbar); modSourcesPanel.Append(shaderListBackPanel); topModSourcesPanel += 146; watchModSourcesCheckbox = new UICheckbox("Watch Mod Sources", "Automatically Compile Mod Sources Shaders when Changed on Disk", false); watchModSourcesCheckbox.Top.Set(topModSourcesPanel, 0); watchModSourcesCheckbox.OnSelectedChanged += WatchModSources_OnSelectedChanged; modSourcesPanel.Append(watchModSourcesCheckbox); topModSourcesPanel += 20; int topTestShaderPanel = 0; var testShaderPanel = new UIPanel(); testShaderPanel.Top.Set(top, 0f); testShaderPanel.Width.Set(0, 1f); testShaderPanel.Height.Set(230f, 0f); testShaderPanel.SetPadding(6); testShaderPanel.BackgroundColor = Color.LightBlue * 0.7f; top += 230; mainPanel.Append(testShaderPanel); text = new UIText("Test Shader:", 0.85f); text.Top.Set(topTestShaderPanel, 0f); testShaderPanel.Append(text); topTestShaderPanel += 20; // Current Working Shader // Status Text: "Compiled .fx" // Filter? // Checkbox: Force UIRadioButtonGroup g = new UIRadioButtonGroup(); armorShaderRadioButton = new UIRadioButton("Armor", "Generate an Armor Shader"); screenShaderRadioButton = new UIRadioButton("Screen", "Generate a Screen Shader"); g.Add(armorShaderRadioButton); g.Add(screenShaderRadioButton); g.Top.Pixels = topTestShaderPanel; g.Width.Set(0, .75f); testShaderPanel.Append(g); armorShaderRadioButton.Selected = true; topTestShaderPanel += (int)g.Height.Pixels; var createTestShaderButton = new UITextPanel <string>("Create/Recreate Test Shader"); createTestShaderButton.OnClick += CreateTestShaderFileButton_OnClick; createTestShaderButton.Top.Set(topTestShaderPanel, 0f); createTestShaderButton.Left.Set(0, 0f); createTestShaderButton.SetPadding(4); testShaderPanel.Append(createTestShaderButton); topTestShaderPanel += 26; var openTestShaderButton = new UITextPanel <string>("Edit Test Shader"); openTestShaderButton.OnClick += OpenTestShaderFileButton_OnClick; openTestShaderButton.Top.Set(topTestShaderPanel, 0f); openTestShaderButton.Left.Set(0, 0f); openTestShaderButton.SetPadding(4); testShaderPanel.Append(openTestShaderButton); topTestShaderPanel += 26; var compileShaderButton = new UITextPanel <string>("Compile Test Shader"); compileShaderButton.OnClick += CompileTestShaderButton_OnClick; compileShaderButton.Top.Set(topTestShaderPanel, 0f); compileShaderButton.Left.Set(0, 0f); compileShaderButton.SetPadding(4); testShaderPanel.Append(compileShaderButton); topTestShaderPanel += 26; topTestShaderPanel += 4; watchTestShaderCheckbox = new UICheckbox("Watch Test Shader File", "Automatically Compile Test Shader when Changed on Disk", true); watchTestShaderCheckbox.Top.Set(topTestShaderPanel, 0); watchTestShaderCheckbox.OnSelectedChanged += WatchTestShader_OnSelectedChanged; testShaderPanel.Append(watchTestShaderCheckbox); topTestShaderPanel += 20; forceShaderCheckbox = new UICheckbox("Force Shader Active", "Automatically enable the last compiled screen shader.", true); forceShaderCheckbox.Top.Set(topTestShaderPanel, 0); //forceShaderCheckbox.OnSelectedChanged += ForceShaderCheckbox_OnSelectedChanged; testShaderPanel.Append(forceShaderCheckbox); topTestShaderPanel += 20; var uiRanges = new List <UIElement>(); colorDataProperty = new Dusts.ColorDataRangeProperty("uColor:"); colorDataProperty.range.Top.Set(top, 0f); colorDataProperty.OnValueChanged += () => Filters.Scene["ModdersToolkit:TestScreenShader"].GetShader().UseColor(colorDataProperty.Data); uiRanges.Add(colorDataProperty.range); intensityData = new UIFloatRangedDataValue("uIntensity:", 1f, 0f, 1f); intensityData.DataGetter = () => Filters.Scene["ModdersToolkit:TestScreenShader"].GetShader().Intensity; intensityData.DataSetter = (value) => Filters.Scene["ModdersToolkit:TestScreenShader"].GetShader().UseIntensity(value); uiRanges.Add(new UIRange <float>(intensityData)); //var uDirectionXProperty = new UIFloatRangedDataValue("uDirectionX:", 0, -1, 1); //uDirectionXProperty.DataGetter = () => Filters.Scene["ModdersToolkit:TestScreenShader"].GetShader().UseDirection.Intensity; //uDirectionXProperty.DataSetter = (value) => Filters.Scene["ModdersToolkit:TestScreenShader"].GetShader().UseDirection(value); //var uDirectionYProperty = new UIFloatRangedDataValue("uDirectionY:", 0, -1, 1); //var ui2DRange = new UI2DRange<float>(uDirectionXProperty, uDirectionYProperty); //uiRanges.Add(ui2DRange); //ui2DRange.Top.Set(top, 0f); //ui2DRange.Left.Set(200, 0f); //mainPanel.Append(ui2DRange); //top += 30; foreach (var uiRange in uiRanges) { uiRange.Top.Set(topTestShaderPanel, 0f); uiRange.Width.Set(0, 1f); testShaderPanel.Append(uiRange); topTestShaderPanel += 22; } updateneeded = true; Append(mainPanel); }
public override void OnInitialize() { mainPanel = new UIPanel(); mainPanel.SetPadding(6); int width = 350; int height = 840; mainPanel.Left.Set(-40f - width, 1f); mainPanel.Top.Set(-110f - height, 1f); mainPanel.Width.Set(width, 0f); mainPanel.Height.Set(height, 0f); mainPanel.BackgroundColor = new Color(173, 94, 171); int playgroundPanelWidth = 400; int playgroundPanelHeight = 150; playgroundPanel = new DebugDrawUIPanel(); playgroundPanel.SetPadding(0); playgroundPanel.Left.Set(0, .15f); playgroundPanel.Top.Set(0, .5f); playgroundPanel.Width.Set(playgroundPanelWidth, 0f); playgroundPanel.Height.Set(playgroundPanelHeight, 0f); playgroundPanel.BackgroundColor = new Color(108, 226, 108); Append(playgroundPanel); playgroundText = new UIText("Example UIText"); playgroundTextPanel = new UITextPanel <string>("Example UITextPanel"); playgroundImageButton = new UIImageButton(TextureAssets.InventoryBack10); // checkboxes int top = 0; int indent = 0; UIElement uiRange; UIText text = new UIText("UIPlayground UI:", 0.85f); //text.Top.Set(12f, 0f); //text.Left.Set(12f, 0f); mainPanel.Append(text); top += 20; panelPaddingData = new UIIntRangedDataValue("Panel Padding:", 0, 0, 12); uiRange = new UIRange <int>(panelPaddingData); panelPaddingData.OnValueChanged += () => UpdatePlaygroundChildren(); uiRange.Top.Set(top, 0f); uiRange.Width.Set(0, 1f); uiRange.Left.Set(indent, 0); mainPanel.Append(uiRange); top += 20; drawInnerDimensionsCheckbox = new UICheckbox("Draw Inner Dimensions", "Inner Dimensions takes into account Padding of the current UIElement"); drawInnerDimensionsCheckbox.TextColor = Color.Blue; drawInnerDimensionsCheckbox.Top.Set(top, 0f); drawInnerDimensionsCheckbox.Left.Set(indent, 0f); mainPanel.Append(drawInnerDimensionsCheckbox); top += 20; drawDimensionsCheckbox = new UICheckbox("Draw Dimensions", ""); drawDimensionsCheckbox.TextColor = Color.Pink; drawDimensionsCheckbox.Top.Set(top, 0f); drawDimensionsCheckbox.Left.Set(indent, 0f); mainPanel.Append(drawDimensionsCheckbox); top += 20; drawOuterDimensionsCheckbox = new UICheckbox("Draw Outer Dimensions", "Outer Dimensions takes into account Margin of the current UIElement"); drawOuterDimensionsCheckbox.TextColor = Color.Yellow; drawOuterDimensionsCheckbox.Top.Set(top, 0f); drawOuterDimensionsCheckbox.Left.Set(indent, 0f); mainPanel.Append(drawOuterDimensionsCheckbox); top += 20; top += 8; // additional spacing playgroundTextCheckbox = new UICheckbox("UIText", "Show UIText"); playgroundTextCheckbox.Top.Set(top, 0f); playgroundTextCheckbox.Left.Set(indent, 0f); playgroundTextCheckbox.OnSelectedChanged += () => UpdatePlaygroundChildren(); mainPanel.Append(playgroundTextCheckbox); top += 20; indent = 18; textHAlign = new UIFloatRangedDataValue("HAlign:", 0, 0, 1); textVAlign = new UIFloatRangedDataValue("VAlign:", 0, 0, 1); textLeftPixels = new UIFloatRangedDataValue("LeftPixels:", 0, 0, playgroundPanelWidth); textLeftPercent = new UIFloatRangedDataValue("LeftPercent:", 0, 0, 1); textTopPixels = new UIFloatRangedDataValue("TopPixels:", 0, 0, playgroundPanelHeight); textTopPercent = new UIFloatRangedDataValue("TopPercent:", 0, 0, 1); AppendRange(ref top, indent, textHAlign); AppendRange(ref top, indent, textVAlign); AppendRange(ref top, indent, textLeftPixels); AppendRange(ref top, indent, textLeftPercent); AppendRange(ref top, indent, textTopPixels); AppendRange(ref top, indent, textTopPercent); textHAlign.OnValueChanged += () => UpdatePlaygroundChildren(); textVAlign.OnValueChanged += () => UpdatePlaygroundChildren(); textLeftPixels.OnValueChanged += () => UpdatePlaygroundChildren(); textLeftPercent.OnValueChanged += () => UpdatePlaygroundChildren(); textTopPixels.OnValueChanged += () => UpdatePlaygroundChildren(); textTopPercent.OnValueChanged += () => UpdatePlaygroundChildren(); indent = 0; top += 8; // additional spacing playgroundTextPanelCheckbox = new UICheckbox("UITextPanel", "Show UITextPanel"); playgroundTextPanelCheckbox.Top.Set(top, 0f); playgroundTextPanelCheckbox.Left.Set(indent, 0f); playgroundTextPanelCheckbox.OnSelectedChanged += () => UpdatePlaygroundChildren(); mainPanel.Append(playgroundTextPanelCheckbox); top += 20; textPanelTextInput = new NewUITextBox("UITextPanel Text Here", 0.85f); textPanelTextInput.SetText(playgroundTextPanel.Text); //textPanelTextInput.SetPadding(0); textPanelTextInput.Top.Set(top, 0f); textPanelTextInput.Left.Set(indent, 0f); textPanelTextInput.Width.Set(-indent, 1f); mainPanel.Append(textPanelTextInput); textPanelTextInput.OnTextChanged += () => // order matters { //if (mainPanel.Parent != null) // UpdatePlaygroundChildren(); // playgroundTextPanel.SetText(textPanelTextInput.Text, textPanelTextScale.Data, false); }; top += 20; textPanelTextScale = new UIFloatRangedDataValue("TextScale:", playgroundTextPanel.TextScale, .2f, 3f); textPanelPadding = new UIFloatRangedDataValue("Padding:", playgroundTextPanel.PaddingBottom, 0, 12); textPanelHAlign = new UIFloatRangedDataValue("HAlign:", 0, 0, 1); textPanelVAlign = new UIFloatRangedDataValue("VAlign:", 0, 0, 1); textPanelLeftPixels = new UIFloatRangedDataValue("LeftPixels:", 0, 0, playgroundPanelWidth); textPanelLeftPercent = new UIFloatRangedDataValue("LeftPercent:", 0, 0, 1); textPanelTopPixels = new UIFloatRangedDataValue("TopPixels:", 0, 0, playgroundPanelHeight); textPanelTopPercent = new UIFloatRangedDataValue("TopPercent:", 0, 0, 1); textPanelWidthPixels = new UIFloatRangedDataValue("WidthPixels:", playgroundTextPanel.Width.Pixels, 0, playgroundPanelWidth); textPanelWidthPercent = new UIFloatRangedDataValue("WidthPercent:", playgroundTextPanel.Width.Precent, 0, 1); textPanelHeightPixels = new UIFloatRangedDataValue("HeightPixels:", playgroundTextPanel.Height.Pixels, 0, playgroundPanelHeight); textPanelHeightPercent = new UIFloatRangedDataValue("HeightPercent:", playgroundTextPanel.Height.Precent, 0, 1); //textPanelMinWidthPixels = new UIFloatRangedDataValue("MinWidthPixels:", playgroundTextPanel.MinWidth.Pixels, 0, playgroundPanelWidth); //textPanelMinWidthPercent = new UIFloatRangedDataValue("MinWidthPercent:", playgroundTextPanel.MinWidth.Precent, 0, 1); //textPanelMinHeightPixels = new UIFloatRangedDataValue("MinHeightPixels:", playgroundTextPanel.MinHeight.Pixels, 0, playgroundPanelHeight); //textPanelMinHeightPercent = new UIFloatRangedDataValue("MinHeightPercent:", playgroundTextPanel.MinHeight.Precent, 0, 1); AppendRange(ref top, indent, textPanelTextScale); AppendRange(ref top, indent, textPanelPadding); AppendRange(ref top, indent, textPanelHAlign); AppendRange(ref top, indent, textPanelVAlign); AppendRange(ref top, indent, textPanelLeftPixels); AppendRange(ref top, indent, textPanelLeftPercent); AppendRange(ref top, indent, textPanelTopPixels); AppendRange(ref top, indent, textPanelTopPercent); AppendRange(ref top, indent, textPanelWidthPixels); AppendRange(ref top, indent, textPanelWidthPercent); AppendRange(ref top, indent, textPanelHeightPixels); AppendRange(ref top, indent, textPanelHeightPercent); //AppendRange(ref top, indent, textPanelMinWidthPixels); //AppendRange(ref top, indent, textPanelMinWidthPercent); //AppendRange(ref top, indent, textPanelMinHeightPixels); //AppendRange(ref top, indent, textPanelMinHeightPercent); textPanelTextScale.OnValueChanged += () => UpdatePlaygroundChildren(); textPanelPadding.OnValueChanged += () => UpdatePlaygroundChildren(); textPanelHAlign.OnValueChanged += () => UpdatePlaygroundChildren(); textPanelVAlign.OnValueChanged += () => UpdatePlaygroundChildren(); textPanelLeftPixels.OnValueChanged += () => UpdatePlaygroundChildren(); textPanelLeftPercent.OnValueChanged += () => UpdatePlaygroundChildren(); textPanelTopPixels.OnValueChanged += () => UpdatePlaygroundChildren(); textPanelTopPercent.OnValueChanged += () => UpdatePlaygroundChildren(); textPanelWidthPixels.OnValueChanged += () => UpdatePlaygroundChildren(); textPanelWidthPercent.OnValueChanged += () => UpdatePlaygroundChildren(); textPanelHeightPixels.OnValueChanged += () => UpdatePlaygroundChildren(); textPanelHeightPercent.OnValueChanged += () => UpdatePlaygroundChildren(); //textPanelMinWidthPixels.OnValueChanged += () => UpdatePlaygroundChildren(); //textPanelMinWidthPercent.OnValueChanged += () => UpdatePlaygroundChildren(); //textPanelMinHeightPixels.OnValueChanged += () => UpdatePlaygroundChildren(); //textPanelMinHeightPercent.OnValueChanged += () => UpdatePlaygroundChildren(); textPanelMinWidthHeightDisplay = new UIText("", 0.85f); textPanelMinWidthHeightDisplay.Top.Set(top, 0f); textPanelMinWidthHeightDisplay.Width.Set(-indent, 1f); textPanelMinWidthHeightDisplay.Left.Set(indent, 0); mainPanel.Append(textPanelMinWidthHeightDisplay); top += 20; indent = 0; top += 8; // additional spacing playgroundImageButtonCheckbox = new UICheckbox("UIImageButton", "Show UIImageButton"); playgroundImageButtonCheckbox.Top.Set(top, 0f); playgroundImageButtonCheckbox.Left.Set(indent, 0f); playgroundImageButtonCheckbox.OnSelectedChanged += () => UpdatePlaygroundChildren(); mainPanel.Append(playgroundImageButtonCheckbox); top += 20; indent = 18; imageButtonHAlign = new UIFloatRangedDataValue("HAlign:", 0, 0, 1); imageButtonVAlign = new UIFloatRangedDataValue("VAlign:", 0, 0, 1); imageButtonLeftPixels = new UIFloatRangedDataValue("LeftPixels:", 0, 0, playgroundPanelWidth); imageButtonLeftPercent = new UIFloatRangedDataValue("LeftPercent:", 0, 0, 1); imageButtonTopPixels = new UIFloatRangedDataValue("TopPixels:", 0, 0, playgroundPanelHeight); imageButtonTopPercent = new UIFloatRangedDataValue("TopPercent:", 0, 0, 1); AppendRange(ref top, indent, imageButtonHAlign); AppendRange(ref top, indent, imageButtonVAlign); AppendRange(ref top, indent, imageButtonLeftPixels); AppendRange(ref top, indent, imageButtonLeftPercent); AppendRange(ref top, indent, imageButtonTopPixels); AppendRange(ref top, indent, imageButtonTopPercent); imageButtonHAlign.OnValueChanged += () => UpdatePlaygroundChildren(); imageButtonVAlign.OnValueChanged += () => UpdatePlaygroundChildren(); imageButtonLeftPixels.OnValueChanged += () => UpdatePlaygroundChildren(); imageButtonLeftPercent.OnValueChanged += () => UpdatePlaygroundChildren(); imageButtonTopPixels.OnValueChanged += () => UpdatePlaygroundChildren(); imageButtonTopPercent.OnValueChanged += () => UpdatePlaygroundChildren(); text = new UIText("UIPlayground UI Extra:", 0.85f); mainPanel.Append(text); top += 20; drawAllDimensionsCheckbox = new UICheckbox("Draw All UIElement Dimensions", "This will draw outer dimensions for Elements in your mod."); drawAllDimensionsCheckbox.Top.Set(top, 0f); //drawAllDimensionsCheckbox.Left.Set(indent, 0f); mainPanel.Append(drawAllDimensionsCheckbox); top += 20; colorDataProperty = new ColorDataRangeProperty("Color:"); colorDataProperty.range.Top.Set(top, 0f); mainPanel.Append(colorDataProperty.range); top += 20; drawAllDimensionsDepthData = new UIIntRangedDataValue("Draw All Depth:", -1, -1, 10); uiRange = new UIRange <int>(drawAllDimensionsDepthData); //drawAllDimensionsDepthData.OnValueChanged += () => UpdatePlaygroundChildren(); uiRange.Top.Set(top, 0f); uiRange.Width.Set(0, 1f); //uiRange.Left.Set(indent, 0); mainPanel.Append(uiRange); top += 30; drawAllParallaxCheckbox = new UICheckbox("Draw with Parallax", "This will offset UIElements to help visualize their hierarchy"); drawAllParallaxCheckbox.Top.Set(top, 0f); //drawAllParallaxCheckbox.Left.Set(indent, 0f); mainPanel.Append(drawAllParallaxCheckbox); parallaxXProperty = new UIFloatRangedDataValue("ParallaxX:", 0, -10, 10); parallaxYProperty = new UIFloatRangedDataValue("ParallaxY:", 0, -10, 10); var ui2DRange = new UI2DRange <float>(parallaxXProperty, parallaxYProperty); ui2DRange.Top.Set(top, 0f); ui2DRange.Left.Set(200, 0f); mainPanel.Append(ui2DRange); top += 30; Append(mainPanel); }
public override void OnInitialize() { mainPanel = new UIPanel(); mainPanel.Left.Set(-350f, 1f); mainPanel.Top.Set(-620f, 1f); mainPanel.Width.Set(310f, 0f); mainPanel.Height.Set(520f, 0f); mainPanel.SetPadding(12); mainPanel.BackgroundColor = Color.Orange * 0.7f; int top = 0; UIText text = new UIText("Projectiles:", 0.85f); text.Top.Set(top, 0f); mainPanel.Append(text); top += 20; UIText text2 = new UIText("Filter:", 0.85f); text2.Top.Set(top, 0f); mainPanel.Append(text2); searchFilter = new NewUITextBox("Search", 0.85f); searchFilter.SetPadding(0); searchFilter.OnTextChanged += () => { ValidateInput(); updateneeded = true; }; searchFilter.Top.Set(top, 0f); searchFilter.Left.Set(text2.GetInnerDimensions().Width, 0f); searchFilter.Width.Set(0, 1f); searchFilter.Height.Set(20, 0f); //searchFilter.VAlign = 0.5f; mainPanel.Append(searchFilter); top += 20; speedXDataProperty = new UIFloatRangedDataValue("SpeedX:", 0, -10, 10); speedYDataProperty = new UIFloatRangedDataValue("SpeedY:", 0, -10, 10); var ui2DRange = new UI2DRange <float>(speedXDataProperty, speedYDataProperty); ui2DRange.Top.Set(top, 0f); mainPanel.Append(ui2DRange); top += 30; ai0DataProperty = new UIFloatRangedDataValue("ai0:", 0, -10, 10); var uiRange = new UIRange <float>(ai0DataProperty); uiRange.Top.Set(top, 0f); uiRange.Width.Set(0, 1f); mainPanel.Append(uiRange); top += 30; ai1DataProperty = new UIFloatRangedDataValue("ai1:", 0, -10, 10); uiRange = new UIRange <float>(ai1DataProperty); uiRange.Top.Set(top, 0f); uiRange.Width.Set(0, 1f); mainPanel.Append(uiRange); top += 30; knockbackDataProperty = new UIFloatRangedDataValue("Knockback:", 0, 0, 20); uiRange = new UIRange <float>(knockbackDataProperty); uiRange.Top.Set(top, 0f); uiRange.Width.Set(0, 1f); mainPanel.Append(uiRange); top += 30; damageDataProperty = new UIIntRangedDataValue("Damage:", 20, 0, 200); var uiRangeI = new UIRange <int>(damageDataProperty); uiRangeI.Top.Set(top, 0f); uiRangeI.Width.Set(0, 1f); mainPanel.Append(uiRangeI); top += 30; aiStyleDataProperty = new UIIntRangedDataValue("AIStyle:", -1, -1, 145); uiRangeI = new UIRange <int>(aiStyleDataProperty); uiRangeI.Top.Set(top, 0f); uiRangeI.Width.Set(0, 1f); mainPanel.Append(uiRangeI); top += 30; hostile = new UIBoolNDataValue("Hostile"); var hostileCheckbox = new UITriStateCheckbox(hostile); hostileCheckbox.Top.Set(top, 0f); mainPanel.Append(hostileCheckbox); top += 30; friendly = new UIBoolNDataValue("Friendly"); var friendlyCheckbox = new UITriStateCheckbox(friendly); friendlyCheckbox.Top.Set(top, 0f); mainPanel.Append(friendlyCheckbox); top += 30; projectileGrid = new UIGrid(7); projectileGrid.Top.Pixels = top; //autoTrashGrid.Left.Pixels = spacing; projectileGrid.Width.Set(-25f, 1f); // leave space for scroll? projectileGrid.Height.Set(-top, 1f); projectileGrid.ListPadding = 6f; mainPanel.Append(projectileGrid); // this will initialize grid updateneeded = true; var projectileGridScrollbar = new UIElements.FixedUIScrollbar(userInterface); projectileGridScrollbar.SetView(100f, 1000f); projectileGridScrollbar.Top.Pixels = top; // + spacing; projectileGridScrollbar.Height.Set(-top /*- spacing*/, 1f); projectileGridScrollbar.HAlign = 1f; mainPanel.Append(projectileGridScrollbar); projectileGrid.SetScrollbar(projectileGridScrollbar); Append(mainPanel); }
public override void OnInitialize() { TabPanel Menu = new TabPanel(450, 600, new Tab("Custom NPC", new CustomNPCUI()), new Tab(" Custom Item", this)); Menu.VAlign = 0.7f; Menu.HAlign = 0.2f; Menu.OnCloseBtnClicked += () => GetInstance <Creativetools>().UserInterface.SetState(new MainUI()); Append(Menu); UITextPanel <string> CreateButton = new UITextPanel <string>(Language.GetTextValue("Create Item")); CreateButton.SetPadding(4); CreateButton.HAlign = 0.05f; CreateButton.MarginTop = 555; CreateButton.OnClick += CreateButtonClicked; Menu.Append(CreateButton); UITextPanel <string> CodeButton = new UITextPanel <string>(Language.GetTextValue("Copy Code")); CodeButton.SetPadding(4); CodeButton.HAlign = 0.5f; CodeButton.MarginTop = 555; CodeButton.OnClick += CodeButtonClicked; Menu.Append(CodeButton); UITextPanel <string> FileButton = new UITextPanel <string>(Language.GetTextValue("Select Texture")); FileButton.SetPadding(4); FileButton.HAlign = 0.9f; FileButton.MarginTop = 555; FileButton.OnClick += FileButtonClicked; Menu.Append(FileButton); nametext = new NewUITextBox("Enter name here"); nametext.HAlign = 0.5f; nametext.MarginTop = 50; nametext.Width.Set(-40f, 1f); Menu.Append(nametext); MakeSlider(new UIIntRangedDataValue("Damage: ", 0, 0, 999), out DamageDataProperty, Menu, top: 100, widthPixels: 1); MakeSlider(new UIIntRangedDataValue("Crit: ", 0, 0, 100), out CritDataProperty, Menu, top: 150, widthPixels: 1); MakeSlider(new UIIntRangedDataValue("Defense: ", 0, 0, 999), out DefenseDataProperty, Menu, top: 200, widthPixels: 1); MakeSlider(new UIIntRangedDataValue("Shoot: ", 0, 0, 100), out ShootDataProperty, Menu, top: 250, widthPixels: 1); MakeSlider(new UIFloatRangedDataValue("Bullet Speed: ", 10, 0, 50), out ShootSpeedDataProperty, Menu, top: 300, widthPixels: 1); MakeSlider(new UIFloatRangedDataValue("Knockback: ", 0, 0, 100), out KnockbackDataProperty, Menu, top: 350, widthPixels: 1); MakeSlider(new UIFloatRangedDataValue("Size: ", 1, 0, 10), out ScaleDataProperty, Menu, top: 400, widthPixels: 1); MakeSlider(new UIIntRangedDataValue("UseTime: ", 10, 0, 600), out UseTimeDataProperty, Menu, top: 450, widthPixels: 1); UITextPanel <string> AutoSwingButton = new UITextPanel <string>("Autoswing: false"); AutoSwingButton.HAlign = 0.05f; AutoSwingButton.MarginTop = 500; AutoSwingButton.OnClick += (evt, listeningelement) => { Global.cAutoSwing = !Global.cAutoSwing; AutoSwingButton.SetText("Autoswing: " + Global.cAutoSwing); }; Menu.Append(AutoSwingButton); UITextPanel <string> TurnAroundButton = new UITextPanel <string>("Turnaround: false"); TurnAroundButton.HAlign = 0.95f; TurnAroundButton.MarginTop = 500; TurnAroundButton.OnClick += (evt, listeningelement) => { Global.cTurnAround = !Global.cTurnAround; TurnAroundButton.SetText("Turnaround: " + Global.cTurnAround); }; Menu.Append(TurnAroundButton); }
public override void OnInitialize() { // Is initialize called? (Yes it is called on reload) I want to reset nicely with new character or new loaded mods: visible = false; announce = false; // overwritten by modplayer collectChestItems = false; showBadge = false; checklistPanel = new UIPanel(); checklistPanel.SetPadding(10); checklistPanel.Left.Pixels = 0; checklistPanel.HAlign = 1f; checklistPanel.Top.Set(85f, 0f); checklistPanel.Left.Set(-40f, 0f); checklistPanel.Width.Set(250f, 0f); checklistPanel.Height.Set(-125, 1f); checklistPanel.BackgroundColor = new Color(73, 94, 171); int top = 0; int left = 0; // Because OnInitialize Happens during load and because we need it to happen for OnEnterWorld, use dummy sprite. buttonsHaveDummyTextures = true; foundFilterButton = new UIHoverImageButton(Main.magicPixel, "Cycle Found Filter: ??"); foundFilterButton.OnClick += (a, b) => ToggleFoundFilterButtonClicked(a, b, true); foundFilterButton.OnRightClick += (a, b) => ToggleFoundFilterButtonClicked(a, b, false); foundFilterButton.Top.Pixels = top; checklistPanel.Append(foundFilterButton); left += (int)spacing * 2 + 28; //sortButton = new UIHoverImageButton(sortButtonTexture, "Cycle Sort Method: ??"); //sortButton.OnClick += (a, b) => ToggleSortButtonClicked(a, b, true); //sortButton.OnRightClick += (a, b) => ToggleSortButtonClicked(a, b, false); //sortButton.Left.Pixels = spacing * 4 + 28 * 2; //sortButton.Top.Pixels = top; //checklistPanel.Append(sortButton); modFilterButton = new UIHoverImageButton(Main.magicPixel, "Cycle Mod Filter: ??"); modFilterButton.OnClick += (a, b) => ToggleModFilterButtonClicked(a, b, true); modFilterButton.OnRightClick += (a, b) => ToggleModFilterButtonClicked(a, b, false); modFilterButton.Left.Pixels = left; modFilterButton.Top.Pixels = top; checklistPanel.Append(modFilterButton); left += (int)spacing * 2 + 28; muteButton = new UIToggleHoverImageButton(Main.magicPixel, ItemChecklist.instance.GetTexture("UIElements/closeButton"), "Toggle Messages", announce); muteButton.OnClick += ToggleMuteButtonClicked; muteButton.Left.Pixels = left; muteButton.Top.Pixels = top; checklistPanel.Append(muteButton); left += (int)spacing * 2 + 28; collectChestItemsButton = new UIToggleHoverImageButton(Main.magicPixel, ItemChecklist.instance.GetTexture("UIElements/closeButton"), "Toggle Collect Chest Items", collectChestItems); collectChestItemsButton.OnClick += ToggleFindChestItemsButtonClicked; collectChestItemsButton.Left.Pixels = left; collectChestItemsButton.Top.Pixels = top; checklistPanel.Append(collectChestItemsButton); left += (int)spacing * 2 + 28; showBadgeButton = new UIToggleHoverImageButton(Main.magicPixel, ItemChecklist.instance.GetTexture("UIElements/closeButton"), "Show Sort Value Text", showBadge); showBadgeButton.OnClick += ToggleShowBadgeButtonClicked; showBadgeButton.Left.Pixels = left; showBadgeButton.Top.Pixels = top; checklistPanel.Append(showBadgeButton); left += (int)spacing * 2 + 28; top += 34; itemNameFilter = new NewUITextBox("Filter by Name"); itemNameFilter.OnTextChanged += () => { ValidateItemFilter(); updateNeeded = true; }; itemNameFilter.OnTabPressed += () => { itemDescriptionFilter.Focus(); }; itemNameFilter.Top.Pixels = top; //itemNameFilter.Left.Set(-152, 1f); itemNameFilter.Width.Set(0, 1f); itemNameFilter.Height.Set(25, 0f); checklistPanel.Append(itemNameFilter); top += 30; itemDescriptionFilter = new NewUITextBox("Filter by tooltip"); itemDescriptionFilter.OnTextChanged += () => { ValidateItemDescription(); updateNeeded = true; }; itemDescriptionFilter.OnTabPressed += () => { itemNameFilter.Focus(); }; itemDescriptionFilter.Top.Pixels = top; //itemDescriptionFilter.Left.Set(-152, 1f); itemDescriptionFilter.Width.Set(0, 1f); itemDescriptionFilter.Height.Set(25, 0f); checklistPanel.Append(itemDescriptionFilter); top += 30; sharedUI = new SharedUI(); sharedUI.Initialize(); sharedUI.sortsAndFiltersPanel.Top.Set(top, 0f); sharedUI.sortsAndFiltersPanel.Width.Set(0f, 1); sharedUI.sortsAndFiltersPanel.Height.Set(60, 0f); checklistPanel.Append(sharedUI.sortsAndFiltersPanel); top += 68; checklistGrid = new UIGrid(5); checklistGrid.alternateSort = ItemGridSort; checklistGrid.Top.Pixels = top; checklistGrid.Width.Set(-25f, 1f); checklistGrid.Height.Set(-top, 1f); checklistGrid.ListPadding = 2f; checklistPanel.Append(checklistGrid); FixedUIScrollbar checklistListScrollbar = new FixedUIScrollbar(); checklistListScrollbar.SetView(100f, 1000f); checklistListScrollbar.Top.Pixels = top; checklistListScrollbar.Height.Set(-top, 1f); checklistListScrollbar.HAlign = 1f; checklistPanel.Append(checklistListScrollbar); checklistGrid.SetScrollbar(checklistListScrollbar); // Checklistlist populated when the panel is shown: UpdateCheckboxes() Append(checklistPanel); // load time impact, do this on first show? itemSlots = new UIItemSlot[ItemLoader.ItemCount]; Item[] itemSlotItems = new Item[ItemLoader.ItemCount]; for (int i = 0; i < ItemLoader.ItemCount; i++) { itemSlots[i] = new UIItemSlot(i); itemSlotItems[i] = itemSlots[i].item; } FieldInfo inventoryGlowHue = typeof(Terraria.UI.ItemSlot).GetField("inventoryGlowHue", BindingFlags.Static | BindingFlags.NonPublic); FieldInfo inventoryGlowTime = typeof(Terraria.UI.ItemSlot).GetField("inventoryGlowTime", BindingFlags.Static | BindingFlags.NonPublic); MethodInfo SortMethod = typeof(ItemSorting).GetMethod("Sort", BindingFlags.Static | BindingFlags.NonPublic); object[] parametersArray = new object[] { itemSlotItems, new int[0] }; inventoryGlowHue.SetValue(null, new float[ItemLoader.ItemCount]); inventoryGlowTime.SetValue(null, new int[ItemLoader.ItemCount]); SortMethod.Invoke(null, parametersArray); inventoryGlowHue.SetValue(null, new float[58]); inventoryGlowTime.SetValue(null, new int[58]); int[] vanillaIDsInSortOrderTemp = itemSlotItems.Select((x) => x.type).ToArray(); vanillaIDsInSortOrder = new int[ItemLoader.ItemCount]; for (int i = 0; i < ItemLoader.ItemCount; i++) { vanillaIDsInSortOrder[i] = Array.FindIndex(vanillaIDsInSortOrderTemp, x => x == i); } modnames = new List <string>() { "All", "Vanilla" }; modnames.AddRange(ModLoader.GetLoadedMods() /*.Where(x => x != "ModLoader")*/); updateNeeded = true; }