public override void Update(GameTime gameTime) { base.Update(gameTime); if (lockScreenBtn != null) { lockScreenBtn.SetState(Camera.Locked); } Camera.speed = speed.Data * 100; playButton.SetText(text: Camera.Playing ? "Stop" : "Play"); if (placing != null) { PlaceTracker((TrackerID)placing); } // Eraser if (erasing) { EraseTracker(); } // Tracker Mover if (moving) { MoveTracker(); } }
private void AddToggle(FieldInfo field, string additionalInfo = "") { var toggle = new UIToggleImage(TextureManager.Load("Images/UI/Settings_Toggle"), 13, 13, new Point(17, 1), new Point(1, 1)); toggle.SetState((bool)field.GetValue(typeof(NPC))); toggle.OnClick += (evt, elm) => field.SetValue(typeof(NPC), toggle.IsOn); toggleList.Add(toggle); var text = new UIText($"Toggle NPC.{field.Name} {additionalInfo}"); textList.Add(text); }
private void AddToggle(string fieldName, string additionalInfo = "") { // get field Type type = typeof(NPC); var field = type.GetField(fieldName, BindingFlags.Public | BindingFlags.Static); // append toggle var toggle = new UIToggleImage(TextureManager.Load("Images/UI/Settings_Toggle"), 13, 13, new Point(17, 1), new Point(1, 1)); toggle.SetState((bool)field.GetValue(type)); toggle.OnClick += (evt, elm) => field.SetValue(type, toggle.IsOn); toggleList.Add(toggle); // append text var text = new UIText($"Toggle NPC.{fieldName} {additionalInfo}"); textList.Add(text); }
public void InitializePage() { this.RemoveAllChildren(); this._categoryButtons.Clear(); this._achievementElements.Clear(); this._achievementsList = (UIList)null; bool largeForOtherLanguages = true; int num = largeForOtherLanguages.ToInt() * 100; UIElement element1 = new UIElement(); element1.Width.Set(0.0f, 0.8f); element1.MaxWidth.Set(800f + (float)num, 0.0f); element1.MinWidth.Set(600f + (float)num, 0.0f); element1.Top.Set(220f, 0.0f); element1.Height.Set(-220f, 1f); element1.HAlign = 0.5f; this._outerContainer = element1; this.Append(element1); UIPanel uiPanel = new UIPanel(); uiPanel.Width.Set(0.0f, 1f); uiPanel.Height.Set(-110f, 1f); uiPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f; uiPanel.PaddingTop = 0.0f; element1.Append((UIElement)uiPanel); this._achievementsList = new UIList(); this._achievementsList.Width.Set(-25f, 1f); this._achievementsList.Height.Set(-50f, 1f); this._achievementsList.Top.Set(50f, 0.0f); this._achievementsList.ListPadding = 5f; uiPanel.Append((UIElement)this._achievementsList); UITextPanel <LocalizedText> uiTextPanel1 = new UITextPanel <LocalizedText>(Language.GetText("UI.Achievements"), 1f, true); uiTextPanel1.HAlign = 0.5f; uiTextPanel1.Top.Set(-33f, 0.0f); uiTextPanel1.SetPadding(13f); uiTextPanel1.BackgroundColor = new Color(73, 94, 171); element1.Append((UIElement)uiTextPanel1); UITextPanel <LocalizedText> uiTextPanel2 = new UITextPanel <LocalizedText>(Language.GetText("UI.Back"), 0.7f, true); uiTextPanel2.Width.Set(-10f, 0.5f); uiTextPanel2.Height.Set(50f, 0.0f); uiTextPanel2.VAlign = 1f; uiTextPanel2.HAlign = 0.5f; uiTextPanel2.Top.Set(-45f, 0.0f); uiTextPanel2.OnMouseOver += new UIElement.MouseEvent(this.FadedMouseOver); uiTextPanel2.OnMouseOut += new UIElement.MouseEvent(this.FadedMouseOut); uiTextPanel2.OnClick += new UIElement.MouseEvent(this.GoBackClick); element1.Append((UIElement)uiTextPanel2); this._backpanel = (UIElement)uiTextPanel2; List <Achievement> achievementsList = Main.Achievements.CreateAchievementsList(); for (int index = 0; index < achievementsList.Count; ++index) { UIAchievementListItem achievementListItem = new UIAchievementListItem(achievementsList[index], largeForOtherLanguages); this._achievementsList.Add((UIElement)achievementListItem); this._achievementElements.Add(achievementListItem); } UIScrollbar scrollbar = new UIScrollbar(); scrollbar.SetView(100f, 1000f); scrollbar.Height.Set(-50f, 1f); scrollbar.Top.Set(50f, 0.0f); scrollbar.HAlign = 1f; uiPanel.Append((UIElement)scrollbar); this._achievementsList.SetScrollbar(scrollbar); UIElement element2 = new UIElement(); element2.Width.Set(0.0f, 1f); element2.Height.Set(32f, 0.0f); element2.Top.Set(10f, 0.0f); Asset <Texture2D> texture = (Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/Achievement_Categories", (AssetRequestMode)1); for (int index = 0; index < 4; ++index) { UIToggleImage uiToggleImage = new UIToggleImage(texture, 32, 32, new Point(34 * index, 0), new Point(34 * index, 34)); uiToggleImage.Left.Set((float)(index * 36 + 8), 0.0f); uiToggleImage.SetState(true); uiToggleImage.OnClick += new UIElement.MouseEvent(this.FilterList); this._categoryButtons.Add(uiToggleImage); element2.Append((UIElement)uiToggleImage); } uiPanel.Append(element2); }
// Token: 0x060010BA RID: 4282 RVA: 0x00405D28 File Offset: 0x00403F28 public void InitializePage() { base.RemoveAllChildren(); this._categoryButtons.Clear(); this._achievementElements.Clear(); this._achievementsList = null; bool flag = true; int num = flag.ToInt() * 100; UIElement uIElement = new UIElement(); uIElement.Width.Set(0f, 0.8f); uIElement.MaxWidth.Set(800f + (float)num, 0f); uIElement.MinWidth.Set(600f + (float)num, 0f); uIElement.Top.Set(220f, 0f); uIElement.Height.Set(-220f, 1f); uIElement.HAlign = 0.5f; this._outerContainer = uIElement; base.Append(uIElement); UIPanel uIPanel = new UIPanel(); uIPanel.Width.Set(0f, 1f); uIPanel.Height.Set(-110f, 1f); uIPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f; uIPanel.PaddingTop = 0f; uIElement.Append(uIPanel); this._achievementsList = new UIList(); this._achievementsList.Width.Set(-25f, 1f); this._achievementsList.Height.Set(-50f, 1f); this._achievementsList.Top.Set(50f, 0f); this._achievementsList.ListPadding = 5f; uIPanel.Append(this._achievementsList); UITextPanel <LocalizedText> uITextPanel = new UITextPanel <LocalizedText>(Language.GetText("UI.Achievements"), 1f, true); uITextPanel.HAlign = 0.5f; uITextPanel.Top.Set(-33f, 0f); uITextPanel.SetPadding(13f); uITextPanel.BackgroundColor = new Color(73, 94, 171); uIElement.Append(uITextPanel); UITextPanel <LocalizedText> uITextPanel2 = new UITextPanel <LocalizedText>(Language.GetText("UI.Back"), 0.7f, true); uITextPanel2.Width.Set(-10f, 0.5f); uITextPanel2.Height.Set(50f, 0f); uITextPanel2.VAlign = 1f; uITextPanel2.HAlign = 0.5f; uITextPanel2.Top.Set(-45f, 0f); uITextPanel2.OnMouseOver += new UIElement.MouseEvent(this.FadedMouseOver); uITextPanel2.OnMouseOut += new UIElement.MouseEvent(this.FadedMouseOut); uITextPanel2.OnClick += new UIElement.MouseEvent(this.GoBackClick); uIElement.Append(uITextPanel2); this._backpanel = uITextPanel2; List <Achievement> list = Main.Achievements.CreateAchievementsList(); for (int i = 0; i < list.Count; i++) { UIAchievementListItem item = new UIAchievementListItem(list[i], flag); this._achievementsList.Add(item); this._achievementElements.Add(item); } UIScrollbar uIScrollbar = new UIScrollbar(); uIScrollbar.SetView(100f, 1000f); uIScrollbar.Height.Set(-50f, 1f); uIScrollbar.Top.Set(50f, 0f); uIScrollbar.HAlign = 1f; uIPanel.Append(uIScrollbar); this._achievementsList.SetScrollbar(uIScrollbar); UIElement uIElement2 = new UIElement(); uIElement2.Width.Set(0f, 1f); uIElement2.Height.Set(32f, 0f); uIElement2.Top.Set(10f, 0f); Texture2D texture = TextureManager.Load("Images/UI/Achievement_Categories"); for (int j = 0; j < 4; j++) { UIToggleImage uIToggleImage = new UIToggleImage(texture, 32, 32, new Point(34 * j, 0), new Point(34 * j, 34)); uIToggleImage.Left.Set((float)(j * 36 + 8), 0f); uIToggleImage.SetState(true); uIToggleImage.OnClick += new UIElement.MouseEvent(this.FilterList); this._categoryButtons.Add(uIToggleImage); uIElement2.Append(uIToggleImage); } uIPanel.Append(uIElement2); }
public override void OnInitialize() { UIElement uIElement = new UIElement(); uIElement.Width.Set(0f, 0.8f); uIElement.MaxWidth.Set(800f, 0f); uIElement.MinWidth.Set(600f, 0f); uIElement.Top.Set(220f, 0f); uIElement.Height.Set(-220f, 1f); uIElement.HAlign = 0.5f; _outerContainer = uIElement; Append(uIElement); UIPanel uIPanel = new UIPanel(); uIPanel.Width.Set(0f, 1f); uIPanel.Height.Set(-110f, 1f); uIPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f; uIPanel.PaddingTop = 0f; uIElement.Append(uIPanel); _achievementsList = new UIList(); _achievementsList.Width.Set(-25f, 1f); _achievementsList.Height.Set(-50f, 1f); _achievementsList.Top.Set(50f, 0f); _achievementsList.ListPadding = 5f; uIPanel.Append(_achievementsList); UITextPanel uITextPanel = new UITextPanel("Achievements", 1f, large: true); uITextPanel.HAlign = 0.5f; uITextPanel.Top.Set(-33f, 0f); uITextPanel.SetPadding(13f); uITextPanel.BackgroundColor = new Color(73, 94, 171); uIElement.Append(uITextPanel); UITextPanel uITextPanel2 = new UITextPanel("Back", 0.7f, large: true); uITextPanel2.Width.Set(-10f, 0.5f); uITextPanel2.Height.Set(50f, 0f); uITextPanel2.VAlign = 1f; uITextPanel2.HAlign = 0.5f; uITextPanel2.Top.Set(-45f, 0f); uITextPanel2.OnMouseOver += FadedMouseOver; uITextPanel2.OnMouseOut += FadedMouseOut; uITextPanel2.OnClick += GoBackClick; uIElement.Append(uITextPanel2); List <Achievement> list = Main.Achievements.CreateAchievementsList(); for (int i = 0; i < list.Count; i++) { UIAchievementListItem item = new UIAchievementListItem(list[i]); _achievementsList.Add(item); _achievementElements.Add(item); } UIScrollbar uIScrollbar = new UIScrollbar(); uIScrollbar.SetView(100f, 1000f); uIScrollbar.Height.Set(-50f, 1f); uIScrollbar.Top.Set(50f, 0f); uIScrollbar.HAlign = 1f; uIPanel.Append(uIScrollbar); _achievementsList.SetScrollbar(uIScrollbar); UIElement uIElement2 = new UIElement(); uIElement2.Width.Set(0f, 1f); uIElement2.Height.Set(32f, 0f); uIElement2.Top.Set(10f, 0f); Texture2D texture = TextureManager.Load("Images/UI/Achievement_Categories"); for (int j = 0; j < 4; j++) { UIToggleImage uIToggleImage = new UIToggleImage(texture, 32, 32, new Point(34 * j, 0), new Point(34 * j, 34)); uIToggleImage.Left.Set(j * 36 + 8, 0f); uIToggleImage.SetState(value: true); uIToggleImage.OnClick += FilterList; _categoryButtons.Add(uIToggleImage); uIElement2.Append(uIToggleImage); } uIPanel.Append(uIElement2); }
public override void OnInitialize() { UIElement element1 = new UIElement(); element1.Width.Set(0.0f, 0.8f); element1.MaxWidth.Set(800f, 0.0f); element1.MinWidth.Set(600f, 0.0f); element1.Top.Set(220f, 0.0f); element1.Height.Set(-220f, 1f); element1.HAlign = 0.5f; _outerContainer = element1; Append(element1); UIPanel uiPanel = new UIPanel(); uiPanel.Width.Set(0.0f, 1f); uiPanel.Height.Set(-110f, 1f); uiPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f; uiPanel.PaddingTop = 0.0f; element1.Append(uiPanel); _achievementsList = new UIList(); _achievementsList.Width.Set(-25f, 1f); _achievementsList.Height.Set(-50f, 1f); _achievementsList.Top.Set(50f, 0.0f); _achievementsList.ListPadding = 5f; uiPanel.Append(_achievementsList); UITextPanel uiTextPanel1 = new UITextPanel("Achievements", 1f, true); uiTextPanel1.HAlign = 0.5f; uiTextPanel1.Top.Set(-33f, 0.0f); uiTextPanel1.SetPadding(13f); uiTextPanel1.BackgroundColor = new Color(73, 94, 171); element1.Append(uiTextPanel1); UITextPanel uiTextPanel2 = new UITextPanel("Back", 0.7f, true); uiTextPanel2.Width.Set(-10f, 0.5f); uiTextPanel2.Height.Set(50f, 0.0f); uiTextPanel2.VAlign = 1f; uiTextPanel2.HAlign = 0.5f; uiTextPanel2.Top.Set(-45f, 0.0f); uiTextPanel2.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver); uiTextPanel2.OnMouseOut += new UIElement.MouseEvent(FadedMouseOut); uiTextPanel2.OnClick += new UIElement.MouseEvent(GoBackClick); element1.Append(uiTextPanel2); List <Achievement> achievementsList = Main.Achievements.CreateAchievementsList(); for (int index = 0; index < achievementsList.Count; ++index) { UIAchievementListItem achievementListItem = new UIAchievementListItem(achievementsList[index]); _achievementsList.Add((UIElement)achievementListItem); _achievementElements.Add(achievementListItem); } UIScrollbar scrollbar = new UIScrollbar(); scrollbar.SetView(100f, 1000f); scrollbar.Height.Set(-50f, 1f); scrollbar.Top.Set(50f, 0.0f); scrollbar.HAlign = 1f; uiPanel.Append((UIElement)scrollbar); _achievementsList.SetScrollbar(scrollbar); UIElement element2 = new UIElement(); element2.Width.Set(0.0f, 1f); element2.Height.Set(32f, 0.0f); element2.Top.Set(10f, 0.0f); Texture2D texture = TextureManager.Load("Images/UI/Achievement_Categories"); for (int index = 0; index < 4; ++index) { UIToggleImage uiToggleImage = new UIToggleImage(texture, 32, 32, new Point(34 * index, 0), new Point(34 * index, 34)); uiToggleImage.Left.Set((float)(index * 36 + 8), 0.0f); uiToggleImage.SetState(true); uiToggleImage.OnClick += new UIElement.MouseEvent(FilterList); _categoryButtons.Add(uiToggleImage); element2.Append((UIElement)uiToggleImage); } uiPanel.Append(element2); }
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); }