public UISettingsItem(string name) { fileName = name; this.BorderColor = new Color(89, 116, 213) * 0.7f; this.dividerTexture = TextureManager.Load("Images/UI/Divider"); this.innerPanelTexture = TextureManager.Load("Images/UI/InnerPanelBackground"); this.Height.Set(90f, 0f); this.Width.Set(0f, 1f); base.SetPadding(6f); this.listName = new UIText(name, 1f, false); this.listName.Left.Set(10f, 0f); this.listName.Top.Set(5f, 0f); base.Append(this.listName); loadThisSettingButton = new UITextPanel <string>(TerraCustomUtils.TCText("EnableThisList"), 1f, false).WithFadedMouseOver(); loadThisSettingButton.Width.Set(100f, 0f); loadThisSettingButton.Height.Set(30f, 0f); loadThisSettingButton.Left.Set(75f, 0f); loadThisSettingButton.Top.Set(40f, 0f); loadThisSettingButton.PaddingTop -= 2f; loadThisSettingButton.PaddingBottom -= 2f; loadThisSettingButton.OnClick += new UIElement.MouseEvent(LoadThisSetting); base.Append(loadThisSettingButton); deleteThisSettingButton = new UITextPanel <string>(TerraCustomUtils.TCText("DeleteThisList"), 1f, false).WithFadedMouseOver(); deleteThisSettingButton.Width.Set(100f, 0f); deleteThisSettingButton.Height.Set(30f, 0f); deleteThisSettingButton.Left.Set(275f, 0f); deleteThisSettingButton.Top.Set(40f, 0f); deleteThisSettingButton.PaddingTop -= 2f; deleteThisSettingButton.PaddingBottom -= 2f; deleteThisSettingButton.OnClick += new UIElement.MouseEvent(DeleteThisSetting); base.Append(deleteThisSettingButton); }
public override void OnInitialize() { UIElement uIElement = new UIElement(); uIElement.Width.Set(0f, 0.8f); uIElement.MaxWidth.Set(600f, 0f); uIElement.Top.Set(220f, 0f); uIElement.Height.Set(-220f, 1f); uIElement.HAlign = 0.5f; UIPanel scrollPanel = new UIPanel(); scrollPanel.Width.Set(0f, 1f); scrollPanel.Height.Set(-65f, 1f); scrollPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f; uIElement.Append(scrollPanel); settingsItemList = new UIList(); settingsItemList.Width.Set(-25f, 1f); settingsItemList.Height.Set(0f, 1f); settingsItemList.ListPadding = 5f; scrollPanel.Append(settingsItemList); UIScrollbar uIScrollbar = new UIScrollbar(); uIScrollbar.SetView(100f, 1000f); uIScrollbar.Height.Set(0f, 1f); uIScrollbar.HAlign = 1f; scrollPanel.Append(uIScrollbar); settingsItemList.SetScrollbar(uIScrollbar); UITextPanel <string> titleTextPanel = new UITextPanel <string>(TerraCustomUtils.TCText("SavedSetings"), 0.8f, true); titleTextPanel.HAlign = 0.5f; titleTextPanel.Top.Set(-35f, 0f); titleTextPanel.SetPadding(15f); titleTextPanel.BackgroundColor = new Color(73, 94, 171); uIElement.Append(titleTextPanel); UITextPanel <string> backButton = new UITextPanel <string>(Localization.Language.GetTextValue("UI.Back"), 1f, false).WithFadedMouseOver(); backButton.Width.Set(-10f, 1f / 2f); backButton.Height.Set(25f, 0f); backButton.VAlign = 1f; backButton.Top.Set(-20f, 0f); backButton.OnClick += new UIElement.MouseEvent(BackClick); uIElement.Append(backButton); UITextPanel <string> saveNewButton = new UITextPanel <string>(TerraCustomUtils.TCText("SaveCurrentSettingsAsNew"), 1f, false).WithFadedMouseOver(Color.Green, Color.Green * 0.7f);; saveNewButton.CopyStyle(backButton); saveNewButton.BackgroundColor = Color.Green * 0.7f; saveNewButton.HAlign = 1f; saveNewButton.OnClick += new UIElement.MouseEvent(SaveNewSettings); uIElement.Append(saveNewButton); base.Append(uIElement); }
private static void SaveNewSettings(UIMouseEvent evt, UIElement listeningElement) { Main.PlaySound(11, -1, -1, 1); Main.MenuUI.SetState(new UIVirtualKeyboard(TerraCustomUtils.TCText("EnterSettingsName"), "", new UIVirtualKeyboard.KeyboardSubmitEvent(SaveSetting), () => Main.menuMode = (int)MenuModes.SettingsView, 0)); Main.menuMode = 888; }