public float textScale = 1f;// чтобы изменять размер текста в будующем public override void OnInitialize() { #region panel CurrentQuestPanel = new UIPanel(); CurrentQuestPanel.Top.Set(200f, 0f); //Позиция сверху на экране CurrentQuestPanel.Left.Set(Main.screenWidth / 2 - 293f, 0f); //Позиция слева на экране CurrentQuestPanel.Width.Set(450f, 0f); //размер по ширине в пикселях CurrentQuestPanel.Height.Set(460f, 0f); //размер по высоте в пикселях CurrentQuestPanel.SetPadding(0f); //Честно, сам без понятия, но вроде надо :shrug: /*CurrentQuestPanel.OnMouseDown += new UIElement.MouseEvent(DragStart); * CurrentQuestPanel.OnMouseUp += new UIElement.MouseEvent(DragEnd);*/ #endregion iText = new UIText(""); iText.Top.Set(15f, 0f); iText.Left.Set(17f, 0f); iText.Width.Set(253f, 0f); iText.Height.Set(158f, 0f); iText.SetPadding(0f); iText.MaxWidth.Set(253f, 0f); iText.Text.Split(' '); CurrentQuestPanel.Append(iText); base.Append(CurrentQuestPanel); }
public float textScale = 1f;// чтобы изменять размер текста в будующем public override void OnInitialize() { #region UI panel QuestTrackerPanel = new UIPanel(); QuestTrackerPanel.Top.Set(200f, 0f); //Позиция сверху на экране QuestTrackerPanel.Left.Set(Main.screenWidth / 2, 0f); //Позиция слева на экране QuestTrackerPanel.Width.Set(250f, 0f); //размер по ширине в пикселях QuestTrackerPanel.Height.Set(102f, 0f); //размер по высоте в пикселях QuestTrackerPanel.SetPadding(0f); //Честно, сам без понятия, но вроде надо :shrug: QuestTrackerPanel.BackgroundColor = new Color(255, 255, 255) * 0f; //чтобы прозрачно было QuestTrackerPanel.BorderColor = new Color(255, 255, 255) * 0f; // ^ QuestTrackerPanel.OnMouseDown += new UIElement.MouseEvent(DragStart); QuestTrackerPanel.OnMouseUp += new UIElement.MouseEvent(DragEnd); // ^ вот это нужно, чтобы панельку можно было таскать #endregion //Вот дальше идёт хардкоре, ибо дальше идут текста #region tracker texts currentQuest = new UIText("", textScale); //Ставим пока так, дабы не крашнуло currentQuest.Top.Set(10, 0); currentQuest.Left.Set(10.2f, 0); currentQuest.Width.Set(250, 0); currentQuest.Height.Set(102, 0); currentQuest.SetPadding(0); currentQuest.TextColor = Color.DarkGray; currentQuestName = new UIText("", textScale); //Ставим пока так, дабы не крашнуло currentQuestName.Top.Set(48, 0); currentQuestName.Left.Set(10.2f, 0); currentQuestName.Width.Set(250, 0); currentQuestName.Height.Set(102, 0); currentQuestName.SetPadding(0); currentQuestName.TextColor = Color.DarkGray; currentQuestText = new UIText("", textScale); //Ставим пока так, дабы не крашнуло currentQuestText.Top.Set(73, 0); currentQuestText.Left.Set(5.2f, 0); currentQuestText.Width.Set(250, 0); currentQuestText.Height.Set(102, 0); currentQuestText.SetPadding(0); currentQuestText.TextColor = Color.DarkGray; #endregion description = new UISilentButton(ModContent.GetTexture("Antiaris/Miscellaneous/QuestIconUI")); description.Top.Set(5f, 0f); description.Left.Set(222f, 0f); description.Height.Set(26, 0f); description.Width.Set(78, 0f); description.SetPadding(0f); description.OnClick += new MouseEvent(PrintInfo); QuestTrackerPanel.Append(description); QuestTrackerPanel.Append(currentQuest); QuestTrackerPanel.Append(currentQuestText); QuestTrackerPanel.Append(currentQuestName); base.Append(QuestTrackerPanel); }
public override void OnInitialize() { 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 = 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); uILoader = new UILoaderAnimatedImage(0.5f, 0.5f, 1f); modList = new UIList(); modList.Width.Set(-25f, 1f); modList.Height.Set(-50f, 1f); modList.Top.Set(50f, 0f); modList.ListPadding = 5f; uIPanel.Append(modList); UIScrollbar uIScrollbar = new UIScrollbar(); uIScrollbar.SetView(100f, 1000f); uIScrollbar.Height.Set(-50f, 1f); uIScrollbar.Top.Set(50f, 0f); uIScrollbar.HAlign = 1f; uIPanel.Append(uIScrollbar); uINoModsFoundText = new UIText(Language.GetTextValue("tModLoader.MBNoModsFound"), 1f, false) { HAlign = 0.5f }; uINoModsFoundText.SetPadding(15f); modList.SetScrollbar(uIScrollbar); uIHeaderTextPanel = new UITextPanel <string>(Language.GetTextValue("tModLoader.MenuModBrowser"), 0.8f, true) { HAlign = 0.5f }; uIHeaderTextPanel.Top.Set(-35f, 0f); uIHeaderTextPanel.SetPadding(15f); uIHeaderTextPanel.BackgroundColor = new Color(73, 94, 171); uIElement.Append(uIHeaderTextPanel); reloadButton = new UITextPanel <string>(Language.GetTextValue("tModLoader.MBGettingData"), 1f, false); reloadButton.Width.Set(-10f, 0.5f); reloadButton.Height.Set(25f, 0f); reloadButton.VAlign = 1f; reloadButton.Top.Set(-65f, 0f); reloadButton.OnMouseOver += UICommon.FadedMouseOver; reloadButton.OnMouseOut += UICommon.FadedMouseOut; reloadButton.OnClick += ReloadList; uIElement.Append(reloadButton); UITextPanel <string> backButton = new UITextPanel <string>(Language.GetTextValue("UI.Back"), 1f, false); backButton.Width.Set(-10f, 0.5f); backButton.Height.Set(25f, 0f); backButton.VAlign = 1f; backButton.Top.Set(-20f, 0f); backButton.OnMouseOver += UICommon.FadedMouseOver; backButton.OnMouseOut += UICommon.FadedMouseOut; backButton.OnClick += BackClick; uIElement.Append(backButton); clearButton = new UITextPanel <string>(Language.GetTextValue("tModLoader.MBClearSpecialFilter", "??"), 1f, false); clearButton.Width.Set(-10f, 0.5f); clearButton.Height.Set(25f, 0f); clearButton.HAlign = 1f; clearButton.VAlign = 1f; clearButton.Top.Set(-65f, 0f); clearButton.BackgroundColor = Color.Purple * 0.7f; clearButton.OnMouseOver += (s, e) => UICommon.CustomFadedMouseOver(Color.Purple, s, e); clearButton.OnMouseOut += (s, e) => UICommon.CustomFadedMouseOut(Color.Purple * 0.7f, s, e); clearButton.OnClick += (s, e) => { Interface.modBrowser.SpecialModPackFilter = null; Interface.modBrowser.SpecialModPackFilterTitle = null; Interface.modBrowser.updateNeeded = true; Main.PlaySound(SoundID.MenuTick); }; downloadAllButton = new UITextPanel <string>(Language.GetTextValue("tModLoader.MBDownloadAll"), 1f, false); downloadAllButton.Width.Set(-10f, 0.5f); downloadAllButton.Height.Set(25f, 0f); downloadAllButton.HAlign = 1f; downloadAllButton.VAlign = 1f; downloadAllButton.Top.Set(-20f, 0f); downloadAllButton.BackgroundColor = Color.Azure * 0.7f; downloadAllButton.OnMouseOver += (s, e) => UICommon.CustomFadedMouseOver(Color.Azure, s, e); downloadAllButton.OnMouseOut += (s, e) => UICommon.CustomFadedMouseOut(Color.Azure * 0.7f, s, e); downloadAllButton.OnClick += (s, e) => DownloadMods(SpecialModPackFilter, SpecialModPackFilterTitle); updateAllButton = new UITextPanel <string>(Language.GetTextValue("tModLoader.MBUpdateAll"), 1f, false); updateAllButton.Width.Set(-10f, 0.5f); updateAllButton.Height.Set(25f, 0f); updateAllButton.HAlign = 1f; updateAllButton.VAlign = 1f; updateAllButton.Top.Set(-20f, 0f); updateAllButton.BackgroundColor = Color.Orange * 0.7f; updateAllButton.OnMouseOver += (s, e) => UICommon.CustomFadedMouseOver(Color.Orange, s, e); updateAllButton.OnMouseOut += (s, e) => UICommon.CustomFadedMouseOut(Color.Orange * 0.7f, s, e); updateAllButton.OnClick += (s, e) => { if (!loading) { var updatableMods = items.Where(x => x.update && !x.updateIsDowngrade).Select(x => x.mod).ToList(); DownloadMods(updatableMods, Language.GetTextValue("tModLoader.MBUpdateAll")); } }; Append(uIElement); UIElement upperMenuContainer = new UIElement(); upperMenuContainer.Width.Set(0f, 1f); upperMenuContainer.Height.Set(32f, 0f); upperMenuContainer.Top.Set(10f, 0f); Texture2D texture = Texture2D.FromStream(Main.instance.GraphicsDevice, Assembly.GetExecutingAssembly().GetManifestResourceStream("Terraria.ModLoader.UI.UIModBrowserIcons.png")); SortModeFilterToggle = new UICycleImage(texture, 6, 32, 32, 0, 0); SortModeFilterToggle.setCurrentState((int)sortMode); SortModeFilterToggle.OnClick += (a, b) => { sortMode = sortMode.NextEnum(); updateNeeded = true; }; SortModeFilterToggle.OnRightClick += (a, b) => { sortMode = sortMode.PreviousEnum(); updateNeeded = true; }; SortModeFilterToggle.Left.Set((float)(0 * 36 + 8), 0f); _categoryButtons.Add(SortModeFilterToggle); upperMenuContainer.Append(SortModeFilterToggle); UpdateFilterToggle = new UICycleImage(texture, 3, 32, 32, 34, 0); UpdateFilterToggle.setCurrentState((int)updateFilterMode); UpdateFilterToggle.OnClick += (a, b) => { updateFilterMode = updateFilterMode.NextEnum(); updateNeeded = true; }; UpdateFilterToggle.OnRightClick += (a, b) => { updateFilterMode = updateFilterMode.PreviousEnum(); updateNeeded = true; }; UpdateFilterToggle.Left.Set((float)(1 * 36 + 8), 0f); _categoryButtons.Add(UpdateFilterToggle); upperMenuContainer.Append(UpdateFilterToggle); ModSideFilterToggle = new UICycleImage(texture, 5, 32, 32, 34 * 5, 0); ModSideFilterToggle.setCurrentState((int)modSideFilterMode); ModSideFilterToggle.OnClick += (a, b) => { modSideFilterMode = modSideFilterMode.NextEnum(); updateNeeded = true; }; ModSideFilterToggle.OnRightClick += (a, b) => { modSideFilterMode = modSideFilterMode.PreviousEnum(); updateNeeded = true; }; ModSideFilterToggle.Left.Set((float)(2 * 36 + 8), 0f); _categoryButtons.Add(ModSideFilterToggle); upperMenuContainer.Append(ModSideFilterToggle); UIPanel filterTextBoxBackground = new UIPanel(); filterTextBoxBackground.Top.Set(0f, 0f); filterTextBoxBackground.Left.Set(-170, 1f); filterTextBoxBackground.Width.Set(135f, 0f); filterTextBoxBackground.Height.Set(40f, 0f); filterTextBoxBackground.OnRightClick += (a, b) => filterTextBox.SetText(""); upperMenuContainer.Append(filterTextBoxBackground); filterTextBox = new UIInputTextField(Language.GetTextValue("tModLoader.ModsTypeToSearch")); filterTextBox.Top.Set(5, 0f); filterTextBox.Left.Set(-160, 1f); filterTextBox.Width.Set(100f, 0f); filterTextBox.Height.Set(10f, 0f); filterTextBox.OnTextChange += (sender, e) => updateNeeded = true; upperMenuContainer.Append(filterTextBox); SearchFilterToggle = new UICycleImage(texture, 2, 32, 32, 34 * 2, 0); SearchFilterToggle.setCurrentState((int)searchFilterMode); SearchFilterToggle.OnClick += (a, b) => { searchFilterMode = searchFilterMode.NextEnum(); updateNeeded = true; }; SearchFilterToggle.OnRightClick += (a, b) => { searchFilterMode = searchFilterMode.PreviousEnum(); updateNeeded = true; }; SearchFilterToggle.Left.Set(545f, 0f); _categoryButtons.Add(SearchFilterToggle); upperMenuContainer.Append(SearchFilterToggle); uIPanel.Append(upperMenuContainer); }
protected override void Initialize(UIAdvPanel WindowPanel) { WindowPanel.MainTexture = ServerSideCharacter2.ModTexturesTable["AdvInvBack1"]; WindowPanel.Left.Set(Main.screenWidth / 2 - WINDOW_WIDTH / 2, 0f); WindowPanel.Top.Set(Main.screenHeight / 2 - WINDOW_HEIGHT / 2, 0f); WindowPanel.Width.Set(WINDOW_WIDTH, 0f); WindowPanel.Height.Set(WINDOW_HEIGHT, 0f); WindowPanel.Color = Color.White * 0.8f; outerContentPanel = new UIAdvPanel(ServerSideCharacter2.ModTexturesTable["Box"]) { CornerSize = new Vector2(8, 8), Color = new Color(33, 43, 79) * 0.8f }; outerContentPanel.Top.Set(-UNIONLIST_HEIGHT / 2 + UNIONLIST_OFFSET_TOP, 0.5f); outerContentPanel.Left.Set(-UNIONLIST_WIDTH / 2 + UNIONLIST_OFFSET_RIGHT, 0.5f); outerContentPanel.Width.Set(UNIONLIST_WIDTH, 0f); outerContentPanel.Height.Set(UNIONLIST_HEIGHT + ITEMSLOT_HEIGHT, 0f); outerContentPanel.SetPadding(10f); WindowPanel.Append(outerContentPanel); mailContentPanel = new UIAdvPanel(ServerSideCharacter2.ModTexturesTable["Box"]) { CornerSize = new Vector2(8, 8), OverflowHidden = true, Color = new Color(33, 43, 79) * 0.8f }; mailContentPanel.Top.Set(-UNIONLIST_HEIGHT / 2 + UNIONLIST_OFFSET_TOP, 0.5f); mailContentPanel.Left.Set(-UNIONLIST_WIDTH / 2 + UNIONLIST_OFFSET_RIGHT, 0.5f); mailContentPanel.Width.Set(UNIONLIST_WIDTH, 0f); mailContentPanel.Height.Set(UNIONLIST_HEIGHT, 0f); mailContentPanel.SetPadding(10f); mailContentPanel.Visible = false; WindowPanel.Append(mailContentPanel); _mailContent = new UIMessageBox(GameLanguage.GetText("rankannouncement")); _mailContent.Width.Set(-25f, 1f); _mailContent.Height.Set(0f, 1f); mailContentPanel.Append(_mailContent); UIAdvScrollBar uiscrollbar = new UIAdvScrollBar(); uiscrollbar.SetView(100f, 1000f); uiscrollbar.Height.Set(-20f, 1f); uiscrollbar.VAlign = 0.5f; uiscrollbar.HAlign = 1f; mailContentPanel.Append(uiscrollbar); _mailContent.SetScrollbar(uiscrollbar); AddItemSlots(); // 上方标题 _uiTitle = new UIText("标题", 0.6f, true); _uiTitle.Top.Set(-70f, 0f); _uiTitle.SetPadding(15f); outerContentPanel.Append(_uiTitle); mailHeadPanel = new UIAdvPanel(ServerSideCharacter2.ModTexturesTable["Box"]) { CornerSize = new Vector2(8, 8), OverflowHidden = true, Color = new Color(33, 43, 79) * 0.8f }; mailHeadPanel.Top.Set(-UNIONLIST_HEIGHT / 2 + UNIONLIST_OFFSET_TOP, 0.5f); mailHeadPanel.Left.Set(-UNIONLIST_WIDTH / 2 + UNIONLIST_OFFSET_RIGHT - 260, 0.5f); mailHeadPanel.Width.Set(240, 0f); mailHeadPanel.Height.Set(UNIONLIST_HEIGHT + ITEMSLOT_HEIGHT, 0f); mailHeadPanel.SetPadding(10f); WindowPanel.Append(mailHeadPanel); _mailList = new UIAdvList(); _mailList.Width.Set(-25f, 1f); _mailList.Height.Set(0f, 1f); _mailList.ListPadding = 5f; mailHeadPanel.Append(_mailList); // ScrollBar设定 var uiscrollbar2 = new UIAdvScrollBar(); uiscrollbar2.SetView(100f, 1000f); uiscrollbar2.Height.Set(0f, 1f); uiscrollbar2.HAlign = 1f; mailHeadPanel.Append(uiscrollbar2); _mailList.SetScrollbar(uiscrollbar2); refreshButton = new UICDButton(ServerSideCharacter2.ModTexturesTable["Refresh"], false); refreshButton.Top.Set(-UNIONLIST_HEIGHT / 2 + UNIONLIST_OFFSET_TOP - 50, 0.5f); refreshButton.Left.Set(UNIONLIST_OFFSET_RIGHT + UNIONLIST_WIDTH / 2 - 35, 0.5f); refreshButton.Width.Set(35, 0f); refreshButton.Height.Set(35, 0f); refreshButton.ButtonDefaultColor = new Color(200, 200, 200); refreshButton.ButtonChangeColor = Color.White; refreshButton.UseRotation = true; refreshButton.TextureScale = 0.2f; refreshButton.Tooltip = "刷新"; refreshButton.OnClick += RefreshButton_OnClick; WindowPanel.Append(refreshButton); }