Esempio n. 1
0
        public override void OnInitialize()
        {
            keyboardPanel = new UIPanel();
            keyboardPanel.SetPadding(8);
            keyboardPanel.Left.Set(-550f, 1f);
            keyboardPanel.Top.Set(-370f, 1f);
            keyboardPanel.Width.Set(500f, 0f);
            keyboardPanel.Height.Set(300f, 0f);
            keyboardPanel.BackgroundColor = new Color(73, 94, 171);

            codeTextBox = new NewUITextBoxMultiLine("Type code here", 1f);
            codeTextBox.SetUnfocusKeys(false, false);
            codeTextBox.BackgroundColor = Color.Transparent;
            codeTextBox.BorderColor     = Color.Transparent;
            codeTextBox.Left.Pixels     = 0;
            codeTextBox.Top.Pixels      = 0;
            codeTextBox.Width.Set(-20, 1f);
            //filterTextBox.OnTextChanged += () => { filterText = filterTextBox.Text; updateneeded = true; };
            codeTextBox.OnEnterPressed += EnterAction;
            codeTextBox.OnTabPressed   += TabAction;
            codeTextBox.OnUpPressed    += UpAction;
            //keyboardPanel.Append(codeTextBox);

            replOutput = new UIList();
            replOutput.Width.Set(-25f, 1f);             // left spacing plus scrollbar
            //replOutput.Height.Set(-codeTextBox.GetDimensions().Height - 32, 1f);
            replOutput.Height.Set(-26, 1f);
            replOutput.Left.Set(0, 0f);
            //replOutput.Top.Set(codeTextBox.GetDimensions().Height, 0f);
            replOutput.Top.Set(0, 0f);
            replOutput.ListPadding = 10f;
            replOutput.Add(codeTextBox);
            keyboardPanel.Append(replOutput);

            keyboardScrollbar = new UIElements.FixedUIScrollbar(userInterface);
            keyboardScrollbar.SetView(100f, 1000f);
            keyboardScrollbar.Top.Pixels = codeTextBox.GetDimensions().Height;
            keyboardScrollbar.Height.Set(-26, 1f);
            keyboardScrollbar.Left.Set(-4, 0f);
            keyboardScrollbar.HAlign = 1f;
            keyboardPanel.Append(keyboardScrollbar);

            replOutput.SetScrollbar(keyboardScrollbar);

            UIImageButton eyeDropperButton = new UIImageButton(ModdersToolkit.instance.GetTexture("UIElements/eyedropper"));

            eyeDropperButton.Height.Pixels = 20;
            //eyeDropperButton.Width.Pixels = 20;
            eyeDropperButton.OnClick += EyeDropperButton_OnClick;
            eyeDropperButton.Top.Set(-26, 1f);
            keyboardPanel.Append(eyeDropperButton);

            UIImageButton openText = new UIHoverImageButton(ModdersToolkit.instance.GetTexture("UIElements/CopyCodeButton"), "Open External Editor");

            openText.OnClick += OpenTextButton_OnClick;
            openText.Top.Set(-26, 1f);
            openText.Left.Set(26, 0f);
            keyboardPanel.Append(openText);

            UIImageButton runText = new UIHoverImageButton(TextureManager.Load("Images/UI/ButtonPlay"), "Execute External Code");

            runText.OnClick += RunTextButton_OnClick;
            runText.Top.Set(-26, 1f);
            runText.Left.Set(52, 0f);
            keyboardPanel.Append(runText);

            Append(keyboardPanel);
        }