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() { TabPanel Menu = new TabPanel(400, 400, new Tab("Better Zoom", this), new Tab(" Camera Control", new CCUI()) ); Menu.Left.Set(DragableUIPanel.lastPos.X, 0f); Menu.Top.Set(DragableUIPanel.lastPos.Y, 0f); Menu.OnCloseBtnClicked += () => ModContent.GetInstance <BetterZoom>().userInterface.SetState(null); Append(Menu); zoom = new UIFloatRangedDataValue("Zoom", 1, -1f, 10); zoomSldr = new UIRange <float>(zoom); zoom.OnValueChanged += () => BetterZoom.zoom = zoom.Data; zoomSldr.Width.Set(0, 1); zoomSldr.MarginTop = 50; zoomSldr.MarginLeft = -20; Menu.Append(zoomSldr); uiScale = new UIFloatRangedDataValue("", 1, 0.2f, 2); uiScaleSldr = new UIRange <float>(uiScale); uiScaleSldr.Width.Set(0, 1); uiScaleSldr.MarginTop = 100; uiScaleSldr.MarginLeft = -20; Menu.Append(uiScaleSldr); var uiScaleBtn = new UITextPanel <string>("UI Scale"); uiScaleBtn.SetPadding(4); uiScaleBtn.MarginLeft = 40; uiScaleBtn.OnClick += (evt, elm) => BetterZoom.uiScale = uiScale.Data; uiScaleSldr.Append(uiScaleBtn); UIToggleImage flipBgBtn = new UIToggleImage(TextureManager.Load("Images/UI/Settings_Toggle"), 13, 13, new Point(17, 1), new Point(1, 1)); flipBgBtn.MarginTop = 150; flipBgBtn.MarginLeft = 250; flipBgBtn.OnClick += (evt, elm) => BetterZoom.flipBackground = !BetterZoom.flipBackground; flipBgBtn.SetState(BetterZoom.flipBackground); flipBgBtn.Append(new UIText("Flip Background", 0.9f) { MarginLeft = -230 }); Menu.Append(flipBgBtn); UIToggleImage zoomBgBtn = new UIToggleImage(TextureManager.Load("Images/UI/Settings_Toggle"), 13, 13, new Point(17, 1), new Point(1, 1)); zoomBgBtn.MarginTop = 200; zoomBgBtn.MarginLeft = 250; zoomBgBtn.OnClick += (evt, elm) => BetterZoom.zoomBackground = !BetterZoom.zoomBackground; zoomBgBtn.SetState(BetterZoom.zoomBackground); zoomBgBtn.Append(new UIText("Zoom Background", 0.9f) { MarginLeft = -230 }); Menu.Append(zoomBgBtn); UIFloatRangedDataValue hotbarScale = new UIFloatRangedDataValue("Hotbar Scale", 1, 0.2f, 5); var hotbarScaleSldr = new UIRange <float>(hotbarScale); hotbarScaleSldr.Width.Set(0, 1); hotbarScaleSldr.MarginTop = 250; hotbarScaleSldr.MarginLeft = -20; hotbarScale.OnValueChanged += () => BetterZoom.hotbarScale = hotbarScale.Data; Menu.Append(hotbarScaleSldr); UIFloatRangedDataValue miniMapScale = new UIFloatRangedDataValue("Minimap Scale", 1, 0.2f, 5); var miniMapScaleSldr = new UIRange <float>(miniMapScale); miniMapScaleSldr.Width.Set(0, 1); miniMapScaleSldr.MarginTop = 300; miniMapScaleSldr.MarginLeft = -20; miniMapScale.OnValueChanged += () => BetterZoom.minimapScale = miniMapScale.Data; Menu.Append(miniMapScaleSldr); /*UIFloatRangedDataValue offScreenRange = new UIFloatRangedDataValue("offscreen Range", 192, -1000f, 1000); * var offScreenRangeSldr = new UIRange<float>(offScreenRange); * offScreenRangeSldr.Width.Set(0, 1); * offScreenRangeSldr.MarginTop = 350; * offScreenRangeSldr.MarginLeft = -20; * offScreenRange.OnValueChanged += () => BetterZoom.offscrnRange = offScreenRange.Data; * Menu.Append(offScreenRangeSldr);*/ var resetBtn = new UITextPanel <string>("Set to Default"); resetBtn.SetPadding(4); resetBtn.MarginLeft = 20; resetBtn.Top.Set(-40, 1); resetBtn.OnClick += (evt, elm) => { zoom.ResetToDefaultValue(); uiScale.ResetToDefaultValue(); uiScale.SetValue(1); flipBgBtn.SetState(true); zoomBgBtn.SetState(false); hotbarScale.ResetToDefaultValue(); miniMapScale.ResetToDefaultValue(); }; Menu.Append(resetBtn); }