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);
        }
示例#2
0
        public override void OnInitialize()
        {
            AddElement(BookButton, 570, 240, 26, 32, this);
            BookButton.OnClick += OpenCodex;
            BookButton.SetVisibility(1, 1);

            AddElement(Back, Main.screenWidth / 2 - 250, Main.screenHeight / 2 - 225, 500, 450, this);
            Back.OnScrollWheel += ScrollEntry;

            AddElement(new CategoryButton(CodexEntry.Categories.Abilities, "Abilities"), 30, 10, 50, 28, Back);
            AddElement(new CategoryButton(CodexEntry.Categories.Biomes, "Biomes"), 90, 10, 50, 28, Back);
            AddElement(new CategoryButton(CodexEntry.Categories.Removed, "[PH]REMOVED"), 150, 10, 50, 28, Back);
            AddElement(new CategoryButton(CodexEntry.Categories.Relics, "Relics"), 210, 10, 50, 28, Back);
            AddElement(new CategoryButton(CodexEntry.Categories.Misc, "Misc"), 270, 10, 50, 28, Back);

            AddElement(EntryBack, 330, 52, 120, 360, Back);
            AddElement(ClickableEntries, 0, 0, 120, 340, EntryBack);
            ClickableEntries.ListPadding = 2;
            AddElement(EntryScroll, 460, 54, 18, 340, Back);
            EntryScroll.SetView(0, 360);
            ClickableEntries.SetScrollbar(EntryScroll);

            AddElement(DragButton, 410, 4, 38, 38, Back);
            AddElement(ExitButton, 454, 4, 38, 38, Back);
            ExitButton.OnClick += Exit;
        }
示例#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);
        }
示例#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 override void OnInitialize()
        {
            messageBox = new UIMessageBox("")
            {
                Width  = { Pixels = -25, Precent = 1f },
                Height = { Pixels = -40, Precent = 1f },
                Top    = { Pixels = 40 },
            };
            Append(messageBox);

            var messageBoxScrollbar = new UIScrollbar
            {
                Height = { Pixels = -30, Precent = 1f },
                Top    = { Pixels = 30 },
                //VAlign = 0.5f,
                HAlign = 1f
            };

            messageBoxScrollbar.SetView(100f, 1000f);
            Append(messageBoxScrollbar);

            messageBox.SetScrollbar(messageBoxScrollbar);

            base.OnInitialize();
        }
示例#6
0
        public void InitializePage()
        {
            RemoveAllChildren();
            UIElement uIElement = new UIElement();

            uIElement.Width.Set(590f, 0f);
            uIElement.Top.Set(220f, 0f);
            uIElement.Height.Set(-220f, 1f);
            uIElement.HAlign = 0.5f;
            _outerContainer  = uIElement;
            Append(uIElement);
            UIPanel uIPanel = new UIPanel();

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

            uIList.Width.Set(-25f, 1f);
            uIList.Height.Set(-50f, 1f);
            uIList.Top.Set(50f, 0f);
            uIList.HAlign      = 0.5f;
            uIList.ListPadding = 14f;
            uIPanel.Append(uIList);
            _list = uIList;
            UIScrollbar uIScrollbar = new UIScrollbar();

            uIScrollbar.SetView(100f, 1000f);
            uIScrollbar.Height.Set(-20f, 1f);
            uIScrollbar.HAlign = 1f;
            uIScrollbar.VAlign = 1f;
            uIScrollbar.Top    = StyleDimension.FromPixels(-5f);
            uIList.SetScrollbar(uIScrollbar);
            _scrollBar = uIScrollbar;
            UITextPanel <LocalizedText> uITextPanel = new UITextPanel <LocalizedText>(Language.GetText("UI.Back"), 0.7f, large: true);

            uITextPanel.Width.Set(-10f, 0.5f);
            uITextPanel.Height.Set(50f, 0f);
            uITextPanel.VAlign = 1f;
            uITextPanel.HAlign = 0.5f;
            uITextPanel.Top.Set(-45f, 0f);
            uITextPanel.OnMouseOver += FadedMouseOver;
            uITextPanel.OnMouseOut  += FadedMouseOut;
            uITextPanel.OnClick     += GoBackClick;
            uITextPanel.SetSnapPoint("Back", 0);
            uIElement.Append(uITextPanel);
            _backPanel = uITextPanel;
            int currentGroupIndex = 0;

            TryAddingList(Language.GetText("UI.EmoteCategoryGeneral"), ref currentGroupIndex, 10, GetEmotesGeneral());
            TryAddingList(Language.GetText("UI.EmoteCategoryRPS"), ref currentGroupIndex, 10, GetEmotesRPS());
            TryAddingList(Language.GetText("UI.EmoteCategoryItems"), ref currentGroupIndex, 11, GetEmotesItems());
            TryAddingList(Language.GetText("UI.EmoteCategoryBiomesAndEvents"), ref currentGroupIndex, 8, GetEmotesBiomesAndEvents());
            TryAddingList(Language.GetText("UI.EmoteCategoryTownNPCs"), ref currentGroupIndex, 9, GetEmotesTownNPCs());
            TryAddingList(Language.GetText("UI.EmoteCategoryCritters"), ref currentGroupIndex, 7, GetEmotesCritters());
            TryAddingList(Language.GetText("UI.EmoteCategoryBosses"), ref currentGroupIndex, 8, GetEmotesBosses());
        }
示例#7
0
        public void InitializePage()
        {
            this.RemoveAllChildren();
            UIElement element = new UIElement();

            element.Width.Set(590f, 0.0f);
            element.Top.Set(220f, 0.0f);
            element.Height.Set(-220f, 1f);
            element.HAlign       = 0.5f;
            this._outerContainer = element;
            this.Append(element);
            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;
            element.Append((UIElement)uiPanel);
            this._container = (UIElement)uiPanel;
            UIList uiList = new UIList();

            uiList.Width.Set(-25f, 1f);
            uiList.Height.Set(-50f, 1f);
            uiList.Top.Set(50f, 0.0f);
            uiList.HAlign      = 0.5f;
            uiList.ListPadding = 14f;
            uiPanel.Append((UIElement)uiList);
            this._list = uiList;
            UIScrollbar scrollbar = new UIScrollbar();

            scrollbar.SetView(100f, 1000f);
            scrollbar.Height.Set(-20f, 1f);
            scrollbar.HAlign = 1f;
            scrollbar.VAlign = 1f;
            scrollbar.Top    = StyleDimension.FromPixels(-5f);
            uiList.SetScrollbar(scrollbar);
            this._scrollBar = scrollbar;
            UITextPanel <LocalizedText> uiTextPanel = new UITextPanel <LocalizedText>(Language.GetText("UI.Back"), 0.7f, true);

            uiTextPanel.Width.Set(-10f, 0.5f);
            uiTextPanel.Height.Set(50f, 0.0f);
            uiTextPanel.VAlign = 1f;
            uiTextPanel.HAlign = 0.5f;
            uiTextPanel.Top.Set(-45f, 0.0f);
            uiTextPanel.OnMouseOver += new UIElement.MouseEvent(this.FadedMouseOver);
            uiTextPanel.OnMouseOut  += new UIElement.MouseEvent(this.FadedMouseOut);
            uiTextPanel.OnClick     += new UIElement.MouseEvent(this.GoBackClick);
            uiTextPanel.SetSnapPoint("Back", 0, new Vector2?(), new Vector2?());
            element.Append((UIElement)uiTextPanel);
            this._backPanel = (UIElement)uiTextPanel;
            int currentGroupIndex = 0;

            this.TryAddingList(Language.GetText("UI.EmoteCategoryGeneral"), ref currentGroupIndex, 10, this.GetEmotesGeneral());
            this.TryAddingList(Language.GetText("UI.EmoteCategoryRPS"), ref currentGroupIndex, 10, this.GetEmotesRPS());
            this.TryAddingList(Language.GetText("UI.EmoteCategoryItems"), ref currentGroupIndex, 11, this.GetEmotesItems());
            this.TryAddingList(Language.GetText("UI.EmoteCategoryBiomesAndEvents"), ref currentGroupIndex, 8, this.GetEmotesBiomesAndEvents());
            this.TryAddingList(Language.GetText("UI.EmoteCategoryTownNPCs"), ref currentGroupIndex, 9, this.GetEmotesTownNPCs());
            this.TryAddingList(Language.GetText("UI.EmoteCategoryCritters"), ref currentGroupIndex, 7, this.GetEmotesCritters());
            this.TryAddingList(Language.GetText("UI.EmoteCategoryBosses"), ref currentGroupIndex, 8, this.GetEmotesBosses());
        }
示例#8
0
        public override void OnInitialize()
        {
            //const float width = 400f;
            //const float height = 600f;

            uiPanel = new UIPanel();
            uiPanel.Width.Set(300f, 0f);
            uiPanel.Height.Set(400f, 0f);
            uiPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f;
            //uiPanel.SetPadding(0);
            uiPanel.HAlign = 0.5f;
            uiPanel.VAlign = 0.5f;

            playerList = new UIList();
            playerList.Width.Set(-10f, 1f);
            playerList.Height.Set(-50f, 1f);
            playerList.Top.Set(50f, 0f);
            playerList.ListPadding = 5f;
            uiPanel.Append(playerList);

            var uiScrollbar = new UIScrollbar();

            uiScrollbar.SetView(100f, 1000f);
            uiScrollbar.Height.Set(-50f, 1f);
            uiScrollbar.Top.Set(50f, 0f);
            uiScrollbar.HAlign = 1f;
            uiPanel.Append(uiScrollbar);
            playerList.SetScrollbar(uiScrollbar);

            homeButton = new UITextPanel <string>(Language.GetTextValue("Mods.GoldensMisc.HomeButton"));
            homeButton.Width.Set(0, 0.4f);
            homeButton.OnMouseOver += MiscUtils.UI.FadedMouseOver;
            homeButton.OnMouseOut  += MiscUtils.UI.FadedMouseOut;
            homeButton.OnClick     += HomeButtonClicked;
            uiPanel.Append(homeButton);

            //var teleportButton = new UITextPanel<string>(Language.GetTextValue("Mods.GoldensMisc.TeleportButton"));
            //teleportButton.Width.Set(0f, 0.7f);
            ////teleportButton.Height.Set(20f, 0f);
            ////teleportButton.SetPadding(0);
            //teleportButton.OnMouseOver += MiscUtils.UI.FadedMouseOver;
            //teleportButton.OnMouseOut += MiscUtils.UI.FadedMouseOut;
            //teleportButton.OnClick += TeleportButtonClick;
            //uiPanel.Append(teleportButton);

            //var buttonDeleteTexture = ModLoader.GetTexture("Terraria/UI/ButtonDelete");
            //var closeButton = new UIImageButton(buttonDeleteTexture);
            var closeButton = new UITextPanel <string>(Language.GetTextValue("Mods.GoldensMisc.CloseButton"));

            closeButton.Left.Set(0, 0.6f);
            closeButton.Width.Set(0, 0.4f);
            //closeButton.SetPadding(0);
            closeButton.OnMouseOver += MiscUtils.UI.FadedMouseOver;
            closeButton.OnMouseOut  += MiscUtils.UI.FadedMouseOut;
            closeButton.OnClick     += new MouseEvent(CloseButtonClicked);
            uiPanel.Append(closeButton);

            base.Append(uiPanel);
        }
示例#9
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);
        }
示例#10
0
 private void UpdateScrollbar()
 {
     if (scrollbar == null)
     {
         return;
     }
     scrollbar.SetView(GetInnerDimensions().Height, innerListHeight);
 }
示例#11
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);
        }
示例#12
0
        public void UpdateScrollBar(int rows)
        {
            if (scrollbar == null)
            {
                return;
            }

            scrollbar.SetView(this.rows, rows);
        }
示例#13
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);
        }
示例#14
0
        private void UpdateScrollbar()
        {
            UIScrollbar scrollbar = Scrollbar;

            if (scrollbar != null)
            {
                scrollbar.SetView(GetInnerDimensions().Height, _height);
            }
        }
示例#15
0
        public override void OnInitialize()
        {
            UIElement area = new UIElement();

            area.Width.Set(0f, 0.8f);
            area.Top.Set(200f, 0f);
            area.Height.Set(-240f, 1f);
            area.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;
            area.Append(uIPanel);

            message.Width.Set(-25f, 1f);
            message.Height.Set(0f, 1f);
            uIPanel.Append(message);

            UIScrollbar uIScrollbar = new UIScrollbar();

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

            message.SetScrollbar(uIScrollbar);

            UITextPanel <string> button1 = new UITextPanel <string>("OK", 0.7f, true);

            button1.Width.Set(-10f, 0.5f);
            button1.Height.Set(50f, 0f);
            button1.Left.Set(0, 0f);
            button1.VAlign = 1f;
            button1.Top.Set(-30f, 0f);
            button1.OnMouseOver += UICommon.FadedMouseOver;
            button1.OnMouseOut  += UICommon.FadedMouseOut;
            button1.OnClick     += OKClick;
            area.Append(button1);

            button2 = new UITextPanel <string>("???", 0.7f, true);
            button2.Width.Set(-10f, 0.5f);
            button2.Height.Set(50f, 0f);
            button2.Left.Set(0, .5f);
            button2.VAlign = 1f;
            button2.Top.Set(-30f, 0f);
            button2.OnMouseOver += UICommon.FadedMouseOver;
            button2.OnMouseOut  += UICommon.FadedMouseOut;
            button2.OnClick     += AltClick;
            area.Append(button2);

            Append(area);
        }
示例#16
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);
        }
        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);
        }
示例#18
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);
        }
示例#19
0
        public override void OnInitialize()
        {
            AddElement(quests, -193, 0, 0.5f, 0.3f, 186, 300, this);
            quests.ListPadding = 6;

            AddElement(questScroll, -260, 0, 0.5f, 0.3f, 18, 300, this);
            questScroll.SetView(0, 300);
            quests.SetScrollbar(questScroll);

            AddElement(itemList, 5, 75, 0.5f, 0.3f, 200, 200, this);
            itemList.ListPadding = 0;

            AddElement(submitButton, 0, 310, 0.5f, 0.3f, 100, 28, this);
        }
        public void init()
        {
            RemoveAllChildren();
            Width.Set(600, 0f);
            Height.Set(635, 0f);
            Top.Set(Main.screenHeight / 2 - 300, 0f);
            Left.Set(Main.screenWidth / 2 - 300, 0f);
            SetPadding(0);


            panel = new UIPanel();
            panel.Width.Set(600, 0f);
            panel.Height.Set(600, 0f);
            panel.Left.Set(5, 0f);
            panel.Top.Set(35f, 0f);



            List <AchievementSlot> achievementSlots = new List <AchievementSlot>();

            list = new AchivementUIList();
            list.Left.Set(-5f, 0f);
            list.Top.Set(35, 0f);


            Scrollbar = new UIScrollbar();
            Scrollbar.SetView(100f, 100f);
            Scrollbar.Height.Set(-35f, 1f);
            Scrollbar.Top.Set(35f, 0f);
            Scrollbar.HAlign = 1f;

            list.SetScrollbar(Scrollbar);
            panel.Append(Scrollbar);
            panel.Append(list);

            title = new UIPanel();
            title.Width.Set(200, 0f);
            title.Height.Set(50, 0f);
            title.Left.Set(200, 0f);
            title.BackgroundColor = Color.DarkBlue;

            UIText text = new UIText("Modded Achievements");

            text.Height.Set(25, 0);

            title.Append(text);

            Append(panel);
            Append(title);
        }
示例#21
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);
        }
示例#22
0
        public void InitPanels()
        {
            UIPanel panelCategories = new UIPanel();

            panelCategories.Width.Pixels = categories.Select(x => Main.fontMouseText.MeasureString(x.Key).X).OrderByDescending(x => x).First() + 28;
            panelCategories.Top.Pixels   = 56;
            panelCategories.SetPadding(0);
            sidePanels.Add("Categories", panelCategories);

            UIGrid gridCategories = new UIGrid();

            gridCategories.Width.Set(-16, 1);
            gridCategories.Height.Set(-16, 1);
            gridCategories.Left.Pixels    = 8;
            gridCategories.Top.Pixels     = 8;
            gridCategories.ListPadding    = 4;
            gridCategories.OverflowHidden = true;
            panelCategories.Append(gridCategories);

            UIScrollbar barCategories = new UIScrollbar();

            barCategories.SetView(100f, 1000f);
            gridCategories.SetScrollbar(barCategories);

            UIPanel panelMods = new UIPanel();

            panelMods.Width.Pixels = 300;
            panelMods.Top.Pixels   = 104;
            panelMods.SetPadding(0);
            sidePanels.Add("Mods", panelMods);

            UIGrid gridMods = new UIGrid();

            gridMods.Width.Set(-16, 1);
            gridMods.Height.Set(-16, 1);
            gridMods.Left.Pixels    = 8;
            gridMods.Top.Pixels     = 8;
            gridMods.ListPadding    = 4;
            gridMods.OverflowHidden = true;
            panelMods.Append(gridMods);

            UIScrollbar barMods = new UIScrollbar();

            barMods.SetView(100f, 1000f);
            gridMods.SetScrollbar(barMods);
        }
        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);
        }
示例#24
0
        public override void OnInitialize()
        {
            UIElement area = new UIElement();

            area.Width.Set(0f, 0.8f);
            area.Top.Set(200f, 0f);
            area.Height.Set(-240f, 1f);
            area.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;
            area.Append(uIPanel);

            message.Width.Set(-25f, 1f);
            message.Height.Set(0f, 1f);
            uIPanel.Append(message);

            UIScrollbar uIScrollbar = new UIScrollbar();

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

            message.SetScrollbar(uIScrollbar);

            UITextPanel <string> button = new UITextPanel <string>(Language.GetTextValue("tModLoader.OK"), 0.7f, true);

            button.Width.Set(-10f, 0.5f);
            button.Height.Set(50f, 0f);
            button.Left.Set(0, .25f);
            button.VAlign = 1f;
            button.Top.Set(-30f, 0f);
            button.OnMouseOver += UICommon.FadedMouseOver;
            button.OnMouseOut  += UICommon.FadedMouseOut;
            button.OnClick     += OKClick;
            area.Append(button);

            Append(area);
        }
示例#25
0
        public override void OnActivate()
        {
            BackgroundColor             = Color.Blue;
            BackgroundColor.A           = 196;
            BorderColor                 = Color.White;
            hasChanged                  = true;
            internalGrid                = new UIGridList();
            internalGrid.OnScrollWheel += ResearchUI.onScrollWheelForUIText;

            //scrollbar = new UIScrollbar();
            scrollbar = new InvisibleScrollbar();
            Append(internalGrid);
            scrollbar.SetView(300f, 1000f);
            scrollbar.Height.Set(0, 1f);
            scrollbar.Width.Set(1, 0);
            scrollbar.Left.Set(-14, 1f);
            Append(scrollbar);
            internalGrid.SetScrollbar(scrollbar);
        }
示例#26
0
        public override void OnActivate()
        {
            base.OnActivate();
            BackgroundColor             = Color.Blue;
            BorderColor                 = Color.White;
            internalGrid                = new UIGrid();
            internalGrid.OnScrollWheel += PartExchangeUI.onScrollWheel;
            //scrollbar = new UIScrollbar();
            scrollbar = new InvisibleScrollbar();
            Append(internalGrid);
            scrollbar.SetView(100f, 1000f);
            scrollbar.Height.Set(0, 1f);
            scrollbar.Width.Set(1, 0);
            scrollbar.Left.Set(-14, 1f);
            Append(scrollbar);
            internalGrid.SetScrollbar(scrollbar);

            //Append(internalGrid);
            hasChanges = true;
        }
示例#27
0
        public void AppendButtons()
        {
            if (realPlayerCount > 42)
            {
                scrollbar = new UIScrollbar();
                scrollbar.Left.Set(-20f, 1f);
                scrollbar.Top.Set(10, 0f);
                scrollbar.Height.Set(-20, 1f);
                scrollbar.Width.Set(20f, 0f);
                scrollbar.SetView(100f, 1000f);

                buttonGrid.SetScrollbar(scrollbar);
                Append(scrollbar);
            }
            for (int i = 0; i < Main.maxPlayers; i++)
            {
                if (Main.player[i].active)
                {
                    buttonGrid.Add(new PlayerHeadButton(Main.player[i]));
                }
            }
        }
示例#28
0
        public override void OnInitialize()
        {
            checklistPanel = new UIPanel();
            checklistPanel.SetPadding(10);
            checklistPanel.Left.Pixels = 0;
            checklistPanel.HAlign      = 1f;
            checklistPanel.Top.Set(50f, 0f);
            checklistPanel.Width.Set(250f, 0f);
            checklistPanel.Height.Set(-100, 1f);
            checklistPanel.BackgroundColor = new Color(73, 94, 171);

            toggleButton             = new UIHoverImageButton(Main.itemTexture[ItemID.SuspiciousLookingEye], "Toggle Completed");
            toggleButton.OnClick    += ToggleButtonClicked;
            toggleButton.Left.Pixels = spacing;
            toggleButton.Top.Pixels  = spacing;
            checklistPanel.Append(toggleButton);

            checklistList            = new UIList();
            checklistList.Top.Pixels = 32f + spacing;
            checklistList.Width.Set(0f, 1f);
            checklistList.Height.Set(-32f, 1f);
            checklistList.ListPadding = 12f;
            checklistPanel.Append(checklistList);

            UIScrollbar checklistListScrollbar = new UIScrollbar();

            checklistListScrollbar.SetView(100f, 1000f);
            checklistListScrollbar.Height.Set(0f, 1f);
            checklistListScrollbar.HAlign = 1f;
            checklistPanel.Append(checklistListScrollbar);
            checklistList.SetScrollbar(checklistListScrollbar);

            // Checklistlist populated when the panel is shown: UpdateCheckboxes()

            Append(checklistPanel);

            // TODO, game window resize issue
        }
        ////////////////

        public UIServerBrowserList(UITheme theme) : base()
        {
            this.Theme          = theme;
            this.FlipComparator = false;

            ////

            this.MyList = new UIList();
            this.MyList.Width.Set(-25, 1f);
            this.MyList.Height.Set(0f, 1f);
            this.MyList.HAlign      = 0f;
            this.MyList.ListPadding = 4f;
            this.MyList.SetPadding(0f);
            this.Append((UIElement)this.MyList);

            UIScrollbar scrollbar = new UIScrollbar();

            scrollbar.Top.Set(8f, 0f);
            scrollbar.Height.Set(-16f, 1f);
            scrollbar.SetView(100f, 1000f);
            scrollbar.HAlign = 1f;
            this.Append((UIElement)scrollbar);

            this.MyList.SetScrollbar(scrollbar);

            ////

            this.ModListPopup = new UIServerModListPopup(this.Theme);
            this.ModListPopup.Top.Set(0f, 0f);
            this.ModListPopup.Left.Set(0f, 0f);

            ////

            this.DefaultComparator = UIServerDataElement.CompareByWorldName;

            this.RefreshTheme_Yielding();
        }
示例#30
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);
        }