Example #1
0
        public UITinker()
        {
            Top.Set(300, 0f);
            Left.Set(100, 0f);
            Height.Set(500, 0f);
            Width.Set(200, 0f);
            var tt = new DragableUIPanel();

            tt.Draggable = false;
            tt.Top.Set(50, 0);
            tt.Left.Set(10, 0);
            tt.Width.Set(180, 0);
            tt.Height.Set(400, 0);
            tt.BackgroundColor = new Color(100, 44, 25);
            Append(tt);
            list = new UIList();
            tt.Append(list);
            //list.Top.Set(50, 0);
            //list.Left.Set(10, 0);
            list.Width.Set(180, 0);
            list.Height.Set(400, 0);
            var el = new UITextPanel <LocalizedText>(Language.GetText("UI.Back"), 0.7f);

            el.HAlign = 0.5f;
            el.Top.Set(-45f, 0.0f);
            el.Left.Set(-10f, 0.0f);
            el.SetPadding(15f);
            list.Add(el);
            //Append(list);
        }
        public override void OnInitialize()
        {
            var element = new UIElement();

            element.Width.Set(0.0f, 0.8f);
            element.MaxWidth.Set(650f, 0.0f);
            element.Top.Set(220f, 0.0f);
            element.Height.Set(-220f, 1f);
            element.HAlign = 0.5f;
            var uiPanel = new UIPanel();

            uiPanel.Width.Set(0.0f, 1f);
            uiPanel.Height.Set(-110f, 1f);
            uiPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f;
            element.Append((UIElement)uiPanel);
            this._containerPanel = uiPanel;
            this._worldList      = new UIList();
            this._worldList.Width.Set(-25f, 1f);
            this._worldList.Height.Set(0.0f, 1f);
            this._worldList.ListPadding = 5f;
            uiPanel.Append((UIElement)this._worldList);
            var scrollbar = new UIScrollbar();

            scrollbar.SetView(100f, 1000f);
            scrollbar.Height.Set(0.0f, 1f);
            scrollbar.HAlign = 1f;
            uiPanel.Append((UIElement)scrollbar);
            this._worldList.SetScrollbar(scrollbar);
            var uiTextPanel1 =
                new UITextPanel <LocalizedText>(Language.GetText("UI.SelectWorld"), 0.8f, true);

            uiTextPanel1.HAlign = 0.5f;
            uiTextPanel1.Top.Set(-35f, 0.0f);
            uiTextPanel1.SetPadding(15f);
            uiTextPanel1.BackgroundColor = new Color(73, 94, 171);
            element.Append((UIElement)uiTextPanel1);
            var 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.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);
            element.Append((UIElement)uiTextPanel2);
            this._backPanel = uiTextPanel2;
            var uiTextPanel3 =
                new UITextPanel <LocalizedText>(Language.GetText("UI.New"), 0.7f, true);

            uiTextPanel3.CopyStyle((UIElement)uiTextPanel2);
            uiTextPanel3.HAlign       = 1f;
            uiTextPanel3.OnMouseOver += new UIElement.MouseEvent(this.FadedMouseOver);
            uiTextPanel3.OnMouseOut  += new UIElement.MouseEvent(this.FadedMouseOut);
            uiTextPanel3.OnClick     += new UIElement.MouseEvent(this.NewWorldClick);
            element.Append((UIElement)uiTextPanel3);
            this._newPanel = uiTextPanel3;
            this.Append(element);
        }
Example #3
0
        //private UITextPanel<string> buttonOMF;

        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 = UICommon.MainPanelBackground;
            uIPanel.PaddingTop      = 0f;
            uIElement.Append(uIPanel);

            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);

            modList.SetScrollbar(uIScrollbar);

            UITextPanel <string> uIHeaderTexTPanel = new UITextPanel <string>(Language.GetTextValue("tModLoader.ModsModsList"), 0.8f, true);

            uIHeaderTexTPanel.HAlign = 0.5f;
            uIHeaderTexTPanel.Top.Set(-35f, 0f);
            uIHeaderTexTPanel.SetPadding(15f);
            uIHeaderTexTPanel.BackgroundColor = UICommon.DefaultUIBlue;
            uIElement.Append(uIHeaderTexTPanel);

            buttonB = new UITextPanel <string>(Language.GetTextValue("UI.Back"), 1f, false);
            buttonB.Width.Set(-10f, 1f / 3f);
            buttonB.Height.Set(25f, 0f);
            buttonB.VAlign = 1f;
            buttonB.Top.Set(-20f, 0f);
            buttonB.WithFadedMouseOver();
            buttonB.OnClick += BackClick;
            uIElement.Append(buttonB);

            //buttonOMF = new UITextPanel<string>(Language.GetTextValue("tModLoader.ModsOpenModsFolder"), 1f, false);
            //buttonOMF.CopyStyle(buttonB);
            //buttonOMF.HAlign = 0.5f;
            //buttonOMF.OnMouseOver += UICommon.FadedMouseOver;
            //buttonOMF.OnMouseOut += UICommon.FadedMouseOut;
            //buttonOMF.OnClick += OpenModsFolder;
            //uIElement.Append(buttonOMF);

            Append(uIElement);
        }
Example #4
0
        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 uIPanel = new UIPanel();

            uIPanel.Width.Set(0f, 1f);
            uIPanel.Height.Set(-110f, 1f);
            uIPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f;
            uIElement.Append(uIPanel);

            modInfo = new UIMessageBox("This is a test of mod info here.");
            modInfo.Width.Set(-25f, 1f);
            modInfo.Height.Set(0f, 1f);
            uIPanel.Append(modInfo);

            UIScrollbar uIScrollbar = new UIScrollbar();

            uIScrollbar.SetView(100f, 1000f);
            uIScrollbar.Height.Set(-20, 1f);
            uIScrollbar.VAlign = 0.5f;
            uIScrollbar.HAlign = 1f;
            uIPanel.Append(uIScrollbar);

            modInfo.SetScrollbar(uIScrollbar);
            uITextPanel        = new UITextPanel <string>("Mod Info", 0.8f, true);
            uITextPanel.HAlign = 0.5f;
            uITextPanel.Top.Set(-35f, 0f);
            uITextPanel.SetPadding(15f);
            uITextPanel.BackgroundColor = new Color(73, 94, 171);
            uIElement.Append(uITextPanel);

            modHomepageButton = new UITextPanel <string>("Visit the Mod's Homepage for even more info", 1f, false);
            modHomepageButton.Width.Set(-10f, 1f);
            modHomepageButton.Height.Set(25f, 0f);
            modHomepageButton.VAlign = 1f;
            modHomepageButton.Top.Set(-65f, 0f);
            modHomepageButton.OnMouseOver += UICommon.FadedMouseOver;
            modHomepageButton.OnMouseOut  += UICommon.FadedMouseOut;
            modHomepageButton.OnClick     += VisitModHomePage;
            uIElement.Append(modHomepageButton);

            UITextPanel <string> backButton = new UITextPanel <string>("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);

            Append(uIElement);
        }
        public DragableUIPanel(string headingtext, float width, float height)
        {
            Width.Set(width, 0f);
            Height.Set(height, 0f);
            SetPadding(0);

            header = new UIPanel();
            header.SetPadding(0);
            header.Width = Width;
            header.Height.Set(30, 0f);
            header.BackgroundColor.A = 255;
            header.OnMouseDown      += Header_OnMouseDown;
            header.OnMouseUp        += Header_OnMouseUp;
            Append(header);

            var heading = new UIText(headingtext, 0.9f);

            heading.VAlign     = 0.5f;
            heading.MarginLeft = 16f;
            header.Append(heading);

            var closeBtn = new UITextPanel <char>('X');

            closeBtn.SetPadding(7);
            closeBtn.Width.Set(40, 0);
            closeBtn.Left.Set(-40, 1f);
            closeBtn.BackgroundColor.A = 255;
            closeBtn.OnClick          += (evt, elm) => OnCloseBtnClicked?.Invoke();
            header.Append(closeBtn);
        }
Example #6
0
        public override void OnInitialize()
        {
            UIElement element = new UIElement();

            element.Width.Set(0.0f, 0.8f);
            element.MaxWidth.Set(650f, 0.0f);
            element.Top.Set(220f, 0.0f);
            element.Height.Set(-220f, 1f);
            element.HAlign = 0.5f;
            UIPanel uiPanel = new UIPanel();

            uiPanel.Width.Set(0.0f, 1f);
            uiPanel.Height.Set(-110f, 1f);
            uiPanel.BackgroundColor = Color.op_Multiply(new Color(33, 43, 79), 0.8f);
            this._containerPanel    = uiPanel;
            element.Append((UIElement)uiPanel);
            this._playerList = new UIList();
            this._playerList.Width.Set(-25f, 1f);
            this._playerList.Height.Set(0.0f, 1f);
            this._playerList.ListPadding = 5f;
            uiPanel.Append((UIElement)this._playerList);
            UIScrollbar scrollbar = new UIScrollbar();

            scrollbar.SetView(100f, 1000f);
            scrollbar.Height.Set(0.0f, 1f);
            scrollbar.HAlign = 1f;
            uiPanel.Append((UIElement)scrollbar);
            this._playerList.SetScrollbar(scrollbar);
            UITextPanel <LocalizedText> uiTextPanel1 = new UITextPanel <LocalizedText>(Language.GetText("UI.SelectPlayer"), 0.8f, true);

            uiTextPanel1.HAlign = 0.5f;
            uiTextPanel1.Top.Set(-35f, 0.0f);
            uiTextPanel1.SetPadding(15f);
            uiTextPanel1.BackgroundColor = new Color(73, 94, 171);
            element.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.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);
            uiTextPanel2.SetSnapPoint("Back", 0, new Vector2?(), new Vector2?());
            element.Append((UIElement)uiTextPanel2);
            this._backPanel = uiTextPanel2;
            UITextPanel <LocalizedText> uiTextPanel3 = new UITextPanel <LocalizedText>(Language.GetText("UI.New"), 0.7f, true);

            uiTextPanel3.CopyStyle((UIElement)uiTextPanel2);
            uiTextPanel3.HAlign       = 1f;
            uiTextPanel3.OnMouseOver += new UIElement.MouseEvent(this.FadedMouseOver);
            uiTextPanel3.OnMouseOut  += new UIElement.MouseEvent(this.FadedMouseOut);
            uiTextPanel3.OnClick     += new UIElement.MouseEvent(this.NewCharacterClick);
            element.Append((UIElement)uiTextPanel3);
            uiTextPanel2.SetSnapPoint("New", 0, new Vector2?(), new Vector2?());
            this._newPanel = uiTextPanel3;
            this.Append(element);
        }
Example #7
0
        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);
        }
Example #8
0
        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);
        }
Example #9
0
        public override void OnInitialize()
        {
            UIElement uIElement = new UIElement();

            uIElement.Width.Set(0f, 0.8f);
            uIElement.MaxWidth.Set(650f, 0f);
            uIElement.Top.Set(220f, 0f);
            uIElement.Height.Set(-220f, 1f);
            uIElement.HAlign = 0.5f;
            UIPanel uIPanel = new UIPanel();

            uIPanel.Width.Set(0f, 1f);
            uIPanel.Height.Set(-110f, 1f);
            uIPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f;
            _containerPanel         = uIPanel;
            uIElement.Append(uIPanel);
            _playerList = new UIList();
            _playerList.Width.Set(0f, 1f);
            _playerList.Height.Set(0f, 1f);
            _playerList.ListPadding = 5f;
            uIPanel.Append(_playerList);
            _scrollbar = new UIScrollbar();
            _scrollbar.SetView(100f, 1000f);
            _scrollbar.Height.Set(0f, 1f);
            _scrollbar.HAlign = 1f;
            _playerList.SetScrollbar(_scrollbar);
            UITextPanel <LocalizedText> uITextPanel = new UITextPanel <LocalizedText>(Language.GetText("UI.SelectPlayer"), 0.8f, large: true);

            uITextPanel.HAlign = 0.5f;
            uITextPanel.Top.Set(-40f, 0f);
            uITextPanel.SetPadding(15f);
            uITextPanel.BackgroundColor = new Color(73, 94, 171);
            uIElement.Append(uITextPanel);
            UITextPanel <LocalizedText> uITextPanel2 = new UITextPanel <LocalizedText>(Language.GetText("UI.Back"), 0.7f, large: true);

            uITextPanel2.Width.Set(-10f, 0.5f);
            uITextPanel2.Height.Set(50f, 0f);
            uITextPanel2.VAlign = 1f;
            uITextPanel2.Top.Set(-45f, 0f);
            uITextPanel2.OnMouseOver += FadedMouseOver;
            uITextPanel2.OnMouseOut  += FadedMouseOut;
            uITextPanel2.OnClick     += GoBackClick;
            uITextPanel2.SetSnapPoint("Back", 0);
            uIElement.Append(uITextPanel2);
            _backPanel = uITextPanel2;
            UITextPanel <LocalizedText> uITextPanel3 = new UITextPanel <LocalizedText>(Language.GetText("UI.New"), 0.7f, large: true);

            uITextPanel3.CopyStyle(uITextPanel2);
            uITextPanel3.HAlign       = 1f;
            uITextPanel3.OnMouseOver += FadedMouseOver;
            uITextPanel3.OnMouseOut  += FadedMouseOut;
            uITextPanel3.OnClick     += NewCharacterClick;
            uIElement.Append(uITextPanel3);
            uITextPanel2.SetSnapPoint("New", 0);
            _newPanel = uITextPanel3;
            Append(uIElement);
        }
        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 uIPanel = new UIPanel();

            uIPanel.Width.Set(0f, 1f);
            uIPanel.Height.Set(-110f, 1f);
            uIPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f;
            uIElement.Append(uIPanel);
            _playerList = new UIList();
            _playerList.Width.Set(-25f, 1f);
            _playerList.Height.Set(0f, 1f);
            _playerList.ListPadding = 5f;
            uIPanel.Append(_playerList);
            UIScrollbar uIScrollbar = new UIScrollbar();

            uIScrollbar.SetView(100f, 1000f);
            uIScrollbar.Height.Set(0f, 1f);
            uIScrollbar.HAlign = 1f;
            uIPanel.Append(uIScrollbar);
            _playerList.SetScrollbar(uIScrollbar);
            UITextPanel uITextPanel = new UITextPanel("Select Player", 0.8f, true);

            uITextPanel.HAlign = 0.5f;
            uITextPanel.Top.Set(-35f, 0f);
            uITextPanel.SetPadding(15f);
            uITextPanel.BackgroundColor = new Color(73, 94, 171);
            uIElement.Append(uITextPanel);
            UITextPanel uITextPanel2 = new UITextPanel("Back", 0.7f, true);

            uITextPanel2.Width.Set(-10f, 0.5f);
            uITextPanel2.Height.Set(50f, 0f);
            uITextPanel2.VAlign = 1f;
            uITextPanel2.Top.Set(-45f, 0f);
            uITextPanel2.OnMouseOver += FadedMouseOver;
            uITextPanel2.OnMouseOut  += FadedMouseOut;
            uITextPanel2.OnClick     += GoBackClick;
            uIElement.Append(uITextPanel2);
            UITextPanel uITextPanel3 = new UITextPanel("New", 0.7f, true);

            uITextPanel3.CopyStyle(uITextPanel2);
            uITextPanel3.HAlign       = 1f;
            uITextPanel3.OnMouseOver += FadedMouseOver;
            uITextPanel3.OnMouseOut  += FadedMouseOut;
            uITextPanel3.OnClick     += NewCharacterClick;
            uIElement.Append(uITextPanel3);
            Append(uIElement);
        }
Example #11
0
        public override void OnInitialize()
        {
            UIElement element = new UIElement();

            element.Width.Set(0.0f, 0.8f);
            element.MaxWidth.Set(600f, 0.0f);
            element.Top.Set(220f, 0.0f);
            element.Height.Set(-220f, 1f);
            element.HAlign = 0.5f;
            UIPanel uiPanel = new UIPanel();

            uiPanel.Width.Set(0.0f, 1f);
            uiPanel.Height.Set(-110f, 1f);
            uiPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f;
            element.Append(uiPanel);
            _worldList = new UIList();
            _worldList.Width.Set(-25f, 1f);
            _worldList.Height.Set(0.0f, 1f);
            _worldList.ListPadding = 5f;
            uiPanel.Append(_worldList);
            UIScrollbar scrollbar = new UIScrollbar();

            scrollbar.SetView(100f, 1000f);
            scrollbar.Height.Set(0.0f, 1f);
            scrollbar.HAlign = 1f;
            uiPanel.Append(scrollbar);
            _worldList.SetScrollbar(scrollbar);
            UITextPanel uiTextPanel1 = new UITextPanel("Select World", 0.8f, true);

            uiTextPanel1.HAlign = 0.5f;
            uiTextPanel1.Top.Set(-35f, 0.0f);
            uiTextPanel1.SetPadding(15f);
            uiTextPanel1.BackgroundColor = new Color(73, 94, 171);
            element.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.Top.Set(-45f, 0.0f);
            uiTextPanel2.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver);
            uiTextPanel2.OnMouseOut  += new UIElement.MouseEvent(FadedMouseOut);
            uiTextPanel2.OnClick     += new UIElement.MouseEvent(GoBackClick);
            element.Append(uiTextPanel2);
            UITextPanel uiTextPanel3 = new UITextPanel("New", 0.7f, true);

            uiTextPanel3.CopyStyle(uiTextPanel2);
            uiTextPanel3.HAlign       = 1f;
            uiTextPanel3.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver);
            uiTextPanel3.OnMouseOut  += new UIElement.MouseEvent(FadedMouseOut);
            uiTextPanel3.OnClick     += new UIElement.MouseEvent(NewWorldClick);
            element.Append(uiTextPanel3);
            Append(element);
        }
Example #12
0
        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);

            UITextPanel <string> uIHeaderTexTPanel = new UITextPanel <string>(Language.GetTextValue("Mods.Localizer.DownloadHeadTitle"), 0.8f, true);

            uIHeaderTexTPanel.HAlign = 0.5f;
            uIHeaderTexTPanel.Top.Set(-35f, 0f);
            uIHeaderTexTPanel.SetPadding(15f);
            uIHeaderTexTPanel.BackgroundColor = new Color(73, 94, 171);
            uIElement.Append(uIHeaderTexTPanel);

            UIScrollbar uIScrollbar = new UIScrollbar();

            uIScrollbar.SetView(100f, 1000f);
            uIScrollbar.Height.Set(-50f, 1f);
            uIScrollbar.Top.Set(50f, 0f);
            uIScrollbar.HAlign = 1f;
            uIPanel.Append(uIScrollbar);

            downloadingList = new UIList();
            downloadingList.Width.Set(-25f, 1f);
            downloadingList.Height.Set(-50f, 1f);
            downloadingList.Top.Set(50f, 0f);
            downloadingList.ListPadding = 5f;
            downloadingList.SetScrollbar(uIScrollbar);
            uIPanel.Append(downloadingList);

            backButton = new UITextPanel <string>(Language.GetTextValue("Mods.Localizer.BackButton"));
            backButton.Width.Set(-10f, 1f / 3f);
            backButton.Height.Set(25f, 0f);
            backButton.VAlign = 1f;
            backButton.Top.Set(-65f, 0f);
            backButton.OnClick     += BackClick;
            backButton.OnMouseOver += UICommon.FadedMouseOver;
            backButton.OnMouseOut  += UICommon.FadedMouseOut;
            uIElement.Append(backButton);

            Append(uIElement);
        }
Example #13
0
        public override void OnInitialize()
        {
            base.OnInitialize();

            mainPanel = new UIPanel();
            mainPanel.SetPadding(6);
            height = 350;
            width  = 200;
            mainPanel.BackgroundColor = new Color(173, 94, 171);

            UIText text = new UIText("Fishing Catches:", 0.85f);

            //	text.Top.Set(12f, 0f);
            //	text.Left.Set(12f, 0f);
            mainPanel.Append(text);

            int top = 20;

            UITextPanel <string> calculateButton = new UITextPanel <string>("Calculate");

            calculateButton.SetPadding(4);
            calculateButton.Width.Set(-10, 0.5f);
            calculateButton.Top.Set(top, 0f);
            //	calculateButton.Left.Set(6, 0f);
            calculateButton.OnClick += CalculateButton_OnClick;
            mainPanel.Append(calculateButton);

            top += 28;

            checklistList = new UIList();
            //	checklistList.SetPadding(6);
            checklistList.Top.Pixels = top;
            checklistList.Width.Set(-25f, 1f);
            checklistList.Height.Set(-top, 1f);
            checklistList.ListPadding = 6f;
            mainPanel.Append(checklistList);

            var checklistListScrollbar = new UIElements.FixedUIScrollbar(userInterface);

            checklistListScrollbar.SetView(100f, 1000f);
            //checklistListScrollbar.Height.Set(0f, 1f);
            checklistListScrollbar.Top.Pixels = top;
            checklistListScrollbar.Height.Set(-top, 1f);
            checklistListScrollbar.Left.Set(-20, 1f);
            //checklistListScrollbar.HAlign = 1f;
            mainPanel.Append(checklistListScrollbar);
            checklistList.SetScrollbar(checklistListScrollbar);

            AdjustMainPanelDimensions(mainPanel);
            Append(mainPanel);
        }
Example #14
0
        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 uIPanel = new UIPanel();

            uIPanel.Width.Set(0f, 1f);
            uIPanel.Height.Set(-110f, 1f);
            uIPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f;
            uIElement.Append(uIPanel);
            myPublishedMods = new UIList();
            myPublishedMods.Width.Set(-25f, 1f);
            myPublishedMods.Height.Set(0f, 1f);
            myPublishedMods.ListPadding = 5f;
            uIPanel.Append(myPublishedMods);
            UIScrollbar uIScrollbar = new UIScrollbar();

            uIScrollbar.SetView(100f, 1000f);
            uIScrollbar.Height.Set(0f, 1f);
            uIScrollbar.HAlign = 1f;
            uIPanel.Append(uIScrollbar);
            myPublishedMods.SetScrollbar(uIScrollbar);
            uITextPanel = new UITextPanel <string>(Language.GetTextValue("tModLoader.MBMyPublishedMods"), 0.8f, true)
            {
                HAlign = 0.5f
            };
            uITextPanel.Top.Set(-35f, 0f);
            uITextPanel.SetPadding(15f);
            uITextPanel.BackgroundColor = new Color(73, 94, 171);
            uIElement.Append(uITextPanel);
            UITextPanel <string> backButton = new UITextPanel <string>(Language.GetTextValue("UI.Back"), 1f, false)
            {
                VAlign = 1f
            };

            backButton.Height.Set(25f, 0f);
            backButton.Width.Set(-10f, 1f / 2f);
            backButton.Top.Set(-20f, 0f);
            backButton.OnMouseOver += UICommon.FadedMouseOver;
            backButton.OnMouseOut  += UICommon.FadedMouseOut;
            backButton.OnClick     += BackClick;
            uIElement.Append(backButton);
            base.Append(uIElement);
        }
Example #15
0
        private void UpdatePlaygroundChildren()
        {
            playgroundPanel.RemoveAllChildren();
            if (playgroundTextCheckbox.Selected)
            {
                playgroundPanel.Append(playgroundText);
            }
            if (playgroundTextPanelCheckbox.Selected)
            {
                playgroundPanel.Append(playgroundTextPanel);
            }
            if (playgroundImageButtonCheckbox.Selected)
            {
                playgroundPanel.Append(playgroundImageButton);
            }

            playgroundPanel.SetPadding(panelPaddingData.Data);

            playgroundText.HAlign = textHAlign.Data;
            playgroundText.VAlign = textVAlign.Data;
            playgroundText.Left.Set(textLeftPixels.Data, textLeftPercent.Data);
            playgroundText.Top.Set(textTopPixels.Data, textTopPercent.Data);

            // if changed only?
            playgroundTextPanel.SetText(textPanelTextInput.Text, textPanelTextScale.Data, false);
            playgroundTextPanel.SetPadding(textPanelPadding.Data);
            playgroundTextPanel.HAlign = textPanelHAlign.Data;
            playgroundTextPanel.VAlign = textPanelVAlign.Data;
            playgroundTextPanel.Left.Set(textPanelLeftPixels.Data, textPanelLeftPercent.Data);
            playgroundTextPanel.Top.Set(textPanelTopPixels.Data, textPanelTopPercent.Data);
            playgroundTextPanel.Width.Set(textPanelWidthPixels.Data, textPanelWidthPercent.Data);
            playgroundTextPanel.Height.Set(textPanelHeightPixels.Data, textPanelHeightPercent.Data);
            textPanelMinWidthHeightDisplay.SetText($"MinWidth: {playgroundTextPanel.MinWidth.Pixels}, MinHeight: {playgroundTextPanel.MinHeight.Pixels}");
            //playgroundTextPanel.MinWidth.Set(textPanelMinWidthPixels.Data, textPanelMinWidthPercent.Data);
            //playgroundTextPanel.MinHeight.Set(textPanelMinHeightPixels.Data, textPanelMinHeightPercent.Data);
            // Margin

            playgroundImageButton.HAlign = imageButtonHAlign.Data;
            playgroundImageButton.VAlign = imageButtonVAlign.Data;
            playgroundImageButton.Left.Set(imageButtonLeftPixels.Data, imageButtonLeftPercent.Data);
            playgroundImageButton.Top.Set(imageButtonTopPixels.Data, imageButtonTopPercent.Data);
            //playgroundImageButton.Width.Set(imageButtonWidthPixels.Data, imageButtonWidthPercent.Data);
            //playgroundImageButton.Width.Set(imageButtonWidthPixels.Data, imageButtonWidthPercent.Data);

            playgroundPanel.Recalculate();

            // recalculate?
        }
Example #16
0
        public override void OnInitialize()
        {
            mainPanel = new UIPanel();
            mainPanel.SetPadding(0);
            int width  = 150;
            int height = 180;

            mainPanel.Left.Set(-40f - width, 1f);
            mainPanel.Top.Set(-110f - height, 1f);
            mainPanel.Width.Set(width, 0f);
            mainPanel.Height.Set(height, 0f);
            mainPanel.BackgroundColor = new Color(173, 94, 171);

            UIText text = new UIText("Miscellaneous:", 0.85f);

            text.Top.Set(12f, 0f);
            text.Left.Set(12f, 0f);
            mainPanel.Append(text);

            // checkboxes
            int        top             = 32;
            UICheckbox npcInfoCheckbox = new UICheckbox("NPC Info", "Show NPC ai values and other variables.");

            npcInfoCheckbox.Top.Set(top, 0f);
            npcInfoCheckbox.Left.Set(12f, 0f);
            npcInfoCheckbox.OnSelectedChanged += () => MiscellaneousTool.showNPCInfo = npcInfoCheckbox.Selected;
            mainPanel.Append(npcInfoCheckbox);
            top += 20;

            UICheckbox tileGridCheckbox = new UICheckbox("Tile Grid", "Show grid lines between tiles.");

            tileGridCheckbox.Top.Set(top, 0f);
            tileGridCheckbox.Left.Set(12f, 0f);
            tileGridCheckbox.OnSelectedChanged += () => MiscellaneousTool.showTileGrid = tileGridCheckbox.Selected;
            mainPanel.Append(tileGridCheckbox);
            top += 20;

            UITextPanel <string> calculateChunkData = new UITextPanel <string>("Calculate Chunk Size");

            calculateChunkData.SetPadding(4);
            calculateChunkData.Width.Set(-10, 0.5f);
            calculateChunkData.Top.Set(top, 0f);
            calculateChunkData.OnClick += CalculateButton_OnClick;
            mainPanel.Append(calculateChunkData);
            top += 20;

            Append(mainPanel);
        }
Example #17
0
        /// <summary>
        /// Creates a UITextPanel with a click event, used with sliders
        /// </summary>
        /// <param name="text">What Text the button has</param>
        /// <param name="appendTo">The UIElement, the button should be appended to</param>
        /// <param name="action">The Click event</param>
        /// <param name="tick">if the button should make a click sound</param>
        public static UIElement SliderButtons(string text, UIElement appendTo, Action <UIElement> action, bool tick = true)
        {
            UITextPanel <string> button = new UITextPanel <string>(text);

            button.SetPadding(4);
            button.MarginLeft = 20;
            button.Width.Set(10, 0f);

            if (tick)
            {
                button.OnClick += (evt, elm) => Main.PlaySound(SoundID.MenuTick);
            }
            appendTo.Append(button);
            action(button);

            return(button);
        }
        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 uIPanel = new UIPanel();

            uIPanel.Width.Set(0f, 1f);
            uIPanel.Height.Set(-110f, 1f);
            uIPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f;
            uIElement.Append(uIPanel);
            myPublishedMods = new UIList();
            myPublishedMods.Width.Set(-25f, 1f);
            myPublishedMods.Height.Set(0f, 1f);
            myPublishedMods.ListPadding = 5f;
            uIPanel.Append(myPublishedMods);
            UIScrollbar uIScrollbar = new UIScrollbar();

            uIScrollbar.SetView(100f, 1000f);
            uIScrollbar.Height.Set(0f, 1f);
            uIScrollbar.HAlign = 1f;
            uIPanel.Append(uIScrollbar);
            myPublishedMods.SetScrollbar(uIScrollbar);
            uITextPanel        = new UITextPanel("My Published Mods", 0.8f, true);
            uITextPanel.HAlign = 0.5f;
            uITextPanel.Top.Set(-35f, 0f);
            uITextPanel.SetPadding(15f);
            uITextPanel.BackgroundColor = new Color(73, 94, 171);
            uIElement.Append(uITextPanel);
            UITextPanel button3 = new UITextPanel("Back", 1f, false);

            button3.VAlign = 1f;
            button3.Height.Set(25f, 0f);
            button3.Width.Set(-10f, 1f / 2f);
            button3.Top.Set(-20f, 0f);
            button3.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver);
            button3.OnMouseOut  += new UIElement.MouseEvent(FadedMouseOut);
            button3.OnClick     += new UIElement.MouseEvent(BackClick);
            uIElement.Append(button3);
            base.Append(uIElement);
        }
Example #19
0
        public override void OnInitialize()
        {
            mainPanel = new UIPanel();
            mainPanel.Width.Set(0f, 1f);
            mainPanel.Height.Set(0f, 1f);
            mainPanel.OnMouseOver += UIUtil.MouseHover;
            mainPanel.OnMouseOut  += UIUtil.MouseOut;
            Append(mainPanel);

            nameLabel        = new UIText(name, 0.8f);
            nameLabel.VAlign = 0.5f;
            mainPanel.Append(nameLabel);

            buyButton        = new UITextPanel <String>("Buy", 0.6f);
            buyButton.VAlign = 0.5f;
            buyButton.SetPadding(8f);
            buyButton.Left.Set(-45f, 1f);
            buyButton.Width.Set(40f, 0f);
            buyButton.Height.Set(20f, 0f);
            buyButton.OnClick += delegate(UIMouseEvent evt, UIElement listeningElement)
            {
                if (onBuyButtonClick != null)
                {
                    onBuyButtonClick(evt, listeningElement);
                }
            };
            buyButton.OnMouseOver += UIUtil.MouseHover;
            buyButton.OnMouseOut  += UIUtil.MouseOut;
            buyButton.OnMouseDown += UIUtil.MouseDown;
            buyButton.OnMouseUp   += UIUtil.MouseHover;
            mainPanel.Append(buyButton);

            hoverPanel = new UIPanel();
            hoverPanel.Width.Set(200f, 0f);
            hoverPanel.Height.Set(75f, 0f);

            descLabel        = new UIText(desc);
            descLabel.VAlign = 0.5f;
            descLabel.HAlign = 0.5f;
            hoverPanel.Append(descLabel);
        }
Example #20
0
        public override void OnInitialize()
        {
            UIElement area = new UIElement {
                Width  = new StyleDimension(0f, 0.5f),
                Top    = new StyleDimension(200f, 0f),
                Height = new StyleDimension(-240f, 1f),
                HAlign = 0.5f
            };

            backPanel = new UIPanel {
                Width           = new StyleDimension(0f, 1f),
                Height          = new StyleDimension(-90f, 1f),
                BackgroundColor = new Color(33, 43, 79) * 0.8f
            };
            area.Append(backPanel);

            UITextPanel <string> heading = new UITextPanel <string>(Language.GetTextValue("tModLoader.MenuEnableDeveloperMode"), 0.8f, true)
            {
                HAlign          = 0.5f,
                Top             = new StyleDimension(-45f, 0f),
                BackgroundColor = new Color(73, 94, 171)
            };

            heading.SetPadding(15f);
            area.Append(heading);

            bottomButton = new UITextPanel <string>(Language.GetTextValue("UI.Back"), 0.7f, true)
            {
                Width  = new StyleDimension(0, 0.5f),
                Height = new StyleDimension(50f, 0f),
                HAlign = 0.5f,
                VAlign = 1f,
                Top    = new StyleDimension(-30f, 0f)
            };
            bottomButton.OnMouseOver += UICommon.FadedMouseOver;
            bottomButton.OnMouseOut  += UICommon.FadedMouseOut;
            bottomButton.OnClick     += BackClick;
            area.Append(bottomButton);

            Append(area);
        }
Example #21
0
        public DraggableUIPanel(float width, float height)
        {
            // Set the width and height to the passed parameters
            Width.Set(width, 0);
            Height.Set(height, 0);
            SetPadding(0);

            // Create a new header, with custom OnMouse events
            header = new UIPanel();
            header.SetPadding(0);
            header.Width             = Width;
            header.Height            = new StyleDimension(30, 0);
            header.BackgroundColor.A = 255;
            header.OnMouseDown      += Header_OnMouseDown;
            header.OnMouseUp        += Header_OnMouseUp;
            Append(header);

            // Create a close button
            var closeBtn = new UITextPanel <char>('X');

            closeBtn.SetPadding(7);
            closeBtn.Width             = new StyleDimension(40, 0);
            closeBtn.Left              = new StyleDimension(-40, 1);
            closeBtn.BackgroundColor.A = 255;
            closeBtn.OnClick          += (evt, elm) => OnCloseBtnClicked?.Invoke();
            header.Append(closeBtn);

            // Create a lock button
            var lockBtn = new UIImageButton(ModContent.GetTexture("Terraria/Lock_" + (isDraggable ? 1 : 0)));

            lockBtn.Width  = new StyleDimension(24, 0);
            lockBtn.Height = new StyleDimension(24, 0);
            lockBtn.Left   = new StyleDimension(width - 65, 0);
            lockBtn.Top    = new StyleDimension(5, 0);
            lockBtn.SetPadding(0);
            lockBtn.OnClick += UpdateLock;
            header.Append(lockBtn);
        }
Example #22
0
        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 uIPanel = new UIPanel();

            uIPanel.Width.Set(0f, 1f);
            uIPanel.Height.Set(-110f, 1f);
            uIPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f;
            uIElement.Append(uIPanel);
            modInfo = new UIMessageBox("This is a test of mod info here.");
            modInfo.Width.Set(0f, 1f);
            modInfo.Height.Set(0f, 1f);
            uIPanel.Append(modInfo);
            uITextPanel        = new UITextPanel("Mod Info", 0.8f, true);
            uITextPanel.HAlign = 0.5f;
            uITextPanel.Top.Set(-35f, 0f);
            uITextPanel.SetPadding(15f);
            uITextPanel.BackgroundColor = new Color(73, 94, 171);
            uIElement.Append(uITextPanel);
            UITextPanel button3 = new UITextPanel("Back", 1f, false);

            button3.Width.Set(-10f, 0.5f);
            button3.Height.Set(25f, 0f);
            button3.VAlign = 1f;
            button3.Top.Set(-20f, 0f);
            button3.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver);
            button3.OnMouseOut  += new UIElement.MouseEvent(FadedMouseOut);
            button3.OnClick     += new UIElement.MouseEvent(BackClick);
            uIElement.Append(button3);
            base.Append(uIElement);
        }
Example #23
0
        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);
        }
Example #24
0
        private void BuildPage()
        {
            this.RemoveAllChildren();
            UIElement uiElement = new UIElement();

            uiElement.Width.Set(0.0f, 0.8f);
            uiElement.MaxWidth.Set(800f, 0.0f);
            uiElement.MinWidth.Set(600f, 0.0f);
            uiElement.Top.Set(240f, 0.0f);
            uiElement.Height.Set(-240f, 1f);
            uiElement.HAlign = 0.5f;
            this.Append(uiElement);
            UIPanel uiPanel1 = new UIPanel();

            uiPanel1.Width           = StyleDimension.Fill;
            uiPanel1.Height          = new StyleDimension(-110f, 1f);
            uiPanel1.BackgroundColor = new Color(33, 43, 79) * 0.8f;
            uiPanel1.PaddingRight    = 0.0f;
            uiPanel1.PaddingLeft     = 0.0f;
            UIPanel uiPanel2 = uiPanel1;

            uiElement.Append((UIElement)uiPanel2);
            int       num1     = 35;
            int       num2     = num1;
            int       num3     = 30;
            UIElement element1 = new UIElement()
            {
                Width  = StyleDimension.Fill,
                Height = StyleDimension.FromPixelsAndPercent((float)-(num3 + 4 + 5), 1f),
                VAlign = 1f
            };

            element1.SetPadding(0.0f);
            uiPanel2.Append(element1);
            UIElement element2 = new UIElement()
            {
                Width  = new StyleDimension(-20f, 0.5f),
                Height = new StyleDimension(0.0f, 1f),
                Left   = new StyleDimension(10f, 0.0f)
            };

            element2.SetPadding(0.0f);
            element1.Append(element2);
            UIElement element3 = new UIElement()
            {
                Width  = new StyleDimension(-20f, 0.5f),
                Height = new StyleDimension(0.0f, 1f),
                Left   = new StyleDimension(-10f, 0.0f),
                HAlign = 1f
            };

            element3.SetPadding(0.0f);
            element1.Append(element3);
            UIList uiList1 = new UIList();

            uiList1.Width       = new StyleDimension(-25f, 1f);
            uiList1.Height      = new StyleDimension(0.0f, 1f);
            uiList1.ListPadding = 5f;
            uiList1.HAlign      = 1f;
            UIList uiList2 = uiList1;

            element2.Append((UIElement)uiList2);
            this._availablePacksList = uiList2;
            UIList uiList3 = new UIList();

            uiList3.Width       = new StyleDimension(-25f, 1f);
            uiList3.Height      = new StyleDimension(0.0f, 1f);
            uiList3.ListPadding = 5f;
            uiList3.HAlign      = 0.0f;
            uiList3.Left        = new StyleDimension(0.0f, 0.0f);
            UIList uiList4 = uiList3;

            element3.Append((UIElement)uiList4);
            this._enabledPacksList = uiList4;
            UIText uiText1 = new UIText(Language.GetText("UI.AvailableResourcePacksTitle"), 1f, false);

            uiText1.HAlign = 0.0f;
            uiText1.Left   = new StyleDimension(25f, 0.0f);
            uiText1.Width  = new StyleDimension(-25f, 0.5f);
            uiText1.VAlign = 0.0f;
            uiText1.Top    = new StyleDimension(10f, 0.0f);
            UIText uiText2 = uiText1;

            this._titleAvailable = uiText2;
            uiPanel2.Append((UIElement)uiText2);
            UIText uiText3 = new UIText(Language.GetText("UI.EnabledResourcePacksTitle"), 1f, false);

            uiText3.HAlign = 1f;
            uiText3.Left   = new StyleDimension(-25f, 0.0f);
            uiText3.Width  = new StyleDimension(-25f, 0.5f);
            uiText3.VAlign = 0.0f;
            uiText3.Top    = new StyleDimension(10f, 0.0f);
            UIText uiText4 = uiText3;

            this._titleEnabled = uiText4;
            uiPanel2.Append((UIElement)uiText4);
            UITextPanel <LocalizedText> uiTextPanel1 = new UITextPanel <LocalizedText>(Language.GetText("UI.ResourcePacks"), 1f, true);

            uiTextPanel1.HAlign          = 0.5f;
            uiTextPanel1.VAlign          = 0.0f;
            uiTextPanel1.Top             = new StyleDimension(-44f, 0.0f);
            uiTextPanel1.BackgroundColor = new Color(73, 94, 171);
            UITextPanel <LocalizedText> uiTextPanel2 = uiTextPanel1;

            uiTextPanel2.SetPadding(13f);
            uiElement.Append((UIElement)uiTextPanel2);
            UIScrollbar uiScrollbar1 = new UIScrollbar();

            uiScrollbar1.Height = new StyleDimension(0.0f, 1f);
            uiScrollbar1.HAlign = 0.0f;
            uiScrollbar1.Left   = new StyleDimension(0.0f, 0.0f);
            UIScrollbar scrollbar1 = uiScrollbar1;

            element2.Append((UIElement)scrollbar1);
            this._availablePacksList.SetScrollbar(scrollbar1);
            UIVerticalSeparator verticalSeparator1 = new UIVerticalSeparator();

            verticalSeparator1.Height = new StyleDimension(-12f, 1f);
            verticalSeparator1.HAlign = 0.5f;
            verticalSeparator1.VAlign = 1f;
            verticalSeparator1.Color  = new Color(89, 116, 213, (int)byte.MaxValue) * 0.9f;
            UIVerticalSeparator verticalSeparator2 = verticalSeparator1;

            uiPanel2.Append((UIElement)verticalSeparator2);
            UIHorizontalSeparator horizontalSeparator1 = new UIHorizontalSeparator(2, true);

            horizontalSeparator1.Width  = new StyleDimension((float)-num2, 0.5f);
            horizontalSeparator1.VAlign = 0.0f;
            horizontalSeparator1.HAlign = 0.0f;
            horizontalSeparator1.Color  = new Color(89, 116, 213, (int)byte.MaxValue) * 0.9f;
            horizontalSeparator1.Top    = new StyleDimension((float)num3, 0.0f);
            horizontalSeparator1.Left   = new StyleDimension((float)num1, 0.0f);
            UIHorizontalSeparator horizontalSeparator2 = new UIHorizontalSeparator(2, true);

            horizontalSeparator2.Width  = new StyleDimension((float)-num2, 0.5f);
            horizontalSeparator2.VAlign = 0.0f;
            horizontalSeparator2.HAlign = 1f;
            horizontalSeparator2.Color  = new Color(89, 116, 213, (int)byte.MaxValue) * 0.9f;
            horizontalSeparator2.Top    = new StyleDimension((float)num3, 0.0f);
            horizontalSeparator2.Left   = new StyleDimension((float)-num1, 0.0f);
            UIScrollbar uiScrollbar2 = new UIScrollbar();

            uiScrollbar2.Height = new StyleDimension(0.0f, 1f);
            uiScrollbar2.HAlign = 1f;
            UIScrollbar scrollbar2 = uiScrollbar2;

            element3.Append((UIElement)scrollbar2);
            this._enabledPacksList.SetScrollbar(scrollbar2);
            this.AddBackAndFolderButtons(uiElement);
        }
Example #25
0
        public override void OnInitialize()
        {
            uIElement = new UIElement();
            uIElement.Width.Set(0f, 0.8f);
            uIElement.MaxWidth.Set(600f, 0f);
            uIElement.Top.Set(160f, 0f);
            uIElement.Height.Set(-180f, 1f);
            uIElement.HAlign = 0.5f;

            uIPanel = new UIPanel();
            uIPanel.Width.Set(0f, 1f);
            uIPanel.Height.Set(-140f, 1f);
            uIPanel.Top.Set(30f, 0f);
            uIPanel.BackgroundColor = UICommon.MainPanelBackground;
            uIElement.Append(uIPanel);

            UIPanel textBoxBackground = new UIPanel();

            textBoxBackground.SetPadding(0);
            filterTextField = new UIFocusInputTextField("Filter Options");
            textBoxBackground.Top.Set(2f, 0f);
            textBoxBackground.Left.Set(-190, 1f);
            textBoxBackground.Width.Set(180, 0f);
            textBoxBackground.Height.Set(30, 0f);
            uIElement.Append(textBoxBackground);

            filterTextField.SetText("");
            filterTextField.Top.Set(5, 0f);
            filterTextField.Left.Set(10, 0f);
            filterTextField.Width.Set(-20, 1f);
            filterTextField.Height.Set(20, 0);
            filterTextField.OnTextChange += (a, b) => {
                updateNeeded = true;
            };
            filterTextField.OnRightClick += (a, b) => {
                filterTextField.SetText("");
            };
            textBoxBackground.Append(filterTextField);

            // TODO: ModConfig Localization support
            message = new UITextPanel <string>("Notification: ");
            message.Width.Set(-80f, 1f);
            message.Height.Set(20f, 0f);
            message.HAlign = 0.5f;
            message.VAlign = 1f;
            message.Top.Set(-65f, 0f);
            uIElement.Append(message);

            mainConfigList = new UIList();
            mainConfigList.Width.Set(-25f, 1f);
            mainConfigList.Height.Set(0f, 1f);
            //mainConfigList.Top.Set(40f, 0f);
            mainConfigList.ListPadding = 5f;
            uIPanel.Append(mainConfigList);
            configPanelStack.Push(uIPanel);
            //currentConfigList = mainConfigList;

            uIScrollbar = new UIScrollbar();
            uIScrollbar.SetView(100f, 1000f);
            uIScrollbar.Height.Set(0f, 1f);
            uIScrollbar.HAlign = 1f;
            uIPanel.Append(uIScrollbar);
            mainConfigList.SetScrollbar(uIScrollbar);

            headerTextPanel        = new UITextPanel <string>("Mod Config", 0.8f, true);
            headerTextPanel.HAlign = 0.5f;
            headerTextPanel.Top.Set(-50f, 0f);
            headerTextPanel.SetPadding(15f);
            headerTextPanel.BackgroundColor = UICommon.DefaultUIBlue;
            uIElement.Append(headerTextPanel);

            previousConfigButton = new UITextPanel <string>("<", 1f, false);
            previousConfigButton.Width.Set(25f, 0);
            previousConfigButton.Height.Set(25f, 0f);
            previousConfigButton.VAlign = 1f;
            previousConfigButton.Top.Set(-65f, 0f);
            previousConfigButton.HAlign = 0f;
            previousConfigButton.WithFadedMouseOver();
            previousConfigButton.OnClick += PreviousConfig;
            //uIElement.Append(previousConfigButton);

            nextConfigButton = new UITextPanel <string>(">", 1f, false);
            nextConfigButton.CopyStyle(previousConfigButton);
            nextConfigButton.WithFadedMouseOver();
            nextConfigButton.HAlign   = 1f;
            nextConfigButton.OnClick += NextConfig;
            //uIElement.Append(nextConfigButton);

            saveConfigButton = new UITextPanel <string>("Save Config", 1f, false);
            saveConfigButton.Width.Set(-10f, 1f / 4f);
            saveConfigButton.Height.Set(25f, 0f);
            saveConfigButton.Top.Set(-20f, 0f);
            saveConfigButton.WithFadedMouseOver();
            saveConfigButton.HAlign   = 0.33f;
            saveConfigButton.VAlign   = 1f;
            saveConfigButton.OnClick += SaveConfig;
            //uIElement.Append(saveConfigButton);

            backButton = new UITextPanel <string>("Back", 1f, false);
            backButton.CopyStyle(saveConfigButton);
            backButton.HAlign = 0;
            backButton.WithFadedMouseOver();
            backButton.OnMouseOver += (a, b) => {
                if (pendingChanges)
                {
                    backButton.BackgroundColor = Color.Red;
                }
            };
            backButton.OnMouseOut += (a, b) => {
                if (pendingChanges)
                {
                    backButton.BackgroundColor = Color.Red * 0.7f;
                }
            };
            backButton.OnClick += BackClick;
            uIElement.Append(backButton);

            revertConfigButton = new UITextPanel <string>("Revert Changes", 1f, false);
            revertConfigButton.CopyStyle(saveConfigButton);
            revertConfigButton.WithFadedMouseOver();
            revertConfigButton.HAlign   = 0.66f;
            revertConfigButton.OnClick += RevertConfig;
            //uIElement.Append(revertConfigButton);

            //float scale = Math.Min(1f, 130f/Main.fontMouseText.MeasureString("Restore Defaults").X);
            restoreDefaultsConfigButton = new UITextPanel <string>("Restore Defaults", 1f, false);
            restoreDefaultsConfigButton.CopyStyle(saveConfigButton);
            restoreDefaultsConfigButton.WithFadedMouseOver();
            restoreDefaultsConfigButton.HAlign   = 1f;
            restoreDefaultsConfigButton.OnClick += RestoreDefaults;
            uIElement.Append(restoreDefaultsConfigButton);

            uIPanel.BackgroundColor = UICommon.MainPanelBackground;

            Append(uIElement);
        }
Example #26
0
        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 uIPanel = new UIPanel();

            uIPanel.Width.Set(0f, 1f);
            uIPanel.Height.Set(-110f, 1f);
            uIPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f;
            uIElement.Append(uIPanel);
            modList = new UIList();
            modList.Width.Set(-25f, 1f);
            modList.Height.Set(0f, 1f);
            modList.ListPadding = 5f;
            uIPanel.Append(modList);
            UIScrollbar uIScrollbar = new UIScrollbar();

            uIScrollbar.SetView(100f, 1000f);
            uIScrollbar.Height.Set(0f, 1f);
            uIScrollbar.HAlign = 1f;
            uIPanel.Append(uIScrollbar);
            modList.SetScrollbar(uIScrollbar);
            UITextPanel uITextPanel = new UITextPanel("Mod Sources", 0.8f, true);

            uITextPanel.HAlign = 0.5f;
            uITextPanel.Top.Set(-35f, 0f);
            uITextPanel.SetPadding(15f);
            uITextPanel.BackgroundColor = new Color(73, 94, 171);
            uIElement.Append(uITextPanel);
            UITextPanel button = new UITextPanel("Build All", 1f, false);

            button.Width.Set(-10f, 0.5f);
            button.Height.Set(25f, 0f);
            button.VAlign = 1f;
            button.Top.Set(-65f, 0f);
            button.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver);
            button.OnMouseOut  += new UIElement.MouseEvent(FadedMouseOut);
            button.OnClick     += new UIElement.MouseEvent(BuildMods);
            uIElement.Append(button);
            UITextPanel button2 = new UITextPanel("Build + Reload All", 1f, false);

            button2.CopyStyle(button);
            button2.HAlign       = 1f;
            button2.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver);
            button2.OnMouseOut  += new UIElement.MouseEvent(FadedMouseOut);
            button2.OnClick     += new UIElement.MouseEvent(BuildAndReload);
            uIElement.Append(button2);
            UITextPanel button3 = new UITextPanel("Back", 1f, false);

            button3.CopyStyle(button);
            button3.Width.Set(-10f, 1f / 3f);
            button3.Top.Set(-20f, 0f);
            button3.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver);
            button3.OnMouseOut  += new UIElement.MouseEvent(FadedMouseOut);
            button3.OnClick     += new UIElement.MouseEvent(BackClick);
            uIElement.Append(button3);
            UITextPanel button4 = new UITextPanel("Open Sources", 1f, false);

            button4.CopyStyle(button3);
            button4.HAlign       = .5f;
            button4.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver);
            button4.OnMouseOut  += new UIElement.MouseEvent(FadedMouseOut);
            button4.OnClick     += new UIElement.MouseEvent(OpenSources);
            uIElement.Append(button4);
            UITextPanel button5 = new UITextPanel("Manage Published", 1f, false);

            button5.CopyStyle(button3);
            button5.HAlign       = 1f;
            button5.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver);
            button5.OnMouseOut  += new UIElement.MouseEvent(FadedMouseOut);
            button5.OnClick     += new UIElement.MouseEvent(ManagePublished);
            uIElement.Append(button5);
            base.Append(uIElement);
        }
Example #27
0
        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;

            uiLoader = new UILoaderAnimatedImage(0.5f, 0.5f, 1f);

            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);

            modListList = new UIList();
            modListList.Width.Set(-25f, 1f);
            modListList.Height.Set(0f, 1f);
            modListList.ListPadding = 5f;
            scrollPanel.Append(modListList);

            UIScrollbar uIScrollbar = new UIScrollbar();

            uIScrollbar.SetView(100f, 1000f);
            uIScrollbar.Height.Set(0f, 1f);
            uIScrollbar.HAlign = 1f;
            scrollPanel.Append(uIScrollbar);
            modListList.SetScrollbar(uIScrollbar);

            UITextPanel <string> titleTextPanel = new UITextPanel <string>(Language.GetTextValue("tModLoader.ModPacksHeader"), 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);

            UIAutoScaleTextTextPanel <string> backButton = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("UI.Back"), 1f, false);

            backButton.Width.Set(-10f, 1f / 2f);
            backButton.Height.Set(40f, 0f);
            backButton.VAlign = 1f;
            backButton.Top.Set(-20f, 0f);
            backButton.OnMouseOver += UICommon.FadedMouseOver;
            backButton.OnMouseOut  += UICommon.FadedMouseOut;
            backButton.OnClick     += BackClick;
            uIElement.Append(backButton);

            UIAutoScaleTextTextPanel <string> saveNewButton = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.ModPacksSaveEnabledAsNewPack"), 1f, false);

            saveNewButton.TextColor = Color.Green;
            saveNewButton.CopyStyle(backButton);
            saveNewButton.HAlign       = 1f;
            saveNewButton.OnMouseOver += UICommon.FadedMouseOver;
            saveNewButton.OnMouseOut  += UICommon.FadedMouseOut;
            saveNewButton.OnClick     += SaveNewModList;
            uIElement.Append(saveNewButton);

            base.Append(uIElement);
        }
Example #28
0
        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 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);
            modListAll = new UIList();
            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);
            modList.SetScrollbar(uIScrollbar);
            uITextPanel        = new UITextPanel <string>("Mod Browser", 0.8f, true);
            uITextPanel.HAlign = 0.5f;
            uITextPanel.Top.Set(-35f, 0f);
            uITextPanel.SetPadding(15f);
            uITextPanel.BackgroundColor = new Color(73, 94, 171);
            uIElement.Append(uITextPanel);
            reloadButton = new UITextPanel <string>("Loading...", 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>("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);
            base.Append(uIElement);
            UIElement uIElement2 = new UIElement();

            uIElement2.Width.Set(0f, 1f);
            uIElement2.Height.Set(32f, 0f);
            uIElement2.Top.Set(10f, 0f);
            Texture2D    texture = Texture2D.FromStream(Main.instance.GraphicsDevice, Assembly.GetExecutingAssembly().GetManifestResourceStream("Terraria.ModLoader.UI.UIModBrowserIcons.png"));
            UICycleImage uIToggleImage;

            for (int j = 0; j < 2; j++)
            {
                if (j == 0)
                {
                    uIToggleImage = new UICycleImage(texture, 5, 32, 32, 0, 0);
                    uIToggleImage.setCurrentState((int)sortMode);
                    uIToggleImage.OnClick += (a, b) =>
                    {
                        sortMode = sortMode.Next();
                        SortList();
                    };
                }
                else
                {
                    uIToggleImage = new UICycleImage(texture, 3, 32, 32, 34, 0);
                    uIToggleImage.setCurrentState((int)updateFilterMode);
                    uIToggleImage.OnClick += (a, b) =>
                    {
                        updateFilterMode = updateFilterMode.Next();
                        SortList();
                    };
                }
                uIToggleImage.Left.Set((float)(j * 36 + 8), 0f);
                _categoryButtons.Add(uIToggleImage);
                uIElement2.Append(uIToggleImage);
            }
            filterTextBox = new UIInputTextField("Type to search");
            filterTextBox.Top.Set(5, 0f);
            filterTextBox.Left.Set(-150, 1f);
            filterTextBox.OnTextChange += (sender, e) => SortList();
            uIElement2.Append(filterTextBox);
            UICycleImage SearchFilterToggle = new UICycleImage(texture, 2, 32, 32, 68, 0);

            SearchFilterToggle.setCurrentState((int)searchFilterMode);
            SearchFilterToggle.OnClick += (a, b) =>
            {
                searchFilterMode = searchFilterMode.Next();
                SortList();
            };
            SearchFilterToggle.Left.Set(545f, 0f);
            _categoryButtons.Add(SearchFilterToggle);
            uIElement2.Append(SearchFilterToggle);
            uIPanel.Append(uIElement2);

            PopulateModBrowser();
        }
Example #29
0
        public override void OnInitialize()
        {
            base.OnInitialize();
            mainPanel = new UIPanel();
            width     = 310;
            height    = 610;
            mainPanel.SetPadding(6);
            mainPanel.BackgroundColor = Color.Orange * 0.7f;

            int    top  = 0;
            UIText text = new UIText("Projectiles:", 0.85f);

            text.Top.Set(top, 0f);
            mainPanel.Append(text);

            UITextPanel <string> clearProjectilesButton = new UITextPanel <string>("Clear Projectiles");

            clearProjectilesButton.OnClick += (a, b) => {
                for (int i = 0; i < Main.maxProjectiles; i++)
                {
                    if (Main.projectile[i].active)
                    {
                        Main.projectile[i].Kill();
                        if (Main.netMode == 1)
                        {
                            NetMessage.SendData(27, -1, -1, null, i, 0f, 0f, 0f, 0);
                        }
                    }
                }
            };
            clearProjectilesButton.Top.Set(top, 0f);
            clearProjectilesButton.Width.Set(-10, 0.5f);
            clearProjectilesButton.HAlign = 1;
            clearProjectilesButton.SetPadding(4);
            mainPanel.Append(clearProjectilesButton);

            top += 20;

            UIText text2 = new UIText("Filter:", 0.85f);

            text2.Top.Set(top, 0f);
            mainPanel.Append(text2);

            searchFilter = new NewUITextBox("Search", 0.85f);
            searchFilter.SetPadding(0);
            searchFilter.OnTextChanged += () => { ValidateInput(); updateNeeded = true; };
            searchFilter.Top.Set(top, 0f);
            searchFilter.Left.Set(text2.GetInnerDimensions().Width, 0f);
            searchFilter.Width.Set(-text2.GetInnerDimensions().Width, 1f);
            searchFilter.Height.Set(20, 0f);
            //searchFilter.VAlign = 0.5f;
            mainPanel.Append(searchFilter);
            top += 20;

            speedXDataProperty = new UIFloatRangedDataValue("SpeedX:", 0, -10, 10);
            speedYDataProperty = new UIFloatRangedDataValue("SpeedY:", 0, -10, 10);
            var ui2DRange = new UI2DRange <float>(speedXDataProperty, speedYDataProperty);

            ui2DRange.Top.Set(top, 0f);
            mainPanel.Append(ui2DRange);
            top += 30;

            ai0DataProperty = new UIFloatRangedDataValue("ai0:", 0, -10, 10);
            var uiRange = new UIRange <float>(ai0DataProperty);

            uiRange.Top.Set(top, 0f);
            uiRange.Width.Set(0, 1f);
            mainPanel.Append(uiRange);
            top += 30;

            ai1DataProperty = new UIFloatRangedDataValue("ai1:", 0, -10, 10);
            uiRange         = new UIRange <float>(ai1DataProperty);
            uiRange.Top.Set(top, 0f);
            uiRange.Width.Set(0, 1f);
            mainPanel.Append(uiRange);
            top += 30;

            knockbackDataProperty = new UIFloatRangedDataValue("Knockback:", 0, 0, 20);
            uiRange = new UIRange <float>(knockbackDataProperty);
            uiRange.Top.Set(top, 0f);
            uiRange.Width.Set(0, 1f);
            mainPanel.Append(uiRange);
            top += 30;

            damageDataProperty = new UIIntRangedDataValue("Damage:", 20, 0, 200);
            var uiRangeI = new UIRange <int>(damageDataProperty);

            uiRangeI.Top.Set(top, 0f);
            uiRangeI.Width.Set(0, 1f);
            mainPanel.Append(uiRangeI);
            top += 30;

            aiStyleDataProperty = new UIIntRangedDataValue("AIStyle:", -1, -1, 145);
            uiRangeI            = new UIRange <int>(aiStyleDataProperty);
            uiRangeI.Top.Set(top, 0f);
            uiRangeI.Width.Set(0, 1f);
            mainPanel.Append(uiRangeI);
            top += 30;

            drawOffsetXDataProperty = new UIIntRangedDataValue("drawOffsetX:", 0, -30, 30);
            uiRangeI = new UIRange <int>(drawOffsetXDataProperty);
            uiRangeI.Top.Set(top, 0f);
            uiRangeI.Width.Set(0, 1f);
            mainPanel.Append(uiRangeI);
            top += 30;

            drawOriginOffsetXDataProperty = new UIIntRangedDataValue("drawOriginOffsetX:", 0, -30, 30);
            uiRangeI = new UIRange <int>(drawOriginOffsetXDataProperty);
            uiRangeI.Top.Set(top, 0f);
            uiRangeI.Width.Set(0, 1f);
            mainPanel.Append(uiRangeI);
            top += 30;

            drawOriginOffsetYDataProperty = new UIIntRangedDataValue("drawOriginOffsetY:", 0, -30, 30);
            uiRangeI = new UIRange <int>(drawOriginOffsetYDataProperty);
            uiRangeI.Top.Set(top, 0f);
            uiRangeI.Width.Set(0, 1f);
            mainPanel.Append(uiRangeI);
            top += 30;

            hostile = new UIBoolNDataValue("Hostile");
            var hostileCheckbox = new UITriStateCheckbox(hostile);

            hostileCheckbox.Top.Set(top, 0f);
            mainPanel.Append(hostileCheckbox);
            top += 30;

            friendly = new UIBoolNDataValue("Friendly");
            var friendlyCheckbox = new UITriStateCheckbox(friendly);

            friendlyCheckbox.Top.Set(top, 0f);
            mainPanel.Append(friendlyCheckbox);
            top += 25;

            pause = new UICheckbox("Pause", "Pauses All Projectiles (Prevent AI from running)");
            pause.Top.Set(top, 0f);
            mainPanel.Append(pause);

            UIHoverImageButton stepButton = new UIHoverImageButton(ModdersToolkit.Instance.GetTexture("UIElements/next"), "Step");

            stepButton.OnClick += (s, e) => step = true;
            stepButton.Top.Set(top - 6, 0f);
            stepButton.Left.Set(80, 0f);
            mainPanel.Append(stepButton);

            top += 25;

            freeze = new UICheckbox("Freeze", "Zero out velocity during PreAI for All Projectiles");
            freeze.Top.Set(top, 0f);
            mainPanel.Append(freeze);
            top += 25;

            projectileGrid            = new UIGrid(7);
            projectileGrid.Top.Pixels = top;
            //autoTrashGrid.Left.Pixels = spacing;
            projectileGrid.Width.Set(-25f, 1f);             // leave space for scroll?
            projectileGrid.Height.Set(-top, 1f);
            projectileGrid.ListPadding = 6f;
            mainPanel.Append(projectileGrid);

            // this will initialize grid
            updateNeeded = true;

            var projectileGridScrollbar = new UIElements.FixedUIScrollbar(_userInterface);

            projectileGridScrollbar.SetView(100f, 1000f);
            projectileGridScrollbar.Top.Pixels = top;            // + spacing;
            projectileGridScrollbar.Height.Set(-top /*- spacing*/, 1f);
            projectileGridScrollbar.HAlign = 1f;
            mainPanel.Append(projectileGridScrollbar);
            projectileGrid.SetScrollbar(projectileGridScrollbar);

            AdjustMainPanelDimensions(mainPanel);
            Append(mainPanel);
        }
Example #30
0
        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 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);

            uITextPanel = new UITextPanel <string>(Language.GetTextValue("tModLoader.EnterSteamID"), 0.8f, true)
            {
                HAlign = 0.5f
            };
            uITextPanel.Top.Set(-35f, 0f);
            uITextPanel.SetPadding(15f);
            uITextPanel.BackgroundColor = new Color(73, 94, 171);
            uIElement.Append(uITextPanel);

            UITextPanel <string> button = new UITextPanel <string>(Language.GetTextValue("UI.Back"), 1f, false);

            button.Width.Set(-10f, 0.5f);
            button.Height.Set(25f, 0f);
            button.VAlign = 1f;
            button.Top.Set(-65f, 0f);
            button.OnMouseOver += UICommon.FadedMouseOver;
            button.OnMouseOut  += UICommon.FadedMouseOut;
            button.OnClick     += BackClick;
            uIElement.Append(button);

            UITextPanel <string> button2 = new UITextPanel <string>(Language.GetTextValue("UI.Submit"), 1f, false);

            button2.CopyStyle(button);
            button2.HAlign       = 1f;
            button2.OnMouseOver += UICommon.FadedMouseOver;
            button2.OnMouseOut  += UICommon.FadedMouseOut;
            button2.OnClick     += OKClick;
            uIElement.Append(button2);

            //UITextPanel<string> button3 = new UITextPanel<string>("Visit Website to Generate Passphrase", 1f, false);
            //button3.CopyStyle(button);
            //button3.Width.Set(0f, 1f);
            //button3.Top.Set(-20f, 0f);
            //button3.OnMouseOver += UICommon.FadedMouseOver;
            //button3.OnMouseOut += UICommon.FadedMouseOut;
            //button3.OnClick += VisitRegisterWebpage;
            //uIElement.Append(button3);

            steamIDTextField = new UIInputTextField(Language.GetTextValue("tModLoader.PasteSteamID"))
            {
                HAlign = 0.5f,
                VAlign = 0.5f
            };
            steamIDTextField.Left.Set(-100, 0);
            steamIDTextField.OnTextChange += new UIInputTextField.EventHandler(OnTextChange);
            uIPanel.Append(steamIDTextField);

            base.Append(uIElement);
        }