public override void OnInitialize() { Visible = false; DragablePanel = new DragableUIPanel(); DragablePanel.SetPadding(0); DragablePanel.Left.Set(Main.screenWidth - 300, 0f); DragablePanel.Top.Set(Main.screenHeight - 100, 0f); DragablePanel.Width.Set(50, 0); DragablePanel.Height.Set(50, 0f); DragablePanel.BackgroundColor = new Color(0, 0, 0, 0); DragablePanel.BorderColor = new Color(0, 0, 0, 0); _cookbookButton = new CookbookButton(ModContent.GetTexture("ExtraExplosives/Items/Accessories/AnarchistCookbook/AnarchistCookbook"), "CookbookButton"); Texture2D button1 = ModContent.GetTexture("ExtraExplosives/Items/Accessories/AnarchistCookbook/AnarchistCookbook"); UIHoverImageButton CookbookButton = new UIHoverImageButton(button1, "Anarchist Cookbook"); CookbookButton.Left.Set(22, 0f); CookbookButton.Top.Set(22, 0f); CookbookButton.Width.Set(22, 0); CookbookButton.Height.Set(22, 0f); CookbookButton.OnClick += new MouseEvent(OpenCookbook); DragablePanel.Append(CookbookButton); Append(DragablePanel); }
public override void OnInitialize() { DragableUIPanel Menu = new DragableUIPanel("Play Sound", 500, 220); Menu.VAlign = 0.6f; Menu.HAlign = 0.2f; Menu.OnCloseBtnClicked += () => ModContent.GetInstance <Creativetools>().UserInterface.SetState(new MainUI()); Append(Menu); //////////////////Sound///////////////////// var SoundSlider = MakeSlider(new UIIntRangedDataValue("", 0, 0, 42), out ID, Menu, top: 50, left: -10); SliderButtons("Play Sound", SoundSlider, button => button.OnClick += (evt, elm) => Main.PlaySound(ID.Data), false); SoundName = new UIText("") { HAlign = 0.6f, MarginTop = 20 }; SoundSlider.Append(SoundName); /////////////////LegacySound///////////// var LegacySlider = MakeSlider(new UIIntRangedDataValue("", 0, 0, 334), out LegacySound, Menu, top: 100, left: -10); SliderButtons("Play Legacy", LegacySlider, button => button.OnClick += (evt, elm) => { var soundlist = new List <LegacySoundStyle> { SoundID.NPCHit1, SoundID.NPCHit2, SoundID.NPCHit3, SoundID.NPCHit4, SoundID.NPCHit5, SoundID.NPCHit6, SoundID.NPCHit7, SoundID.NPCHit8, SoundID.NPCHit9, SoundID.NPCHit10, SoundID.NPCHit11, SoundID.NPCHit12, SoundID.NPCHit13, SoundID.NPCHit14, SoundID.NPCHit15, SoundID.NPCHit16, SoundID.NPCHit17, SoundID.NPCHit18, SoundID.NPCHit19, SoundID.NPCHit20, SoundID.NPCHit21, SoundID.NPCHit22, SoundID.NPCHit23, SoundID.NPCHit24, SoundID.NPCHit25, SoundID.NPCHit26, SoundID.NPCHit27, SoundID.NPCHit28, SoundID.NPCHit29, SoundID.NPCHit30, SoundID.NPCHit31, SoundID.NPCHit32, SoundID.NPCHit33, SoundID.NPCHit34, SoundID.NPCHit35, SoundID.NPCHit36, SoundID.NPCHit37, SoundID.NPCHit38, SoundID.NPCHit39, SoundID.NPCHit40, SoundID.NPCHit41, SoundID.NPCHit42, SoundID.NPCHit43, SoundID.NPCHit44, SoundID.NPCHit45, SoundID.NPCHit46, SoundID.NPCHit47, SoundID.NPCHit48, SoundID.NPCHit49, SoundID.NPCHit50, SoundID.NPCHit51, SoundID.NPCHit52, SoundID.NPCHit53, SoundID.NPCHit54, SoundID.NPCHit55, SoundID.NPCHit56, SoundID.NPCHit57, SoundID.NPCDeath1, SoundID.NPCDeath2, SoundID.NPCDeath3, SoundID.NPCDeath4, SoundID.NPCDeath5, SoundID.NPCDeath6, SoundID.NPCDeath7, SoundID.NPCDeath8, SoundID.NPCDeath9, SoundID.NPCDeath10, SoundID.NPCDeath11, SoundID.NPCDeath12, SoundID.NPCDeath13, SoundID.NPCDeath14, SoundID.NPCDeath15, SoundID.NPCDeath16, SoundID.NPCDeath17, SoundID.NPCDeath18, SoundID.NPCDeath19, SoundID.NPCDeath20, SoundID.NPCDeath21, SoundID.NPCDeath22, SoundID.NPCDeath23, SoundID.NPCDeath24, SoundID.NPCDeath25, SoundID.NPCDeath26, SoundID.NPCDeath27, SoundID.NPCDeath28, SoundID.NPCDeath29, SoundID.NPCDeath30, SoundID.NPCDeath31, SoundID.NPCDeath32, SoundID.NPCDeath33, SoundID.NPCDeath34, SoundID.NPCDeath35, SoundID.NPCDeath36, SoundID.NPCDeath37, SoundID.NPCDeath38, SoundID.NPCDeath39, SoundID.NPCDeath40, SoundID.NPCDeath41, SoundID.NPCDeath42, SoundID.NPCDeath43, SoundID.NPCDeath44, SoundID.NPCDeath45, SoundID.NPCDeath46, SoundID.NPCDeath47, SoundID.NPCDeath48, SoundID.NPCDeath49, SoundID.NPCDeath50, SoundID.NPCDeath51, SoundID.NPCDeath52, SoundID.NPCDeath53, SoundID.NPCDeath54, SoundID.NPCDeath55, SoundID.NPCDeath56, SoundID.NPCDeath57, SoundID.NPCDeath58, SoundID.NPCDeath59, SoundID.NPCDeath60, SoundID.NPCDeath61, SoundID.NPCDeath62, SoundID.Item1, SoundID.Item2, SoundID.Item3, SoundID.Item4, SoundID.Item5, SoundID.Item6, SoundID.Item7, SoundID.Item8, SoundID.Item9, SoundID.Item10, SoundID.Item11, SoundID.Item12, SoundID.Item13, SoundID.Item14, SoundID.Item15, SoundID.Item16, SoundID.Item17, SoundID.Item18, SoundID.Item19, SoundID.Item20, SoundID.Item21, SoundID.Item22, SoundID.Item23, SoundID.Item24, SoundID.Item25, SoundID.Item26, SoundID.Item27, SoundID.Item28, SoundID.Item29, SoundID.Item30, SoundID.Item31, SoundID.Item32, SoundID.Item33, SoundID.Item34, SoundID.Item35, SoundID.Item36, SoundID.Item37, SoundID.Item38, SoundID.Item39, SoundID.Item40, SoundID.Item41, SoundID.Item42, SoundID.Item43, SoundID.Item44, SoundID.Item45, SoundID.Item46, SoundID.Item47, SoundID.Item48, SoundID.Item49, SoundID.Item50, SoundID.Item51, SoundID.Item52, SoundID.Item53, SoundID.Item54, SoundID.Item55, SoundID.Item56, SoundID.Item57, SoundID.Item58, SoundID.Item59, SoundID.Item60, SoundID.Item61, SoundID.Item62, SoundID.Item63, SoundID.Item64, SoundID.Item65, SoundID.Item66, SoundID.Item67, SoundID.Item68, SoundID.Item69, SoundID.Item70, SoundID.Item71, SoundID.Item72, SoundID.Item73, SoundID.Item74, SoundID.Item75, SoundID.Item76, SoundID.Item77, SoundID.Item78, SoundID.Item79, SoundID.Item80, SoundID.Item81, SoundID.Item82, SoundID.Item83, SoundID.Item84, SoundID.Item85, SoundID.Item86, SoundID.Item87, SoundID.Item88, SoundID.Item89, SoundID.Item90, SoundID.Item91, SoundID.Item92, SoundID.Item93, SoundID.Item94, SoundID.Item95, SoundID.Item96, SoundID.Item97, SoundID.Item98, SoundID.Item99, SoundID.Item100, SoundID.Item101, SoundID.Item102, SoundID.Item103, SoundID.Item104, SoundID.Item105, SoundID.Item106, SoundID.Item107, SoundID.Item108, SoundID.Item109, SoundID.Item110, SoundID.Item111, SoundID.Item112, SoundID.Item113, SoundID.Item114, SoundID.Item115, SoundID.Item116, SoundID.Item117, SoundID.Item118, SoundID.Item119, SoundID.Item120, SoundID.Item121, SoundID.Item122, SoundID.Item123, SoundID.Item124, SoundID.Item125, SoundID.DD2_GoblinBomb, SoundID.BlizzardInsideBuildingLoop, SoundID.BlizzardStrongLoop, SoundID.LiquidsHoneyWater, SoundID.LiquidsHoneyLava, SoundID.LiquidsWaterLava, SoundID.DD2_BallistaTowerShot, SoundID.DD2_ExplosiveTrapExplode, SoundID.DD2_FlameburstTowerShot, SoundID.DD2_LightningAuraZap, SoundID.DD2_DefenseTowerSpawn, SoundID.DD2_BetsyDeath, SoundID.DD2_BetsyFireballShot, SoundID.DD2_BetsyFireballImpact, SoundID.DD2_BetsyFlameBreath, SoundID.DD2_BetsyFlyingCircleAttack, SoundID.DD2_BetsyHurt, SoundID.DD2_BetsyScream, SoundID.DD2_BetsySummon, SoundID.DD2_BetsyWindAttack, SoundID.DD2_DarkMageAttack, SoundID.DD2_DarkMageCastHeal, SoundID.DD2_DarkMageDeath, SoundID.DD2_DarkMageHealImpact, SoundID.DD2_DarkMageHurt, SoundID.DD2_DarkMageSummonSkeleton, SoundID.DD2_DrakinBreathIn, SoundID.DD2_DrakinDeath, SoundID.DD2_DrakinHurt, SoundID.DD2_DrakinShot, SoundID.DD2_GoblinDeath, SoundID.DD2_GoblinHurt, SoundID.DD2_GoblinScream, SoundID.DD2_GoblinBomberDeath, SoundID.DD2_GoblinBomberHurt, SoundID.DD2_GoblinBomberScream, SoundID.DD2_GoblinBomberThrow, SoundID.DD2_JavelinThrowersAttack, SoundID.DD2_JavelinThrowersDeath, SoundID.DD2_JavelinThrowersHurt, SoundID.DD2_JavelinThrowersTaunt, SoundID.DD2_KoboldDeath, SoundID.DD2_KoboldExplosion, SoundID.DD2_KoboldHurt, SoundID.DD2_KoboldIgnite, SoundID.DD2_KoboldIgniteLoop, SoundID.DD2_KoboldScreamChargeLoop, SoundID.DD2_KoboldFlyerChargeScream, SoundID.DD2_KoboldFlyerDeath, SoundID.DD2_KoboldFlyerHurt, SoundID.DD2_LightningBugDeath, SoundID.DD2_LightningBugHurt, SoundID.DD2_LightningBugZap, SoundID.DD2_OgreAttack, SoundID.DD2_OgreDeath, SoundID.DD2_OgreGroundPound, SoundID.DD2_OgreHurt, SoundID.DD2_OgreRoar, SoundID.DD2_OgreSpit, SoundID.DD2_SkeletonDeath, SoundID.DD2_SkeletonHurt, SoundID.DD2_SkeletonSummoned, SoundID.DD2_WitherBeastAuraPulse, SoundID.DD2_WitherBeastCrystalImpact, SoundID.DD2_WitherBeastDeath, SoundID.DD2_WitherBeastHurt, SoundID.DD2_WyvernDeath, SoundID.DD2_WyvernHurt, SoundID.DD2_WyvernScream, SoundID.DD2_WyvernDiveDown, SoundID.DD2_EtherianPortalDryadTouch, SoundID.DD2_EtherianPortalIdleLoop, SoundID.DD2_EtherianPortalOpen, SoundID.DD2_EtherianPortalSpawnEnemy, SoundID.DD2_CrystalCartImpact, SoundID.DD2_DefeatScene, SoundID.DD2_WinScene, SoundID.DD2_BetsysWrathShot, SoundID.DD2_BetsysWrathImpact, SoundID.DD2_BookStaffCast, SoundID.DD2_BookStaffTwisterLoop, SoundID.DD2_GhastlyGlaiveImpactGhost, SoundID.DD2_GhastlyGlaivePierce, SoundID.DD2_MonkStaffGroundImpact, SoundID.DD2_MonkStaffGroundMiss, SoundID.DD2_MonkStaffSwing, SoundID.DD2_PhantomPhoenixShot, SoundID.DD2_SonicBoomBladeSlash, SoundID.DD2_SkyDragonsFuryCircle, SoundID.DD2_SkyDragonsFuryShot, SoundID.DD2_SkyDragonsFurySwing }; Main.PlaySound(soundlist[LegacySound.Data]); }, false); LegacyName = new UIText("") { HAlign = 0.6f, MarginTop = 20 }; LegacySlider.Append(LegacyName); /////////////////Music//////////////////// var MusicSlider = MakeSlider(new UIIntRangedDataValue("", 0, 0, 41), out MusicSound, Menu, top: 150, left: -10); UITextPanel <string> PlayMusic = new UITextPanel <string>(text: playmusic ? "Stop Music" : "Play Music"); PlayMusic.SetPadding(4); PlayMusic.MarginLeft = 20; PlayMusic.Width.Set(10, 0f); PlayMusic.OnClick += (evt, element) => { playmusic = !playmusic; PlayMusic.SetText(text: playmusic ? "Stop Music" : "Play Music"); }; MusicSlider.Append(PlayMusic); MusicName = new UIText("") { HAlign = 0.6f, MarginTop = 20 }; MusicSlider.Append(MusicName); }
public override void OnInitialize() { DragableUIPanel ConfirmPanel = new DragableUIPanel("Are you sure you want to delete all your items?", 550f, 100f); ConfirmPanel.SetPadding(0); ConfirmPanel.VAlign = ConfirmPanel.HAlign = 0.5f; ConfirmPanel.OnCloseBtnClicked += () => Visible = false; Append(ConfirmPanel); UIPanel YEPbutton = new UIPanel(); YEPbutton.Width.Set(100, 0); YEPbutton.Height.Set(50, 0); YEPbutton.HAlign = 0.03f; YEPbutton.Top.Set(35, 0); YEPbutton.OnClick += YEPClicked; ConfirmPanel.Append(YEPbutton); UIPanel DelFavbutton = new UIPanel(); DelFavbutton.Width.Set(300, 0); DelFavbutton.Height.Set(50, 0); DelFavbutton.HAlign = 0.5f; DelFavbutton.Top.Set(35, 0); DelFavbutton.OnClick += DelFavClicked; ConfirmPanel.Append(DelFavbutton); UIPanel NObutton = new UIPanel(); NObutton.Width.Set(100, 0); NObutton.Height.Set(50, 0); NObutton.HAlign = 0.97f; NObutton.Top.Set(35, 0); NObutton.OnClick += NOClicked; ConfirmPanel.Append(NObutton); YEPbutton.Append(new UIText("Yes") { HAlign = 0.5f, VAlign = 0.5f }); DelFavbutton.Append(new UIText("Delete all, exept favorited Items") { HAlign = 0.5f, VAlign = 0.5f }); NObutton.Append(new UIText("NO!") { HAlign = 0.5f, VAlign = 0.5f }); }
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); }
public override void OnInitialize() { WeatherMenu = new DragableUIPanel("Weather Control", 500f, 200f); WeatherMenu.VAlign = 0.6f; WeatherMenu.HAlign = 0.2f; WeatherMenu.OnCloseBtnClicked += () => ModContent.GetInstance <Creativetools>().UserInterface.SetState(new MainUI()); Append(WeatherMenu); var TimeSlider = MakeSlider(new UIIntRangedDataValue("Time Control:", 0, 0, 86399), out Time, WeatherMenu, top: 50); WeatherMenu.Append(new UIText(Language.GetTextValue("LegacyInterface.102") + ":", 0.85f) { MarginTop = 105, MarginLeft = 20 }); float pos = 0.3f; ImageButtons(new UIHoverImageButton("Creativetools/UI Assets/FullMoon", Language.GetTextValue("GameUI.FullMoon")), WeatherMenu, button => button.OnClick += (evt, elm) => Main.moonPhase = 0, MarginTop: 100, HAllign: pos); pos += 0.1f; ImageButtons(new UIHoverImageButton("Creativetools/UI Assets/WaningGibbous", Language.GetTextValue("GameUI.WaningGibbous")), WeatherMenu, button => button.OnClick += (evt, elm) => Main.moonPhase = 1, MarginTop: 100, HAllign: pos); pos += 0.1f; ImageButtons(new UIHoverImageButton("Creativetools/UI Assets/ThirdQuarter", Language.GetTextValue("GameUI.ThirdQuarter")), WeatherMenu, button => button.OnClick += (evt, elm) => Main.moonPhase = 2, MarginTop: 100, HAllign: pos); pos += 0.1f; ImageButtons(new UIHoverImageButton("Creativetools/UI Assets/WaningCrescent", Language.GetTextValue("GameUI.WaningCrescent")), WeatherMenu, button => button.OnClick += (evt, elm) => Main.moonPhase = 3, MarginTop: 100, HAllign: pos); pos += 0.1f; ImageButtons(new UIHoverImageButton("Creativetools/UI Assets/NewMoon", Language.GetTextValue("GameUI.NewMoon")), WeatherMenu, button => button.OnClick += (evt, elm) => Main.moonPhase = 4, MarginTop: 100, HAllign: pos); pos += 0.1f; ImageButtons(new UIHoverImageButton("Creativetools/UI Assets/waxingCrescent", Language.GetTextValue("GameUI.WaxingCrescent")), WeatherMenu, button => button.OnClick += (evt, elm) => Main.moonPhase = 5, MarginTop: 100, HAllign: pos); pos += 0.1f; ImageButtons(new UIHoverImageButton("Creativetools/UI Assets/FirstQuarter", Language.GetTextValue("GameUI.FirstQuarter")), WeatherMenu, button => button.OnClick += (evt, elm) => Main.moonPhase = 6, MarginTop: 100, HAllign: pos); pos += 0.1f; ImageButtons(new UIHoverImageButton("Creativetools/UI Assets/WaxingGibbous", Language.GetTextValue("GameUI.WaxingGibbous")), WeatherMenu, button => button.OnClick += (evt, elm) => Main.moonPhase = 7, MarginTop: 100, HAllign: pos); }
public override void OnInitialize() { visible = false; panel = new DragableUIPanel(); panel.BackgroundColor = Color.CornflowerBlue; panel.BorderColor = Color.White; panel.Top.Set(Main.screenHeight / 2 - 150, 0); panel.Left.Set(Main.screenWidth / 2 - 300, 0); panel.Width.Set(350, 0); panel.Height.Set(300, 0); panel.MinWidth.Set(350, 0); panel.MinHeight.Set(300, 0); panel.MaxWidth.Set(1920, 0); panel.MaxHeight.Set(1080, 0); itemSlot = new UIItemSlot(new Item()); itemSlot.Top.Set(0, 0); itemSlot.Left.Set(0, 0); panel.Append(itemSlot); closeButton = new CloseButton(); closeButton.Top.Set(0, 0); closeButton.Left.Set(panel.GetInnerDimensions().Width - 20, 0); panel.Append(closeButton); prefixPanel = new PrefixScrollablePanel(); prefixPanel.Top.Set(itemSlot.Height.Pixels + 32, 0); prefixPanel.Left.Set(0, 0); prefixPanel.Width.Set(0, 1f); prefixPanel.Height.Set(0, 0.75f); panel.Append(prefixPanel); Append(panel); }
public override void OnInitialize() { visible = false; panel = new DragableUIPanel(); panel.BackgroundColor = Color.CornflowerBlue; panel.BorderColor = Color.White; panel.Top.Set(Main.screenHeight / 2 - 150, 0); panel.Left.Set(Main.screenWidth / 2 - 300, 0); panel.Width.Set(600, 0); panel.Height.Set(300, 0); panel.MinWidth.Set(600, 0); panel.MinHeight.Set(300, 0); panel.MaxWidth.Set(1920, 0); panel.MaxHeight.Set(1080, 0); destroySlot = new ResearchSlot(new Item()); destroySlot.Top.Set(0, 0); destroySlot.Left.Set(0, 0); panel.Append(destroySlot); totalText = new UIText("", 0.75f); totalText.Top.Set(0, 0f); totalText.Left.Set(0, 0f); panel.Append(totalText); search = new SearchUITextBox(); search.Top.Set(0, 0); search.Left.Set(destroySlot.Width.Pixels + destroySlot.MarginLeft + destroySlot.MarginRight + 112, 0); search.Width.Set(panel.GetInnerDimensions().Width - (destroySlot.Width.Pixels + destroySlot.MarginLeft + destroySlot.MarginRight + 12), 0); search.Height.Set(destroySlot.GetInnerDimensions().Height / 2, 0); search.OnTextChanged += () => setVisible(true); panel.Append(search); destroyButton = new ResearchButton(); destroyButton.BackgroundColor = Color.Blue; destroyButton.Top.Set(search.Top.Pixels + search.Height.Pixels + 2, 0); destroyButton.Left.Set(destroySlot.Width.Pixels + 12, 0); destroyButton.Height.Set(destroySlot.GetInnerDimensions().Height / 2, 0); destroyButton.Width.Set(search.Width.Pixels / 6, 0); panel.Append(destroyButton); tooltipSearch = new TooltipSearchButton(); tooltipSearch.BackgroundColor = Color.Blue; tooltipSearch.Top.Set(search.Top.Pixels + search.Height.Pixels + 2, 0); tooltipSearch.Left.Set(destroyButton.Left.Pixels + destroyButton.Width.Pixels + 24, 0); tooltipSearch.Height.Set(destroySlot.GetInnerDimensions().Height / 2, 0); tooltipSearch.Width.Set(search.Width.Pixels / 6, 0); panel.Append(tooltipSearch); clearText = new ClearTextButton(search); clearText.BackgroundColor = Color.Blue; clearText.Top.Set(search.Top.Pixels + search.Height.Pixels + 2, 0); clearText.Left.Set(tooltipSearch.Left.Pixels + tooltipSearch.Width.Pixels + 24, 0); clearText.Height.Set(destroySlot.GetInnerDimensions().Height / 2, 0); clearText.Width.Set(search.Width.Pixels / 6, 0); panel.Append(clearText); closeButton = new CloseButton(); closeButton.Top.Set(search.Top.Pixels + search.Height.Pixels + 2, 0); closeButton.Left.Set(panel.GetInnerDimensions().Width - 20, 0); panel.Append(closeButton); categories = new PathTreePanel(); categories.Top.Set(destroySlot.Height.Pixels + 32, 0); categories.Left.Set(0, 0); categories.Width.Set(panel.GetInnerDimensions().Width / 3 - 4, 0); categories.Height.Set(panel.GetInnerDimensions().Height - categories.Top.Pixels, 0); panel.Append(categories); recipes = new RecipePanel(this); recipes.Top.Set(destroySlot.Height.Pixels + 12, 0); recipes.Left.Set(panel.Width.Pixels / 3, 0); recipes.Width.Set(panel.GetInnerDimensions().Width * 2 / 3, 0); recipes.Height.Set(panel.GetInnerDimensions().Height - (recipes.Top.Pixels + 32), 0); panel.Append(recipes); Append(panel); }
public override void OnInitialize() { var panel = new DragableUIPanel("DownedBoss Toggle", 600, 430); panel.VAlign = 0.6f; panel.HAlign = 0.2f; panel.OnCloseBtnClicked += () => ModContent.GetInstance <Creativetools>().UserInterface.SetState(new MainUI()); Append(panel); var scrollbar = new UIScrollbar(); scrollbar.Width.Set(20, 0); scrollbar.Height.Set(340, 0); scrollbar.Left.Set(0, 0.9f); scrollbar.Top.Set(0, 0.1f); panel.Append(scrollbar); toggleList = new BetterUIList(); toggleList.Width.Set(0, 0.1f); toggleList.Height.Set(340, 0); toggleList.Left.Set(0, 0.1f); toggleList.Top.Set(0, 0.1f); toggleList.ListPadding = 8f; toggleList.SetScrollbar(scrollbar); panel.Append(toggleList); textList = new BetterUIList(); textList.Width.Set(0, 0.9f); textList.Height.Set(340, 0); textList.Left.Set(0, 0.2f); textList.Top.Set(0, 0.1f); textList.ListPadding = 5f; textList.SetScrollbar(scrollbar); panel.Append(textList); BindingFlags flags = BindingFlags.Public | BindingFlags.Static; AddToggle(typeof(NPC).GetField("downedBoss1", flags), "(EoC)"); AddToggle(typeof(NPC).GetField("downedBoss2", flags), "(BoC/EoW)"); AddToggle(typeof(NPC).GetField("downedBoss3", flags), "(Skeletron)"); AddToggle(typeof(NPC).GetField("downedQueenBee", flags)); AddToggle(typeof(NPC).GetField("downedSlimeKing", flags)); AddToggle(typeof(NPC).GetField("downedGoblins", flags)); AddToggle(typeof(NPC).GetField("downedFrost", flags)); AddToggle(typeof(NPC).GetField("downedPirates", flags)); AddToggle(typeof(NPC).GetField("downedClown", flags)); AddToggle(typeof(NPC).GetField("downedPlantBoss", flags)); AddToggle(typeof(NPC).GetField("downedGolemBoss", flags)); AddToggle(typeof(NPC).GetField("downedMartians", flags)); AddToggle(typeof(NPC).GetField("downedFishron", flags)); AddToggle(typeof(NPC).GetField("downedHalloweenTree", flags)); AddToggle(typeof(NPC).GetField("downedHalloweenKing", flags)); AddToggle(typeof(NPC).GetField("downedChristmasIceQueen", flags)); AddToggle(typeof(NPC).GetField("downedChristmasTree", flags)); AddToggle(typeof(NPC).GetField("downedChristmasSantank", flags)); AddToggle(typeof(NPC).GetField("downedAncientCultist", flags)); AddToggle(typeof(NPC).GetField("downedMoonlord", flags)); AddToggle(typeof(NPC).GetField("downedTowerSolar", flags)); AddToggle(typeof(NPC).GetField("downedTowerVortex", flags)); AddToggle(typeof(NPC).GetField("downedTowerNebula", flags)); AddToggle(typeof(NPC).GetField("downedTowerStardust", flags)); AddToggle(typeof(NPC).GetField("downedMechBossAny", flags)); AddToggle(typeof(NPC).GetField("downedMechBoss1", flags), "(The Destroyer)"); AddToggle(typeof(NPC).GetField("downedMechBoss2", flags), "(The Twins)"); AddToggle(typeof(NPC).GetField("downedMechBoss3", flags), "(Skeletron Prime)"); var resetBtn = new UITextPanel <string>("Uncheck all"); resetBtn.SetPadding(4); resetBtn.Left.Set(0, 0.5f); resetBtn.Top.Set(0, 0.92f); resetBtn.Width.Set(0, 0.3f); resetBtn.OnClick += (evt, elm) => SetAll(false); panel.Append(resetBtn); var allTrueBtn = new UITextPanel <string>("Check all"); allTrueBtn.SetPadding(4); allTrueBtn.Left.Set(0, 0.1f); allTrueBtn.Top.Set(0, 0.92f); allTrueBtn.Width.Set(0, 0.3f); allTrueBtn.OnClick += (evt, elm) => SetAll(true); panel.Append(allTrueBtn); base.OnInitialize(); }
// In OnInitialize, we place various UIElements onto our UIState (this class). // UIState classes have width and height equal to the full screen, because of this, usually we first define a UIElement that will act as the container for our UI. // We then place various other UIElement onto that container UIElement positioned relative to the container UIElement. public override void OnInitialize() { // Here we define our container UIElement. In DragableUIPanel.cs, you can see that DragableUIPanel is a UIPanel with a couple added features. // Here we define our container UIElement. In DragableUIPanel.cs, you can see that DragableUIPanel is a UIPanel with a couple added features. //pokemon icons // Next, we create another UIElement that we will place. Since we will be calling `mainPanel.Append(playButton);`, Left and Top are relative to the top left of the mainPanel UIElement. // By properly nesting UIElements, we can position things relatively to each other easily. mainPanel = new DragableUIPanel(); mainPanel.SetPadding(0); // We need to place this UIElement in relation to its Parent. Later we will be calling `base.Append(mainPanel);`. // This means that this class, ExampleUI, will be our Parent. Since ExampleUI is a UIState, the Left and Top are relative to the top left of the screen. mainPanel.HAlign = 0.4f; mainPanel.VAlign = 0.65f; mainPanel.Width.Set(185, 0f); mainPanel.Height.Set(150f, 0f); partyslot1 = new VanillaItemSlotWrapper(ItemSlot.Context.BankItem, 1f); partyslot1.SetPadding(0); // We need to place this UIElement in relation to its Parent. Later we will be calling `base.Append(mainPanel);`. // This means that this class, ExampleUI, will be our Parent. Since ExampleUI is a UIState, the Left and Top are relative to the top left of the screen. partyslot1.HAlign = 0.15f; partyslot1.VAlign = 0.15f; partyslot1.ValidItemFunc = item => item.IsAir || TerramonMod.PokeballFactory.GetEnum(item.modItem) != TerramonMod.PokeballFactory.Pokebals.Nothing; mainPanel.Append(partyslot1); partyslot2 = new VanillaItemSlotWrapper(ItemSlot.Context.BankItem, 1f); partyslot2.SetPadding(0); // We need to place this UIElement in relation to its Parent. Later we will be calling `base.Append(mainPanel);`. // This means that this class, ExampleUI, will be our Parent. Since ExampleUI is a UIState, the Left and Top are relative to the top left of the screen. partyslot2.HAlign = 0.5f; partyslot2.VAlign = 0.15f; partyslot2.ValidItemFunc = item => item.IsAir || TerramonMod.PokeballFactory.GetEnum(item.modItem) != TerramonMod.PokeballFactory.Pokebals.Nothing; mainPanel.Append(partyslot2); partyslot3 = new VanillaItemSlotWrapper(ItemSlot.Context.BankItem, 1f); partyslot3.SetPadding(0); // We need to place this UIElement in relation to its Parent. Later we will be calling `base.Append(mainPanel);`. // This means that this class, ExampleUI, will be our Parent. Since ExampleUI is a UIState, the Left and Top are relative to the top left of the screen. partyslot3.HAlign = 0.85f; partyslot3.VAlign = 0.15f; partyslot3.ValidItemFunc = item => item.IsAir || TerramonMod.PokeballFactory.GetEnum(item.modItem) != TerramonMod.PokeballFactory.Pokebals.Nothing; mainPanel.Append(partyslot3); partyslot4 = new VanillaItemSlotWrapper(ItemSlot.Context.BankItem, 1f); partyslot4.SetPadding(0); // We need to place this UIElement in relation to its Parent. Later we will be calling `base.Append(mainPanel);`. // This means that this class, ExampleUI, will be our Parent. Since ExampleUI is a UIState, the Left and Top are relative to the top left of the screen. partyslot4.HAlign = 0.15f; partyslot4.VAlign = 0.85f; partyslot4.ValidItemFunc = item => item.IsAir || TerramonMod.PokeballFactory.GetEnum(item.modItem) != TerramonMod.PokeballFactory.Pokebals.Nothing; mainPanel.Append(partyslot4); partyslot5 = new VanillaItemSlotWrapper(ItemSlot.Context.BankItem, 1f); partyslot5.SetPadding(0); // We need to place this UIElement in relation to its Parent. Later we will be calling `base.Append(mainPanel);`. // This means that this class, ExampleUI, will be our Parent. Since ExampleUI is a UIState, the Left and Top are relative to the top left of the screen. partyslot5.HAlign = 0.5f; partyslot5.VAlign = 0.85f; partyslot5.ValidItemFunc = item => item.IsAir || TerramonMod.PokeballFactory.GetEnum(item.modItem) != TerramonMod.PokeballFactory.Pokebals.Nothing; mainPanel.Append(partyslot5); partyslot6 = new VanillaItemSlotWrapper(ItemSlot.Context.BankItem, 1f); partyslot6.SetPadding(0); // We need to place this UIElement in relation to its Parent. Later we will be calling `base.Append(mainPanel);`. // This means that this class, ExampleUI, will be our Parent. Since ExampleUI is a UIState, the Left and Top are relative to the top left of the screen. partyslot6.HAlign = 0.85f; partyslot6.VAlign = 0.85f; partyslot6.ValidItemFunc = item => item.IsAir || TerramonMod.PokeballFactory.GetEnum(item.modItem) != TerramonMod.PokeballFactory.Pokebals.Nothing; mainPanel.Append(partyslot6); Append(mainPanel); partyslot1.OnItemPlaced += UpdateUI; partyslot2.OnItemPlaced += UpdateUI; partyslot3.OnItemPlaced += UpdateUI; partyslot4.OnItemPlaced += UpdateUI; partyslot5.OnItemPlaced += UpdateUI; partyslot6.OnItemPlaced += UpdateUI; }
// In OnInitialize, we place various UIElements onto our UIState (this class). // UIState classes have width and height equal to the full screen, because of this, usually we first define a UIElement that will act as the container for our UI. // We then place various other UIElement onto that container UIElement positioned relative to the container UIElement. public override void OnInitialize() { // Here we define our container UIElement. In DragableUIPanel.cs, you can see that DragableUIPanel is a UIPanel with a couple added features. // Here we define our container UIElement. In DragableUIPanel.cs, you can see that DragableUIPanel is a UIPanel with a couple added features. //pokemon icons // Next, we create another UIElement that we will place. Since we will be calling `mainPanel.Append(playButton);`, Left and Top are relative to the top left of the mainPanel UIElement. // By properly nesting UIElements, we can position things relatively to each other easily. mainPanel = new DragableUIPanel(); mainPanel.SetPadding(0); // We need to place this UIElement in relation to its Parent. Later we will be calling `base.Append(mainPanel);`. // This means that this class, ExampleUI, will be our Parent. Since ExampleUI is a UIState, the Left and Top are relative to the top left of the screen. mainPanel.HAlign = 0.4f; mainPanel.VAlign = 0.65f; mainPanel.Width.Set(180, 0f); mainPanel.Height.Set(70f, 0f); partyslot1 = new VanillaItemSlotWrapper(ItemSlot.Context.BankItem, 1f); partyslot1.SetPadding(0); // We need to place this UIElement in relation to its Parent. Later we will be calling `base.Append(mainPanel);`. // This means that this class, ExampleUI, will be our Parent. Since ExampleUI is a UIState, the Left and Top are relative to the top left of the screen. partyslot1.HAlign = 0.15f; partyslot1.VAlign = 0.5f; partyslot1.ValidItemFunc = item => item.IsAir || TerramonMod.PokeballFactory.GetEnum(item.modItem) != TerramonMod.PokeballFactory.Pokebals.Nothing; mainPanel.Append(partyslot1); partyslot2 = new VanillaItemSlotWrapper(ItemSlot.Context.BankItem, 1f); partyslot2.SetPadding(0); // We need to place this UIElement in relation to its Parent. Later we will be calling `base.Append(mainPanel);`. // This means that this class, ExampleUI, will be our Parent. Since ExampleUI is a UIState, the Left and Top are relative to the top left of the screen. partyslot2.HAlign = 0.65f; partyslot2.VAlign = 0.5f; partyslot2.ValidItemFunc = item => item.IsAir || item.modItem is RareCandy; mainPanel.Append(partyslot2); PokemonGoesHere = new UIText("0/0"); PokemonGoesHere.HAlign = 0.5f; PokemonGoesHere.VAlign = 1.5f; PokemonGoesHere.SetText("Place a Pokémon in the first slot."); mainPanel.Append(PokemonGoesHere); RareCandiesGoHere = new UIText("0/0"); RareCandiesGoHere.HAlign = 0.5f; RareCandiesGoHere.VAlign = 1.7f; RareCandiesGoHere.SetText(""); mainPanel.Append(RareCandiesGoHere); Texture2D buttonSaveTexture = ModContent.GetTexture("Terraria/UI/ButtonPlay"); SaveButton = new UIHoverImageButton(buttonSaveTexture, "Evolve!"); // Localized text for "Close" SaveButton.HAlign = 0.95f; SaveButton.VAlign = 0.53f; SaveButton.Width.Set(30, 0f); SaveButton.Height.Set(30, 0f); SaveButton.OnClick += new MouseEvent(EvolveButtonClicked); //Texture2D buttonSaveTexture = ModContent.GetTexture("Terraria/UI/ButtonPlay"); //UIHoverImageButton SaveButton = new UIHoverImageButton(buttonSaveTexture, "Evolve"); // Localized text for "Close" //SaveButton.Left.Set(33, 0f); //SaveButton.Top.Set(7, 0f); //SaveButton.Width.Set(30, 0f); //SaveButton.Height.Set(30, 0f); //SaveButton.OnClick += new MouseEvent(); //mainPanel.Append(SaveButton); Append(mainPanel); // As a recap, ExampleUI is a UIState, meaning it covers the whole screen. We attach mainPanel to ExampleUI some distance from the top left corner. // We then place playButton, closeButton, and moneyDiplay onto mainPanel so we can easily place these UIElements relative to mainPanel. // Since mainPanel will move, this proper organization will move playButton, closeButton, and moneyDiplay properly when mainPanel moves. }
public override void OnInitialize() { DragableUIPanel MenuPanel = new DragableUIPanel("Creativetools Menu", 442f, 212f) { VAlign = 0.5f, HAlign = 0.1f }; MenuPanel.OnCloseBtnClicked += () => { GetInstance <Creativetools>().UserInterface.SetState(null); Main.PlaySound(SoundID.MenuClose); }; Append(MenuPanel); buttonGrid = new UIGrid(8); buttonGrid.Top.Set(40, 0f); buttonGrid.Left.Set(10, 0f); buttonGrid.Width.Set(0, 1); buttonGrid.Height.Set(0, 1); buttonGrid.ListPadding = 10f; MenuPanel.Append(buttonGrid); // 1. Zeile buttonGrid.Add(new MenuButton("bloodmoonToggle", "Toggle bloodmoon", (evt, element) => Main.bloodMoon = !Main.bloodMoon)); buttonGrid.Add(new MenuButton("frostmoonToggle", "Toggle Frost moon", (evt, element) => { if (Main.snowMoon) { Main.stopMoonEvent(); } else { Main.startSnowMoon(); } })); buttonGrid.Add(new MenuButton("pumpkinmoonToggle", "Toggle Pumpkin moon", (evt, element) => { if (Main.pumpkinMoon) { Main.stopMoonEvent(); } else { Main.startPumpkinMoon(); } })); buttonGrid.Add(new MenuButton("solareclipseToggle", "Toggle Solar Eclipse", (evt, element) => Main.eclipse = !Main.eclipse)); buttonGrid.Add(new MenuButton("pirateInvasionToggle", "Toggle Pirate invasion", (evt, element) => ToggleInvasion(InvasionID.PirateInvasion))); buttonGrid.Add(new MenuButton("goblinInvasionToggle", "Toggle Goblin invasion", (evt, element) => ToggleInvasion(InvasionID.GoblinArmy))); buttonGrid.Add(new MenuButton("alienInvasionToggle", "Toggle Martian Madness", (evt, element) => ToggleInvasion(InvasionID.MartianMadness))); buttonGrid.Add(new MenuButton("frostLegionToggle", "Toggle Frost Legion", (evt, element) => ToggleInvasion(InvasionID.SnowLegion))); // 2. Zeile buttonGrid.Add(new MenuButton("hardmodeToggle", "Toggle hardmode", (evt, element) => Main.hardMode = !Main.hardMode)); buttonGrid.Add(new MenuButton("expertModeToggle", "Toggle Expert Mode", (evt, element) => Main.expertMode = !Main.expertMode)); buttonGrid.Add(new MenuButton("halloweenToggle", "Toggle halloween", (evt, element) => Main.halloween = !Main.halloween)); buttonGrid.Add(new MenuButton("xmasToggle", "Toggle Christmas", (evt, element) => Main.xMas = !Main.xMas)); buttonGrid.Add(new MenuButton("partyToggle", "Toggle party", (evt, element) => BirthdayParty.GenuineParty = !BirthdayParty.PartyIsUp)); buttonGrid.Add(new MenuButton("slimerainToggle", "Toggle Slime Rain", (evt, element) => { if (Main.slimeRain) { Main.StopSlimeRain(announce: true); } else { Main.StartSlimeRain(announce: true); } })); buttonGrid.Add(new MenuButton("spawnMeteor", "spawn Meteor", (evt, element) => WorldGen.dropMeteor())); buttonGrid.Add(new MenuButton("clearInventory", "Clear inventory", (evt, element) => Confirm_Panel.Visible = true)); // 3. Zeile buttonGrid.Add(new MenuButton("modifyItem", "Modify Item/Player", (evt, element) => GetInstance <Creativetools>().UserInterface.SetState(new ItemModUI()))); buttonGrid.Add(new MenuButton("custom", "Custom Item/NPC", (evt, element) => GetInstance <Creativetools>().UserInterface.SetState(new CustomNPCUI()))); buttonGrid.Add(new MenuButton("creativeFly", "Creative Fly", (evt, element) => MovePlayer.CreativeFly = !MovePlayer.CreativeFly)); buttonGrid.Add(new MenuButton("magicCursor", "Magic Cursor", (evt, element) => MagicCursor = !MagicCursor)); buttonGrid.Add(new MenuButton("Info", "Game Info", (evt, element) => GameInfo.Visible = !GameInfo.Visible)); buttonGrid.Add(new MenuButton("weatherControl", "Weather Control", (evt, element) => GetInstance <Creativetools>().UserInterface.SetState(new WeatherControlUI()))); buttonGrid.Add(new MenuButton("playSound", "Play Sound", (evt, element) => GetInstance <Creativetools>().UserInterface.SetState(new PlaySoundUI()))); buttonGrid.Add(new MenuButton("DownedBossToggle", "DownedBoss Toggle", (evt, element) => GetInstance <Creativetools>().UserInterface.SetState(new DownedBossToggleUI()))); }