예제 #1
0
        public override void BuildLayout(SingleContainer editorContainer, IAssetManager assetManager)
        {
            this.m_FileSelect          = new FileSelect();
            this.m_FileSelect.Changed += (sender, e) =>
            {
                using (var stream = new FileStream(this.m_FileSelect.Path, FileMode.Open))
                {
                    using (var reader = new BinaryReader(stream))
                    {
                        this.m_Asset.RawData = reader.ReadBytes((int)stream.Length);
                    }
                }
                assetManager.Recompile(this.m_Asset);
                assetManager.Save(this.m_Asset);
            };

            var form = new Form();

            form.AddControl("Source File:", this.m_FileSelect);

            var textureViewer = new AudioPlayer();

            textureViewer.Audio = this.m_Asset;

            var vertContainer = new VerticalContainer();

            vertContainer.AddChild(form, "*");
            vertContainer.AddChild(textureViewer, "200");

            editorContainer.SetChild(vertContainer);
        }
예제 #2
0
        public void PromptForCreation(string createType, EventHandler submit)
        {
            this.PromptName = new TextBox();

            var label = new Label();

            label.Text = "Enter the name of the new " + createType + ":";

            var form = new Form();

            form.AddControl("Name: ", this.PromptName);

            var submitButton = new Button();

            submitButton.Text   = "Create";
            submitButton.Click += (sender, e) =>
            {
                submit(sender, e);
                this.m_CanvasEntity.Windows.Remove(this.PromptWindow);
                this.PromptWindow = null;
                this.PromptName   = null;
            };

            var cancelButton = new Button();

            cancelButton.Text   = "Cancel";
            cancelButton.Click += (sender, e) =>
            {
                this.m_CanvasEntity.Windows.Remove(this.PromptWindow);
                this.PromptWindow = null;
                this.PromptName   = null;
            };

            var horizontalContainer = new HorizontalContainer();

            horizontalContainer.AddChild(submitButton, "50%");
            horizontalContainer.AddChild(cancelButton, "50%");

            var verticalContainer = new VerticalContainer();

            verticalContainer.AddChild(label, "24");
            verticalContainer.AddChild(form, "*");
            verticalContainer.AddChild(horizontalContainer, "24");

            this.PromptWindow        = new Window();
            this.PromptWindow.Modal  = true;
            this.PromptWindow.Bounds = new Microsoft.Xna.Framework.Rectangle(
                (int)this.m_CanvasEntity.Width / 2 - 150,
                (int)this.m_CanvasEntity.Height / 2 - 75,
                300,
                150);
            this.PromptWindow.SetChild(verticalContainer);
            this.m_CanvasEntity.Windows.Add(this.PromptWindow);

            this.MainMenu.Active = false;
            foreach (var item in this.MainMenu.Children.Cast <MenuItem>())
            {
                item.Active = false;
            }
        }
예제 #3
0
        /*public override void OnFocus()
         * {
         *  // Switch focus to the scrollable container.
         *  _verticalContainer.Focus();
         * }*/

        public override void Update(ISkinLayout skinLayout, Rectangle layout, GameTime gameTime, ref bool stealFocus)
        {
            foreach (var ext in _extensionManager.Extensions)
            {
                if (_verticalContainer.Children.Any(x => x.Userdata == ext))
                {
                    continue;
                }

                var label = new Label
                {
                    Text = ext.Name
                };
                var debugButton = new Button
                {
                    Text = "Debug"
                };
                var restartButton = new Button
                {
                    Text = "Restart"
                };

                debugButton.Click += (sender, e) =>
                {
                    _extensionManager.DebugExtension(ext);
                };
                restartButton.Click += (sender, e) =>
                {
                    _extensionManager.RestartExtension(ext);
                };


                var buttonContainer = new VerticalContainer();
                buttonContainer.AddChild(debugButton, "24");
                buttonContainer.AddChild(restartButton, "24");

                var horizontalContainer = new HorizontalContainer();
                horizontalContainer.Userdata = ext;
                horizontalContainer.AddChild(label, "*");
                horizontalContainer.AddChild(buttonContainer, "120");

                _verticalContainer.AddChild(horizontalContainer, "48");
            }

            foreach (var vert in _verticalContainer.Children.ToArray())
            {
                if (!_extensionManager.Extensions.Any(x => x == vert.Userdata))
                {
                    _verticalContainer.RemoveChild(vert);
                }
            }

            base.Update(skinLayout, layout, gameTime, ref stealFocus);
        }
예제 #4
0
        public override void BuildLayout(SingleContainer editorContainer, IAssetManager assetManager)
        {
            this.m_FileSelect = new FileSelect {
                Path = this.m_Asset.SourcePath
            };
            this.m_FileSelect.Changed += (sender, e) =>
            {
                this.m_Asset.SourcePath = this.m_FileSelect.Path;
                using (var stream = new StreamReader(this.m_Asset.SourcePath, Encoding.UTF8))
                {
                    this.m_Asset.Value = stream.ReadToEnd();
                }
                assetManager.Save(this.m_Asset);
            };

            var form = new Form();

            form.AddControl("Source File:", this.m_FileSelect);

            var vertContainer = new VerticalContainer();

            vertContainer.AddChild(form, "*");

            editorContainer.SetChild(vertContainer);
        }
예제 #5
0
        public ProfilerEditorWindow(
            IAssetManager assetManager,
            ILoadedGame loadedGame,
            IProjectManager projectManager)
        {
            _assetManager   = assetManager;
            _loadedGame     = loadedGame;
            _projectManager = projectManager;

            Title = "Profiler";
            Icon  = _assetManager.Get <TextureAsset>("texture.IconProfiler");

            var verticalContainer = new VerticalContainer();

            _readStallLabel  = new Label();
            _writeStallLabel = new Label();
            verticalContainer.AddChild(_readStallLabel, "20");
            verticalContainer.AddChild(_writeStallLabel, "20");
            verticalContainer.AddChild(new EmptyContainer(), "*");

            SetChild(verticalContainer);
        }
예제 #6
0
        public override void BuildLayout(SingleContainer editorContainer, IAssetManager assetManager)
        {
            this.m_FileSelect          = new FileSelect();
            this.m_FileSelect.Changed += (sender, e) =>
            {
                using (var reader = new StreamReader(this.m_FileSelect.Path))
                {
                    this.m_Asset.Code = reader.ReadToEnd();
                }
                assetManager.Recompile(this.m_Asset);
                assetManager.Save(this.m_Asset);
            };

            var form = new Form();

            form.AddControl("Source File:", this.m_FileSelect);

            var vertContainer = new VerticalContainer();

            vertContainer.AddChild(form, "*");

            editorContainer.SetChild(vertContainer);
        }
예제 #7
0
        private void SetupCanvas()
        {
            _canvas = new Canvas();

            var dockableLayoutContainer = new DockableLayoutContainer();

            dockableLayoutContainer.RightWidth   = 250;
            dockableLayoutContainer.BottomHeight = 250;

            var profilerDockableLayoutContainer = new DockableLayoutContainer();

            profilerDockableLayoutContainer.AddInnerRegion(_editorWindowFactory.CreateProfilerEditorWindow());

            var rightDockableLayoutContainer = new DockableLayoutContainer();

            rightDockableLayoutContainer.SetTopRegion(profilerDockableLayoutContainer);
            rightDockableLayoutContainer.AddInnerRegion(_editorWindowFactory.CreateInspectorEditorWindow());
            dockableLayoutContainer.SetRightRegion(rightDockableLayoutContainer);

            var bottomDockableLayoutContainer = new DockableLayoutContainer();

            bottomDockableLayoutContainer.AddInnerRegion(_editorWindowFactory.CreateProjectEditorWindow());
            bottomDockableLayoutContainer.AddInnerRegion(_editorWindowFactory.CreateConsoleEditorWindow());
            dockableLayoutContainer.SetBottomRegion(bottomDockableLayoutContainer);

            var workspaceDockableLayoutContainer = new DockableLayoutContainer();

            _workspaceContainer = new DockableLayoutContainer();
            workspaceDockableLayoutContainer.AddInnerRegion(_workspaceContainer);
            dockableLayoutContainer.AddInnerRegion(workspaceDockableLayoutContainer);

            var leftDockableLayoutContainer = new DockableLayoutContainer();

            leftDockableLayoutContainer.AddInnerRegion(_editorWindowFactory.CreateHierarchyEditorWindow());
            _workspaceContainer.SetLeftRegion(leftDockableLayoutContainer);

            _workspaceContainer.AddInnerRegion(_editorWindowFactory.CreateStartEditorWindow());
            _workspaceContainer.AddInnerRegion(_worldEditorWindow = _editorWindowFactory.CreateWorldEditorWindow());
            _workspaceContainer.AddInnerRegion(_gameEditorWindow  = _editorWindowFactory.CreateGameEditorWindow());

            var toolContainer = new RelativeContainer();

            /*var panButton = CreateToolButton("texture.IconToolPan", "pan");
             * panButton.Toggled = true;
             *
             * toolContainer.AddChild(panButton, new Rectangle(16, 8, 28, 28));
             * toolContainer.AddChild(CreateToolButton("texture.IconToolMove", "move"), new Rectangle(16 + 30 * 1, 8, 28, 28));
             * toolContainer.AddChild(CreateToolButton("texture.IconToolRotate", "rotate"), new Rectangle(16 + 30 * 2, 8, 28, 28));
             * toolContainer.AddChild(CreateToolButton("texture.IconToolResize", "resize"), new Rectangle(16 + 30 * 3, 8, 28, 28));
             * toolContainer.AddChild(CreateToolButton("texture.IconToolSelect", "select"), new Rectangle(16 + 30 * 4, 8, 28, 28));*/

            _gameControlContainer = new RelativeContainer();

            var unusedContainer = new RelativeContainer();

            _horizontalContainer = new HorizontalContainer();
            _horizontalContainer.AddChild(toolContainer, "*");
            _horizontalContainer.AddChild(_gameControlContainer, "0");
            _horizontalContainer.AddChild(unusedContainer, "*");

            var verticalContainer = new VerticalContainer();

            verticalContainer.AddChild(_horizontalContainer, "40");
            verticalContainer.AddChild(dockableLayoutContainer, "*");

            _canvas.SetChild(verticalContainer);

            _windowManagement.SetMainDocumentContainer(_workspaceContainer);
        }
예제 #8
0
        public MenuWorld(ISkin skin, IWorldFactory worldFactory, IAssetManagerProvider assetManagerProvider, I2DRenderUtilities twodRenderUtilities)
        {
            this.m_2DRenderUtilities = twodRenderUtilities;

            this.m_LogoTexture = assetManagerProvider.GetAssetManager().Get <TextureAsset>("texture.Logo");

            this.m_WorldFactory = worldFactory;

            this.Entities = new List <IEntity>();

            var startServer = new Button();

            startServer.Text   = "Start Server";
            startServer.Click += (sender, e) =>
            {
                this.m_LastGameContext.SwitchWorld <IWorldFactory>(
                    x => x.CreateLobbyWorld(false, IPAddress.Any));
            };

            var ipAddressTextBox = new TextBox();

            var joinGame = new Button();

            joinGame.Text   = "Join Game";
            joinGame.Click += (sender, e) =>
            {
                this.m_LastGameContext.SwitchWorld <IWorldFactory>(
                    x => x.CreateLobbyWorld(true, IPAddress.Parse(ipAddressTextBox.Text)));
            };

            var exitGame = new Button();

            exitGame.Text   = "Exit Game";
            exitGame.Click += (sender, e) =>
            {
                this.m_LastGameContext.Game.Exit();
            };

            var vertical = new VerticalContainer();

            vertical.AddChild(new EmptyContainer(), "*");
            vertical.AddChild(new Label {
                Text = "Perspective"
            }, "25");
            vertical.AddChild(new EmptyContainer(), "*");
            vertical.AddChild(startServer, "25");
            vertical.AddChild(new EmptyContainer(), "*");
            vertical.AddChild(new Label {
                Text = "Server IP address:"
            }, "20");
            vertical.AddChild(ipAddressTextBox, "20");
            vertical.AddChild(joinGame, "25");
            vertical.AddChild(new EmptyContainer(), "*");
            vertical.AddChild(exitGame, "25");
            vertical.AddChild(new EmptyContainer(), "*");

            var horizontal = new HorizontalContainer();

            horizontal.AddChild(new EmptyContainer(), "*");
            horizontal.AddChild(vertical, "250");
            horizontal.AddChild(new EmptyContainer(), "*");

            var canvas = new Canvas();

            canvas.SetChild(horizontal);

            this.Entities.Add(new CanvasEntity(skin, canvas));
        }
예제 #9
0
        public AssetManagerLayout(
            IAssetManagerProvider assetManagerProvider,
            I2DRenderUtilities renderUtilities,
            IAssetLoader[] loaders,
            CanvasEntity canvasEntity)
        {
            this.m_CanvasEntity = canvasEntity;

            var toolbarContainer = new HorizontalContainer();

            toolbarContainer.AddChild(new SingleContainer(), "*");
            toolbarContainer.AddChild(this.Bake = new Button {
                Text = "Bake"
            }, "50");
            toolbarContainer.AddChild(this.MarkDirty = new Button {
                Text = "Mark Dirty"
            }, "80");

            var assetContainer = new VerticalContainer();

            assetContainer.AddChild(toolbarContainer, "20");
            assetContainer.AddChild(this.EditorContainer = new SingleContainer(), "*");

            var contentContainer = new HorizontalContainer();

            contentContainer.AddChild(this.AssetTree = new TreeView(), "210");
            contentContainer.AddChild(assetContainer, "*");

            var menuContainer = new VerticalContainer();

            menuContainer.AddChild(this.MainMenu = new MainMenu(assetManagerProvider, renderUtilities), "24");
            menuContainer.AddChild(contentContainer, "*");
            menuContainer.AddChild(this.Status = new Label {
                Text = "..."
            }, "24");
            this.SetChild(menuContainer);

            var exitItem = new MenuItem(assetManagerProvider, renderUtilities)
            {
                Text = "Exit"
            };
            var bakeAllItem = new MenuItem(assetManagerProvider, renderUtilities)
            {
                Text = "Bake All"
            };
            var assetManagerMenuItem = new MenuItem(assetManagerProvider, renderUtilities)
            {
                Text = "Asset Manager"
            };

            exitItem.Click += (sender, e) =>
            {
                if (this.ExitClick != null)
                {
                    this.ExitClick(sender, e);
                }
            };
            bakeAllItem.Click += (sender, e) =>
            {
                if (this.BakeAllClick != null)
                {
                    this.BakeAllClick(sender, e);
                }
                (bakeAllItem.Parent as MenuItem).Active = false;
            };
            assetManagerMenuItem.AddChild(bakeAllItem);
            assetManagerMenuItem.AddChild(exitItem);
            this.MainMenu.AddChild(assetManagerMenuItem);

            var newAssetMenuItem = new MenuItem(assetManagerProvider, renderUtilities)
            {
                Text = "Create New..."
            };

            foreach (var loader in loaders.Where(x => x.CanNew()))
            {
                var createNewMenuItem = new MenuItem(assetManagerProvider, renderUtilities)
                {
                    Text = loader.GetType().Name
                };
                createNewMenuItem.Click += (sender, e) =>
                {
                    if (this.PromptWindow == null)
                    {
                        this.PromptForCreation(loader.GetType().Name, (_, _2) =>
                        {
                            if (this.CreateNameEntered != null)
                            {
                                this.CreateNameEntered(this, new CreateEventArgs(loader));
                            }
                        });
                    }
                };
                newAssetMenuItem.AddChild(createNewMenuItem);
            }
            this.MainMenu.AddChild(newAssetMenuItem);
        }
예제 #10
0
        public AugmentedBoardGameWorld(
            I2DRenderUtilities twoDRenderUtilities,
            IAssetManagerProvider assetManagerProvider,
            IEntityFactory entityFactory)
        {
            this.Entities = new List <IEntity>();

            _renderUtilities = twoDRenderUtilities;
            _assetManager    = assetManagerProvider.GetAssetManager();
            _defaultFont     = this._assetManager.Get <FontAsset>("font.Default");

            var canvasEntity = entityFactory.CreateCanvasEntity();

            var pointThresholdTextBox = new TextBox();
            var minPoints             = new TextBox();
            var maxPoints             = new TextBox();
            var alpha        = new TextBox();
            var deviceWidth  = new TextBox();
            var deviceHeight = new TextBox();
            var nextColor    = new Button()
            {
                Text = "Show Next Color "
            };
            var showDiagnostics = new Button()
            {
                Text = "Show Diagnostics"
            };
            var showBoard = new Button()
            {
                Text = "Show Board"
            };
            var nextDevice = new Button()
            {
                Text = "Next Device"
            };
            var deviceName = new TextBox();

            _fullscreen = new Button()
            {
                Text = "Fullscreen 1080"
            };

            var camera640x480 = new Button()
            {
                Text = "Camera 640x480"
            };

            camera640x480.Click += (sender, args) =>
            {
                deviceWidth.Text  = "640";
                deviceHeight.Text = "480";
            };
            var camera720p = new Button()
            {
                Text = "Camera 720p"
            };

            camera720p.Click += (sender, args) =>
            {
                deviceWidth.Text  = "1080";
                deviceHeight.Text = "720";
            };
            var camera1080p = new Button()
            {
                Text = "Camera 1080p"
            };

            camera1080p.Click += (sender, args) =>
            {
                deviceWidth.Text  = "1920";
                deviceHeight.Text = "1080";
            };

            var pointThresholdEntry = new HorizontalContainer();

            pointThresholdEntry.AddChild(new Label()
            {
                Text = "Point Threshold: "
            }, "100");
            pointThresholdEntry.AddChild(pointThresholdTextBox, "*");

            var minPointsEntry = new HorizontalContainer();

            minPointsEntry.AddChild(new Label()
            {
                Text = "Min. Points: "
            }, "100");
            minPointsEntry.AddChild(minPoints, "*");

            var maxPointsEntry = new HorizontalContainer();

            maxPointsEntry.AddChild(new Label()
            {
                Text = "Max. Points: "
            }, "100");
            maxPointsEntry.AddChild(maxPoints, "*");

            var renderAlphaEntry = new HorizontalContainer();

            renderAlphaEntry.AddChild(new Label()
            {
                Text = "Render Alpha: "
            }, "100");
            renderAlphaEntry.AddChild(alpha, "*");

            var deviceWidthEntry = new HorizontalContainer();

            deviceWidthEntry.AddChild(new Label()
            {
                Text = "Device Width: "
            }, "100");
            deviceWidthEntry.AddChild(deviceWidth, "*");

            var deviceHeightEntry = new HorizontalContainer();

            deviceHeightEntry.AddChild(new Label()
            {
                Text = "Device Height: "
            }, "100");
            deviceHeightEntry.AddChild(deviceHeight, "*");

            var vert = new VerticalContainer();

            vert.AddChild(pointThresholdEntry, "24");
            vert.AddChild(minPointsEntry, "24");
            vert.AddChild(maxPointsEntry, "24");
            vert.AddChild(renderAlphaEntry, "24");
            vert.AddChild(nextColor, "24");
            vert.AddChild(showDiagnostics, "48");
            vert.AddChild(showBoard, "48");
            vert.AddChild(nextDevice, "48");
            vert.AddChild(deviceName, "24");
            vert.AddChild(deviceWidthEntry, "24");
            vert.AddChild(deviceHeightEntry, "24");
            vert.AddChild(_fullscreen, "48");
            vert.AddChild(camera640x480, "48");
            vert.AddChild(camera720p, "48");
            vert.AddChild(camera1080p, "48");

            var hor = new HorizontalContainer();

            hor.AddChild(new EmptyContainer(), "*");
            hor.AddChild(vert, "200");

            var canvas = new Canvas();

            canvas.SetChild(hor);

            canvasEntity.Canvas = canvas;

            var webcamEntity   = entityFactory.CreateWebcamEntity(deviceName, deviceWidth, deviceHeight);
            var detectorEntity = entityFactory.CreateDetectorEntity(webcamEntity);

            detectorEntity.X = 0;
            detectorEntity.Y = 0;
            var boardAnalyzerEntity = entityFactory.CreateBoardAnalyzerEntity(detectorEntity, pointThresholdTextBox, minPoints, maxPoints);
            var boardRendererEntity = entityFactory.CreateBoardRendererEntity(boardAnalyzerEntity, webcamEntity, alpha);

            nextColor.Click += (sender, args) =>
            {
                detectorEntity.NextColor();
            };
            showDiagnostics.Click += (sender, args) =>
            {
                alpha.Text = "0";
            };
            showBoard.Click += (sender, args) =>
            {
                alpha.Text = "1";
            };
            nextDevice.Click += (sender, args) =>
            {
                webcamEntity.NextDevice();
            };

            _hasSetupFullscreenButton = false;

            this.Entities.Add(webcamEntity);
            this.Entities.Add(detectorEntity);
            this.Entities.Add(boardAnalyzerEntity);
            this.Entities.Add(canvasEntity);
            this.Entities.Add(boardRendererEntity);
        }
예제 #11
0
        public override void Render(IRenderContext context, ISkinLayout skinLayout, ISkinDelegator skinDelegator, Rectangle layout)
        {
            if (_recentProjectsTask == null)
            {
                _recentProjectsTask = _coroutine.Run(() => _recentProjects.GetRecentProjects(context));
            }

            if (_recentProjectsTask.IsCompleted && !_hasAppliedRecentProjects)
            {
                foreach (var recentProject in _recentProjectsTask.Result)
                {
                    var horizontalContainer = new ClickableHorizontalContainer();
                    if (recentProject.Thumbnail != null)
                    {
                        var textureContainer = new RawTextureContainer(_renderUtilities);
                        textureContainer.Texture    = recentProject.Thumbnail;
                        textureContainer.TextureFit = "stretch";
                        horizontalContainer.AddChild(textureContainer, "60");
                    }
                    else
                    {
                        horizontalContainer.AddChild(new EmptyContainer(), "60");
                    }

                    var verticalContainer = new VerticalContainer();
                    verticalContainer.AddChild(new EmptyContainer(), "*");
                    verticalContainer.AddChild(new Label {
                        Text = recentProject.Name, HorizontalAlignment = HorizontalAlignment.Left
                    }, "16");
                    verticalContainer.AddChild(new EmptyContainer(), "*");
                    verticalContainer.AddChild(new Label {
                        Text = recentProject.Path, HorizontalAlignment = HorizontalAlignment.Left, TextColor = new Color(63, 63, 63, 255)
                    }, "16");
                    verticalContainer.AddChild(new EmptyContainer(), "*");

                    var button = new Button
                    {
                        Text = "Load",
                    };
                    button.Click += (sender, e) =>
                    {
                        _projectManager.LoadProject(recentProject.Path);
                    };
                    horizontalContainer.Click += (sender, e) =>
                    {
                        _projectManager.LoadProject(recentProject.Path);
                    };

                    horizontalContainer.AddChild(new EmptyContainer(), "16");
                    horizontalContainer.AddChild(verticalContainer, "*");
                    horizontalContainer.AddChild(new EmptyContainer(), "16");
                    horizontalContainer.AddChild(button, "60");

                    _recentProjectsContainer.AddChild(horizontalContainer, "60");
                    _recentProjectsContainer.AddChild(new EmptyContainer(), "10");
                }

                _hasAppliedRecentProjects = true;
            }

            base.Render(context, skinLayout, skinDelegator, layout);
        }
예제 #12
0
        public StartEditorWindow(
            IAssetManager assetManager,
            IProjectManager projectManager,
            IProjectManagerUi projectManagerUi,
            ICoroutine coroutine,
            IRecentProjects recentProjects,
            I2DRenderUtilities renderUtilities)
        {
            _assetManager    = assetManager;
            _projectManager  = projectManager;
            _coroutine       = coroutine;
            _recentProjects  = recentProjects;
            _renderUtilities = renderUtilities;

            Title = "Welcome!";
            Icon  = _assetManager.Get <TextureAsset>("texture.IconWelcome");

            var newProject = new Button
            {
                Text = "New Project"
            };
            var openProject = new Button
            {
                Text = "Open Project"
            };

            openProject.Click += (sender, e) =>
            {
                _coroutine.Run(() => projectManagerUi.LoadProject());
            };

            var buttonContainer = new HorizontalContainer();

            buttonContainer.AddChild(newProject, "*");
            buttonContainer.AddChild(new EmptyContainer(), "20");
            buttonContainer.AddChild(openProject, "*");

            _recentProjectsContainer = new VerticalContainer();
            //var scrollableContainer = new ScrollableContainer();
            //scrollableContainer.SetChild(_recentProjectsContainer);

            var verticalContainer = new VerticalContainer();

            verticalContainer.AddChild(new Label {
                Font = _assetManager.Get <FontAsset>("font.Welcome"),
                Text = "Welcome to Protogame!",
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment   = VerticalAlignment.Top
            }, "80");
            verticalContainer.AddChild(buttonContainer, "60");
            verticalContainer.AddChild(new EmptyContainer(), "24");
            verticalContainer.AddChild(_recentProjectsContainer, "*");

            var outerVertContainer = new VerticalContainer();

            outerVertContainer.AddChild(new EmptyContainer(), "15%");
            outerVertContainer.AddChild(verticalContainer, "*");
            outerVertContainer.AddChild(new EmptyContainer(), "15%");

            var outerHorContainer = new HorizontalContainer();

            outerHorContainer.AddChild(new EmptyContainer(), "15%");
            outerHorContainer.AddChild(outerVertContainer, "*");
            outerHorContainer.AddChild(new EmptyContainer(), "15%");

            SetChild(outerHorContainer);
        }
예제 #13
0
        public override void BuildLayout(SingleContainer editorContainer, IAssetManager assetManager)
        {
            this.m_FontNameTextBox = new TextBox {
                Text = this.m_Asset.FontName
            };
            this.m_FontNameTextBox.TextChanged += (sender, e) =>
            {
                this.m_Asset.FontName = this.m_FontNameTextBox.Text;

                this.StartCompilation(assetManager);
            };
            this.m_FontSizeTextBox = new TextBox {
                Text = this.m_Asset.FontSize.ToString()
            };
            this.m_FontSizeTextBox.TextChanged += (sender, e) =>
            {
                try
                {
                    this.m_Asset.FontSize = Convert.ToInt32(this.m_FontSizeTextBox.Text);

                    this.StartCompilation(assetManager);
                } catch (FormatException) { }
            };
            this.m_UseKerningTextBox = new TextBox {
                Text = this.m_Asset.UseKerning.ToString()
            };
            this.m_UseKerningTextBox.TextChanged += (sender, e) =>
            {
                try
                {
                    this.m_Asset.UseKerning = Convert.ToBoolean(this.m_UseKerningTextBox.Text);

                    this.StartCompilation(assetManager);
                } catch (FormatException) { }
            };
            this.m_SpacingTextBox = new TextBox {
                Text = this.m_Asset.Spacing.ToString()
            };
            this.m_SpacingTextBox.TextChanged += (sender, e) =>
            {
                try
                {
                    this.m_Asset.Spacing = Convert.ToInt32(this.m_SpacingTextBox.Text);

                    this.StartCompilation(assetManager);
                } catch (FormatException) { }
            };

            var form = new Form();

            form.AddControl("Font Name:", this.m_FontNameTextBox);
            form.AddControl("Font Size:", this.m_FontSizeTextBox);
            form.AddControl("Use Kerning (true/false):", this.m_UseKerningTextBox);
            form.AddControl("Spacing:", this.m_SpacingTextBox);

            this.m_StatusLabel      = new Label();
            this.m_StatusLabel.Text = "";

            var fontViewer = new FontViewer();

            fontViewer.Font = this.m_Asset;

            var vertContainer = new VerticalContainer();

            vertContainer.AddChild(form, "*");
            vertContainer.AddChild(this.m_StatusLabel, "20");
            vertContainer.AddChild(fontViewer, "200");

            editorContainer.SetChild(vertContainer);
        }