示例#1
0
        public override void LoadContent(ContentManager contentloader)
        {
            _guiman = new Manager(_gamemanager.Game, _gamemanager.Graphics, "Default");
            _guiman.Initialize();

            _settingsmenu = new Window(_guiman);
            _settingsmenu.Init();
            _settingsmenu.Resizable = false;
            _settingsmenu.Movable = false;
            _settingsmenu.CloseButtonVisible = false;
            _settingsmenu.Text = "Settings Menu";
            _settingsmenu.Width = 300;
            _settingsmenu.Height = 400;
            _settingsmenu.Center();
            _settingsmenu.Visible = true;
            _settingsmenu.BorderVisible = true;
            _settingsmenu.Cursor = _guiman.Skin.Cursors["Default"].Resource;

            _back = new Button(_guiman);
            _back.Init();
            _back.Text = "Go Back";
            _back.Width = 200;
            _back.Height = 50;
            _back.Left = 50;
            _back.Top = 300;
            _back.Anchor = Anchors.Bottom;
            _back.Parent = _settingsmenu;

            _playername = new TextBox(_guiman);
            _playername.Init();
            _playername.Text = _gamemanager.Pbag.Player.Name;
            _playername.Width = 200;
            _playername.Height = 50;
            _playername.Left = 50;
            _playername.Top = 0;
            _playername.Anchor = Anchors.Bottom;
            _playername.Parent = _settingsmenu;

            _volume = new ScrollBar(_guiman, Orientation.Horizontal);
            _volume.Init();
            //Todo check why volume.value is reseting it to 50 :S
            _volume.Value = _gamemanager.Audiomanager.GetVolume();
            _volume.Range = 100;
            _volume.PageSize = 10;
            _volume.StepSize = 1;
            _volume.Width = 200;
            _volume.Height = 50;
            _volume.Left = 50;
            _volume.Top = 50;
            _volume.Anchor = Anchors.Bottom;
            _volume.Parent = _settingsmenu;

            _guiman.Add(_settingsmenu);

            _gamemanager.Game.IsMouseVisible = true;
        }
示例#2
0
        public override void LoadContent(ContentManager contentloader)
        {
            _guiman = new Manager(_gamemanager.Game, _gamemanager.Graphics, "Default");
            _guiman.Initialize();

            _mainmenu = new Window(_guiman);
            _mainmenu.Init();
            _mainmenu.Resizable = false;
            _mainmenu.Movable = false;
            _mainmenu.CloseButtonVisible = false;
            _mainmenu.Text = "Main Menu";
            _mainmenu.Width = 300;
            _mainmenu.Height = 400;
            _mainmenu.Center();
            _mainmenu.Visible = true;
            _mainmenu.BorderVisible = true;
            //mainmenu.Cursor = guiman.Skin.Cursors["Default"].Resource;

            _play = new Button(_guiman);
            _play.Init();
            _play.Text = "Play";
            _play.Width = 200;
            _play.Height = 50;
            _play.Left = 50;
            _play.Top = 0;
            _play.Anchor = Anchors.Bottom;
            _play.Parent = _mainmenu;

            _settings = new Button(_guiman);
            _settings.Init();
            _settings.Text = "Settings";
            _settings.Width = 200;
            _settings.Height = 50;
            _settings.Left = 50;
            _settings.Top = 50;
            _settings.Anchor = Anchors.Bottom;
            _settings.Parent = _mainmenu;

            _exit = new Button(_guiman);
            _exit.Init();
            _exit.Text = "Exit";
            _exit.Width = 200;
            _exit.Height = 50;
            _exit.Left = 50;
            _exit.Top = 100;
            _exit.Anchor = Anchors.Bottom;
            _exit.Parent = _mainmenu;

            _guiman.Cursor = _guiman.Skin.Cursors["Default"].Resource;
            _guiman.Add(_mainmenu);

            _gamemanager.Game.IsMouseVisible = true;
        }
示例#3
0
        private Window window; // Main window

        #endregion Fields

        #region Constructors

        public FileBrowserScreen(Game game)
        {
            this.game = game;
            graphics = GameServices.GetService<GraphicsDeviceManager>();
            // Setting up the shared skins directory

            manager = new Manager(game, graphics, "Green");

            manager.SkinDirectory = @"..\..\Skins\";
            manager.Initialize();

            gpList = new List<GroupPanel>();
            Initialize();
        }
示例#4
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // Create an instance of manager using Default skin. We set the fourth parameter to false,
            // so the instance of manager is not registered as an XNA game component and methods
            // like Initialize(), Update() and Draw() are called manually in the game loop.
            manager = new Manager(this, graphics, "Default");

            // Setting up the shared skins directory
            manager.SkinDirectory = "Content/Skins/";
            manager.RenderTarget = new RenderTarget2D(GraphicsDevice, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight, false, SurfaceFormat.Color, DepthFormat.None, 0, RenderTargetUsage.DiscardContents);
            manager.TargetFrames = 120;
            manager.Initialize();
            #if(!DEBUG)
            manager.LogUnhandledExceptions = false;
            #endif
            world = new EntityWorld();

            if (useMaxRes && GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height > 960)
            {
                graphics.PreferredBackBufferWidth = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;
                graphics.PreferredBackBufferHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height-22;
                canvasRender = new RenderTarget2D(GraphicsDevice,
                    GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width,
                    GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height - 22);
            }
            else
            {
                graphics.PreferredBackBufferWidth = 1280;
                graphics.PreferredBackBufferHeight = 720;
                canvasRender = new RenderTarget2D(GraphicsDevice, 1280, 720);
            }
            IsMouseVisible = true;

            graphics.SynchronizeWithVerticalRetrace = true;
            graphics.ApplyChanges();

            Window.AllowUserResizing = false; //DONT CHANGE!
            Window.ClientSizeChanged += new EventHandler<System.EventArgs>(Window_ClientSizeChanged);

            System.Windows.Forms.Form xnaWindow = System.Windows.Forms.Form.FromHandle(Window.Handle) as System.Windows.Forms.Form;
            if (xnaWindow != null)
            {
                xnaWindow.FormClosing += f_FormClosing;
                xnaWindow.Text = "The Little Cheese Boy Editor - Beta";

                if (useMaxRes && GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height > 960)
                {
                    xnaWindow.WindowState = System.Windows.Forms.FormWindowState.Maximized;
                }
            }

            base.Initialize();

            Debug.Print("Finished Initializing");
        }
示例#5
0
文件: Main.cs 项目: ishellstrike/Mork
        /// <summary>
        /// Код дизайнера всех базовых окон
        /// </summary>
        private void WindowsDesigner()
        {
            Manager = new Manager(this, graphics, "Default");
            Manager.Initialize();

            #region mainmenu

            mainmenu = new Window(Manager) {BackColor = Color.Black};
            mainmenu.Init();
            mainmenu.Text = "";
            mainmenu.SetPosition(resx/3, resy/4);
            mainmenu.Width = resx/3;
            mainmenu.Height = resy/2;
            mainmenu.Visible = true;
            mainmenu.BorderVisible = false;
            mainmenu.Movable = false;
            mainmenu.Resizable = false;

            mainmenucloseB = new Button(Manager);
            mainmenucloseB.Init();
            mainmenucloseB.Text = "Quit";
            mainmenucloseB.Width = resx/5;
            mainmenucloseB.Height = 25;
            mainmenucloseB.Left = (resx/3 - resx/5)/2;
            mainmenucloseB.Top = mainmenu.ClientHeight - mainmenucloseB.Height - 8;
            mainmenucloseB.Anchor = Anchors.Bottom;
            mainmenucloseB.Parent = mainmenu;
            mainmenucloseB.Click += button_Click;

            mainmenugeneratenewB = new Button(Manager);
            mainmenugeneratenewB.Init();
            mainmenugeneratenewB.Text = "Создать новый мир и начать игру";
            mainmenugeneratenewB.Width = resx/5;
            mainmenugeneratenewB.Height = 25;
            mainmenugeneratenewB.Left = (resx/3 - resx/5)/2;
            mainmenugeneratenewB.Top = 50;
            mainmenugeneratenewB.Anchor = Anchors.Bottom;
            mainmenugeneratenewB.Parent = mainmenu;
            mainmenugeneratenewB.Click += mainmenugeneratenewB_Click;

            mainmenuloadmapB = new Button(Manager) {Text = "Начать игру в созданном мире", Width = resx/5};
            mainmenuloadmapB.Init();
            mainmenuloadmapB.Height = 25;
            mainmenuloadmapB.Left = (resx/3 - resx/5)/2;
            mainmenuloadmapB.Top = 100;
            mainmenuloadmapB.Anchor = Anchors.Bottom;
            mainmenuloadmapB.Parent = mainmenu;
            mainmenuloadmapB.Click += mainmenuloadmapB_Click;

            mainmenuloadgameB = new Button(Manager);
            mainmenuloadgameB.Init();
            mainmenuloadgameB.Text = "Загрузить игру";
            mainmenuloadgameB.Width = resx/5;
            mainmenuloadgameB.Height = 25;
            mainmenuloadgameB.Left = (resx/3 - resx/5)/2;
            mainmenuloadgameB.Top = 150;
            mainmenuloadgameB.Anchor = Anchors.Bottom;
            mainmenuloadgameB.Parent = mainmenu;
            mainmenuloadgameB.Click += mainmenuloadgameB_Click;

            mainmenuoptionsB = new Button(Manager);
            mainmenuoptionsB.Init();
            mainmenuoptionsB.Text = "Опции";
            mainmenuoptionsB.Width = resx/5;
            mainmenuoptionsB.Height = 25;
            mainmenuoptionsB.Left = (resx/3 - resx/5)/2;
            mainmenuoptionsB.Top = 200;
            mainmenuoptionsB.Anchor = Anchors.Bottom;
            mainmenuoptionsB.Parent = mainmenu;
            mainmenuoptionsB.Click += mainmenuoptionsB_Click;

            Manager.Add(mainmenu);

            #endregion

            #region generateoptionsmenu

            generateoptionsmenu = new Window(Manager) {BackColor = Color.Black};
            generateoptionsmenu.Init();
            generateoptionsmenu.Text = "";
            generateoptionsmenu.SetPosition(resx/3, resy/4);
            generateoptionsmenu.Width = resx/3;
            generateoptionsmenu.Height = resy/2;
            generateoptionsmenu.Visible = false;
            generateoptionsmenu.BorderVisible = false;
            generateoptionsmenu.Movable = false;
            generateoptionsmenu.Resizable = false;

            generateoptionnextB = new Button(Manager);
            generateoptionnextB.Init();
            generateoptionnextB.Text = "Продолжить";
            generateoptionnextB.Width = resx/5;
            generateoptionnextB.Height = 25;
            generateoptionnextB.Left = (resx/3 - resx/5)/2;
            generateoptionnextB.Top = 50;
            generateoptionnextB.Anchor = Anchors.Bottom;
            generateoptionnextB.Parent = generateoptionsmenu;
            generateoptionnextB.Click += generateoptionnextB_Click;

            generateoptionbackB = new Button(Manager);
            generateoptionbackB.Init();
            generateoptionbackB.Text = "Назад";
            generateoptionbackB.Width = resx/5;
            generateoptionbackB.Height = 25;
            generateoptionbackB.Left = (resx/3 - resx/5)/2;
            generateoptionbackB.Top = generateoptionsmenu.ClientHeight - generateoptionbackB.Height - 8;
            generateoptionbackB.Anchor = Anchors.Bottom;
            generateoptionbackB.Parent = generateoptionsmenu;
            generateoptionbackB.Click += generateoptionbackB_Click;

            Manager.Add(generateoptionsmenu);

            #endregion

            #region generationMenu

            generationMenu = new Window(Manager) {BackColor = Color.Black};
            generationMenu.Init();
            generationMenu.Text = "";
            generationMenu.SetPosition(20, 20);
            generationMenu.Width = resx/6;
            generationMenu.Height = 300;
            generationMenu.Visible = false;
            generationMenu.BorderVisible = false;
            generationMenu.Movable = false;
            generationMenu.Resizable = false;

            generationbegingameB = new Button(Manager);
            generationbegingameB.Init();
            generationbegingameB.Text = "Начать игру";
            generationbegingameB.Width = resx/8;
            generationbegingameB.Height = 25;
            generationbegingameB.Left = (resx/6 - resx/8)/2;
            generationbegingameB.Top = 50;
            generationbegingameB.Anchor = Anchors.Bottom;
            generationbegingameB.Parent = generationMenu;
            generationbegingameB.Click += generationbegingameB_Click;

            generationgenerateB = new Button(Manager);
            generationgenerateB.Init();
            generationgenerateB.Text = "Генерировать";
            generationgenerateB.Width = resx/8;
            generationgenerateB.Height = 25;
            generationgenerateB.Left = (resx/6 - resx/8)/2;
            generationgenerateB.Top = 80;
            generationgenerateB.Anchor = Anchors.Bottom;
            generationgenerateB.Parent = generationMenu;
            generationgenerateB.Click += generationgenerateB_Click;

            generationNormalMapB = new Button(Manager);
            generationNormalMapB.Init();
            generationNormalMapB.Text = "Обычная карта";
            generationNormalMapB.Width = resx/8;
            generationNormalMapB.Height = 25;
            generationNormalMapB.Left = (resx/6 - resx/8)/2;
            generationNormalMapB.Top = 110;
            generationNormalMapB.Anchor = Anchors.Bottom;
            generationNormalMapB.Parent = generationMenu;
            generationNormalMapB.Click += generationnormalmapB_Click;

            generationheightmapB = new Button(Manager);
            generationheightmapB.Init();
            generationheightmapB.Text = "Карта высот";
            generationheightmapB.Width = resx/8;
            generationheightmapB.Height = 25;
            generationheightmapB.Left = (resx/6 - resx/8)/2;
            generationheightmapB.Top = 140;
            generationheightmapB.Anchor = Anchors.Bottom;
            generationheightmapB.Parent = generationMenu;
            generationheightmapB.Click += generationheightmapB_Click;

            generationtempmapB = new Button(Manager);
            generationtempmapB.Init();
            generationtempmapB.Text = "Карта температур";
            generationtempmapB.Width = resx/8;
            generationtempmapB.Height = 25;
            generationtempmapB.Left = (resx/6 - resx/8)/2;
            generationtempmapB.Top = 170;
            generationtempmapB.Anchor = Anchors.Bottom;
            generationtempmapB.Parent = generationMenu;
            generationtempmapB.Click += generationtempmapB_Click;

            generationbackB = new Button(Manager);
            generationbackB.Init();
            generationbackB.Text = "Назад";
            generationbackB.Width = resx/8;
            generationbackB.Height = 25;
            generationbackB.Left = (resx/6 - resx/8)/2;
            generationbackB.Top = 200;
            generationbackB.Anchor = Anchors.Bottom;
            generationbackB.Parent = generationMenu;
            generationbackB.Click += generationbackB_Click;

            generateoption = new TrackBar(Manager);
            generateoption.Init();
            generateoption.Top = 230;
            generateoption.Left = (resx/6 - resx/8)/2;
            generateoption.Width = resx/8;
            generateoption.Height = 25;
            generateoption.Parent = generationMenu;
            generateoption.ValueChanged += generateoption_ValueChanged;

            generateoptionlabel = new Label(Manager);
            generateoptionlabel.Init();
            generateoptionlabel.Top = 250;
            generateoptionlabel.Left = (resx/6 - resx/8)/2;
            generateoptionlabel.Width = resx/8;
            generateoptionlabel.Height = 25;
            generateoptionlabel.Parent = generationMenu;

            Manager.Add(generationMenu);

            #endregion

            #region mapload

            maploadmenu = new Window(Manager) {Color = Color.Black};
            maploadmenu.Init();
            maploadmenu.Text = "";
            maploadmenu.SetPosition(resx/3, resy/4);
            maploadmenu.Width = resx/3;
            maploadmenu.Height = resy/2;
            maploadmenu.Visible = false;
            maploadmenu.BorderVisible = false;
            maploadmenu.Movable = false;
            maploadmenu.Resizable = false;

            maploadmenuLoad = new Button(Manager);
            maploadmenuLoad.Init();
            maploadmenuLoad.Text = "Назад";
            maploadmenuLoad.Width = resx/5;
            maploadmenuLoad.Height = 25;
            maploadmenuLoad.Left = (resx/3 - resx/5)/2;
            maploadmenuLoad.Top = maploadmenu.ClientHeight - maploadmenuLoad.Height - 8;
            maploadmenuLoad.Anchor = Anchors.Bottom;
            maploadmenuLoad.Parent = maploadmenu;
            maploadmenuLoad.Click += maploadmenuLoad_Click;

            maploadmenuLoadNext = new Button(Manager);
            maploadmenuLoadNext.Init();
            maploadmenuLoadNext.Text = "Далее";
            maploadmenuLoadNext.Width = resx/5;
            maploadmenuLoadNext.Height = 25;
            maploadmenuLoadNext.Left = (resx/3 - resx/5)/2;
            maploadmenuLoadNext.Top = maploadmenu.ClientHeight - maploadmenuLoad.Height - 8 - 30;
            maploadmenuLoadNext.Anchor = Anchors.Bottom;
            maploadmenuLoadNext.Parent = maploadmenu;
            maploadmenuLoadNext.Click += maploadmenuLoadNext_Click;

            maploadmenulistbox = new ListBox(Manager);
            maploadmenulistbox.Init();
            maploadmenulistbox.Text = "";
            maploadmenulistbox.Width = resx/5;
            maploadmenulistbox.Height = resy/3;
            maploadmenulistbox.Left = (resx/3 - resx/5)/2;
            maploadmenulistbox.Top = 50;
            maploadmenulistbox.Anchor = Anchors.Bottom;
            maploadmenulistbox.Parent = maploadmenu;
            maploadmenulistbox.DoubleClick += maploadmenulistbox_DoubleClick;

            Manager.Add(maploadmenu);

            #endregion

            #region Summary Window

            SummaryWindow = new Window(Manager) {Color = Color.Black};
            SummaryWindow.Init();
            SummaryWindow.Text = "";
            SummaryWindow.SetPosition(100, 100);
            SummaryWindow.Width = resx/4;
            SummaryWindow.Height = resy/4;
            SummaryWindow.Visible = false;
            SummaryWindow.BorderVisible = true;
            SummaryWindow.Movable = true;
            SummaryWindow.Resizable = false;

            summarytb = new TextBox(Manager);
            summarytb.Init();
            summarytb.Text = "";
            summarytb.Width = resx/4 - 30;
            summarytb.Height = resy/4 - 60;
            summarytb.Left = (20)/2;
            summarytb.CaretVisible = false;
            summarytb.Passive = true;
            summarytb.Mode = TextBoxMode.Multiline;
            summarytb.Top = (20)/2;
            summarytb.Anchor = Anchors.Bottom;
            summarytb.Parent = SummaryWindow;

            Manager.Add(SummaryWindow);

            #endregion

            #region ingameUIpartLeft

            ingameUIpartLeft = new Window(Manager) {Color = Color.Black};
            ingameUIpartLeft.Init();
            ingameUIpartLeft.Text = "";
            ingameUIpartLeft.SetPosition(resx/5*4, 0);
            ingameUIpartLeft.Width = resx/5;
            ingameUIpartLeft.Height = resy;
            ingameUIpartLeft.Visible = false;
            ingameUIpartLeft.BorderVisible = false;
            ingameUIpartLeft.Movable = false;
            ingameUIpartLeft.Resizable = false;

            ingameshowOrdersB = new Button(Manager);
            ingameshowOrdersB.Init();
            ingameshowOrdersB.Text = "Приказы (O)";
            ingameshowOrdersB.Width = resx/5 - 20;
            ingameshowOrdersB.Height = 25;
            ingameshowOrdersB.Left = (20)/2;
            ingameshowOrdersB.Top = 10;
            ingameshowOrdersB.Anchor = Anchors.Bottom;
            ingameshowOrdersB.Parent = ingameUIpartLeft;
            ingameshowOrdersB.Click += ingameshowOrdersB_Click;

            ingameshowZonesB = new Button(Manager);
            ingameshowZonesB.Init();
            ingameshowZonesB.Text = "Зоны (Z)";
            ingameshowZonesB.Width = resx/5 - 20;
            ingameshowZonesB.Height = 25;
            ingameshowZonesB.Left = (20)/2;
            ingameshowZonesB.Top = 40;
            ingameshowZonesB.Anchor = Anchors.Bottom;
            ingameshowZonesB.Parent = ingameUIpartLeft;
            ingameshowZonesB.Click += ingameshowZonesB_Click;

            ingameshowBuildingsB = new Button(Manager);
            ingameshowBuildingsB.Init();
            ingameshowBuildingsB.Text = "Постройки (Z)";
            ingameshowBuildingsB.Width = resx/5 - 20;
            ingameshowBuildingsB.Height = 25;
            ingameshowBuildingsB.Left = (20)/2;
            ingameshowBuildingsB.Top = 70;
            ingameshowBuildingsB.Anchor = Anchors.Bottom;
            ingameshowBuildingsB.Parent = ingameUIpartLeft;
            ingameshowBuildingsB.Click += ingameshowBuildingsB_Click;

            ingameshowallinfo = new Button(Manager);
            ingameshowallinfo.Init();
            ingameshowallinfo.Text = "Подробная информация";
            ingameshowallinfo.Width = resx/5 - 20;
            ingameshowallinfo.Height = 25;
            ingameshowallinfo.Left = (20)/2;
            ingameshowallinfo.Top = 100;
            ingameshowallinfo.Anchor = Anchors.Bottom;
            ingameshowallinfo.Parent = ingameUIpartLeft;
            ingameshowallinfo.Click += ingameshowallinfo_Click;

            ingameUIpartLeftlistbox = new ListBox(Manager);
            ingameUIpartLeftlistbox.Init();
            ingameUIpartLeftlistbox.Text = "";
            ingameUIpartLeftlistbox.Width = resx/5 - 20;
            ingameUIpartLeftlistbox.Height = 90;
            ingameUIpartLeftlistbox.Left = 10;
            ingameUIpartLeftlistbox.Top = 200;
            ingameUIpartLeftlistbox.Anchor = Anchors.Bottom;
            ingameUIpartLeftlistbox.Parent = ingameUIpartLeft;
            ingameUIpartLeftlistbox.DoubleClick += maploadmenulistbox_DoubleClick;

            ingameUIpartLeftlistbox2 = new ListBox(Manager);
            ingameUIpartLeftlistbox2.Init();
            ingameUIpartLeftlistbox2.Text = "";
            ingameUIpartLeftlistbox2.Width = resx/5 - 20;
            ingameUIpartLeftlistbox2.Height = 200;
            ingameUIpartLeftlistbox2.Left = 10;
            ingameUIpartLeftlistbox2.Top = 300;
            ingameUIpartLeftlistbox2.Anchor = Anchors.Bottom;
            ingameUIpartLeftlistbox2.Parent = ingameUIpartLeft;

            Manager.Add(ingameUIpartLeft);

            #endregion

            #region orderssubmenu

            orderssubmenu = new Window(Manager);
            orderssubmenu.Init();
            orderssubmenu.Text = "";
            orderssubmenu.Width = 150;
            orderssubmenu.Height = 200;
            orderssubmenu.Center();
            orderssubmenu.Visible = false;
            orderssubmenu.Resizable = false;

            digorder = new Button(Manager);
            digorder.Init();
            digorder.Text = "Выкопать";
            digorder.Width = orderssubmenu.Width - 40;
            digorder.Height = 24;
            digorder.Left = 20;
            digorder.Top = 20;
            digorder.Anchor = Anchors.Bottom;
            digorder.Parent = orderssubmenu;
            digorder.Click += digorder_Click;

            supplyorder = new Button(Manager);
            supplyorder.Init();
            supplyorder.Text = "Обеспечить ресурсами";
            supplyorder.Width = orderssubmenu.Width - 40;
            supplyorder.Height = 24;
            supplyorder.Left = 20;
            supplyorder.Top = 50;
            supplyorder.Anchor = Anchors.Bottom;
            supplyorder.Parent = orderssubmenu;
            supplyorder.Click += supplyorder_Click;

            cancelorder = new Button(Manager);
            cancelorder.Init();
            cancelorder.Text = "Отменить все приказы";
            cancelorder.Width = orderssubmenu.Width - 40;
            cancelorder.Height = 24;
            cancelorder.Left = 20;
            cancelorder.Top = 80;
            cancelorder.Anchor = Anchors.Bottom;
            cancelorder.Parent = orderssubmenu;
            cancelorder.Click += cancelorder_Click;

            collectorder = new Button(Manager);
            collectorder.Init();
            collectorder.Text = "Cобрать";
            collectorder.Width = orderssubmenu.Width - 40;
            collectorder.Height = 24;
            collectorder.Left = 20;
            collectorder.Top = 110;
            collectorder.Anchor = Anchors.Bottom;
            collectorder.Parent = orderssubmenu;
            collectorder.Click += collectorder_Click;

            orderslabel = new Label(Manager);
            orderslabel.Left = 5;
            orderslabel.Top = 5;
            orderslabel.Text = "Приказы";
            orderslabel.Parent = orderssubmenu;

            Manager.Add(orderssubmenu);

            #endregion

            #region Buildings window

            buildinsgwindow = new Window(Manager) {BackColor = Color.Black};
            buildinsgwindow.Init();
            buildinsgwindow.Text = "";
            buildinsgwindow.SetPosition(20, 20);
            buildinsgwindow.Width = 42*6 + 20;
            buildinsgwindow.Height = 300;
            buildinsgwindow.Visible = false;
            buildinsgwindow.Resizable = false;

            buildingssb = new ScrollBar(Manager, Orientation.Vertical);
            buildingssb.Init();
            buildingssb.Top = 0;
            buildingssb.Width = 20;
            buildingssb.Left = buildinsgwindow.Width - buildingssb.Width - 20;
            buildingssb.Height = buildinsgwindow.Height - 40;
            buildingssb.Parent = buildinsgwindow;
            buildingssb.ValueChanged += buildingssb_ValueChanged;

            buildingsbuttons = new Button[dbobject.Data.Count];
            buildingsbuttonslabel = new Label[dbobject.Data.Count];
            int i = 0;
            foreach (var dbo in dbobject.Data) {
                buildingsbuttons[i] = new Button(Manager);
                buildingsbuttons[i].Init();
                buildingsbuttons[i].Text = dbo.Value.Name;
                buildingsbuttons[i].Width = 40;
                buildingsbuttons[i].Height = 40;
                buildingsbuttons[i].Left = i%5*42;
                buildingsbuttons[i].Top = i/5*42;
                int[] tg = {buildingsbuttons[i].Top, dbo.Key};
                buildingsbuttons[i].Tag = tg;
                buildingsbuttons[i].Anchor = Anchors.Bottom;
                buildingsbuttons[i].Parent = buildinsgwindow;
                buildingsbuttons[i].Glyph = new Glyph(object_tex, GetTexRectFromN(dbo.Value.MetatexN));
                buildingsbuttons[i].ToolTip = new ToolTip(Manager);
                buildingsbuttons[i].ToolTip.Text = dbo.Value.Name + " id " + dbo.Key;
                buildingsbuttons[i].Click += Buildingsbutton_Click;
                iss.n.Add(dbo.Key, new LocalItem {id = dbo.Key, count = 0});

                buildingsbuttonslabel[i] = new Label(Manager);
                buildingsbuttonslabel[i].Init();
                buildingsbuttonslabel[i].Text = "0";
                buildingsbuttonslabel[i].Width = 40;
                buildingsbuttonslabel[i].Height = 40;
                buildingsbuttonslabel[i].Left = i%5*42;
                buildingsbuttonslabel[i].Top = i/5*42;
                buildingsbuttonslabel[i].Parent = buildinsgwindow;

                i++;
            }

            Manager.Add(buildinsgwindow);

            #endregion

            #region Ingamemesages

            Ingamemesages = new Window(Manager);
            Ingamemesages.Init();
            Ingamemesages.Text = "";
            Ingamemesages.Width = 480;
            Ingamemesages.Height = 200;
            Ingamemesages.Center();
            Ingamemesages.Visible = false;
            Ingamemesages.Resizable = false;

            IngamemesagesOk = new Button(Manager);
            IngamemesagesOk.Init();
            IngamemesagesOk.Text = "OK";
            IngamemesagesOk.Width = 72;
            IngamemesagesOk.Height = 24;
            IngamemesagesOk.Left = (Ingamemesages.ClientWidth/2) - (IngamemesagesOk.Width/2);
            IngamemesagesOk.Top = Ingamemesages.ClientHeight - IngamemesagesOk.Height - 8;
            IngamemesagesOk.Anchor = Anchors.Bottom;
            IngamemesagesOk.Parent = Ingamemesages;
            IngamemesagesOk.Click += IngamemesagesOk_Click;

            Ingamemesageslabel = new Label(Manager);
            Ingamemesageslabel.Left = 5;
            Ingamemesageslabel.Top = 5;
            Ingamemesageslabel.Text = "Text";
            Ingamemesageslabel.Parent = Ingamemesages;

            Manager.Add(Ingamemesages);

            #endregion
        }
示例#6
0
文件: Game1.cs 项目: slicedpan/demo
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            Manager = new Manager(this, graphics, "Default");
            Manager.AutoCreateRenderTarget = true;
            Manager.Initialize();

            ModelDrawer = new BruteModelDrawer(this);
            ConstraintDrawer = new LineDrawer(this);
            LightDrawer = new LightDrawer(this);
            space = new Space();
            space.ForceUpdater.Gravity = new Vector3(0.0f, -10.0f, 0.0f);
            Actors = new ActorContainer(space, ModelDrawer, ConstraintDrawer, LightDrawer);

            base.Initialize();
        }
示例#7
0
        private void InitializeControls()
        {
            manager = new Manager(CurrGame, CurrGame.Graphics, "Green") { SkinDirectory = CurrGame.ApplicationDirectory + @"\Content\GUI\Skin\" };
            try
            {
                manager.Initialize();
            }
            catch (Exception)
            {
                throw;
            }

            manager.AutoCreateRenderTarget = true;

            Console = new Console(manager);
            Console.Init();
            LoadConsoleCommands();
            manager.Add(Console);
            Console.ChannelsVisible = false;
            Console.MessageSent += Console_MessageSent;
            Console.MessageFormat = ConsoleMessageFormats.None;
            Console.Width = manager.ScreenWidth;
            Console.Channels.Add(new ConsoleChannel(0, "[System]", Color.Orange));
            Console.Channels.Add(new ConsoleChannel(1, "[User]", Color.White));
            Console.Channels.Add(new ConsoleChannel(2, "[Error]", Color.DarkRed));
            Console.SelectedChannel = 1;
            Console.Hide();

            tabControl = new TabControl(manager);
            tabControl.Init();
            tabControl.Left = CurrGame.CreepFieldWidth;
            tabControl.Top = 0;
            tabControl.Width = CurrGame.Width - CurrGame.CreepFieldWidth;
            tabControl.Height = CurrGame.Height;

            #region Gameplaypage

            GameplayPage = tabControl.AddPage();
            GameplayPage.Init();
            GameplayPage.Text = "Spiel";

            #region Turmauswahl

            var thumbnailBox = new GroupBox(manager);
            thumbnailBox.Init();
            thumbnailBox.Parent = GameplayPage;
            thumbnailBox.Left = 2;
            thumbnailBox.Top = 2;
            thumbnailBox.Width = thumbnailBox.Parent.Width - 4;
            thumbnailBox.Height = 100;

            int counter = 0;
            foreach (TowerClass towerClass in GamePlayScreen.TowerManager.TowerClassList)
            {
                var towerButton = new ImageButton(manager)
                                      {
                                          Image = GamePlayScreen.TowerManager.GetThumbnail(towerClass.TowerKey),
                                          SizeMode = SizeMode.Stretched,
                                          Top = 14,
                                          Tag = towerClass
                                      };
                towerButton.Width = towerButton.Height = 60;
                towerButton.Left = 6 + counter * (towerButton.Width + 5);
                towerButton.Click += towerButton_Click;
                towerButton.MouseOver += towerButton_MouseOver;
                towerButton.MouseOut += towerButton_MouseOut;
                towerButton.Init();
                thumbnailBox.Add(towerButton);
                BuyTowerButtons.Add(towerButton);
                counter++;
            }

            thumbnailBox.AutoScroll = true;

            var scrollBar = new ScrollBar(manager, Orientation.Horizontal);
            scrollBar.Init();
            thumbnailBox.Add(scrollBar);
            scrollBar.Visible = false;

            #endregion

            #region Informationen

            var infoBox = new GroupBox(manager);
            infoBox.Init();
            infoBox.Parent = GameplayPage;
            infoBox.Text = "Informationen";
            infoBox.Width = infoBox.Parent.Width - 4;
            infoBox.Height = 110;
            infoBox.Left = 2;
            infoBox.Top = thumbnailBox.Top + thumbnailBox.Height + 2;

            CreepNumber = new Label(manager);
            CreepNumber.Init();
            CreepNumber.Parent = infoBox;
            CreepNumber.Top = 14;
            CreepNumber.Left = 4;
            CreepNumber.Width = CreepNumber.Parent.Width - 4;
            CreepNumber.ToolTip = new ToolTip(manager) { Text = "So viele Creeps sind momentan\nauf dem Spielfeld" };
            CreepNumber.Passive = false;

            CreepHealth = new Label(manager);
            CreepHealth.Init();
            CreepHealth.Parent = infoBox;
            CreepHealth.Top = CreepNumber.Top + CreepNumber.Height + 2;
            CreepHealth.Left = CreepNumber.Left;
            CreepHealth.Width = CreepHealth.Parent.Width - 4;
            CreepHealth.ToolTip = new ToolTip(manager) { Text = "Die Gesamtenergie aller auf dem\nSpielfeld befindlicher Creeps" };
            CreepHealth.Passive = false;

            Money = new Label(manager);
            Money.Init();
            Money.Parent = infoBox;
            Money.Top = CreepHealth.Top + CreepHealth.Height + 2;
            Money.Left = CreepNumber.Left;
            Money.Width = Money.Parent.Width - 4;
            Money.ToolTip = new ToolTip(manager) { Text = "So viel Geld besitzt der Spieler" };
            Money.Passive = false;

            OwnHealth = new Label(manager);
            OwnHealth.Init();
            OwnHealth.Parent = infoBox;
            OwnHealth.Top = Money.Top + Money.Height + 2;
            OwnHealth.Left = CreepNumber.Left;
            OwnHealth.Width = OwnHealth.Parent.Width - 4;
            OwnHealth.ToolTip = new ToolTip(manager) { Text = "So viel Energie hat der Spieler noch" };
            OwnHealth.Passive = false;

            Points = new Label(manager);
            Points.Init();
            Points.Parent = infoBox;
            Points.Top = OwnHealth.Top + OwnHealth.Height + 2;
            Points.Left = CreepNumber.Left;
            Points.Width = Points.Parent.Width - 4;
            Points.ToolTip = new ToolTip(manager) { Text = "So viele Punkte hat der Spieler schon.\nDie Punkte setzen sich aus Energie\nund Geschwindigkeit der Creeps zusammen.\nJe näher ein Gegner am Ziel ist, desto mehr\nPunkte gibt er." };
            Points.Passive = false;

            #endregion

            #region Waves

            var waveBox = new GroupBox(manager);
            waveBox.Init();
            waveBox.Parent = GameplayPage;
            waveBox.Text = "Waves";
            waveBox.Left = 2;
            waveBox.Top = infoBox.Top + infoBox.Height + 2;
            waveBox.Width = waveBox.Parent.Width - 4;
            waveBox.Height = 137;

            WaveNumber = new Label(manager);
            WaveNumber.Init();
            WaveNumber.Parent = waveBox;
            WaveNumber.Top = 14;
            WaveNumber.Left = 4;
            WaveNumber.Width = WaveNumber.Parent.Width - 4;

            RealWaveNumber = new Label(manager);
            RealWaveNumber.Init();
            RealWaveNumber.Parent = waveBox;
            RealWaveNumber.Top = WaveNumber.Top + WaveNumber.Height + 2;
            RealWaveNumber.Left = WaveNumber.Left;
            RealWaveNumber.Width = RealWaveNumber.Parent.Width - 4;

            CreepsLeft = new Label(manager);
            CreepsLeft.Init();
            CreepsLeft.Parent = waveBox;
            CreepsLeft.Top = RealWaveNumber.Top + RealWaveNumber.Height + 2;
            CreepsLeft.Left = WaveNumber.Left;
            CreepsLeft.Width = CreepsLeft.Parent.Width - 4;
            CreepsLeft.Passive = false;
            CreepsLeft.ToolTip = new ToolTip(manager) { Text = "So viele Creeps werden noch im Level erscheinen,\nbevor die Aktuelle Welle vorbei ist." };

            CreepHealthLevel = new Label(manager);
            CreepHealthLevel.Init();
            CreepHealthLevel.Parent = waveBox;
            CreepHealthLevel.Top = CreepsLeft.Top + CreepsLeft.Height + 2;
            CreepHealthLevel.Left = WaveNumber.Left;
            CreepHealthLevel.Width = CreepHealthLevel.Parent.Width - 4;
            CreepHealthLevel.Passive = false;
            CreepHealthLevel.ToolTip = new ToolTip(manager) { Text = "Wenn alle Waves eines Levels fertig sind, werden die Waves von Anfang anwiederholt.\nAllerdings steigt die Energie der Creeps dabei.\nDas Gesundheitsniveau liegt dieser Energie zugrunde." };

            TimeLeftNextWave = new Label(manager);
            TimeLeftNextWave.Init();
            TimeLeftNextWave.Parent = waveBox;
            TimeLeftNextWave.Top = CreepHealthLevel.Top + CreepHealthLevel.Height + 2;
            TimeLeftNextWave.Left = WaveNumber.Left;
            TimeLeftNextWave.Width = TimeLeftNextWave.Parent.Width - 4;

            var nextWaveButton = new Button(manager);
            nextWaveButton.Init();
            nextWaveButton.Parent = waveBox;
            nextWaveButton.Text = "Nächste Welle";
            nextWaveButton.Left = 2;
            nextWaveButton.Top = TimeLeftNextWave.Top + TimeLeftNextWave.Height + 2;
            nextWaveButton.Width = nextWaveButton.Parent.Width - 4;
            nextWaveButton.Click += delegate { GamePlayScreen.StartNextWave(); };

            #endregion

            #region Spielsteuerung

            var gameBox = new GroupBox(manager);
            gameBox.Init();
            gameBox.Text = "Spielsteuerung";
            gameBox.Parent = GameplayPage;
            gameBox.Width = gameBox.Parent.Width - 4;
            gameBox.Height = 200;
            gameBox.Left = 2;
            gameBox.Top = waveBox.Top + waveBox.Height + 2;

            var playButton = new ImageButton(manager)
                                 {
                                     Image =
                                         CurrGame.Content.Load<Texture2D>(CurrGame.ApplicationDirectory + "\\Content\\GUI\\play"),
                                     SizeMode = SizeMode.Stretched,
                                     Top = 14,
                                     Left = 2,
                                     Width = 50
                                 };
            playButton.Height = playButton.Width;
            playButton.Click += ((sender, e) => GamePlayScreen.StartGame());
            playButton.Init();

            var pauseButton = new ImageButton(manager)
                                  {
                                      Image =
                                          CurrGame.Content.Load<Texture2D>(CurrGame.ApplicationDirectory +
                                                                           "\\Content\\GUI\\pause"),
                                      SizeMode = SizeMode.Stretched,
                                      Top = 14,
                                      Left = playButton.Left + playButton.Width + 4
                                  };
            pauseButton.Width = pauseButton.Height = playButton.Width;
            pauseButton.Click += ((sender, e) => GamePlayScreen.StopGame());
            pauseButton.Init();

            gameBox.Add(playButton);
            gameBox.Add(pauseButton);

            #endregion

            RefreshGameInformation();

            #endregion

            #region Optionspage

            OptionsPage = tabControl.AddPage();
            OptionsPage.Text = "Optionen";

            #endregion

            #region SaveLoadPage

            #endregion

            manager.Add(tabControl);
        }
        public override void LoadContent(ContentManager contentloader)
        {
            _guiman = new Manager(_gamemanager.Game, _gamemanager.Graphics, "Default");
            _guiman.Initialize();

            _serverbrowsingmenu = new Window(_guiman);
            _serverbrowsingmenu.Init();
            _serverbrowsingmenu.Resizable = false;
            _serverbrowsingmenu.Movable = false;
            _serverbrowsingmenu.CloseButtonVisible = false;
            _serverbrowsingmenu.Text = "Server Browser";
            _serverbrowsingmenu.Width = 300;
            _serverbrowsingmenu.Height = 400;
            _serverbrowsingmenu.Center();
            _serverbrowsingmenu.Visible = true;
            _serverbrowsingmenu.BorderVisible = true;

            _serversbox = new ListBox(_guiman);
            _serversbox.Init();
            //servers.SetPosition(50, 50);
            _serversbox.Left = 50;
            _serversbox.Top = 150;
            _serversbox.Width = 200;
            _serversbox.Height = 200;
            _serversbox.Anchor = Anchors.Bottom;
            _serversbox.Parent = _serverbrowsingmenu;

            _join = new Button(_guiman);
            _join.Init();
            _join.Text = "Join";
            _join.Width = 200;
            _join.Height = 50;
            _join.Left = 50;
            _join.Top = 0;
            _join.Anchor = Anchors.Bottom;
            _join.Parent = _serverbrowsingmenu;

            _refresh = new Button(_guiman);
            _refresh.Init();
            _refresh.Text = "Refresh";
            _refresh.Width = 200;
            _refresh.Height = 50;
            _refresh.Left = 50;
            _refresh.Top = 50;
            _refresh.Anchor = Anchors.Bottom;
            _refresh.Parent = _serverbrowsingmenu;

            _back = new Button(_guiman);
            _back.Init();
            _back.Text = "Back";
            _back.Width = 200;
            _back.Height = 50;
            _back.Left = 50;
            _back.Top = 100;
            _back.Anchor = Anchors.Bottom;
            _back.Parent = _serverbrowsingmenu;

            _guiman.Cursor = _guiman.Skin.Cursors["Default"].Resource;
            _guiman.Add(_serverbrowsingmenu);

            _gamemanager.Game.IsMouseVisible = true;
        }