コード例 #1
0
        public uiDialogResult()
        {
            Set_Size(450, 300);
            Center();

            message = Create <uiTextArea>("msg", this);
            message.Autosize_Method = AutosizeMethod.BLOCK;
            message.Autosize        = true;
            message.Text            = "Lorum Ipsum Lorum Ipsum\nLorum Ipsum Lorum Ipsum";
            message.TextColor       = new Color(0.6f, 0.6f, 0.6f, 1f);

            contentPanel = Create <uiScrollPanel>("content", this);
            contentPanel.Set_Margin(0, 6);

            btnPanel = Create <uiWrapperPanel>("btn_panel", this);
            btnPanel.Autosize_Method = AutosizeMethod.BLOCK;
            btnPanel.Autosize        = true;
            btnPanel.onLayout       += BtnPanel_onLayout;

            btn_ok            = Create <uiButton>("btn_ok", btnPanel);
            btn_ok.Text       = "OK";
            btn_ok.onClicked += (uiControl c) => { Result = DialogResult.OK; };
            btn_ok.Set_Padding(5, 2);

            btn_later            = Create <uiButton>("btn_later", btnPanel);
            btn_later.Text       = "Later";
            btn_later.onClicked += (uiControl c) => { Result = DialogResult.CANCEL; };
            btn_later.Set_Padding(5, 2);
        }
コード例 #2
0
        public uiWindow() : base(uiControlType.Window)
        {
            ALL.Add(ID);

            isDraggable = true;  // among other things; this control cannot have it's position assigned via auto-positioners.
            Autosize    = false;
            isVisible   = false; //hidden by default
            Title       = "Window";
            //selfPadding = new RectOffset(0, 0, title_bar_height, 0);
            //local_style.fontStyle = FontStyle.Bold;
            //local_style.fontSize = 32;

            Setup_Titlebar();


            closeBtn = Create <uiButton>();
            GUIStyle sty = new GUIStyle();

            sty.normal.background       = TextureHelper.icon_close_dark;
            sty.hover.background        = TextureHelper.icon_close;
            closeBtn.Border.hover.size  = new RectOffset(1, 1, 1, 1);
            closeBtn.Border.hover.color = new Color(1f, 1f, 1f, 0.2f);
            closeBtn.Border.type        = uiBorderType.NONE;//we don't ever want the close button to render a border.

            closeBtn.Set_Size(title_bar_height, title_bar_height);
            closeBtn.Set_Style(sty);
            closeBtn.onClicked += CloseBtn_onClicked;
            closeBtn.Set_Margin(6);


            content_panel = Create <uiScrollPanel>();
            content_panel.Set_Margin(5, 5, 0, 5);
            content_panel.Autosize            = true;
            content_panel.Autosize_Method     = AutosizeMethod.FILL;
            content_panel.Border.normal.color = new Color(0f, 0f, 0f, 0.35f);// A semi-transparent black to darken the edges around the content area so it's more distinguishable.

            this.Add_Control(content_panel);
            this.Add_Control(closeBtn);

            this.layout_content_area();
        }