Exemplo n.º 1
0
        public CraftingTab(GameState gameState, List <Recipe> recipies = null) : base(gameState)
        {
            Icon         = new Sprite(Resources.TileIcons, new Point(4, 2));
            CraftingList = new WidgetList
            {
                Dock       = Dock.Fill,
                ItemHeight = 64,
            };

            var craftButton = new WidgetButton
            {
                Text = "Craft",
                Dock = Dock.Bottom,
            };

            craftButton.MouseClick += Craft;

            foreach (var recipe in recipies ?? RECIPIES.HandCrafted)
            {
                CraftingList.AddItem(new CraftingListItem(recipe,
                                                          GameState.LocalPlayer.Entity.GetComponent <ComponentInventory>().Content));
            }

            Content = new LayoutDock()
            {
                Padding  = new Spacing(16),
                Children =
                {
                    new WidgetLabel {
                        Text = "Crafting", Font = Resources.FontAlagard, Dock = Dock.Top
                    },
                    craftButton, CraftingList,
                }
            };
        }
Exemplo n.º 2
0
        public LoadingMenu(string title, Job job, GameState gameState) : base(gameState)
        {
            _job = job;

            PauseGame = true;

            _progressLabel = new WidgetLabel
            {
                Anchor     = Anchor.Center,
                Font       = Resources.FontRomulus,
                Origine    = Anchor.Center,
                Text       = "",
                UnitOffset = new Point(0, -16)
            };

            _progressBar = new WidgetProgress
            {
                Anchor     = Anchor.Center,
                Origine    = Anchor.Center,
                UnitBound  = new Rectangle(0, 0, 320 + 64, 8),
                UnitOffset = new Point(0, 16)
            };

            Content = new LayoutDock
            {
                Children =
                {
                    new WidgetLabel
                    {
                        Text       = title,
                        Anchor     = Anchor.Center,
                        Origine    = Anchor.Center,
                        UnitOffset = new Point(0),
                        Font       = Resources.FontAlagard,
                        TextSize   = 1f,
                    },
                    new WidgetFancyPanel
                    {
                        Anchor  = Anchor.Bottom,
                        Origine = Anchor.Bottom,
                        Content = new LayoutDock{
                            Children ={ _progressBar,                    _progressLabel }
                        },
                        Dock       = Rise.Platform.Family == Framework.Platform.PlatformFamily.Mobile ? Dock.Fill : Dock.None,
                        UnitBound  = new Rectangle(0, 0, 512, 96),
                        UnitOffset = new Point(0, -32)
                    }
                }
            };

            _job.Start(true);

            _job.Finish += (sender, e) =>
            {
                if (!_job.Canceled)
                {
                    gameState.CurrentMenu = new MenuInGame(gameState);
                }
            };
        }
        public override void Load()
        {
            var background = Rise.Rnd.Pick(Resources.ParalaxeForest, Resources.ParalaxeMontain);

            Rise.Scene.SetBackground(background);
            Rise.Sound.Play(Resources.Theme0);

            var title = new WidgetLabel
            {
                Text       = Game.Title,
                Anchor     = Anchor.Center,
                Origine    = Anchor.Center,
                UnitOffset = new Point(0),
                Font       = Resources.FontAlagard,
                TextSize   = 6f,
            };

            var subTitle = new WidgetLabel
            {
                Text       = Game.SubTitle,
                Anchor     = Anchor.Center,
                Origine    = Anchor.Center,
                UnitOffset = new Point(0, 72),
                Font       = Resources.FontRomulus,
                TextColor  = ColorPalette.Accent,
                TextSize   = 1f,
            };

            var prompt = new WidgetButton("> Press any key <")
            {
                Anchor     = Anchor.Center,
                Origine    = Anchor.Center,
                UnitOffset = new Point(0, 256),
                Font       = Resources.FontRomulus,
            }.RegisterMouseClickEvent(Game.GoToMainMenu);

            var version = new WidgetLabel
            {
                Text           = $"{Game.Title} {Game.Version}",
                Anchor         = Anchor.BottomRight,
                Origine        = Anchor.BottomRight,
                UnitOffset     = new Point(-16, 0),
                Font           = Resources.FontHack,
                TextAlignement = TextAlignement.Right,
                TextColor      = Color.White * 0.5f,
                TextSize       = 1f,
            };

            Container = new LayoutDock()
            {
                Children =
                {
                    title, subTitle, prompt, version
                }
            };
        }
Exemplo n.º 4
0
        public override void Load()
        {
            _progressLabel = new WidgetLabel
            {
                Anchor     = Anchor.Center,
                Font       = Resources.FontRomulus,
                Origine    = Anchor.Center,
                Text       = "Loading...",
                UnitOffset = new Point(0, -24)
            };

            _progressBar = new WidgetProgress
            {
                Anchor     = Anchor.Center,
                Origine    = Anchor.Center,
                UnitBound  = new Rectangle(0, 0, 320, 8),
                UnitOffset = new Point(0, 24)
            };

            var _cancelButton = new WidgetSprite()
            {
                Anchor     = Anchor.TopRight,
                Origine    = Anchor.Center,
                Sprite     = new Sprite(Resources.TileGui, new Point(7, 7)),
                UnitBound  = new Rectangle(0, 0, 48, 48),
                UnitOffset = new Point(-48, 48)
            }.RegisterMouseClickEvent((sender) =>
            {
                _job.Cancel();
                Game.GoToMainMenu();
            });

            Container = new LayoutDock
            {
                Padding  = new Spacing(16),
                Children =
                {
                    new WidgetFancyPanel
                    {
                        Anchor  = Anchor.Center,
                        Content = new LayoutDock{
                            Children ={ _progressBar,                    _progressLabel, _cancelButton }
                        },
                        Dock      = Rise.Platform.Family == Framework.Platform.PlatformFamily.Mobile ? Dock.Fill : Dock.None,
                        Origine   = Anchor.Center,
                        UnitBound = new Rectangle(0, 0, 840, 256),
                    }
                }
            };

            _job.Start(true);
        }
Exemplo n.º 5
0
        public SaveTab(GameState gameState)
        {
            Icon = new Sprite(Resources.TileIcons, new Point(3, 2));

            var container = new LayoutFlow
            {
                Dock    = Dock.Fill,
                Flow    = LayoutFlowDirection.TopToBottom,
                Marging = 8,
            };

            Content = new LayoutDock()
            {
                Padding  = new Spacing(16),
                Children =
                {
                    new WidgetLabel {
                        Text = "Save", Font = Resources.FontAlagard, Dock = Dock.Top
                    },
                    container
                }
            };

            container.AddChild(
                new WidgetButton
            {
                Text    = "Quick save",
                Padding = new Spacing(4)
            }
                .RegisterMouseClickEvent(gameState.QuickSave)
                );

            container.AddChild(
                new WidgetButton
            {
                Text    = "Save and Exit",
                Padding = new Spacing(4)
            }
                .RegisterMouseClickEvent(gameState.SaveAndExit)
                );

            container.AddChild(
                new WidgetButton
            {
                Text    = "Exit",
                Padding = new Spacing(4)
            }
                .RegisterMouseClickEvent(Game.GoToMainMenu)
                );
        }
Exemplo n.º 6
0
        public MenuPlayerRespawn(GameState gameState) : base(gameState)
        {
            PauseGame = true;

            Content = new LayoutDock
            {
                Children =
                {
                    new WidgetFancyPanel
                    {
                        UnitBound = new Rectangle(0, 0, 840, 420),
                        Padding   = new Spacing(16),
                        Anchor    = Anchor.Center,
                        Origine   = Anchor.Center,
                        Dock      = Rise.Platform.Family == PlatformFamily.Mobile ? Dock.Fill : Dock.None,

                        Content = new LayoutDock
                        {
                            Children =
                            {
                                new WidgetLabel()
                                {
                                    Text   = "You died!", Font = Resources.FontAlagard, TextSize = 2f,
                                    Anchor = Anchor.Center, Origine = Anchor.Center
                                },

                                new WidgetButton("Respawn")
                                {
                                    UnitOffset = new Point(-16, 0), Anchor = Anchor.Bottom,
                                    Origine    = Anchor.BottomRight
                                }
                                .RegisterMouseClickEvent((sender) =>
                                {
                                    gameState.CurrentMenu = new MenuInGame(gameState);
                                    gameState.LocalPlayer.Respawn();
                                }),

                                new WidgetButton("Exit")
                                {
                                    UnitOffset = new Point(16, 0), Anchor = Anchor.Bottom,
                                    Origine    = Anchor.BottomLeft
                                }
                                .RegisterMouseClickEvent(gameState.SaveAndExit),
                            }
                        }
                    }
                }
            };
        }
Exemplo n.º 7
0
        public TabOption()
        {
            Icon = new Sprite(Resources.TileIcons, new Point(2, 4));

            Content = new LayoutDock
            {
                Padding  = new Spacing(16),
                Children =
                {
                    new WidgetButton {
                        Text = "Exit", Dock = Dock.Bottom
                    }
                    .RegisterMouseClickEvent((sender) => Rise.Platform.Stop())
                },
            };
        }
Exemplo n.º 8
0
 public EquipmentTab()
 {
     Icon    = new Sprite(Resources.TileIcons, new Point(4, 4));
     Content = new LayoutDock()
     {
         Padding  = new Spacing(16),
         Children =
         {
             new WidgetLabel
             {
                 Text = "Equipment",
                 Font = Resources.FontAlagard,
                 Dock = Dock.Top
             },
         }
     };
 }
Exemplo n.º 9
0
        public TabLoadWorld()
        {
            Icon = new Sprite(Resources.TileIcons, new Point(2, 2));

            var title = new WidgetLabel
            {
                Text = "Load World",
                Font = Resources.FontAlagard,
                Dock = Dock.Top
            };

            var saveList = new WidgetList()
            {
                Dock = Dock.Fill
            };

            var loadButton = new WidgetButton
            {
                Text = "Load",
                Dock = Dock.Bottom
            }
            .RegisterMouseClickEvent((sender) =>
            {
                if (saveList.SelectedItem != null)
                {
                    var item = (ListItemWorld)saveList.SelectedItem;
                    Game.Play(item.WorldPath);
                }
            });

            Content = new LayoutDock();
            Content.AddChildren(title, loadButton, saveList);
            Content.Padding = new Spacing(16);

            var s = Directory.GetDirectories(Game.SavesFolder);

            foreach (var save in s)
            {
                saveList.AddItem(new ListItemWorld(Path.GetFileName(save), save));
            }
        }
Exemplo n.º 10
0
        public MinimapTab(GameState gameState) : base(gameState)
        {
            Icon = new Sprite(Resources.TileIcons, new Point(5, 4));

            var title = new WidgetLabel
            {
                Text = "Maps",
                Font = Resources.FontAlagard,
                Dock = Dock.Top
            };

            var minimap = new WidgetMinimap(gameState)
            {
                Dock = Dock.Fill
            };

            Content = new LayoutDock
            {
                Padding  = new Spacing(16),
                Children = { title, minimap }
            };
        }
Exemplo n.º 11
0
        public (DockBase root, ILayoutDock centerPane, IDocumentDock documentDock) CreatePerspectiveLayout(string identifier)
        {
            var debugLayout = new LayoutDock
            {
                Id          = $"{identifier}Layout",
                Proportion  = double.NaN,
                Orientation = Orientation.Vertical,
                Title       = $"{identifier}Layout",
                CurrentView = null,
                Views       = new ObservableCollection <IView>
                {
                    _centerPane
                }
            };

            var container = new LayoutDock
            {
                Id          = $"{identifier}Container",
                Proportion  = double.NaN,
                Orientation = Orientation.Horizontal,
                Title       = $"{identifier}Container",
                CurrentView = null,
                Views       = new ObservableCollection <IView>
                {
                    debugLayout
                }
            };

            return(new MainView
            {
                Id = identifier,
                Title = identifier,
                CurrentView = container,
                Views = new ObservableCollection <IView>
                {
                    container
                }
            }, debugLayout, _documentDock);
        }
Exemplo n.º 12
0
        public MenuInGame(GameState gameState) : base(gameState)
        {
            var btnMinimap = new WidgetSprite
            {
                Anchor     = Anchor.TopRight,
                Origine    = Anchor.TopRight,
                Sprite     = new Sprite(Resources.TileIcons, new Point(5, 4)),
                UnitOffset = new Point(-16, 16),
            };

            var playerStats = new WidgetPlayerStats(GameState.LocalPlayer.Entity)
            {
                Dock      = Dock.Top,
                UnitBound = new Rectangle(0, 0, 320, 64),
            };

            var minimapPanel = new WidgetFancyPanel()
            {
                Enabled    = false,
                Anchor     = Anchor.TopRight,
                Origine    = Anchor.TopRight,
                UnitBound  = new Rectangle(0, 0, 320, 320),
                UnitOffset = new Point(-16, 16),
                Padding    = new Spacing(0),
                Content    = new WidgetMinimap(gameState),
            };

            var hotBar = new WidgetHotBar(GameState.LocalPlayer.Entity.GetComponent <ComponentInventory>().Content)
            {
                Dock       = Dock.Bottom,
                UnitOffset = new Point(0, -16)
            };

            Content = new LayoutDock
            {
                Children =
                {
                    playerStats, minimapPanel, btnMinimap, hotBar,

                    new WidgetButton
                    {
                        Text       = "Inventory",
                        Origine    = Anchor.BottomLeft,
                        Anchor     = Anchor.BottomLeft,
                        UnitOffset = new Point(16, -16)
                    }
                    .RegisterMouseClickEvent(
                        (sender) => { GameState.CurrentMenu = new MenuGamePaused(GameState); })
                },
                Padding = new Spacing(16)
            };

            btnMinimap.MouseClick += (sender) =>
            {
                minimapPanel.Toggle();
                minimapPanel.RefreshLayout();
                sender.Disable();
            };
            minimapPanel.MouseClick += (sender) =>
            {
                sender.Toggle();
                btnMinimap.Enable();
            };
        }
Exemplo n.º 13
0
        /// <inheritdoc/>
        public override IDock CreateLayout()
        {
            // Documents

            var pageDocument = new PageDocument
            {
                Id    = nameof(PageDocument),
                Title = "Page"
            };

            // Tools

            var projectTool = new ProjectTool
            {
                Id    = nameof(ProjectTool),
                Title = "Project"
            };

            var optionsTool = new OptionsTool
            {
                Id    = nameof(OptionsTool),
                Title = "Options"
            };

            var imagesTool = new ImagesTool
            {
                Id    = nameof(ImagesTool),
                Title = "Images"
            };

            var groupsTool = new GroupsTool
            {
                Id    = nameof(GroupsTool),
                Title = "Groups"
            };

            var databasesTool = new DatabasesTool
            {
                Id    = nameof(DatabasesTool),
                Title = "Databases"
            };

            var scriptTool = new ScriptTool
            {
                Id    = nameof(ScriptTool),
                Title = "Script"
            };

            var browserTool = new BrowserTool
            {
                Id    = nameof(BrowserTool),
                Title = "Browser"
            };

            var stylesTool = new StylesTool
            {
                Id    = nameof(StylesTool),
                Title = "Styles"
            };

            var templatesTool = new TemplatesTool
            {
                Id    = nameof(TemplatesTool),
                Title = "Templates"
            };

            var containerTool = new ContainerTool
            {
                Id    = nameof(ContainerTool),
                Title = "Container"
            };

            var zoomTool = new ZoomTool
            {
                Id    = nameof(ZoomTool),
                Title = "Zoom"
            };

            var shapeTool = new ShapeTool
            {
                Id    = nameof(ShapeTool),
                Title = "Shape"
            };

            var toolsTool = new ToolsTool
            {
                Id    = nameof(ToolsTool),
                Title = "Tools"
            };

            var dataTool = new DataTool
            {
                Id    = nameof(DataTool),
                Title = "Data"
            };

            var styleTool = new StyleTool
            {
                Id    = nameof(StyleTool),
                Title = "Style"
            };

            var templateTool = new TemplateTool
            {
                Id    = nameof(TemplateTool),
                Title = "Template"
            };

            // Panes

            var leftPane = new LayoutDock
            {
                Id          = nameof(ILayoutDock),
                Title       = "EditorLeft",
                Orientation = Orientation.Vertical,
                Proportion  = 0.17,
                CurrentView = null,
                Views       = new ObservableCollection <IView>
                {
                    new ToolDock
                    {
                        Id          = nameof(IToolDock),
                        Title       = "EditorLeftTop",
                        Proportion  = double.NaN,
                        CurrentView = projectTool,
                        Views       = new ObservableCollection <IView>
                        {
                            projectTool,
                            optionsTool,
                            imagesTool
                        }
                    },
                    new SplitterDock()
                    {
                        Id    = nameof(ISplitterDock),
                        Title = "LeftTopSplitter"
                    },
                    new ToolDock
                    {
                        Id          = nameof(IToolDock),
                        Title       = "EditorLeftBottom",
                        Proportion  = double.NaN,
                        CurrentView = groupsTool,
                        Views       = new ObservableCollection <IView>
                        {
                            groupsTool,
                            databasesTool,
                            scriptTool,
                            browserTool
                        }
                    }
                }
            };

            var rightPane = new LayoutDock
            {
                Id          = nameof(ILayoutDock),
                Title       = "EditorRight",
                Orientation = Orientation.Vertical,
                Proportion  = 0.17,
                CurrentView = null,
                Views       = new ObservableCollection <IView>
                {
                    new ToolDock
                    {
                        Id          = nameof(IToolDock),
                        Title       = "EditorRightTop",
                        Proportion  = double.NaN,
                        CurrentView = stylesTool,
                        Views       = new ObservableCollection <IView>
                        {
                            stylesTool,
                            templatesTool,
                            containerTool,
                            zoomTool
                        }
                    },
                    new SplitterDock()
                    {
                        Id    = nameof(ISplitterDock),
                        Title = "RightTopSplitter"
                    },
                    new ToolDock
                    {
                        Id          = nameof(IToolDock),
                        Title       = "EditorRightBottom",
                        Proportion  = double.NaN,
                        CurrentView = shapeTool,
                        Views       = new ObservableCollection <IView>
                        {
                            shapeTool,
                            toolsTool,
                            dataTool,
                            styleTool,
                            templateTool
                        }
                    }
                }
            };

            var documentsPane = new DocumentDock
            {
                Id          = nameof(IDocumentDock),
                Title       = "DocumentsPane",
                Proportion  = double.NaN,
                CurrentView = pageDocument,
                Views       = new ObservableCollection <IView>
                {
                    pageDocument
                }
            };

            // Editor

            var editorLayout = new LayoutDock
            {
                Id          = nameof(ILayoutDock),
                Title       = "EditorLayout",
                Orientation = Orientation.Horizontal,
                Proportion  = double.NaN,
                CurrentView = null,
                Views       = new ObservableCollection <IView>
                {
                    leftPane,
                    new SplitterDock()
                    {
                        Id    = nameof(ISplitterDock),
                        Title = "LeftSplitter"
                    },
                    documentsPane,
                    new SplitterDock()
                    {
                        Id    = nameof(ISplitterDock),
                        Title = "RightSplitter"
                    },
                    rightPane
                }
            };

            // Views

            var editorView = new EditorView
            {
                Id          = nameof(EditorView),
                Title       = "Editor",
                CurrentView = editorLayout,
                Views       = new ObservableCollection <IView>
                {
                    editorLayout
                }
            };

            var aboutView = new AboutView
            {
                Id    = nameof(AboutView),
                Title = "About"
            };

            var browserView = new BrowserView
            {
                Id    = nameof(BrowserView),
                Title = "Browser"
            };

            var scriptView = new ScriptView
            {
                Id    = nameof(ScriptView),
                Title = "Script"
            };

            var documentView = new DocumentView
            {
                Id    = nameof(DocumentView),
                Title = "Document"
            };

            var dashboardView = new DashboardView
            {
                Id    = nameof(DashboardView),
                Title = "Dashboard"
            };

            // Root

            var layout = new RootDock
            {
                Id          = nameof(IRootDock),
                Title       = "Root",
                CurrentView = dashboardView,
                DefaultView = dashboardView,
                Views       = new ObservableCollection <IView>
                {
                    dashboardView,
                    editorView,
                    aboutView,
                    browserView,
                    scriptView,
                    documentView
                }
            };

            return(layout);
        }
Exemplo n.º 14
0
        public override IDock CreateLayout()
        {
            //var elementTreeDocument = new ElementTreeDocument
            //{
            //	Id    = "ElementTreeDocument",
            //	Title = "ElementTreeDocument"
            //};

            var elementTreeTool = new ElementTreeTool
            {
                Id    = "ElementTreeTool",
                Title = "ElementTreeTool"
            };

            var leftPaneTop = new ToolDock()
            {
                Id          = "LeftPaneTop",
                Title       = "LeftPaneTop",
                Proportion  = double.NaN,
                CurrentView = elementTreeTool,
                Views       = CreateList <IView>(elementTreeTool)
            };
            var leftPane = new LayoutDock()
            {
                Id          = "LeftPane",
                Title       = "LeftPane",
                Proportion  = double.NaN,
                Orientation = Orientation.Vertical,
                CurrentView = null,
                Views       = CreateList <IView>(leftPaneTop)
            };
            var leftSplitter = new SplitterDock()
            {
                Id    = "LeftSplitter",
                Title = "LeftSplitter"
            };
            var documentsPane = new DocumentDock()
            {
                Id          = "DocumentsPane",
                Title       = "DocumentsPane",
                Proportion  = double.NaN,
                CurrentView = null,
                Views       = CreateList <IView>()
                              //CurrentView = elementTreeDocument,
                              //Views = CreateList<IView>(elementTreeDocument)
            };
            var mainLayout = new LayoutDock
            {
                Id          = "MainLayout",
                Title       = "MainLayout",
                Proportion  = double.NaN,
                Orientation = Orientation.Horizontal,
                CurrentView = null,
                Views       = CreateList <IView>(leftPane, leftSplitter, documentsPane)
            };

            var mainView = new MainView
            {
                Id          = "Main",
                Title       = "Main",
                CurrentView = mainLayout,
                Views       = CreateList <IView>(mainLayout)
            };


            var root = CreateRootDock();

            root.Id             = "Root";
            root.Title          = "Root";
            root.CurrentView    = mainView;
            root.DefaultView    = mainView;
            root.Views          = CreateList <IView>(mainView);
            root.Left           = CreatePinDock();
            root.Left.Alignment = Alignment.Left;

            AddAllViews(root, mainView, mainLayout, documentsPane, leftSplitter, leftPane, leftPaneTop, elementTreeTool);

            return(root);
        }
Exemplo n.º 15
0
        public TabNewWorld()
        {
            Icon = new Sprite(Resources.TileIcons, new Point(1, 2));

            var worldNameTextBox = new WidgetTextBox()
            {
                Padding = new Spacing(8),
                Text    = "new world"
            };

            var worldSeedtextBox = new WidgetTextBox()
            {
                Padding = new Spacing(8),
                Text    = Rise.Rnd.Next().ToString()
            };

            var worldTypeList = new WidgetList()
            {
                UnitBound = new Rectangle(0, 0, 256, 128)
            };

            foreach (var item in GENERATOR.GENERATORS)
            {
                worldTypeList.AddItem(new ListItemText(item.Key));
            }

            worldTypeList.SelectFirst();

            var generateButton = new WidgetButton {
                Text = "Generate", Dock = Dock.Bottom
            }
            .RegisterMouseClickEvent((s) => Game.New(worldNameTextBox.Text, worldSeedtextBox.Text,
                                                     GENERATOR.GENERATORS[((ListItemText)worldTypeList.SelectedItem).Text]));

            var worldOptions = new LayoutFlow
            {
                Flow     = LayoutFlowDirection.TopToBottom,
                Dock     = Dock.Fill,
                Children =
                {
                    new WidgetLabel
                    {
                        Text = "World name:", Padding = new Spacing(8), TextAlignement = TextAlignement.Left
                    },
                    worldNameTextBox,
                    new WidgetLabel {
                        Text = "Seed:", Padding = new Spacing(8), TextAlignement = TextAlignement.Left
                    },
                    worldSeedtextBox,
                    new WidgetLabel
                    {
                        Text = "World type:", Padding = new Spacing(8), TextAlignement = TextAlignement.Left
                    },
                    worldTypeList
                }
            };

            Content = new LayoutDock()
            {
                Padding  = new Spacing(16),
                Children =
                {
                    new WidgetLabel {
                        Text = "New World", Font = Resources.FontAlagard, Dock = Dock.Top
                    },
                    generateButton,
                    worldOptions,
                }
            };
        }
Exemplo n.º 16
0
        public override IDock CreateLayout()
        {
            var document1 = new Document1
            {
                Id    = "Document1",
                Title = "Document1"
            };

            var document2 = new Document2
            {
                Id    = "Document2",
                Title = "Document2"
            };

            var document3 = new Document3
            {
                Id    = "Document3",
                Title = "Document3"
            };

            var leftTopTool1 = new LeftTopTool1
            {
                Id    = "LeftTop1",
                Title = "LeftTop1"
            };

            var leftTopTool2 = new LeftTopTool2
            {
                Id    = "LeftTop2",
                Title = "LeftTop2"
            };

            var leftTopTool3 = new LeftTopTool3
            {
                Id    = "LeftTop3",
                Title = "LeftTop3"
            };

            var leftBottomTool1 = new LeftBottomTool1
            {
                Id    = "LeftBottom1",
                Title = "LeftBottom1"
            };

            var leftBottomTool2 = new LeftBottomTool2
            {
                Id    = "LeftBottom2",
                Title = "LeftBottom2"
            };

            var leftBottomTool3 = new LeftBottomTool3
            {
                Id    = "LeftBottom3",
                Title = "LeftBottom3"
            };

            var rightTopTool1 = new RightTopTool1
            {
                Id    = "RightTop1",
                Title = "RightTop1"
            };

            var rightTopTool2 = new RightTopTool2
            {
                Id    = "RightTop2",
                Title = "RightTop2"
            };

            var rightTopTool3 = new RightTopTool3
            {
                Id    = "RightTop3",
                Title = "RightTop3"
            };

            var rightBottomTool1 = new RightBottomTool1
            {
                Id    = "RightBottom1",
                Title = "RightBottom1"
            };

            var rightBottomTool2 = new RightBottomTool2
            {
                Id    = "RightBottom2",
                Title = "RightBottom2"
            };

            var rightBottomTool3 = new RightBottomTool3
            {
                Id    = "RightBottom3",
                Title = "RightBottom3"
            };

            var mainLayout = new LayoutDock
            {
                Id          = "MainLayout",
                Title       = "MainLayout",
                Proportion  = double.NaN,
                Orientation = Orientation.Horizontal,
                CurrentView = null,
                Views       = CreateList <IView>
                              (
                    new LayoutDock
                {
                    Id          = "LeftPane",
                    Title       = "LeftPane",
                    Proportion  = double.NaN,
                    Orientation = Orientation.Vertical,
                    CurrentView = null,
                    Views       = CreateList <IView>
                                  (
                        new ToolDock
                    {
                        Id          = "LeftPaneTop",
                        Title       = "LeftPaneTop",
                        Proportion  = double.NaN,
                        CurrentView = leftTopTool1,
                        Views       = CreateList <IView>
                                      (
                            leftTopTool1,
                            leftTopTool2,
                            leftTopTool3
                                      )
                    },
                        new SplitterDock()
                    {
                        Id    = "LeftPaneTopSplitter",
                        Title = "LeftPaneTopSplitter"
                    },
                        new ToolDock
                    {
                        Id          = "LeftPaneBottom",
                        Title       = "LeftPaneBottom",
                        Proportion  = double.NaN,
                        CurrentView = leftBottomTool1,
                        Views       = CreateList <IView>
                                      (
                            leftBottomTool1,
                            leftBottomTool2,
                            leftBottomTool3
                                      )
                    }
                                  )
                },
                    new SplitterDock()
                {
                    Id    = "LeftSplitter",
                    Title = "LeftSplitter"
                },
                    new DocumentDock
                {
                    Id          = "DocumentsPane",
                    Title       = "DocumentsPane",
                    Proportion  = double.NaN,
                    CurrentView = document1,
                    Views       = CreateList <IView>
                                  (
                        document1,
                        document2,
                        document3
                                  )
                },
                    new SplitterDock()
                {
                    Id    = "RightSplitter",
                    Title = "RightSplitter"
                },
                    new LayoutDock
                {
                    Id          = "RightPane",
                    Title       = "RightPane",
                    Proportion  = double.NaN,
                    Orientation = Orientation.Vertical,
                    CurrentView = null,
                    Views       = CreateList <IView>
                                  (
                        new ToolDock
                    {
                        Id          = "RightPaneTop",
                        Title       = "RightPaneTop",
                        Proportion  = double.NaN,
                        CurrentView = rightTopTool1,
                        Views       = CreateList <IView>
                                      (
                            rightTopTool1,
                            rightTopTool2,
                            rightTopTool3
                                      )
                    },
                        new SplitterDock()
                    {
                        Id    = "RightPaneTopSplitter",
                        Title = "RightPaneTopSplitter"
                    },
                        new ToolDock
                    {
                        Id          = "RightPaneBottom",
                        Title       = "RightPaneBottom",
                        Proportion  = double.NaN,
                        CurrentView = rightBottomTool1,
                        Views       = CreateList <IView>
                                      (
                            rightBottomTool1,
                            rightBottomTool2,
                            rightBottomTool3
                                      )
                    }
                                  )
                }
                              )
            };

            var mainView = new MainView
            {
                Id          = "Main",
                Title       = "Main",
                CurrentView = mainLayout,
                Views       = CreateList <IView>(mainLayout)
            };

            var homeView = new HomeView
            {
                Id    = "Home",
                Title = "Home"
            };

            var root = CreateRootDock();

            root.Id               = "Root";
            root.Title            = "Root";
            root.CurrentView      = homeView;
            root.DefaultView      = homeView;
            root.Views            = CreateList <IView>(homeView, mainView);
            root.Top              = CreatePinDock();
            root.Top.Alignment    = Alignment.Top;
            root.Bottom           = CreatePinDock();
            root.Bottom.Alignment = Alignment.Bottom;
            root.Left             = CreatePinDock();
            root.Left.Alignment   = Alignment.Left;
            root.Right            = CreatePinDock();
            root.Right.Alignment  = Alignment.Right;

            return(root);
        }
Exemplo n.º 17
0
        public override void Load()
        {
            Rise.Sound.Play(Resources.Theme0);

            var title = new WidgetLabel
            {
                Text       = Game.Title,
                Anchor     = Anchor.Center,
                Origine    = Anchor.Center,
                UnitOffset = new Point(0, -72),
                Font       = Resources.FontAlagard,
                TextSize   = 3f,
            };

            var subTitle = new WidgetLabel
            {
                Text       = Game.SubTitle,
                Anchor     = Anchor.Center,
                Origine    = Anchor.Center,
                UnitOffset = new Point(0, -16),
                Font       = Resources.FontRomulus,
                TextColor  = ColorPalette.Accent,
                TextSize   = 1f,
            };

            var copyright = new WidgetLabel
            {
                Text     = "© 2017-2021 SMNX",
                Anchor   = Anchor.Bottom,
                Origine  = Anchor.Bottom,
                Font     = Resources.FontRomulus,
                TextSize = 1f
            };

            var continueButton = new WidgetButton
            {
                Enabled    = Game.GetLastGame() != null,
                Text       = "Continue",
                Anchor     = Anchor.Center,
                Origine    = Anchor.Center,
                UnitOffset = new Point(0, 72),
                UnitBound  = new Rectangle(0, 0, 256, 64),
            }
            .RegisterMouseClickEvent((sender) => Game.Play(Game.GetLastGame()));

            var version = new WidgetLabel
            {
                Text           = $"{Game.Title} {Game.Version}",
                Anchor         = Anchor.BottomRight,
                Origine        = Anchor.BottomRight,
                UnitOffset     = new Point(-16, 0),
                Font           = Resources.FontHack,
                TextAlignement = TextAlignement.Right,
                TextColor      = Color.White * 0.5f,
                TextSize       = 1f,
            };

            var homeTab = new Tab
            {
                Icon    = new Sprite(Resources.TileIcons, new Point(0, 4)),
                Content = new LayoutDock()
                {
                    Children =
                    {
                        title, subTitle, copyright, continueButton
                    }
                }
            };

            var menu = new WidgetTabContainer
            {
                Anchor     = Anchor.Center,
                Origine    = Anchor.Center,
                UnitBound  = new Rectangle(0, 0, 600, 720),
                TabAnchore = Rise.Platform.Family == PlatformFamily.Mobile ? TabAnchore.Bottom : TabAnchore.Left,
                Tabs       =
                {
                    homeTab,
                    new TabNewWorld(),
                    new TabLoadWorld(),
                    new TabOption(),
                }
            };

            Container = new LayoutDock().AddChildren(menu, version);
        }
Exemplo n.º 18
0
        public void InitializeComponents()
        {
            PauseGame     = true;
            EscapeToClose = true;

            var r = new List <List <Recipe> >();

            foreach (var e in GameState.LocalPlayer.Entity.Level.QueryEntity(GameState.LocalPlayer.Entity.Position,
                                                                             Game.Unit * 3))
            {
                var s = e.GetComponent <ComponentCraftingStation>();
                if (s != null)
                {
                    if (!r.Contains(s.Recipes))
                    {
                        r.Add(s.Recipes);
                    }
                }
            }

            var recipies = new List <Recipe>();

            recipies.AddRange(RECIPIES.HandCrafted);
            foreach (var i in r)
            {
                recipies.AddRange(i);
            }

            _inventory = new WidgetItemContainer(GameState.LocalPlayer.Entity.GetComponent <ComponentInventory>().Content);
            _crafting  = new CraftingTab(GameState, recipies);

            _inventory.Dock = Dock.Fill;

            _inventory.MouseClick += (sender) =>
            {
                _inventory.HighlightedItem = _inventory.SelectedItem;
                GameState.LocalPlayer.Entity.HoldItem(_inventory.SelectedItem);
            };

            var closeBtn = new WidgetSprite()
            {
                Sprite     = new Sprite(Resources.TileGui, new Point(7, 7)),
                UnitBound  = new Rectangle(0, 0, 48, 48),
                Anchor     = Anchor.TopRight,
                Origine    = Anchor.TopRight,
                UnitOffset = new Point(-24, 24)
            };

            closeBtn.MouseClick += CloseBtnOnMouseClick;

            var _sideMenu = new WidgetTabContainer
            {
                Anchor     = Anchor.Center,
                Origine    = Anchor.Center,
                UnitBound  = new Rectangle(0, 0, 600, 720),
                Dock       = Rise.Platform.Family == PlatformFamily.Mobile ? Dock.Fill : Dock.None,
                TabAnchore = Rise.Platform.Family == PlatformFamily.Mobile ? TabAnchore.Bottom : TabAnchore.Left,

                Tabs =
                {
                    new EquipmentTab(),
                    _crafting,
                    new Tab()
                    {
                        Icon    = new Sprite(Resources.TileIcons, new Point(2,        3)),
                        Content = new LayoutDock()
                        {
                            Padding  = new Spacing(16),
                            Children =
                            {
                                new WidgetLabel {
                                    Text = "Inventory",Font = Resources.FontAlagard,           Dock = Dock.Top
                                },
                                _inventory,
                            }
                        }
                    },
                    new MinimapTab(GameState),
                    new SaveTab(GameState),
                }
            };

            Content = new LayoutDock()
            {
                Children = { _sideMenu },
            };
        }
Exemplo n.º 19
0
        /// <inheritdoc/>
        public override IDock CreateLayout()
        {
            // Documents

            var document1 = new Document1
            {
                Id     = "Document1",
                Width  = double.NaN,
                Height = double.NaN,
                Title  = "Document1"
            };

            var document2 = new Document2
            {
                Id     = "Document2",
                Width  = double.NaN,
                Height = double.NaN,
                Title  = "Document2"
            };

            var document3 = new Document3
            {
                Id     = "Document3",
                Width  = double.NaN,
                Height = double.NaN,
                Title  = "Document3"
            };

            // Left / Top

            var leftTopTool1 = new LeftTopTool1
            {
                Id     = "LeftTop1",
                Width  = double.NaN,
                Height = double.NaN,
                Title  = "LeftTop1"
            };

            var leftTopTool2 = new LeftTopTool2
            {
                Id     = "LeftTop2",
                Width  = 200,
                Height = 200,
                Title  = "LeftTop2"
            };

            var leftTopTool3 = new LeftTopTool3
            {
                Id     = "LeftTop3",
                Width  = double.NaN,
                Height = double.NaN,
                Title  = "LeftTop3"
            };

            // Left / Bottom

            var leftBottomTool1 = new LeftBottomTool1
            {
                Id     = "LeftBottom1",
                Width  = double.NaN,
                Height = double.NaN,
                Title  = "LeftBottom1"
            };

            var leftBottomTool2 = new LeftBottomTool2
            {
                Id     = "LeftBottom2",
                Width  = double.NaN,
                Height = double.NaN,
                Title  = "LeftBottom2"
            };

            var leftBottomTool3 = new LeftBottomTool3
            {
                Id     = "LeftBottom3",
                Width  = double.NaN,
                Height = double.NaN,
                Title  = "LeftBottom3"
            };

            // Right / Top

            var rightTopTool1 = new RightTopTool1
            {
                Id     = "RightTop1",
                Width  = double.NaN,
                Height = double.NaN,
                Title  = "RightTop1"
            };

            var rightTopTool2 = new RightTopTool2
            {
                Id     = "RightTop2",
                Width  = double.NaN,
                Height = double.NaN,
                Title  = "RightTop2"
            };

            var rightTopTool3 = new RightTopTool3
            {
                Id     = "RightTop3",
                Width  = double.NaN,
                Height = double.NaN,
                Title  = "RightTop3"
            };

            // Right / Bottom

            var rightBottomTool1 = new RightBottomTool1
            {
                Id     = "RightBottom1",
                Width  = double.NaN,
                Height = double.NaN,
                Title  = "RightBottom1"
            };

            var rightBottomTool2 = new RightBottomTool2
            {
                Id     = "RightBottom2",
                Width  = double.NaN,
                Height = double.NaN,
                Title  = "RightBottom2"
            };

            var rightBottomTool3 = new RightBottomTool3
            {
                Id     = "RightBottom3",
                Width  = double.NaN,
                Height = double.NaN,
                Title  = "RightBottom3"
            };

            // Left Pane

            var leftPane = new LayoutDock
            {
                Id          = "LeftPane",
                Dock        = "Left",
                Width       = 200,
                Height      = double.NaN,
                Title       = "LeftPane",
                CurrentView = null,
                Views       = CreateList <IView>
                              (
                    new ToolDock
                {
                    Id          = "LeftPaneTop",
                    Dock        = "Top",
                    Width       = double.NaN,
                    Height      = 340,
                    Title       = "LeftPaneTop",
                    CurrentView = leftTopTool1,
                    Views       = CreateList <IView>
                                  (
                        leftTopTool1,
                        leftTopTool2,
                        leftTopTool3
                                  )
                },
                    new SplitterDock()
                {
                    Id    = "LeftPaneTopSplitter",
                    Dock  = "Top",
                    Title = "LeftPaneTopSplitter"
                },
                    new ToolDock
                {
                    Id          = "LeftPaneBottom",
                    Dock        = "Bottom",
                    Width       = double.NaN,
                    Height      = double.NaN,
                    Title       = "LeftPaneBottom",
                    CurrentView = leftBottomTool1,
                    Views       = CreateList <IView>
                                  (
                        leftBottomTool1,
                        leftBottomTool2,
                        leftBottomTool3
                                  )
                }
                              )
            };

            // Right Pane

            var rightPane = new LayoutDock
            {
                Id          = "RightPane",
                Dock        = "Right",
                Width       = 240,
                Height      = double.NaN,
                Title       = "RightPane",
                CurrentView = null,
                Views       = CreateList <IView>
                              (
                    new ToolDock
                {
                    Id          = "RightPaneTop",
                    Dock        = "Top",
                    Width       = double.NaN,
                    Height      = 340,
                    Title       = "RightPaneTop",
                    CurrentView = rightTopTool1,
                    Views       = CreateList <IView>
                                  (
                        rightTopTool1,
                        rightTopTool2,
                        rightTopTool3
                                  )
                },
                    new SplitterDock()
                {
                    Id    = "RightPaneTopSplitter",
                    Dock  = "Top",
                    Title = "RightPaneTopSplitter"
                },
                    new ToolDock
                {
                    Id          = "RightPaneBottom",
                    Dock        = "Bottom",
                    Width       = double.NaN,
                    Height      = double.NaN,
                    Title       = "RightPaneBottom",
                    CurrentView = rightBottomTool1,
                    Views       = CreateList <IView>
                                  (
                        rightBottomTool1,
                        rightBottomTool2,
                        rightBottomTool3
                                  )
                }
                              )
            };

            // Documents

            var documentsPane = new DocumentDock
            {
                Id          = "DocumentsPane",
                Dock        = "",
                Width       = double.NaN,
                Height      = double.NaN,
                Title       = "DocumentsPane",
                CurrentView = document1,
                Views       = CreateList <IView>
                              (
                    document1,
                    document2,
                    document3
                              )
            };

            // Main

            var mainLayout = new LayoutDock
            {
                Id          = "MainLayout",
                Dock        = "",
                Width       = double.NaN,
                Height      = double.NaN,
                Title       = "MainLayout",
                CurrentView = null,
                Views       = CreateList <IView>
                              (
                    leftPane,
                    new SplitterDock()
                {
                    Id    = "LeftSplitter",
                    Dock  = "Left",
                    Title = "LeftSplitter"
                },
                    rightPane,
                    new SplitterDock()
                {
                    Id    = "RightSplitter",
                    Dock  = "Right",
                    Title = "RightSplitter"
                },
                    documentsPane
                              )
            };

            var mainView = new MainView
            {
                Id          = "Main",
                Width       = double.NaN,
                Height      = double.NaN,
                Title       = "Main",
                CurrentView = mainLayout,
                Views       = CreateList <IView>
                              (
                    mainLayout
                              )
            };

            // Home

            var homeView = new HomeView
            {
                Id     = "Home",
                Width  = double.NaN,
                Height = double.NaN,
                Title  = "Home"
            };

            // Root

            var root = new RootDock
            {
                Id          = "Root",
                Width       = double.NaN,
                Height      = double.NaN,
                Title       = "Root",
                CurrentView = homeView,
                DefaultView = homeView,
                Views       = CreateList <IView>(homeView, mainView)
            };

            return(root);
        }
Exemplo n.º 20
0
        /// <inheritdoc/>
        public override IDock CreateLayout()
        {
            LeftDock = new ToolDock
            {
                Id          = "LeftPaneTop",
                Proportion  = double.NaN,
                Title       = "LeftPaneTop",
                CurrentView = null,
                Views       = new ObservableCollection <IView>()
            };

            // Left Pane
            LeftPane = new LayoutDock
            {
                Id          = "LeftPane",
                Proportion  = 0.15,
                Orientation = Orientation.Vertical,
                Title       = "LeftPane",
                CurrentView = null,
                Views       = CreateList <IView>
                              (
                    LeftDock
                              )
            };

            RightDock = new ToolDock
            {
                Id          = "RightDock",
                Title       = "RightDock",
                CurrentView = null,
                Views       = new ObservableCollection <IView>()
            };

            var RightPane = new LayoutDock
            {
                Id          = "RightPane",
                Proportion  = 0.15,
                Orientation = Orientation.Vertical,
                Title       = "LeftPane",
                CurrentView = null,
                Views       = CreateList <IView>
                              (
                    RightDock
                              )
            };

            BottomDock = new ToolDock
            {
                Id          = "BottomDock",
                Title       = "BottomDock",
                CurrentView = null,
                Proportion  = 0.3,
                Views       = new ObservableCollection <IView>()
            };

            // Documents

            DocumentDock = new DocumentDock
            {
                Id          = "DocumentsPane",
                Proportion  = double.NaN,
                Title       = "DocumentsPane",
                CurrentView = null,
                Views       = new ObservableCollection <IView>()
            };

            CenterPane = new LayoutDock
            {
                Id          = "CenterPane",
                Proportion  = double.NaN,
                Orientation = Orientation.Vertical,
                Title       = "LeftPane",
                CurrentView = null,
                Views       = CreateList <IView>
                              (
                    DocumentDock,
                    new SplitterDock(),
                    BottomDock
                              )
            };

            // Main

            var mainLayout = new LayoutDock
            {
                Id          = "MainLayout",
                Proportion  = double.NaN,
                Orientation = Orientation.Horizontal,
                Title       = "MainLayout",
                CurrentView = null,
                Views       = new ObservableCollection <IView>
                {
                    LeftPane,
                    new SplitterDock()
                    {
                        Id    = "LeftSplitter",
                        Title = "LeftSplitter"
                    },
                    CenterPane,
                    new SplitterDock()
                    {
                        Id    = "RightSplitter",
                        Title = "RightSplitter"
                    },
                    RightPane
                }
            };

            var mainView = new MainView
            {
                Id          = "Main",
                Title       = "Main",
                CurrentView = mainLayout,
                Views       = new ObservableCollection <IView>
                {
                    mainLayout
                }
            };

            // Root

            var root = new RootDock
            {
                Id          = "Root",
                Title       = "Root",
                CurrentView = mainView,
                DefaultView = mainView,
                Views       = new ObservableCollection <IView>
                {
                    mainView,
                }
            };

            return(root);
        }
        public MenuAddMinimapWaypoint(GameState gameState) : base(gameState)
        {
            PauseGame     = true;
            EscapeToClose = true;

            var wayPointNameTextBox = new WidgetTextBox()
            {
                Dock = Dock.Top
            };
            var wayPointAddButton = new WidgetButton("Add waypoint")
            {
                Dock = Dock.Bottom
            };

            wayPointAddButton.RegisterMouseClickEvent(_ =>
            {
                AddWaypoint(wayPointAddButton.Text);
                gameState.CurrentMenu = new MenuInGame(gameState);
            });

            Content = new LayoutDock
            {
                Children =
                {
                    new WidgetFancyPanel
                    {
                        UnitBound = new Rectangle(0, 0, 600, 720),
                        Padding   = new Spacing(16),
                        Anchor    = Anchor.Center,
                        Origine   = Anchor.Center,
                        Dock      = Dock.None,

                        Content = new LayoutDock
                        {
                            Children =
                            {
                                new WidgetLabel()
                                {
                                    Text     = "Add waypoint",
                                    Font     = Resources.FontAlagard,
                                    TextSize = 1f,
                                    Dock     = Dock.Top
                                },
                                new WidgetSprite()
                                {
                                    Anchor     = Anchor.TopRight,
                                    Origine    = Anchor.Center,
                                    Sprite     = new Sprite(Resources.TileGui, new Point(7, 7)),
                                    UnitBound  = new Rectangle(0, 0, 48, 48),
                                    UnitOffset = new Point(-24, 24)
                                }.RegisterMouseClickEvent(sender => gameState.CurrentMenu = new MenuInGame(gameState)),
                                new WidgetLabel()
                                {
                                    Text           = "Name:",
                                    Font           = Resources.FontRomulus,
                                    TextAlignement = TextAlignement.Left,
                                    Dock           = Dock.Top
                                },
                                wayPointNameTextBox,
                                wayPointAddButton,
                            }
                        }
                    }
                }
            };
        }
Exemplo n.º 22
0
        /// <inheritdoc/>
        public override IDock CreateLayout()
        {
            // Right Pane

            RightDock = new ToolDock
            {
                Id          = "RightDock",
                Dock        = "Right",
                Width       = 300,
                Height      = double.NaN,
                Title       = "RightDock",
                CurrentView = null,
                Views       = new ObservableCollection <IView>()
            };

            // Documents

            DocumentDock = new DocumentDock
            {
                Id          = "DocumentsPane",
                Dock        = "",
                Width       = double.NaN,
                Height      = double.NaN,
                Title       = "DocumentsPane",
                CurrentView = null,
                Views       = new ObservableCollection <IView>()
            };

            // Main

            var mainLayout = new LayoutDock
            {
                Id          = "MainLayout",
                Dock        = "",
                Width       = double.NaN,
                Height      = double.NaN,
                Title       = "MainLayout",
                CurrentView = null,
                Views       = new ObservableCollection <IView>
                {
                    RightDock,
                    DocumentDock
                }
            };

            var mainView = new MainView
            {
                Id          = "Main",
                Width       = double.NaN,
                Height      = double.NaN,
                Title       = "Main",
                CurrentView = mainLayout,
                Views       = new ObservableCollection <IView>
                {
                    mainLayout
                }
            };

            // Root

            var root = new RootDock
            {
                Id          = "Root",
                Width       = double.NaN,
                Height      = double.NaN,
                Title       = "Root",
                CurrentView = mainView,
                DefaultView = mainView,
                Views       = new ObservableCollection <IView>
                {
                    mainView,
                }
            };

            return(root);
        }
Exemplo n.º 23
0
        public void LayoutDock_Ctor()
        {
            var actual = new LayoutDock();

            Assert.NotNull(actual);
        }
Exemplo n.º 24
0
        /// <inheritdoc/>
        public override IDock CreateLayout()
        {
            // Documents

            var pageDocument = new PageDocument
            {
                Id     = nameof(PageDocument),
                Width  = double.NaN,
                Height = double.NaN,
                Title  = "Page"
            };

            // Left / Top

            var projectView = new ProjectTool
            {
                Id     = nameof(ProjectTool),
                Width  = double.NaN,
                Height = double.NaN,
                Title  = "Project"
            };

            var optionsView = new OptionsTool
            {
                Id     = nameof(OptionsTool),
                Width  = 200,
                Height = 200,
                Title  = "Options"
            };

            var imagesView = new ImagesTool
            {
                Id     = nameof(ImagesTool),
                Width  = double.NaN,
                Height = double.NaN,
                Title  = "Images"
            };

            // Left / Bottom

            var groupsView = new GroupsTool
            {
                Id     = nameof(GroupsTool),
                Width  = double.NaN,
                Height = double.NaN,
                Title  = "Groups"
            };

            var databasesView = new DatabasesTool
            {
                Id     = nameof(DatabasesTool),
                Width  = double.NaN,
                Height = double.NaN,
                Title  = "Databases"
            };

            // Right / Top

            var stylesView = new StylesTool
            {
                Id     = nameof(StylesTool),
                Width  = double.NaN,
                Height = double.NaN,
                Title  = "Styles"
            };

            var templatesView = new TemplatesTool
            {
                Id     = nameof(TemplatesTool),
                Width  = double.NaN,
                Height = double.NaN,
                Title  = "Templates"
            };

            var containerView = new ContainerTool
            {
                Id     = nameof(ContainerTool),
                Width  = double.NaN,
                Height = double.NaN,
                Title  = "Container"
            };

            var zoomView = new ZoomTool
            {
                Id     = nameof(ZoomTool),
                Width  = double.NaN,
                Height = double.NaN,
                Title  = "Zoom"
            };

            // Right / Bottom

            var toolsView = new ToolsTool
            {
                Id     = nameof(ToolsTool),
                Width  = double.NaN,
                Height = double.NaN,
                Title  = "Tools"
            };

            var shapeView = new ShapeTool
            {
                Id     = nameof(ShapeTool),
                Width  = double.NaN,
                Height = double.NaN,
                Title  = "Shape"
            };

            var dataView = new DataTool
            {
                Id     = nameof(DataTool),
                Width  = double.NaN,
                Height = double.NaN,
                Title  = "Data"
            };

            var styleView = new StyleTool
            {
                Id     = nameof(StyleTool),
                Width  = double.NaN,
                Height = double.NaN,
                Title  = "Style"
            };

            var templateView = new TemplateTool
            {
                Id     = nameof(TemplateTool),
                Width  = double.NaN,
                Height = double.NaN,
                Title  = "Template"
            };

            // Left Pane

            var leftPane = new LayoutDock
            {
                Id          = nameof(ILayoutDock),
                Dock        = "Left",
                Width       = 200,
                Height      = double.NaN,
                Title       = "EditorLeft",
                CurrentView = null,
                Views       = new ObservableCollection <IView>
                {
                    new ToolDock
                    {
                        Id          = nameof(IToolDock),
                        Dock        = "Top",
                        Width       = double.NaN,
                        Height      = 340,
                        Title       = "EditorLeftTop",
                        CurrentView = projectView,
                        Views       = new ObservableCollection <IView>
                        {
                            projectView,
                            optionsView,
                            imagesView
                        }
                    },
                    new SplitterDock()
                    {
                        Id    = nameof(ISplitterDock),
                        Dock  = "Top",
                        Title = "LeftTopSplitter"
                    },
                    new ToolDock
                    {
                        Id          = nameof(IToolDock),
                        Dock        = "Bottom",
                        Width       = double.NaN,
                        Height      = double.NaN,
                        Title       = "EditorLeftBottom",
                        CurrentView = groupsView,
                        Views       = new ObservableCollection <IView>
                        {
                            groupsView,
                            databasesView
                        }
                    }
                }
            };

            // Right Pane

            var rightPane = new LayoutDock
            {
                Id          = nameof(ILayoutDock),
                Dock        = "Right",
                Width       = 240,
                Height      = double.NaN,
                Title       = "EditorRight",
                CurrentView = null,
                Views       = new ObservableCollection <IView>
                {
                    new ToolDock
                    {
                        Id          = nameof(IToolDock),
                        Dock        = "Top",
                        Width       = double.NaN,
                        Height      = 340,
                        Title       = "EditorRightTop",
                        CurrentView = stylesView,
                        Views       = new ObservableCollection <IView>
                        {
                            stylesView,
                            templatesView,
                            containerView,
                            zoomView
                        }
                    },
                    new SplitterDock()
                    {
                        Id    = nameof(ISplitterDock),
                        Dock  = "Top",
                        Title = "RightTopSplitter"
                    },
                    new ToolDock
                    {
                        Id          = nameof(IToolDock),
                        Dock        = "Bottom",
                        Width       = double.NaN,
                        Height      = double.NaN,
                        Title       = "EditorRightBottom",
                        CurrentView = toolsView,
                        Views       = new ObservableCollection <IView>
                        {
                            toolsView,
                            shapeView,
                            dataView,
                            styleView,
                            templateView
                        }
                    }
                }
            };

            // Documents

            var documentsPane = new DocumentDock
            {
                Id          = nameof(IDocumentDock),
                Dock        = "",
                Width       = double.NaN,
                Height      = double.NaN,
                Title       = "DocumentsPane",
                CurrentView = pageDocument,
                Views       = new ObservableCollection <IView>
                {
                    pageDocument
                }
            };

            // Main

            var editorLayout = new LayoutDock
            {
                Id          = nameof(ILayoutDock),
                Dock        = "",
                Width       = double.NaN,
                Height      = double.NaN,
                Title       = "EditorLayout",
                CurrentView = null,
                Views       = new ObservableCollection <IView>
                {
                    leftPane,
                    new SplitterDock()
                    {
                        Id    = nameof(ISplitterDock),
                        Dock  = "Left",
                        Title = "LeftSplitter"
                    },
                    rightPane,
                    new SplitterDock()
                    {
                        Id    = nameof(ISplitterDock),
                        Dock  = "Right",
                        Title = "RightSplitter"
                    },
                    documentsPane
                }
            };

            var editorView = new EditorView
            {
                Id          = nameof(EditorView),
                Width       = double.NaN,
                Height      = double.NaN,
                Title       = "Editor",
                CurrentView = editorLayout,
                Views       = new ObservableCollection <IView>
                {
                    editorLayout
                }
            };

            // About

            var aboutView = new AboutView
            {
                Id     = nameof(AboutView),
                Width  = double.NaN,
                Height = double.NaN,
                Title  = "About"
            };

            // Browser

            var browserView = new BrowserView
            {
                Id     = nameof(BrowserView),
                Width  = double.NaN,
                Height = double.NaN,
                Title  = "Browser"
            };

            // Document

            var documentView = new DocumentView
            {
                Id     = nameof(DocumentView),
                Width  = double.NaN,
                Height = double.NaN,
                Title  = "Document"
            };

            // Dashboard

            var dashboardView = new DashboardView
            {
                Id     = nameof(DashboardView),
                Width  = double.NaN,
                Height = double.NaN,
                Title  = "Dashboard"
            };

            // Main

            var layout = new RootDock
            {
                Id          = nameof(IRootDock),
                Width       = double.NaN,
                Height      = double.NaN,
                Title       = "Root",
                CurrentView = dashboardView,
                DefaultView = dashboardView,
                Views       = new ObservableCollection <IView>
                {
                    dashboardView,
                    editorView,
                    aboutView,
                    browserView,
                    documentView
                }
            };

            return(layout);
        }
Exemplo n.º 25
0
        public override IDock CreateLayout()
        {
            var elementTreeView = new ElementTreeTool()
            {
                Id    = "ElementTree",
                Title = "Element Tree"
            };

            var mainLayout = new LayoutDock()
            {
                Id          = $"MainLayout",
                Title       = "MainLayout",
                Proportion  = double.NaN,
                Orientation = Orientation.Horizontal,
                CurrentView = null,
                Views       = CreateList <IView>
                              (

                    #region LeftPane

                    new LayoutDock
                {
                    Id          = "LeftPane",
                    Title       = "LeftPane",
                    Proportion  = double.NaN,
                    Orientation = Orientation.Vertical,
                    CurrentView = null,
                    Views       = CreateList <IView>
                                  (
                        new ToolDock
                    {
                        Id          = "LeftPaneTop",
                        Title       = "LeftPaneTop",
                        Proportion  = double.NaN,
                        CurrentView = elementTreeView,
                        Views       = CreateList <IView>(elementTreeView)
                    },
                        new SplitterDock()
                    {
                        Id    = "RightPaneTopSplitter",
                        Title = "RightPaneTopSplitter"
                    },
                        new ToolDock
                    {
                        Id          = "LeftPaneBottom",
                        Title       = "LeftPaneBottom",
                        Proportion  = double.NaN,
                        CurrentView = null,
                        Views       = CreateList <IView>()
                    }
                                  ),
                },
                    new SplitterDock()
                {
                    Id    = "LeftSplitter",
                    Title = "LeftSplitter"
                },

                    #endregion

                    #region DocumentsPane

                    new DocumentDock
                {
                    Id          = "DocumentsPane",
                    Title       = "DocumentsPane",
                    Proportion  = double.NaN,
                    CurrentView = null,
                    Views       = CreateList <IView>()
                },

                    #endregion

                    #region RightPane

                    new SplitterDock()
                {
                    Id    = "RightSplitter",
                    Title = "RightSplitter"
                },
                    new LayoutDock
                {
                    Id          = "RightPane",
                    Title       = "RightPane",
                    Proportion  = double.NaN,
                    Orientation = Orientation.Vertical,
                    CurrentView = null,
                    Views       = CreateList <IView>
                                  (
                        new ToolDock
                    {
                        Id          = "RightPaneTop",
                        Title       = "RightPaneTop",
                        Proportion  = double.NaN,
                        CurrentView = null,
                        Views       = CreateList <IView>()
                    },
                        new SplitterDock()
                    {
                        Id    = "RightPaneTopSplitter",
                        Title = "RightPaneTopSplitter"
                    },
                        new ToolDock
                    {
                        Id          = "RightPaneBottom",
                        Title       = "RightPaneBottom",
                        Proportion  = double.NaN,
                        CurrentView = null,
                        Views       = CreateList <IView>()
                    }
                                  )
                }

                    #endregion

                              )
            };

            var mainView = new MainView
            {
                Id          = "Main",
                Title       = "Main",
                CurrentView = mainLayout,
                Views       = CreateList <IView>(mainLayout)
            };

            var root = CreateRootDock();

            root.Id               = "Root";
            root.Title            = "Root";
            root.CurrentView      = mainView;
            root.DefaultView      = mainView;
            root.Views            = CreateList <IView>(mainView);
            root.Top              = CreatePinDock();
            root.Top.Alignment    = Alignment.Top;
            root.Bottom           = CreatePinDock();
            root.Bottom.Alignment = Alignment.Bottom;
            root.Left             = CreatePinDock();
            root.Left.Alignment   = Alignment.Left;
            root.Right            = CreatePinDock();
            root.Right.Alignment  = Alignment.Right;

            return(root);
        }