Exemplo n.º 1
0
        void Initialize()
        {
            Tabs       = new Dictionary <string, GUIComponent>();
            Icons      = TextureManager.GetTexture(ContentPaths.GUI.icons);
            TabButtons = new List <Button>();
            GUI        = new DwarfGUI(Game, Game.Content.Load <SpriteFont>(ContentPaths.Fonts.Default), Game.Content.Load <SpriteFont>(ContentPaths.Fonts.Title), Game.Content.Load <SpriteFont>(ContentPaths.Fonts.Small), Input)
            {
                DebugDraw = false
            };
            IsInitialized = true;
            Drawer        = new Drawer2D(Game.Content, Game.GraphicsDevice);
            MainWindow    = new GUIComponent(GUI, GUI.RootComponent)
            {
                LocalBounds = new Rectangle(EdgePadding, EdgePadding, Game.GraphicsDevice.Viewport.Width - EdgePadding * 2, Game.GraphicsDevice.Viewport.Height - EdgePadding * 2)
            };
            Layout = new GridLayout(GUI, MainWindow, 11, 4);
            Layout.UpdateSizes();

            Button back = new Button(GUI, Layout, "Back", GUI.DefaultFont, Button.ButtonMode.ToolButton, GUI.Skin.GetSpecialFrame(GUISkin.Tile.LeftArrow));

            Layout.SetComponentPosition(back, 0, 10, 1, 1);
            back.OnClicked += back_OnClicked;

            Panel tabPanel = new Panel(GUI, Layout);

            Layout.SetComponentPosition(tabPanel, 0, 0, 4, 1);

            GridLayout tabLayout = new GridLayout(GUI, tabPanel, 1, 10)
            {
                EdgePadding = 10
            };


            CreateTabButton(tabLayout, "Employees", "Hire and fire dwarves", 5, 0);
            EmployeeDisplay employeeDisplay = new EmployeeDisplay(GUI, Layout, PlayState.Master.Faction)
            {
                IsVisible = false
            };

            Tabs["Employees"] = employeeDisplay;

            CreateTabButton(tabLayout, "Assets", "Buy/Sell goods", 3, 1);
            GoodsPanel assetsPanel = new GoodsPanel(GUI, Layout, PlayState.Master.Faction)
            {
                IsVisible = false
            };

            Tabs["Assets"] = assetsPanel;


            CreateTabButton(tabLayout, "Capital", "Financial report", 2, 1);
            CapitalPanel capitalPanel = new CapitalPanel(GUI, Layout, PlayState.Master.Faction)
            {
                IsVisible = false
            };

            Tabs["Capital"] = capitalPanel;

            ButtonClicked(TabButtons[0]);
        }
Exemplo n.º 2
0
        void Initialize()
        {
            Tabs = new Dictionary<string, GUIComponent>();
            Icons = TextureManager.GetTexture(ContentPaths.GUI.icons);
            TabButtons = new List<Button>();
            GUI = new DwarfGUI(Game, Game.Content.Load<SpriteFont>(ContentPaths.Fonts.Default), Game.Content.Load<SpriteFont>(ContentPaths.Fonts.Title), Game.Content.Load<SpriteFont>(ContentPaths.Fonts.Small), Input)
            {
                DebugDraw = false
            };
            IsInitialized = true;
            Drawer = new Drawer2D(Game.Content, Game.GraphicsDevice);
            MainWindow = new GUIComponent(GUI, GUI.RootComponent)
            {
                LocalBounds = new Rectangle(EdgePadding, EdgePadding, Game.GraphicsDevice.Viewport.Width - EdgePadding * 2, Game.GraphicsDevice.Viewport.Height - EdgePadding * 2)
            };
            Layout = new GridLayout(GUI, MainWindow, 11, 4);
            Layout.UpdateSizes();

            Button back = new Button(GUI, Layout, "Back", GUI.DefaultFont, Button.ButtonMode.ToolButton, GUI.Skin.GetSpecialFrame(GUISkin.Tile.LeftArrow));
            Layout.SetComponentPosition(back, 0, 10, 1, 1);
            back.OnClicked += back_OnClicked;

            Panel tabPanel = new Panel(GUI, Layout);
            Layout.SetComponentPosition(tabPanel, 0, 0, 4, 1);

            GridLayout tabLayout = new GridLayout(GUI, tabPanel, 1, 10)
            {
                EdgePadding = 10
            };

               CreateTabButton(tabLayout, "Employees", "Hire and fire dwarves", 5, 0);
            EmployeeDisplay employeeDisplay = new EmployeeDisplay(GUI, Layout, PlayState.Master.Faction)
            {
                IsVisible = false
            };
            Tabs["Employees"] = employeeDisplay;

               CreateTabButton(tabLayout, "Assets", "Buy/Sell goods", 3, 1);
               GoodsPanel assetsPanel = new GoodsPanel(GUI, Layout, PlayState.Master.Faction)
               {
               IsVisible = false
               };
               Tabs["Assets"] = assetsPanel;

               CreateTabButton(tabLayout, "Capital", "Financial report", 2, 1);
               CapitalPanel capitalPanel = new CapitalPanel(GUI, Layout, PlayState.Master.Faction)
               {
               IsVisible = false
               };
               Tabs["Capital"] = capitalPanel;

              ButtonClicked(TabButtons[0]);
        }