示例#1
0
 public void Init(GUIHost host)
 {
     Sprite.pixel_perfect = false;
     this.host            = host;
     listboxwidget.Init(host, "guicontrols", 944f, 96f, 960f, 144f, 944f, 96f, 960f, 144f, 4, 4, 16, 4, 4, 48, 24, 24);
     editboxwidget.Init(host, "guicontrols", 944f, 96f, 960f, 144f);
     editboxwidget.SetTextWindowBorders(10, 10, 3, 3);
     editboxwidget.SetGrowableWidth(3, 3, 12);
     buttonwidget.Init(host, "guicontrols", 928f, 48f, 951f, 71f, 952f, 48f, 975f, 71f, 976f, 48f, 999f, 71f);
     listboxwidget.ScrollBar.InitTrack(host, "guicontrols", 809f, 80f, 831f, 87f, 2, 8);
     listboxwidget.ScrollBar.InitButton(host, "guicontrols", 1000f, 0.0f, 1023f, 23f, 1000f, 24f, 1023f, 47f, 1000f, 48f, 1023f, 71f, 4, 4, 24);
     listboxwidget.ScrollBar.InitMinus(host, "guicontrols", 928f, 48f, 951f, 71f, 952f, 48f, 975f, 71f, 976f, 48f, 999f, 71f);
     listboxwidget.ScrollBar.InitPlus(host, "guicontrols", 928f, 72f, 951f, 95f, 952f, 72f, 975f, 95f, 976f, 72f, 999f, 95f);
     listboxwidget.ScrollBar.SetButtonSize(24f);
     listboxwidget.ScrollBar.ShowPushButtons = true;
     listboxwidget.ShowScrollbar             = ListBoxWidget.ScrollBarState.On;
     editboxwidget.Color = new Color4(0.5f, 0.5f, 0.5f, 1f);
     listboxwidget.Color = new Color4(0.5f, 0.5f, 0.5f, 1f);
 }
示例#2
0
        private void Initialize(int num)
        {
            var num1 = 1.0 - (num - 1.0) * 0.100000001490116;
            var num2 = 0.1f;
            var num3 = (double)num;
            var num4 = (float)(num1 / num3);
            var num5 = 0.0f;

            editboxes = new EditBoxWidget[num];
            for (var index = 0; index < num; ++index)
            {
                var editBoxWidget = new EditBoxWidget(index + 1000, this);
                editBoxWidget.Init(host, "guicontrols", 640f, 448f, 672f, 480f);
                editBoxWidget.SetGrowableWidth(4, 4, 32);
                editBoxWidget.Text = "";
                editBoxWidget.OnKeyboardEvent(new KeyboardEvent(KeyboardEventType.InputKey, false, false, false));
                editBoxWidget.Enabled = true;
                editBoxWidget.SetSize(100, 24);
                editBoxWidget.Color = Color;
                editBoxWidget.SetTextWindowBorders(7, 7, 7, 7);
                editBoxWidget.RelativeX      = num5;
                editBoxWidget.RelativeY      = 0.0f;
                editBoxWidget.RelativeWidth  = num4;
                editBoxWidget.RelativeHeight = 1f;
                editBoxWidget.Size           = FontSize.Large;
                editBoxWidget.CAPS           = true;
                editBoxWidget.SetCallbackEnterKey(new EditBoxWidget.EditBoxCallback(EditBoxCallbackEnterKey));
                editBoxWidget.SetCallbackOnClick(new EditBoxWidget.EditBoxCallback(EditBoxCallbackOnClick));
                editBoxWidget.SetCallbackOnTextAdded(new EditBoxWidget.EditBoxCallback(EditBoxCallbackEnterKeyOnTextAdded));
                editBoxWidget.SetCallbackOnBackspace(new EditBoxWidget.EditBoxCallback(EditBoxCallbackOnBackSpace));
                editBoxWidget.MAX_CHARS = MaxCharacterPerBox;
                num5 += num2 + num4;
                AddChildElement(editBoxWidget);
                editboxes[index] = editBoxWidget;
            }
            initialized = true;
        }