コード例 #1
0
        public FileBrowserWindow(GUISystem system, GUITheme theme, UDim2 size, string title,
                                 FileBrowserMode mode, string[] exts, FileBrowserCompleted callback)
            : base(system, size, title, theme)
        {
            this.mode     = mode;
            this.callback = callback;
            this.exts     = exts;

            BMPFont smallFont = theme.GetField <BMPFont>(null, "SmallFont", "Font");

            dirField            = new GUITextField(new UDim2(0, 0, 0, 20), new UDim2(1, -40, 0, 20), Environment.CurrentDirectory, TextAlign.Left, theme);
            dirField.Label.Font = smallFont;

            GUIButton goToDirBtn = new GUIButton(new UDim2(1, -40, 0, 20), new UDim2(0, 40, 0, 20), "Go", theme);

            goToDirBtn.OnMouseClick += (btn, mbtn) =>
            {
                ScanDir();
            };

            GUILabel fileNameLabel = new GUILabel(new UDim2(0, 0, 1, -40), new UDim2(1, -200, 0, 20), "File Name:", TextAlign.Left, theme);

            selectedFileLabel            = new GUITextField(new UDim2(0, 0, 1, -20), new UDim2(1, -200, 0, 20), "", TextAlign.Left, theme);
            selectedFileLabel.Label.Font = smallFont;
            GUIButton doneBtn = new GUIButton(new UDim2(1, -100, 1, -40), new UDim2(0, 100, 0, 40),
                                              mode == FileBrowserMode.OpenFile ? "Open" : "Save", TextAlign.Center, theme);

            doneBtn.OnMouseClick += (btn, mbtn) => { callback(this); Visible = false; };
            GUIButton cancelBtn = new GUIButton(new UDim2(1, -200, 1, -40), new UDim2(0, 100, 0, 40), "Cancel", TextAlign.Center, theme);

            cancelBtn.OnMouseClick += (btn, mbtn) => { Visible = false; };

            AddTopLevel(dirField, goToDirBtn, fileNameLabel, selectedFileLabel, doneBtn, cancelBtn);
            ScanDir();
        }
コード例 #2
0
 public GUIWindowBase(GUISystem system, UDim2 position, UDim2 size)
     : base(system)
 {
     Visible  = false;
     Position = position;
     Size     = size;
 }
コード例 #3
0
        public GUIArea(GUISystem system)
        {
            this.system = system;
            hierarchy   = new GUIHierarchy();

            Resize(system.ScreenWidth, system.ScreenHeight);
        }
コード例 #4
0
 public GUIWindowBase(GUISystem system, UDim2 size)
     : base(system)
 {
     Visible = false;
     Size    = size;
     Center();
 }
コード例 #5
0
        public MessageWindow(GUISystem system, GUITheme theme, UDim2 size, string title)
            : base(system, size, title, theme)
        {
            msgLabel = new GUILabel(UDim2.Zero, new UDim2(1f, 0, 1f, -30), "", TextAlign.Center, theme);
            GUIButton okBtn = new GUIButton(new UDim2(0.5f, -75, 1f, -30), new UDim2(0, 150, 0, 30), "Okay", theme);

            okBtn.OnMouseClick += (btn, mbtn) => { Visible = false; };
            AddTopLevel(msgLabel, okBtn);
        }