Esempio n. 1
0
        private static UIFocusTextInputPanel AddInput(string text, UIPanel mainPanel, ref float top, bool noSpaces = false, int h = 40)
        {
            UIFocusTextInputPanel boolElement = new UIFocusTextInputPanel(text);

            boolElement.SetPadding(0);
            boolElement.Width.Set(0, 1f);
            boolElement.Height.Set(h, 0f);
            boolElement.Top.Set(top, 0f);

            if (noSpaces)
            {
                //boolElement.OnTextChange += (a, b) =>
                //{
                //	boolElement.SetText(boolElement.currentText.RemoveSpaces());
                //};
            }

            mainPanel.Append(boolElement);

            top += h + 6;
            return(boolElement);
        }
Esempio n. 2
0
        public override void OnInitialize()
        {
            UIElement uIElement = new UIElement
            {
                Width    = { Percent = 0.8f },
                MaxWidth = UICommon.MaxPanelWidth,
                Top      = { Pixels = 220 },
                Height   = { Pixels = -220, Percent = 1f },
                HAlign   = 0.5f
            };

            Append(uIElement);

            UIPanel mainPanel = new UIPanel
            {
                Width           = { Percent = 1f },
                Height          = { Pixels = -110, Percent = 1f },
                BackgroundColor = UICommon.MainPanelBackground,
                PaddingTop      = 0f
            };

            uIElement.Append(mainPanel);

            UITextPanel <string> uITextPanel = new UITextPanel <string>("Advanced Create Mod", 0.8f, true)
            {
                HAlign          = 0.5f,
                Top             = { Pixels = -45 },
                BackgroundColor = UICommon.DefaultUIBlue
            }.WithPadding(15);

            uIElement.Append(uITextPanel);

            infoTextPanel = new UITextPanel <string>("No Problems Found. If a problem occurs it will be shown here")
            {
                Width  = { Percent = 1f },
                Height = { Pixels = 25 },
                VAlign = 1f,
                Top    = { Pixels = -10 }
            };
            uIElement.Append(infoTextPanel);

            UITextPanel <string> buttonBack = new UITextPanel <string>(Language.GetTextValue("UI.Back"))
            {
                Width  = { Pixels = -10, Percent = 0.5f },
                Height = { Pixels = 25 },
                VAlign = 1f,
                Top    = { Pixels = -65 }
            }.WithFadedMouseOver();

            buttonBack.OnClick += BackClick;
            uIElement.Append(buttonBack);

            UITextPanel <string> buttonCreate = new UITextPanel <string>("Create");           // Create

            buttonCreate.CopyStyle(buttonBack);
            buttonCreate.HAlign = 1f;
            buttonCreate.WithFadedMouseOver();
            buttonCreate.OnClick += OKClick;
            uIElement.Append(buttonCreate);

            float top = 16;

            internalNamePanel = AddInput("Internal Name", mainPanel, ref top, true);

            displayNamePanel = AddInput("Display Name", mainPanel, ref top);

            authorsPanel = AddInput("Author(s)", mainPanel, ref top);

            AddToggle("Test 1?", mainPanel, ref top);
            AddToggle("Test 2?", mainPanel, ref top);
            AddToggle("Test 3?", mainPanel, ref top);
            AddToggle("Test 4?", mainPanel, ref top);
            AddToggle("Test 5?", mainPanel, ref top);
            AddInput("Test 6?", mainPanel, ref top);
        }