예제 #1
0
        public override void Add(ScreenManager screenManager)
        {
            base.Add(screenManager);
            Window.Focused = true;
            Bar = new StatusBar(Manager) { Top = Window.Height - 24, Width = Window.Width };
            Bar.Init();
            Window.Add(Bar);
            StatsLabel = new Label(Manager) { Top = 4, Left = 8, Width = Window.Width - 16, Text = "" };
            StatsLabel.Init();
            Bar.Add(StatsLabel);

            LeaveButton = new Button(Manager) { Right = Bar.ClientWidth - 4, Top = 4, Height = 16, Text = "Lobby" };
            LeaveButton.Init();
            LeaveButton.Click += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e)
            {
                ScreenManager.SwitchScreen(new LobbyScreen());
            });
            Bar.Add(LeaveButton);

            Sidebar = new StatusBar(Manager);
            Sidebar.Init();
            Sidebar.SetSize(SidebarWidth, (int)((Window.Height - Bar.Height)));
            Sidebar.SetPosition(Window.Width - Sidebar.Width, 0);
            Window.Add(Sidebar);

            PlayerList = new ListBox(Manager);
            PlayerList.Init();
            PlayerList.SetSize(SidebarWidth, (int)((Window.Height - Bar.Height - 4) * .25f));
            PlayerList.SetPosition(1, 2);
            Sidebar.Add(PlayerList);

            ChatBox = new Console(Manager);
            Manager.Add(ChatBox);
            ChatBox.Init();
            ChatBox.SetSize(PlayerList.Width, (int)((Window.Height - Bar.Height - 4) * .75f));
            ChatBox.SetPosition(Sidebar.Left + 1, PlayerList.Bottom + 1);
            ChatBox.ChannelsVisible = false;
            ChatBox.MessageSent += new ConsoleMessageEventHandler(SentChat);
            ChatBox.Channels.Add(new ConsoleChannel(0, "Global", Color.White));
            // Select default channel
            ChatBox.SelectedChannel = 0;
            // Do we want to add timestamp or channel name at the start of every message?
            ChatBox.MessageFormat = ConsoleMessageFormats.None;
            ChatBox.TextBox.TextChanged += TextBox_TextChanged;

            //Hide them until we recieve the Init packet
            ChatBox.Visible = PlayerList.Visible = Sidebar.Visible = false;
        }
        ////////////////////////////////////////////////////////////////////////////   
        public TaskEvents(Manager manager)
            : base(manager)
        {
            Height = 360;
              MinimumHeight = 99;
              MinimumWidth = 78;
              Text = "Events Test";
              Center();

              btn = new Button(manager);
              btn.Init();
              btn.Parent = this;
              btn.Left = 20;
              btn.Top = 20;
              btn.MouseMove += new MouseEventHandler(btn_MouseMove);
              btn.MouseDown += new MouseEventHandler(btn_MouseDown);
              btn.MouseUp += new MouseEventHandler(btn_MouseUp);
              btn.MouseOver += new MouseEventHandler(btn_MouseOver);
              btn.MouseOut += new MouseEventHandler(btn_MouseOut);
              btn.MousePress += new MouseEventHandler(btn_MousePress);
              btn.Click += new EventHandler(btn_Click);

              lst = new ListBox(manager);
              lst.Init();
              lst.Parent = this;
              lst.Left = 20;
              lst.Top = 60;
              lst.Width = 128;
              lst.Height = 128;
              lst.MouseMove += new MouseEventHandler(btn_MouseMove);
              lst.MouseDown += new MouseEventHandler(btn_MouseDown);
              lst.MouseUp += new MouseEventHandler(btn_MouseUp);
              lst.MouseOver += new MouseEventHandler(btn_MouseOver);
              lst.MouseOut += new MouseEventHandler(btn_MouseOut);
              lst.MousePress += new MouseEventHandler(btn_MousePress);
              lst.MouseScroll += new MouseEventHandler(lst_MouseScroll);
              lst.Click += new EventHandler(btn_Click);

              txt = new ListBox(manager);
              txt.Init();
              txt.Parent = this;
              txt.Left = 200;
              txt.Top = 8;
              txt.Width = 160;
              txt.Height = 300;
        }
예제 #3
0
        ////////////////////////////////////////////////////////////////////////////

        #endregion

        #region //// Construstors //////

        ////////////////////////////////////////////////////////////////////////////
        public ComboBox(Manager manager) : base(manager)
        {
            Height   = 20;
            Width    = 64;
            ReadOnly = true;

            btnDown = new Button(Manager);
            btnDown.Init();
            btnDown.Skin     = new SkinControl(Manager.Skin.Controls["ComboBox.Button"]);
            btnDown.CanFocus = false;
            btnDown.Click   += new EventHandler(btnDown_Click);
            Add(btnDown, false);

            lstCombo = new ListBox(Manager);
            lstCombo.Init();
            lstCombo.HotTrack        = true;
            lstCombo.Detached        = true;
            lstCombo.Visible         = false;
            lstCombo.Click          += new EventHandler(lstCombo_Click);
            lstCombo.FocusLost      += new EventHandler(lstCombo_FocusLost);
            lstCombo.Items           = items;
            manager.Input.MouseDown += new MouseEventHandler(Input_MouseDown);
        }
        ////////////////////////////////////////////////////////////////////////////       
        public ComboBox(Manager manager)
            : base(manager)
        {
            Height = 20;
              Width = 64;
              ReadOnly = true;

              btnDown = new Button(Manager);
              btnDown.Init();
              btnDown.Skin = new SkinControl(Manager.Skin.Controls["ComboBox.Button"]);
              btnDown.CanFocus = false;
              btnDown.Click += new EventHandler(btnDown_Click);
              Add(btnDown, false);

              lstCombo = new ListBox(Manager);
              lstCombo.Init();
              lstCombo.HotTrack = true;
              lstCombo.Detached = true;
              lstCombo.Visible = false;
              lstCombo.Click += new EventHandler(lstCombo_Click);
              lstCombo.FocusLost += new EventHandler(lstCombo_FocusLost);
              lstCombo.Items = items;
              manager.Input.MouseDown += new MouseEventHandler(Input_MouseDown);
        }
        public void Initialize()
        {
            HeightCounter = 0;
            Width = parent.Width - LeftPadding * 2;

            #region /// GroupBox (back panel) ///
            backPanel = new Panel(manager);
            backPanel.Init();
            //backPanel.Left = Left;//change
            backPanel.Top = Top;
            backPanel.Width = Width;
            backPanel.Parent = parent;
            backPanel.Text = "";
            backPanel.Color = sidebar.master.BackColor;

            #endregion

            int WidthReduction = 15; //change

            #region  /// Inspector Address Label ///
            lblInspectorAddress = new Label(manager);
            lblInspectorAddress.Init();
            //lblInspectorAddress.Visible = false; //change
            lblInspectorAddress.Parent = backPanel;
            lblInspectorAddress.Top = HeightCounter; //HeightCounter += VertPadding + lblInspectorAddress.Height + 10;
            lblInspectorAddress.Width = Width - WidthReduction;
            lblInspectorAddress.Height = lblInspectorAddress.Height * 2; //HeightCounter += lblInspectorAddress.Height;
            labelDoubleHeight = lblInspectorAddress.Height;
            //lblInspectorAddress.Left = LeftPadding;
            //lblInspectorAddress.Anchor = Anchors.Left;
            lblInspectorAddress.Text = ">No Node Selected<";
            bool changed = false;
            lblInspectorAddress.TextChanged += delegate(object s, EventArgs e)
            {
                if (!changed)
                {
                    changed = true;
                    Label l = (Label)s;
                    l.Text = l.Text.wordWrap(25);
                }
                changed = false;
            };
            #endregion
            //btnToggleFields = new Button(manager);
            //btnToggleFields.Init();
            //btnToggleFields.Parent = backPanel;
            //btnToggleFields.Left = LeftPadding + backPanel.Width - 30;
            //btnToggleFields.Width = 15;
            //btnToggleFields.Height = 20;
            //btnToggleFields.Top = HeightCounter + 10;
            //btnToggleFields.Text = "F";
            //btnToggleFields.Click += delegate(object s, EventArgs e)
            //{
            //    this.GenerateFields = !this.GenerateFields;
            //    //ResetInspectorBox(ActiveInspectorParent.obj);
            //    ActiveInspectorParent.DoubleClickItem(this);
            //};

            HeightCounter += lblInspectorAddress.Height;

            #region  /// Component List ///
            InsBox = new ListBox(manager);
            InsBox.Init();
            //manager.Add(InsBox);
            InsBox.Parent = backPanel;

            InsBox.Top = HeightCounter;
            InsBox.Left = 10;
            InsBox.Width = Width - WidthReduction;
            InsBox.Height = 140; HeightCounter += InsBox.Height;

            InsBox.HideSelection = false;
            InsBox.ItemIndexChanged += InsBox_ItemIndexChanged;
            InsBox.Click += InsBox_Click;
            InsBox.DoubleClick += InsBox_DoubleClick;
            InsBox.Refresh();

            sidebar.ui.SetScrollableControl(InsBox, InsBox_ChangeScrollPosition);

            #region  /// Context Menu ///
            contextMenuInsBox = new ContextMenu(manager);
            applyToAllNodesMenuItem = new MenuItem("Apply to Group");
            applyToAllNodesMenuItem.Click += applyToAllNodesMenuItem_Click;
            toggleComponentMenuItem = new MenuItem("Toggle Component");
            toggleComponentMenuItem.Click += toggleComponentMenuItem_Click;
            removeComponentMenuItem = new MenuItem("Remove Component");
            removeComponentMenuItem.Click += removeComponentMenuItem_Click;
            toggleBoolMenuItem = new MenuItem("Toggle");
            toggleBoolMenuItem.Click += toggleBoolMenuItem_Click;
            toggleLinkMenuItem = new MenuItem("Toggle link");
            toggleLinkMenuItem.Click += toggleLinkMenuItem_Click;
            removeLinkMenuItem = new MenuItem("Delete link");
            removeLinkMenuItem.Click += removeLinkMenuItem_Click;
            addComponentToLinkMenuItem = new MenuItem("Add Link Component");
            addComponentToLinkMenuItem.Click += AddComponentToLinkMenuItem_Click;

            contextMenuInsBox.Items.Add(applyToAllNodesMenuItem);

            InsBox.ContextMenu = contextMenuInsBox;
            #endregion

            #endregion

            #region  /// GroupPanel ///
            GroupPanel groupPanel = new GroupPanel(manager);
            groupPanel.Init();
            groupPanel.Parent = backPanel;
            //groupPanel.Visible = false;//change
            groupPanel.Anchor = Anchors.Left | Anchors.Top | Anchors.Right;
            groupPanel.Width = Width - WidthReduction;
            groupPanel.Top = HeightCounter;
            groupPanel.Height = 90; HeightCounter += VertPadding + groupPanel.Height;
            groupPanel.Left = InsBox.Left;
            groupPanel.Text = "Inspector Property";
            #endregion

            #region  /// PropertyEditPanel ///
            propertyEditPanel = new PropertyEditPanel(this, groupPanel);
            #endregion

            backPanel.Height = groupPanel.Top + groupPanel.Height;
        }
예제 #6
0
        private void InitializeControls()
        {
            _manager.Initialize();
            _manager.AutoCreateRenderTarget = true;

            _tabControl = new TabControl(_manager);
            _tabControl.Init();
            _tabControl.Left   = 600;
            _tabControl.Top    = 0;
            _tabControl.Width  = Width;
            _tabControl.Height = Height;
            _tabControl.Show();
            #region WavePage
            _wavePage      = _tabControl.AddPage();
            _wavePage.Text = "Waves";

            #region Constructors
            _health = new Label(_manager);
            _health.Init();
            _texture = new Label(_manager);
            _texture.Init();
            _speed = new Label(_manager);
            _speed.Init();
            _number = new Label(_manager);
            _number.Init();

            _waves = new ListBox(_manager);
            _waves.Init();
            _deleteWaveButton = new Button(_manager);
            _deleteWaveButton.Init();
            _addWaveButton = new Button(_manager);
            _addWaveButton.Init();
            _currentWave = new ListBox(_manager);
            _currentWave.Init();
            _addCreepsButton = new Button(_manager);
            _addCreepsButton.Init();
            _numberOfCreeps = new TextBox(_manager);
            _numberOfCreeps.Init();
            _speedOfCreeps = new TextBox(_manager);
            _speedOfCreeps.Init();
            _healthOfCreeps = new TextBox(_manager);
            _healthOfCreeps.Init();
            _creepTexture = new ComboBox(_manager);
            _creepTexture.Init();
            #endregion

            #region Properties
            _texture.Text   = "Textur";
            _texture.Top    = 2;
            _texture.Left   = 2;
            _texture.Parent = _wavePage;
            _wavePage.Add(_texture);

            _creepTexture.Items.AddRange(new[] { "Slyder", "Drone", "Ape", "Paw" });
            _creepTexture.Text      = "Slyder";
            _creepTexture.Width     = 80;
            _creepTexture.Left      = 2;
            _creepTexture.Top       = _texture.Top + _texture.Height + 2;
            _creepTexture.TextColor = Color.LightGray;
            _creepTexture.Parent    = _wavePage;

            _health.Text   = "Gesundheit";
            _health.Top    = 2;
            _health.Left   = _creepTexture.Left + _creepTexture.Width + 5;
            _health.Parent = _wavePage;

            _healthOfCreeps.Left      = _health.Left;
            _healthOfCreeps.Top       = _health.Top + _health.Height + 2;
            _healthOfCreeps.Width     = _health.Width;
            _healthOfCreeps.TextColor = Color.LightGray;
            _healthOfCreeps.Parent    = _wavePage;

            _speed.Text   = "Geschwindigkeit";
            _speed.Left   = _health.Left + _health.Width + 5;
            _speed.Top    = 2;
            _speed.Width  = 93;
            _speed.Parent = _wavePage;

            _speedOfCreeps.Left      = _speed.Left;
            _speedOfCreeps.Top       = _speed.Top + _speed.Height + 2;
            _speedOfCreeps.Width     = _speed.Width;
            _speedOfCreeps.TextColor = Color.LightGray;
            _speedOfCreeps.Parent    = _wavePage;

            _number.Text   = "Anzahl";
            _number.Top    = 2;
            _number.Left   = _speed.Left + _speed.Width + 5;
            _number.Width  = 40;
            _number.Parent = _wavePage;

            _numberOfCreeps.Left      = _number.Left;
            _numberOfCreeps.Top       = _number.Top + _number.Height + 2;
            _numberOfCreeps.Width     = _number.Width;
            _numberOfCreeps.TextColor = Color.LightGray;
            _numberOfCreeps.Parent    = _wavePage;

            _addCreepsButton.Text   = "Creeps hinzufügen";
            _addCreepsButton.Top    = _numberOfCreeps.Top + _numberOfCreeps.Height - _addCreepsButton.Height;
            _addCreepsButton.Left   = _numberOfCreeps.Left + _numberOfCreeps.Width + 5;
            _addCreepsButton.Width  = 120;
            _addCreepsButton.Parent = _wavePage;

            _currentWave.Left      = 2;
            _currentWave.Top       = _creepTexture.Top + _creepTexture.Height + 5;
            _currentWave.Width     = _addCreepsButton.Left + _addCreepsButton.Width;
            _currentWave.Height    = 150;
            _currentWave.TextColor = Color.LightGray;
            _currentWave.Parent    = _wavePage;

            _addWaveButton.Text   = "Wave hinzufügen";
            _addWaveButton.Left   = 2;
            _addWaveButton.Top    = _currentWave.Top + _currentWave.Height + 5;
            _addWaveButton.Width  = 150;
            _addWaveButton.Parent = _wavePage;

            _deleteWaveButton.Text   = "Wave löschen";
            _deleteWaveButton.Left   = _addWaveButton.Left + _addWaveButton.Width + 5;
            _deleteWaveButton.Top    = _currentWave.Top + _currentWave.Height + 5;
            _deleteWaveButton.Width  = _addWaveButton.Width;
            _deleteWaveButton.Parent = _wavePage;

            _waves.Left              = 2;
            _waves.Top               = _addWaveButton.Top + _addWaveButton.Height + 5;
            _waves.Width             = _currentWave.Width;
            _waves.Height            = 150;
            _waves.TextColor         = Color.LightGray;
            _waves.Parent            = _wavePage;
            _waves.ItemIndexChanged += _waves_ItemIndexChanged;
            #endregion

            #region Events
            _addCreepsButton.Click  += AddCreepsButton_Click;
            _addWaveButton.Click    += AddWaveButton_Click;
            _deleteWaveButton.Click += DeleteWaveButton_Click;
            #endregion
            #endregion

            #region SavePage
            _savePage      = _tabControl.AddPage();
            _savePage.Text = "Speichern & Laden";
            _path          = new TextBox(_manager);
            _path.Init();
            _path.Top      = 2;
            _path.Left     = 2;
            _path.Width    = 200;
            _path.Parent   = _savePage;
            _path.ReadOnly = true;

            _fileNameButton = new Button(_manager);
            _fileNameButton.Init();
            _fileNameButton.Text   = "...";
            _fileNameButton.Width  = 17;
            _fileNameButton.Height = _fileNameButton.Width;
            _fileNameButton.Top    = _path.Top + _path.Height / 2 - _fileNameButton.Height / 2;
            _fileNameButton.Left   = _path.Left + _path.Width + 2;
            _fileNameButton.Parent = _savePage;
            _fileNameButton.Click += delegate {
                var dlg = new SaveFileDialog {
                    Filter           = "Level-Dateien|*.xml",
                    InitialDirectory =
                        Path.GetFullPath(
                            Path.GetDirectoryName(
                                Assembly.GetExecutingAssembly().Location) +
                            @"\..\Content\Map")
                };
                dlg.ShowDialog();
                _path.Text = dlg.FileName;
            };

            _saveButton = new Button(_manager);
            _saveButton.Init();
            _saveButton.Top    = _path.Top + _path.Height + 2;
            _saveButton.Left   = 2;
            _saveButton.Text   = "Speichern";
            _saveButton.Width  = 120;
            _saveButton.Parent = _savePage;
            _saveButton.Click += delegate {
                if (_path.Text.Length > 0)
                {
                    string fileName = _path.Text;
                    Save(fileName);
                }
            };

            LoadButton = new Button(_manager);
            LoadButton.Init();
            LoadButton.Left   = 2;
            LoadButton.Top    = 50;
            LoadButton.Text   = "Laden";
            LoadButton.Width  = 120;
            LoadButton.Parent = _savePage;
            LoadButton.Click += LoadButton_Click;
            #endregion
            _manager.Add(_tabControl);
        }
예제 #7
0
        public override void Initialize()
        {
            //Create background sprite
            Sprite Background = SpriteManager.AddSprite(Global.CONFIG_BG, FlatRedBallServices.GlobalContentManager, m_Layer);

            //Resize sprite
            Background.ScaleX = Background.Texture.Width / SpriteManager.Camera.PixelsPerUnitAt(0) / 2.0f;
            Background.ScaleY = Background.Texture.Height / SpriteManager.Camera.PixelsPerUnitAt(0) / 2.0f;

            #region Initialize Hero Buttons
            m_HeroButtons = new HeroButton[Global.HEROBUTTON_MENU.Length];
            for (int i = 0; i < m_HeroButtons.Length; i++)
            {
                //Create buttons
                m_HeroButtons[i] = new HeroButton(
                    Global.GUIManager,
                    Global.HEROBUTTON_MENU[i],
                    Global.HEROBUTTON_LEFT,
                    Global.HEROBUTTON_TOP + (i * Global.HEROBUTTON_SPACE),
                    "Images/HeroImage" + i,
                    Global.HEROBUTTON_INFO[i]);
                m_HeroButtons[i].Init();

                //Add the buttons
                m_Panel.Add(m_HeroButtons[i]);
                Global.GUIManager.Add(m_HeroButtons[i]);

                //Set event handler
                m_HeroButtons[i].Click += HeroChoose;
            }
            #endregion

            #region Initialize Board File ListBox
            //Create ListBox
            m_FileListBox = new ListBox(Global.GUIManager);

            //Init ListBox
            m_FileListBox.Init();
            m_FileListBox.Left = Global.BOARD_LISTMENU_LEFT;
            m_FileListBox.Top = Global.BOARD_LISTMENU_TOP;
            m_FileListBox.Width = 228;
            m_FileListBox.Height = 400;

            //Fill ListBox with GameBoard file list
            List<string> m_TempList = null;
            m_TempList = FileManager.GetAllFilesInDirectory(Global.LEVEL_FOLDER, Global.BOARD_EXTENSION, 0);

            //Remove Extension and Path
            for (int i = 0; i < m_TempList.Count; ++i)
            {
                m_TempList[i] = FileManager.RemovePath(m_TempList[i]);
                m_TempList[i] = FileManager.RemoveExtension(m_TempList[i]);
                m_FileListBox.Items.Add(m_TempList[i]);
            }

            //add ListBox to GUI manager and State Panel List
            Global.GUIManager.Add(m_FileListBox);
            m_Panel.Add(m_FileListBox);
            #endregion

            #region Initialize Buttons
            m_MenuButtons = new Button[Global.CONFIG_MENU.Length];
            for (int i = 0; i < m_MenuButtons.Length; i++)
            {
                //Create buttons
                m_MenuButtons[i] = new Button(Global.GUIManager);
                m_MenuButtons[i].Text = Global.CONFIG_MENU[i];
                m_MenuButtons[i].Top = Global.CONFIGBUTTON_TOP + (i * Global.CONFIGBUTTON_SPACE);
                m_MenuButtons[i].Left = Global.CONFIGBUTTON_LEFT;
                m_MenuButtons[i].Width = Global.CONFIGBUTTON_WIDTH;
                m_MenuButtons[i].Init();

                //Add the buttons
                m_Panel.Add(m_MenuButtons[i]);
                Global.GUIManager.Add(m_MenuButtons[i]);

                //Set event handler
                m_MenuButtons[i].Click += MenuChoose;
            }
            #endregion

            //Set default selection
            m_FileListBox.ItemIndex			= 0;
            m_FileListBox.Focused			= true;
            m_HeroButtons[0].m_Highlight	= true;
        }
예제 #8
0
        public void Init()
        {
            texture = new Texture2D(manager.GraphicsDevice, 1, 1);
            texture.SetData<Color>(new Color[] { Color.White });

            #region Window
            window = new Window(manager) ;
            window.Init();
            window.Text = "Tank Creation";
            window.Width = 600;
            window.Height = 500;
            window.Center();
            window.Visible = true;
            window.CloseButtonVisible = false;
            #endregion

            #region ListBoxes

            #region Tank
            tankBoxLbl = new Label(manager);
            tankBoxLbl.Init();
            tankBoxLbl.Text = "Tanks: ";
            tankBoxLbl.Width = 100;
            tankBoxLbl.Height = 10;
            tankBoxLbl.Left = 20;
            tankBoxLbl.Top = 10;
            tankBoxLbl.Anchor = Anchors.Left;
            tankBoxLbl.Parent = window;

            tankBox = new ListBox(manager);
            tankBox.Init();
            tankBox.Width = 200;
            tankBox.Height = 75;
            tankBox.Left = 30;
            tankBox.Top = 30;
            tankBox.Anchor = Anchors.Left;
            tankBox.HideSelection = false;
            tankBox.Parent = window;
            foreach (String s in tanks)
            {
                tankBox.Items.Add(s);
            }
            tankBox.ItemIndexChanged += new TomShane.Neoforce.Controls.EventHandler(tankBox_ItemIndexChanged);
            #endregion

            #region Turret

            turretBoxLbl = new Label(manager);
            turretBoxLbl.Init();
            turretBoxLbl.Text = "Turrets: ";
            turretBoxLbl.Width = 50;
            turretBoxLbl.Height = 10;
            turretBoxLbl.Left = tankBoxLbl.Left;
            turretBoxLbl.Top = tankBox.Top + tankBox.Height + 20;
            turretBoxLbl.Anchor = Anchors.Left;
            turretBoxLbl.Parent = window;

            turretBox = new ListBox(manager);
            turretBox.Init();
            turretBox.Width = 200;
            turretBox.Height = 100;
            turretBox.Left = 30;
            turretBox.Top = turretBoxLbl.Top + turretBoxLbl.Height + 10;
            turretBox.Anchor = Anchors.Left;
            turretBox.HideSelection = false;
            turretBox.Parent = window;
            foreach (String s in tanks)
            {
                turretBox.Items.Add(s);
            }
            turretBox.ItemIndexChanged += new TomShane.Neoforce.Controls.EventHandler(turretBox_ItemIndexChanged);

            tPowerLbl = new Label(manager);
            tPowerLbl.Init();
            tPowerLbl.Text = "Power: ";
            tPowerLbl.Width = 50;
            tPowerLbl.Height = 10;
            tPowerLbl.Left = turretBox.Left;
            tPowerLbl.Top = turretBox.Top + turretBox.Height + 10;
            tPowerLbl.Anchor = Anchors.Left;
            tPowerLbl.Parent = window;

            tPower = new ProgressBar(manager);
            tPower.Init();
            tPower.Width = 75;
            tPower.Height = 10;
            tPower.Left = tPowerLbl.Left + tPowerLbl.Width + 5;
            tPower.Top = tPowerLbl.Top;
            tPower.Anchor = Anchors.Left;
            tPower.Parent = window;
            tPower.Value = 50;

            tRateLbl = new Label(manager);
            tRateLbl.Init();
            tRateLbl.Text = "Rate: ";
            tRateLbl.Width = 50;
            tRateLbl.Height = 10;
            tRateLbl.Left = turretBox.Left;
            tRateLbl.Top = tPowerLbl.Top + tPowerLbl.Height;
            tRateLbl.Anchor = Anchors.Left;
            tRateLbl.Parent = window;

            tRate = new ProgressBar(manager);
            tRate.Init();
            tRate.Width = 75;
            tRate.Height = 10;
            tRate.Left = tRateLbl.Left + tRateLbl.Width + 5;
            tRate.Top = tRateLbl.Top;
            tRate.Anchor = Anchors.Left;
            tRate.Parent = window;
            tRate.Value = 50;

            tRangeLbl = new Label(manager);
            tRangeLbl.Init();
            tRangeLbl.Text = "Range: ";
            tRangeLbl.Width = 50;
            tRangeLbl.Height = 15;
            tRangeLbl.Left = turretBox.Left;
            tRangeLbl.Top = tRateLbl.Top + tRateLbl.Height;
            tRangeLbl.Anchor = Anchors.Left;
            tRangeLbl.Parent = window;

            tRange = new ProgressBar(manager);
            tRange.Init();
            tRange.Width = 75;
            tRange.Height = 10;
            tRange.Left = tRangeLbl.Left + tRangeLbl.Width + 5;
            tRange.Top = tRangeLbl.Top;
            tRange.Anchor = Anchors.Left;
            tRange.Parent = window;
            tRange.Value = 50;

            #endregion

            #endregion

            #region TankStats

            armorLbl = new Label(manager);
            armorLbl.Init();
            armorLbl.Text = "Armor: ";
            armorLbl.Width = 50;
            armorLbl.Height = 24;
            armorLbl.Left = 20;
            armorLbl.Top = window.Height - 160; ;
            armorLbl.Anchor = Anchors.Left;
            armorLbl.Parent = window;

            armorBar = new ProgressBar(manager);
            armorBar.Init();
            armorBar.Width = 150;
            armorBar.Height = 24;
            armorBar.Left = armorLbl.Left + armorLbl.Width + 20; ;
            armorBar.Top = armorLbl.Top;
            armorBar.Anchor = Anchors.Left;
            armorBar.Parent = window;
            armorBar.Value = 50;

            speedLbl = new Label(manager);
            speedLbl.Init();
            speedLbl.Text = "Speed: ";
            speedLbl.Width = 50;
            speedLbl.Height = 24;
            speedLbl.Left = armorLbl.Left;
            speedLbl.Top = armorLbl.Top + armorLbl.Height;
            speedLbl.Anchor = Anchors.Left;
            speedLbl.Parent = window;

            speedBar = new ProgressBar(manager);
            speedBar.Init();
            speedBar.Width = 150;
            speedBar.Height = 24;
            speedBar.Left = speedLbl.Left + speedLbl.Width + 20; ;
            speedBar.Top = speedLbl.Top;
            speedBar.Anchor = Anchors.Left;
            speedBar.Parent = window;
            speedBar.Value = 50;

            ratioLbl = new Label(manager);
            ratioLbl.Init();
            ratioLbl.Text = "Ratio: ";
            ratioLbl.Width = 50;
            ratioLbl.Height = 24;
            ratioLbl.Left = armorLbl.Left;
            ratioLbl.Top = speedLbl.Top + speedLbl.Height + 20;
            ratioLbl.Anchor = Anchors.Left;
            ratioLbl.Parent = window;

            ratioSlide = new SliderBar(manager);
            ratioSlide.Init();
            ratioSlide.Width = 150;
            ratioSlide.Height = 20;
            ratioSlide.Left = ratioLbl.Left + ratioLbl.Width + 20; ;
            ratioSlide.Top = ratioLbl.Top + 3;
            ratioSlide.Anchor = Anchors.Left;
            ratioSlide.Parent = window;
            ratioSlide.Value = 50;
            ratioSlide.ValueChanged += new TomShane.Neoforce.Controls.EventHandler(ratioSlide_ValueChanged);

            #endregion

            #region Render Region
            image = new ImageBox(manager);
            image.Init();
            image.SizeMode = SizeMode.Stretched;
            image.Width = 200;
            image.Height = 150;
            image.Left = window.Width - image.Width - 70;
            image.Top = 40;
            image.Anchor = Anchors.Right;
            image.Parent = window;
            image.Image = texture;
            #endregion

            #region Skin Scrolling (Left/Right)
            ScrollSkinLeft = new Button(manager);
            ScrollSkinLeft.Init();
            ScrollSkinLeft.Width = 25;
            ScrollSkinLeft.Height = 25;
            ScrollSkinLeft.Left = window.Width - image.Width - 70;
            ScrollSkinLeft.Top = image.Top + image.Height + 10;
            ScrollSkinLeft.Text = " < ";
            ScrollSkinLeft.Parent = window;

            ScrollSkinRight = new Button(manager);
            ScrollSkinRight.Init();
            ScrollSkinRight.Width = 25;
            ScrollSkinRight.Height = 25;
            ScrollSkinRight.Left = image.Left + image.Width - ScrollSkinRight.Width;
            ScrollSkinRight.Top = image.Top + image.Height + 10;
            ScrollSkinRight.Text = " > ";
            ScrollSkinRight.Parent = window;
            #endregion

            #region Skin Label
            SkinLabel = new Label(manager);
            SkinLabel.Init();
            SkinLabel.Alignment = Alignment.MiddleCenter;
            SkinLabel.Height = 15;
            SkinLabel.Width = 100;
            SkinLabel.Left = ScrollSkinRight.Left - 120;
            SkinLabel.Top = image.Top + image.Width - 33;
            SkinLabel.Text = "Skin";
            SkinLabel.Parent = window;
            #endregion

            #region Color Choosing
            redLbl = new Label(manager);
            redLbl.Init();
            redLbl.Text = "Red: ";
            redLbl.Width = 50;
            redLbl.Height = 24;
            redLbl.Left = image.Left;
            redLbl.Top = ScrollSkinLeft.Top + ScrollSkinLeft.Height + 20;
            redLbl.Anchor = Anchors.Left;
            redLbl.Parent = window;

            red = new SliderBar(manager);
            red.Init();
            red.Width = 120;
            red.Height = 15;
            red.Left = redLbl.Left + redLbl.Width + 20;
            red.Top = ScrollSkinLeft.Top + ScrollSkinLeft.Height + 25;
            red.Anchor = Anchors.Left;
            red.Parent = window;
            red.Value = 50;
            red.ValueChanged += new TomShane.Neoforce.Controls.EventHandler(Color_Changed);

            greenLbl = new Label(manager);
            greenLbl.Init();
            greenLbl.Text = "Green: ";
            greenLbl.Width = 50;
            greenLbl.Height = 24;
            greenLbl.Left = redLbl.Left;
            greenLbl.Top = redLbl.Top + redLbl.Height;
            greenLbl.Anchor = Anchors.Left;
            greenLbl.Parent = window;

            green = new SliderBar(manager);
            green.Init();
            green.Width = red.Width;
            green.Height = red.Height;
            green.Left = greenLbl.Left + greenLbl.Width + 20;
            green.Top = greenLbl.Top + 5;
            green.Anchor = Anchors.Left;
            green.Parent = window;
            green.Value = 50;
            green.ValueChanged += new TomShane.Neoforce.Controls.EventHandler(Color_Changed);

            blueLbl = new Label(manager);
            blueLbl.Init();
            blueLbl.Text = "Blue: ";
            blueLbl.Width = 50;
            blueLbl.Height = 24;
            blueLbl.Left = redLbl.Left;
            blueLbl.Top = greenLbl.Top + greenLbl.Height;
            blueLbl.Anchor = Anchors.Left;
            blueLbl.Parent = window;

            blue = new SliderBar(manager);
            blue.Init();
            blue.Width = red.Width;
            blue.Height = red.Height;
            blue.Left = blueLbl.Left + blueLbl.Width + 20; ;
            blue.Top = blueLbl.Top + 5;
            blue.Anchor = Anchors.Left;
            blue.Parent = window;
            blue.Value = 50;
            blue.ValueChanged += new TomShane.Neoforce.Controls.EventHandler(Color_Changed);
            #endregion

            #region Tank Name
            name = new Label(manager);
            name.Init();
            name.Text = "Tank Name: ";
            name.Width = 100;
            name.Height = 24;
            name.Left = redLbl.Left;
            name.Top = blueLbl.Top + blueLbl.Height + 20;
            name.Anchor = Anchors.Left;
            name.Parent = window;

            nameBox = new TextBox(manager);
            nameBox.Init();
            nameBox.Text = "";
            nameBox.Width = 180;
            nameBox.Height = 24;
            nameBox.Left = name.Left + 10;
            nameBox.Top = name.Top + name.Height;
            nameBox.Anchor = Anchors.Left;
            nameBox.Parent = window;

            #endregion

            #region Buttons
            create = new Button(manager);
            create.Init();
            create.Text = "Create";
            create.Width = 90;
            create.Height = 24;
            create.Left = window.Width - create.Width - 40; ;
            create.Top = ratioLbl.Top;
            create.Anchor = Anchors.Left;
            create.Parent = window;

            cancel = new Button(manager);
            cancel.Init();
            cancel.Text = "Cancel";
            cancel.Width = 80;
            cancel.Height = 24;
            cancel.Left = create.Left - cancel.Width - 60;
            cancel.Top = create.Top;
            cancel.Anchor = Anchors.Right;
            cancel.Parent = window;
            #endregion
        }
예제 #9
0
        public void Init()
        {
            texture = new Texture2D(manager.GraphicsDevice, 1, 1);
            texture.SetData<Color>(new Color[] { Color.White });

            window = new Window(manager) ;
            window.Init();
            window.Text = "Tank List";
            window.Width = 600;
            window.Height = 500;
            window.Center();
            window.Visible = true;
            window.CloseButtonVisible = false;

            play = new Button(manager);
            play.Init();
            play.Text = "Play";
            play.Width = 100;
            play.Height = 24;
            play.Left = window.Width - play.Width - 40;
            play.Top = window.Height - 90;
            play.Anchor = Anchors.Right;
            play.Parent = window;

            create = new Button(manager);
            create.Init();
            create.Text = "Create New Tank";
            create.Width = 150;
            create.Height = 24;
            create.Left = 30;
            create.Top = window.Height - 160;
            create.Anchor = Anchors.Left;
            create.Parent = window;

            edit = new Button(manager);
            edit.Init();
            edit.Text = "Edit Tank";
            edit.Width = 100;
            edit.Height = 24;
            edit.Left = 30;
            edit.Top = window.Height - 125;
            edit.Anchor = Anchors.Left;
            edit.Parent = window;

            delete = new Button(manager);
            delete.Init();
            delete.Text = "Delete Tank";
            delete.Width = 100;
            delete.Height = 24;
            delete.Left = edit.Left + edit.Width + 30;
            delete.Top = edit.Top;
            delete.Anchor = Anchors.Left;
            delete.Parent = window;

            back = new Button(manager);
            back.Init();
            back.Text = "Back";
            back.Width = 150;
            back.Height = 24;
            back.Left = 30;
            back.Top = play.Top;
            back.Anchor = Anchors.Left;
            back.Parent = window;

            listbox = new ListBox(manager);
            listbox.Init();
            listbox.Width = 225;
            listbox.Height = 275;
            listbox.Left = 30;
            listbox.Top = 40;
            listbox.Anchor = Anchors.Left;
            listbox.HideSelection = false;
            listbox.Parent = window;
            listbox.ItemIndexChanged += new TomShane.Neoforce.Controls.EventHandler(listbox_ItemIndexChanged);

            image = new ImageBox(manager);
            image.Init();
            image.Image = texture;
            image.SizeMode = SizeMode.Stretched;
            image.Width = 200;
            image.Height = 150;
            image.Left = window.Width - image.Width - 70;
            image.Top = 40;
            image.Anchor = Anchors.Right;
            image.Parent = window;

            RankImage = new ImageBox(manager);
            RankImage.Init();
            //RankImage.Image = null;
            RankImage.SizeMode = SizeMode.Stretched;
            RankImage.Width = 32;
            RankImage.Height = 32;
            RankImage.Top = window.Height - 280;
            RankImage.Left = window.Width - RankImage.Width - 240;
            RankImage.Anchor = Anchors.Left;
            RankImage.Parent = window;

            rankLbl = new Label(manager);
            rankLbl.Init();
            rankLbl.Text = "Unknown";
            rankLbl.Top = window.Height - 275;
            rankLbl.Anchor = Anchors.Left;
            rankLbl.Width = 232 - RankImage.Width;
            rankLbl.Left = window.Width - rankLbl.Width - RankImage.Width;
            rankLbl.Height = 24;
            rankLbl.Parent = window;

            RankProgressBar = new ProgressBar(manager);
            RankProgressBar.Init();
            RankProgressBar.Value = 0;
            RankProgressBar.Top = window.Height - 243;
            RankProgressBar.Anchor = Anchors.Left;
            RankProgressBar.Width = 200;
            RankProgressBar.Left = window.Width - rankLbl.Width - 69;
            RankProgressBar.Height = 25;
            RankProgressBar.ToolTip = new ToolTip(manager);
            RankProgressBar.ToolTip.Text = "0 / 0";
            RankProgressBar.Parent = window;

            RankNextLabel = new Label(manager);
            RankNextLabel.Init();
            RankNextLabel.Top = window.Height - 215;
            RankNextLabel.Width = 200;
            RankNextLabel.Height = 15;
            RankNextLabel.Left = window.Width - RankImage.Width - 235;
            RankNextLabel.Text = "Progress is loading...";
            RankNextLabel.Parent = window;

            armorBar = new ProgressBar(manager);
            armorBar.Init();
            armorBar.Width = 150;
            armorBar.Height = 24;
            armorBar.Left = window.Width - armorBar.Width - 50; ;
            armorBar.Top = window.Height - 180;
            armorBar.Anchor = Anchors.Left;
            armorBar.Parent = window;
            armorBar.Value = 50;

            armorLbl = new Label(manager);
            armorLbl.Init();
            armorLbl.Text = "Armor: ";
            armorLbl.Width = 50;
            armorLbl.Height = 24;
            armorLbl.Left = armorBar.Left - armorLbl.Width - 20;
            armorLbl.Top = armorBar.Top;
            armorLbl.Anchor = Anchors.Left;
            armorLbl.Parent = window;

            speedBar = new ProgressBar(manager);
            speedBar.Init();
            speedBar.Width = 150;
            speedBar.Height = 24;
            speedBar.Left = window.Width - speedBar.Width - 50; ;
            speedBar.Top = window.Height - 150;
            speedBar.Anchor = Anchors.Left;
            speedBar.Parent = window;
            speedBar.Value = 50;

            speedLbl = new Label(manager);
            speedLbl.Init();
            speedLbl.Text = "Speed: ";
            speedLbl.Width = 50;
            speedLbl.Height = 24;
            speedLbl.Left = speedBar.Left - speedLbl.Width - 20;
            speedLbl.Top = speedBar.Top;
            speedLbl.Anchor = Anchors.Left;
            speedLbl.Parent = window;
        }
예제 #10
0
        /// <summary>
        /// Initializes UI elements
        /// </summary>
        private void InitControls()
        {
            //Map

            MapControl = new MapWindow(Manager);
            MapControl.Init();
            MapControl.SetPosition(201, 0);
            MapControl.Environment = Environment;
            MapControl.Renderer = Renderers[0];
            MapControl.SetSize(Height, Height);
            MapControl.Resizable = true;
            MapControl.Movable = true;
            Add(MapControl);

            //Left side bar

            SideBar = new SideBar(Manager);
            SideBar.Init();
            SideBar.StayOnBack = true;
            SideBar.Passive = true;
            SideBar.SetSize(200, Height);
            SideBar.Anchor = Anchors.Left | Anchors.Top | Anchors.Bottom;

            Add(SideBar);

            NewMapBtn = new Button(Manager);
            NewMapBtn.Init();
            NewMapBtn.Text = "New Map";
            NewMapBtn.SetPosition(25, 10);
            NewMapBtn.SetSize(150, 25);
            NewMapBtn.Anchor = Anchors.Top | Anchors.Left;
            NewMapBtn.Click += new EventHandler(NewMapBtn_Click);
            SideBar.Add(NewMapBtn);

            SelectMapBtn = new Button(Manager);
            SelectMapBtn.Init();
            SelectMapBtn.Text = "Select Map";
            SelectMapBtn.Click += new EventHandler(selectMapBtn_Click);
            SelectMapBtn.SetPosition(25, 40);
            SelectMapBtn.SetSize(150, 25);
            SelectMapBtn.Anchor = Anchors.Top | Anchors.Left;
            SideBar.Add(SelectMapBtn);

            DoOneStepBtn = new Button(Manager);
            DoOneStepBtn.Init();
            DoOneStepBtn.Text = "Do One Step";
            DoOneStepBtn.SetPosition(25, 90);
            DoOneStepBtn.SetSize(150, 25);
            DoOneStepBtn.Anchor = Anchors.Top | Anchors.Left;
            DoOneStepBtn.Click += new EventHandler(DoOneStepBtn_Click);
            SideBar.Add(DoOneStepBtn);

            DoOneRunBtn = new Button(Manager);
            DoOneRunBtn.Init();
            DoOneRunBtn.Text = "Do One Run";
            DoOneRunBtn.SetPosition(25, 120);
            DoOneRunBtn.SetSize(150, 25);
            DoOneRunBtn.Anchor = Anchors.Top | Anchors.Left;
            DoOneRunBtn.Click += new EventHandler(DoOneRunBtn_Click);
            SideBar.Add(DoOneRunBtn);

            NextRunBtn = new Button(Manager);
            NextRunBtn.Init();
            NextRunBtn.Text = "Next Run";
            NextRunBtn.SetPosition(25, 150);
            NextRunBtn.SetSize(150, 25);
            NextRunBtn.Anchor = Anchors.Top | Anchors.Left;
            NextRunBtn.Click += new EventHandler(NextRunBtn_Click);
            SideBar.Add(NextRunBtn);

            DoAllRunBtn = new Button(Manager);
            DoAllRunBtn.Init();
            DoAllRunBtn.Text = "Do All Run";
            DoAllRunBtn.SetPosition(25, 180);
            DoAllRunBtn.SetSize(150, 25);
            DoAllRunBtn.Anchor = Anchors.Top | Anchors.Left;
            DoAllRunBtn.Click += new EventHandler(DoAllRunBtn_Click);
            SideBar.Add(DoAllRunBtn);

            GrpBox = new GroupBox(Manager);
            GrpBox.Init();
            GrpBox.SetSize(SideBar.Width - 30, 135);
            GrpBox.SetPosition(5, 220);
            GrpBox.ClientWidth = 180;
            GrpBox.Text = "Display Options";
            GrpBox.TextColor = Color.Wheat;
            SideBar.Add(GrpBox);

            Label stepsLbl = new Label(Manager);
            stepsLbl.Init();
            stepsLbl.Text = "Steps:";
            stepsLbl.SetPosition(5, 25);
            GrpBox.Add(stepsLbl);

            StepsTxt = new TextBox(Manager);
            StepsTxt.Init();
            StepsTxt.Text = "100";
            StepsTxt.SetSize(100, 25);
            StepsTxt.SetPosition(5 + stepsLbl.Width, 20);
            StepsTxt.TextColor = Color.WhiteSmoke;
            StepsTxt.TextChanged += new EventHandler(TimeTxt_TextChanged);
            GrpBox.Add(StepsTxt);

            Label timeLbl = new Label(Manager);
            timeLbl.Init();
            timeLbl.Text = "Time:";
            timeLbl.SetPosition(5, 60);
            GrpBox.Add(timeLbl);

            TimeTxt = new TextBox(Manager);
            TimeTxt.Init();
            TimeTxt.Text = "20";
            TimeTxt.SetSize(100, 25);
            TimeTxt.SetPosition(5 + stepsLbl.Width, 55);
            TimeTxt.TextChanged += new EventHandler(TimeTxt_TextChanged);
            TimeTxt.TextColor = Color.WhiteSmoke;
            GrpBox.Add(TimeTxt);

            DisplayBtn = new Button(Manager);
            DisplayBtn.Init();
            DisplayBtn.Text = "Display";
            DisplayBtn.Click += new EventHandler(displayBtn_Click);
            DisplayBtn.SetSize(120, 25);
            DisplayBtn.SetPosition(50, 90);
            GrpBox.Add(DisplayBtn);

            Label rendererLbl = new Label(Manager);
            rendererLbl.Init();
            rendererLbl.Text = "Renderer:";
            rendererLbl.SetPosition(25, 360);
            Add(rendererLbl);

            RenderersComboBox = new ComboBox(Manager);
            RenderersComboBox.Init();
            RenderersComboBox.SetPosition(25, 385);
            RenderersComboBox.Width = 150;
            RenderersComboBox.TextColor = Color.Wheat;
            RenderersComboBox.Items.AddRange(Renderers);
            RenderersComboBox.ItemIndex = 0;
            RenderersComboBox.TextChanged += new EventHandler(RenderersComboBox_TextChanged);
            Add(RenderersComboBox);

            Button makeFullScreenBtn = new Button(Manager);
            makeFullScreenBtn.Init();
            makeFullScreenBtn.Text = "Fullscreen";
            makeFullScreenBtn.SetPosition(25, 475);
            makeFullScreenBtn.SetSize(150, 25);
            makeFullScreenBtn.Click += new EventHandler(makeFullScreenBtn_Click);
            makeFullScreenBtn.Anchor = Anchors.Top | Anchors.Left;
            SideBar.Add(makeFullScreenBtn);

            Button exitBtn = new Button(Manager);
            exitBtn.Init();
            exitBtn.Text = "Quit";
            exitBtn.SetPosition(25, 510);
            exitBtn.SetSize(150, 25);
            exitBtn.Click += new EventHandler(exitBtn_Click);
            exitBtn.Anchor = Anchors.Top | Anchors.Left;
            SideBar.Add(exitBtn);

            ExitDlg = new ExitDialog(Manager);
            ExitDlg.Init();
            ExitDlg.Closed += new WindowClosedEventHandler(ExitDlg_Closed);
            Manager.Add(ExitDlg);
            ExitDlg.Hide();

            //Right side bar
            SideBarRight = new SideBar(Manager);
            SideBarRight.Init();
            SideBarRight.StayOnBack = true;
            SideBarRight.Resizable = true;
            SideBarRight.ResizeEdge = Anchors.Left;
            SideBarRight.SetSize(200, Height);
            SideBarRight.SetPosition(Width - SideBarRight.Width, 0);
            SideBarRight.Anchor = Anchors.Right | Anchors.Top | Anchors.Bottom;
            Add(SideBarRight);

            GroupBox runParamsGrpBox = new GroupBox(Manager);
            runParamsGrpBox.Init();
            runParamsGrpBox.SetSize(SideBarRight.Width - 30, 155);
            runParamsGrpBox.SetPosition(5, 10);
            runParamsGrpBox.ClientWidth = 38;
            runParamsGrpBox.Text = "Run Statistics";
            runParamsGrpBox.TextColor = Color.Wheat;
            runParamsGrpBox.Anchor = Anchors.Left | Anchors.Right | Anchors.Top;
            SideBarRight.Add(runParamsGrpBox);

            Label runLbl1 = new Label(Manager);
            runLbl1.Init();
            runLbl1.Text = "Run:";
            runLbl1.SetPosition(10, 20);
            runLbl1.Width = 120;
            runParamsGrpBox.Add(runLbl1);

            Label runLbl2 = new Label(Manager);
            runLbl2.Init();
            runLbl2.Text = "0";
            runLbl2.SetPosition(runLbl1.Left + runLbl1.Width + 10, 20);
            runParamsGrpBox.Add(runLbl2);
            RunStatsLbls.Add(runLbl2);

            Label timeStepLbl1 = new Label(Manager);
            timeStepLbl1.Init();
            timeStepLbl1.Text = "Time step:";
            timeStepLbl1.SetPosition(10, 35);
            timeStepLbl1.Width = 120;
            runParamsGrpBox.Add(timeStepLbl1);

            Label timeStepLbl2 = new Label(Manager);
            timeStepLbl2.Init();
            timeStepLbl2.Text = "0";
            timeStepLbl2.SetPosition(timeStepLbl1.Left + timeStepLbl1.Width + 10, 35);
            runParamsGrpBox.Add(timeStepLbl2);
            RunStatsLbls.Add(timeStepLbl2);

            Label actionLbl1 = new Label(Manager);
            actionLbl1.Init();
            actionLbl1.Text = "Action:";
            actionLbl1.SetPosition(10, 60);
            actionLbl1.Width = 120;
            runParamsGrpBox.Add(actionLbl1);

            Label actionLbl2 = new Label(Manager);
            actionLbl2.Init();
            actionLbl2.Text = "0";
            actionLbl2.SetPosition(actionLbl1.Left + actionLbl1.Width + 10, 60);
            runParamsGrpBox.Add(actionLbl2);
            RunStatsLbls.Add(actionLbl2);

            Label dirtyOnMapLbl1 = new Label(Manager);
            dirtyOnMapLbl1.Init();
            dirtyOnMapLbl1.Text = "Dirty on map:";
            dirtyOnMapLbl1.SetPosition(10, 85);
            dirtyOnMapLbl1.Width = 120;
            runParamsGrpBox.Add(dirtyOnMapLbl1);

            Label dirtyOnMapLbl2 = new Label(Manager);
            dirtyOnMapLbl2.Init();
            dirtyOnMapLbl2.Text = "0";
            dirtyOnMapLbl2.SetPosition(dirtyOnMapLbl1.Left + dirtyOnMapLbl1.Width + 10, 85);
            runParamsGrpBox.Add(dirtyOnMapLbl2);
            RunStatsLbls.Add(dirtyOnMapLbl2);

            Label overAllDirtyLbl1 = new Label(Manager);
            overAllDirtyLbl1.Init();
            overAllDirtyLbl1.Text = "Overall dirty:";
            overAllDirtyLbl1.SetPosition(10, 100);
            overAllDirtyLbl1.Width = 120;
            runParamsGrpBox.Add(overAllDirtyLbl1);

            Label overAllDirtyLbl2 = new Label(Manager);
            overAllDirtyLbl2.Init();
            overAllDirtyLbl2.Text = "0";
            overAllDirtyLbl2.SetPosition(overAllDirtyLbl1.Left + overAllDirtyLbl1.Width + 10, 100);
            runParamsGrpBox.Add(overAllDirtyLbl2);
            RunStatsLbls.Add(overAllDirtyLbl2);

            Label cleanedDirtyLbl1 = new Label(Manager);
            cleanedDirtyLbl1.Init();
            cleanedDirtyLbl1.Text = "Cleaned dirty:";
            cleanedDirtyLbl1.SetPosition(10, 115);
            cleanedDirtyLbl1.Width = 120;
            runParamsGrpBox.Add(cleanedDirtyLbl1);

            Label cleanedDirtyLbl2 = new Label(Manager);
            cleanedDirtyLbl2.Init();
            cleanedDirtyLbl2.Text = "0";
            cleanedDirtyLbl2.SetPosition(cleanedDirtyLbl1.Left + cleanedDirtyLbl1.Width + 10, 115);
            runParamsGrpBox.Add(cleanedDirtyLbl2);
            RunStatsLbls.Add(cleanedDirtyLbl2);

            Label consumedEnergyLbl1 = new Label(Manager);
            consumedEnergyLbl1.Init();
            consumedEnergyLbl1.Text = "Consumed energy:";
            consumedEnergyLbl1.SetPosition(10, 130);
            consumedEnergyLbl1.Width = 120;
            runParamsGrpBox.Add(consumedEnergyLbl1);

            Label consumedEnergyLbl2 = new Label(Manager);
            consumedEnergyLbl2.Init();
            consumedEnergyLbl2.Text = "0";
            consumedEnergyLbl2.SetPosition(consumedEnergyLbl1.Left + consumedEnergyLbl1.Width + 10, 130);
            runParamsGrpBox.Add(consumedEnergyLbl2);
            RunStatsLbls.Add(consumedEnergyLbl2);
            ////
            GroupBox totalParamsGrpBox = new GroupBox(Manager);
            totalParamsGrpBox.Init();
            totalParamsGrpBox.SetSize(SideBarRight.Width - 30, 215);
            totalParamsGrpBox.SetPosition(5, runParamsGrpBox.Top + runParamsGrpBox.Height + 10);
            totalParamsGrpBox.ClientWidth = 38;
            totalParamsGrpBox.Text = "Total Statistics";
            totalParamsGrpBox.TextColor = Color.Wheat;
            totalParamsGrpBox.Anchor = Anchors.Left | Anchors.Right | Anchors.Top;
            SideBarRight.Add(totalParamsGrpBox);

            Label completedRunsLbl1 = new Label(Manager);
            completedRunsLbl1.Init();
            completedRunsLbl1.Text = "Completed Runs:";
            completedRunsLbl1.SetPosition(10, 20);
            completedRunsLbl1.Width = 120;
            totalParamsGrpBox.Add(completedRunsLbl1);

            Label completedRunsLbl2 = new Label(Manager);
            completedRunsLbl2.Init();
            completedRunsLbl2.Text = "0";
            completedRunsLbl2.SetPosition(completedRunsLbl1.Left + completedRunsLbl1.Width + 10, 20);
            totalParamsGrpBox.Add(completedRunsLbl2);
            TotalStatsLbls.Add(completedRunsLbl2);

            Label totalDirtyLbl1 = new Label(Manager);
            totalDirtyLbl1.Init();
            totalDirtyLbl1.Text = "Total dirty degree:";
            totalDirtyLbl1.SetPosition(10, 35);
            totalDirtyLbl1.Width = 120;
            totalParamsGrpBox.Add(totalDirtyLbl1);

            Label totalDirtyLbl2 = new Label(Manager);
            totalDirtyLbl2.Init();
            totalDirtyLbl2.Text = "0";
            totalDirtyLbl2.SetPosition(totalDirtyLbl1.Left + totalDirtyLbl1.Width + 10, 35);
            totalParamsGrpBox.Add(totalDirtyLbl2);
            TotalStatsLbls.Add(totalDirtyLbl2);

            Label totalCleanedLbl1 = new Label(Manager);
            totalCleanedLbl1.Init();
            totalCleanedLbl1.Text = "Total cleaned dirty:";
            totalCleanedLbl1.SetPosition(10, 60);
            totalCleanedLbl1.Width = 120;
            totalParamsGrpBox.Add(totalCleanedLbl1);

            Label totalCleanedLbl2 = new Label(Manager);
            totalCleanedLbl2.Init();
            totalCleanedLbl2.Text = "0";
            totalCleanedLbl2.SetPosition(totalCleanedLbl1.Left + totalCleanedLbl1.Width + 10, 60);
            totalParamsGrpBox.Add(totalCleanedLbl2);
            TotalStatsLbls.Add(totalCleanedLbl2);

            Label totalConsumedLbl1 = new Label(Manager);
            totalConsumedLbl1.Init();
            totalConsumedLbl1.Text = "Total consumed\nenergy:";
            totalConsumedLbl1.SetPosition(10, 85);
            totalConsumedLbl1.SetSize(120, 30);
            totalParamsGrpBox.Add(totalConsumedLbl1);

            Label totalConsumedLbl2 = new Label(Manager);
            totalConsumedLbl2.Init();
            totalConsumedLbl2.Text = "0";
            totalConsumedLbl2.SetPosition(totalConsumedLbl1.Left + totalConsumedLbl1.Width + 10, 85);
            totalParamsGrpBox.Add(totalConsumedLbl2);
            TotalStatsLbls.Add(totalConsumedLbl2);

            Label avarageDirtyLbl1 = new Label(Manager);
            avarageDirtyLbl1.Init();
            avarageDirtyLbl1.Text = "Average dirty\ndegree:";
            avarageDirtyLbl1.SetPosition(10, 115);
            avarageDirtyLbl1.SetSize(120, 30);
            totalParamsGrpBox.Add(avarageDirtyLbl1);

            Label avarageDirtyLbl2 = new Label(Manager);
            avarageDirtyLbl2.Init();
            avarageDirtyLbl2.Text = "0";
            avarageDirtyLbl2.SetPosition(avarageDirtyLbl1.Left + avarageDirtyLbl1.Width + 10, 115);
            totalParamsGrpBox.Add(avarageDirtyLbl2);
            TotalStatsLbls.Add(avarageDirtyLbl2);

            Label avarageCleanedLbl1 = new Label(Manager);
            avarageCleanedLbl1.Init();
            avarageCleanedLbl1.Text = "Average cleaned\ndirty:";
            avarageCleanedLbl1.SetPosition(10, 145);
            avarageCleanedLbl1.SetSize(120, 30);
            totalParamsGrpBox.Add(avarageCleanedLbl1);

            Label avarageCleanedLbl2 = new Label(Manager);
            avarageCleanedLbl2.Init();
            avarageCleanedLbl2.Text = "0";
            avarageCleanedLbl2.SetPosition(avarageCleanedLbl1.Left + avarageCleanedLbl1.Width + 10, 145);
            totalParamsGrpBox.Add(avarageCleanedLbl2);
            TotalStatsLbls.Add(avarageCleanedLbl2);

            Label avarageConsumedLbl1 = new Label(Manager);
            avarageConsumedLbl1.Init();
            avarageConsumedLbl1.Text = "Average consumed\nenergy:";
            avarageConsumedLbl1.SetPosition(10, 175);
            avarageConsumedLbl1.Width = 120;
            avarageConsumedLbl1.Height = 30;
            totalParamsGrpBox.Add(avarageConsumedLbl1);

            Label avarageConsumedLbl2 = new Label(Manager);
            avarageConsumedLbl2.Init();
            avarageConsumedLbl2.Text = "0";
            avarageConsumedLbl2.SetPosition(avarageConsumedLbl1.Left + avarageConsumedLbl1.Width + 10, 175);
            totalParamsGrpBox.Add(avarageConsumedLbl2);
            TotalStatsLbls.Add(avarageConsumedLbl2);
            /////
            //Select map

            OpenFileDialog = new Dialog(Manager);
            OpenFileDialog.Init();
            OpenFileDialog.Text = "Select map file";
            OpenFileDialog.Description.Visible = false;
            OpenFileDialog.Caption.Text = "";
            OpenFileDialog.Width = 600;
            OpenFileDialog.Resize += new ResizeEventHandler(OpenFileDialog_Resize);
            Manager.Add(OpenFileDialog);
            OpenFileDialog.Hide();

            FilesList = new ListBox(Manager);
            FilesList.Init();
            FilesList.Tag = System.Environment.CurrentDirectory;
            FilesList.SetPosition(0, 40);
            FilesList.ClientWidth = OpenFileDialog.Width - 15;
            FilesList.ClientHeight = OpenFileDialog.ClientHeight - 40;
            FilesList.TextColor = Color.Wheat;
            FilesList.DoubleClick += new EventHandler(FilesList_DoubleClick);
            GetFilesAndFolders();
            OpenFileDialog.Add(FilesList);

            LifeTimeLbl = new Label(Manager);
            LifeTimeLbl.Init();
            LifeTimeLbl.Text = "Life Time:";
            LifeTimeLbl.SetPosition(5, 10);
            OpenFileDialog.Add(LifeTimeLbl);

            LifeTimeTxt = new TextBox(Manager);
            LifeTimeTxt.Init();
            LifeTimeTxt.Text = "2000";
            LifeTimeTxt.SetSize(100, 25);
            LifeTimeTxt.SetPosition(5 + stepsLbl.Width, 5);
            LifeTimeTxt.TextColor = Color.WhiteSmoke;
            LifeTimeTxt.TextChanged += new EventHandler(TimeTxt_TextChanged);
            OpenFileDialog.Add(LifeTimeTxt);

            TestCaseLbl = new Label(Manager);
            TestCaseLbl.Init();
            TestCaseLbl.Text = "Test Case:";
            TestCaseLbl.SetPosition(LifeTimeTxt.Left + LifeTimeTxt.Width + 5, 10);
            OpenFileDialog.Add(TestCaseLbl);

            TestCaseTxt = new TextBox(Manager);
            TestCaseTxt.Init();
            TestCaseTxt.Text = "10";
            TestCaseTxt.SetSize(100, 25);
            TestCaseTxt.SetPosition(TestCaseLbl.Left + TestCaseLbl.Width + 5, 5);
            TestCaseTxt.TextColor = Color.WhiteSmoke;
            TestCaseTxt.TextChanged += new EventHandler(TimeTxt_TextChanged);
            OpenFileDialog.Add(TestCaseTxt);

            AgentLbl = new Label(Manager);
            AgentLbl.Init();
            AgentLbl.Text = "Agent:";
            AgentLbl.SetPosition(TestCaseTxt.Left + TestCaseTxt.Width + 5, 10);
            OpenFileDialog.Add(AgentLbl);

            AgentsComboBox = new ComboBox(Manager);
            AgentsComboBox.Init();
            AgentsComboBox.SetPosition(AgentLbl.Left + AgentLbl.Width - 10, 5);
            AgentsComboBox.Width = 150;
            AgentsComboBox.Height = 25;
            AgentsComboBox.TextColor = Color.Wheat;
            AgentsComboBox.Items.Add("RandomAgent");
            AgentsComboBox.Items.Add("ModelAgent");
            AgentsComboBox.Items.Add("ModelAgentNoIdle");
            AgentsComboBox.ItemIndex = 0;
            OpenFileDialog.Add(AgentsComboBox);

            NewGameDialog = new Dialog(Manager);
            NewGameDialog.Init();
            NewGameDialog.Text = "Start new tests";
            NewGameDialog.Description.Visible = false;
            NewGameDialog.BottomPanel.Visible = false;
            NewGameDialog.Caption.Text = "";
            NewGameDialog.Width = 600;
            NewGameDialog.Height = 130;
            NewGameDialog.TopPanel.Height = 100;
            Manager.Add(NewGameDialog);
            NewGameDialog.Hide();

            Button newGameOk = new Button(Manager);
            newGameOk.Init();
            newGameOk.SetPosition(20, 50);
            newGameOk.Text = "Confirm";
            newGameOk.Click += new EventHandler(newGameOk_Click);
            NewGameDialog.Add(newGameOk);

            EnableDisableMapControls(false);
        }
예제 #11
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
        }
예제 #12
0
        /// <summary>
        /// Creates a new combo box control.
        /// </summary>
        /// <param name="manager">GUI manager for the combo box control.</param>
        public ComboBox(Manager manager)
            : base(manager)
        {
            // Set dimensions of the combo box text box control.
            Height = 20;
            Width = 64;
            ReadOnly = true;

            // Configure the combo box drop-down button control.
            btnDown = new Button(Manager);
            btnDown.Init();
            btnDown.Skin = new SkinControl(Manager.Skin.Controls["ComboBox.Button"]);
            btnDown.CanFocus = false;
            btnDown.Click += new EventHandler(btnDown_Click);
            Add(btnDown, false);

            // Configure the combo box drop-down list control.
            lstCombo = new ListBox(Manager);
            lstCombo.Init();
            lstCombo.HotTrack = true;
            lstCombo.Detached = true;
            lstCombo.Visible = false;
            lstCombo.Click += new EventHandler(lstCombo_Click);
            lstCombo.FocusLost += new EventHandler(lstCombo_FocusLost);
            lstCombo.Items = items;
            manager.Input.MouseDown += new MouseEventHandler(Input_MouseDown);
        }
예제 #13
0
        ////////////////////////////////////////////////////////////////////////////   
        public TaskControls(Manager manager)
            : base(manager)
        {
            MinimumWidth = 340;
              MinimumHeight = 140;
              Height = 480;
              Center();
              Text = "Controls Test";

              TopPanel.Visible = true;
              Caption.Text = "Information";
              Description.Text = "Demonstration of various controls available in Neoforce Controls library.";
              Caption.TextColor = Description.TextColor = new Color(96, 96, 96);

              grpEdit = new GroupPanel(Manager);
              grpEdit.Init();
              grpEdit.Parent = this;
              grpEdit.Anchor = Anchors.Left | Anchors.Top | Anchors.Right;
              grpEdit.Width = ClientWidth - 200;
              grpEdit.Height = 160;
              grpEdit.Left = 8;
              grpEdit.Top = TopPanel.Height + 8;
              grpEdit.Text = "EditBox";

              pnlControls = new Panel(Manager);
              pnlControls.Init();
              pnlControls.Passive = true;
              pnlControls.Parent = this;
              pnlControls.Anchor = Anchors.Left | Anchors.Top | Anchors.Right;
              pnlControls.Left = 8;
              pnlControls.Top = grpEdit.Top + grpEdit.Height + 8;
              pnlControls.Width = ClientWidth - 200;
              pnlControls.Height = BottomPanel.Top - 32 - pnlControls.Top;
              pnlControls.BevelBorder = BevelBorder.All;
              pnlControls.BevelMargin = 1;
              pnlControls.BevelStyle = BevelStyle.Etched;
              pnlControls.Color = Color.Transparent;

              lblEdit = new Label(manager);
              lblEdit.Init();
              lblEdit.Parent = grpEdit;
              lblEdit.Left = 16;
              lblEdit.Top = 8;
              lblEdit.Text = "Testing field:";
              lblEdit.Width = 128;
              lblEdit.Height = 16;

              txtEdit = new TextBox(manager);
              txtEdit.Init();
              txtEdit.Parent = grpEdit;
              txtEdit.Left = 16;
              txtEdit.Top = 24;
              txtEdit.Width = grpEdit.ClientWidth - 32;
              txtEdit.Height = 20;
              txtEdit.Anchor = Anchors.Left | Anchors.Top | Anchors.Right | Anchors.Bottom;
              txtEdit.Text = "Text";

              rdbNormal = new RadioButton(manager);
              rdbNormal.Init();
              rdbNormal.Parent = grpEdit;
              rdbNormal.Left = 16;
              rdbNormal.Top = 52;
              rdbNormal.Width = grpEdit.ClientWidth - 32;
              rdbNormal.Anchor = Anchors.Left | Anchors.Bottom | Anchors.Right;
              rdbNormal.Checked = true;
              rdbNormal.Text = "Normal mode";
              rdbNormal.ToolTip.Text = "Enables normal mode for TextBox control.";
              rdbNormal.CheckedChanged += new TomShane.Neoforce.Controls.EventHandler(ModeChanged);

              rdbPassword = new RadioButton(manager);
              rdbPassword.Init();
              rdbPassword.Parent = grpEdit;
              rdbPassword.Left = 16;
              rdbPassword.Top = 68;
              rdbPassword.Width = grpEdit.ClientWidth - 32;
              rdbPassword.Anchor = Anchors.Left | Anchors.Bottom | Anchors.Right;
              rdbPassword.Checked = false;
              rdbPassword.Text = "Password mode";
              rdbPassword.ToolTip.Text = "Enables password mode for TextBox control.";
              rdbPassword.CheckedChanged += new TomShane.Neoforce.Controls.EventHandler(ModeChanged);

              chkBorders = new CheckBox(manager);
              chkBorders.Init();
              chkBorders.Parent = grpEdit;
              chkBorders.Left = 16;
              chkBorders.Top = 96;
              chkBorders.Width = grpEdit.ClientWidth - 32;
              chkBorders.Anchor = Anchors.Left | Anchors.Bottom | Anchors.Right;
              chkBorders.Checked = false;
              chkBorders.Text = "Borderless mode";
              chkBorders.ToolTip.Text = "Enables or disables borderless mode for TextBox control.";
              chkBorders.CheckedChanged += new TomShane.Neoforce.Controls.EventHandler(chkBorders_CheckedChanged);

              chkReadOnly = new CheckBox(manager);
              chkReadOnly.Init();
              chkReadOnly.Parent = grpEdit;
              chkReadOnly.Left = 16;
              chkReadOnly.Top = 110;
              chkReadOnly.Width = grpEdit.ClientWidth - 32;
              chkReadOnly.Anchor = Anchors.Left | Anchors.Bottom | Anchors.Right;
              chkReadOnly.Checked = false;
              chkReadOnly.Text = "Read only mode";
              chkReadOnly.ToolTip.Text = "Enables or disables read only mode for TextBox control.\nThis mode is necessary to enable explicitly.";
              chkReadOnly.CheckedChanged += new TomShane.Neoforce.Controls.EventHandler(chkReadOnly_CheckedChanged);

              string[] colors = new string[] {"Red", "Green", "Blue", "Yellow", "Orange", "Purple", "White", "Black", "Magenta", "Cyan",
                                      "Brown", "Aqua", "Beige", "Coral", "Crimson", "Gray", "Azure", "Ivory", "Indigo", "Khaki",
                                      "Orchid", "Plum", "Salmon", "Silver", "Gold", "Pink", "Linen", "Lime", "Olive", "Slate"};

              spnMain = new SpinBox(manager, SpinBoxMode.List);
              spnMain.Init();
              spnMain.Parent = pnlControls;
              spnMain.Left = 16;
              spnMain.Top = 16;
              spnMain.Width = pnlControls.Width - 32;
              spnMain.Height = 20;
              spnMain.Anchor = Anchors.Left | Anchors.Top | Anchors.Right;
              spnMain.Items.AddRange(colors);
              spnMain.Mode = SpinBoxMode.Range;

              spnMain.ItemIndex = 0;

              cmbMain = new ComboBox(manager);
              cmbMain.Init();
              cmbMain.Parent = pnlControls;
              cmbMain.Left = 16;
              cmbMain.Top = 44;
              cmbMain.Width = pnlControls.Width - 32;
              cmbMain.Height = 20;
              cmbMain.ReadOnly = true;
              cmbMain.Anchor = Anchors.Left | Anchors.Top | Anchors.Right;
              cmbMain.Items.AddRange(colors);
              cmbMain.ItemIndex = 0;
              cmbMain.MaxItems = 5;
              cmbMain.ToolTip.Color = Color.Yellow;
              cmbMain.Movable = cmbMain.Resizable = true;
              cmbMain.OutlineMoving = cmbMain.OutlineResizing = true;

              trkMain = new TrackBar(manager);
              trkMain.Init();
              trkMain.Parent = pnlControls;
              trkMain.Left = 16;
              trkMain.Top = 72;
              trkMain.Width = pnlControls.Width - 32;
              trkMain.Anchor = Anchors.Left | Anchors.Top | Anchors.Right;
              trkMain.Range = 64;
              trkMain.Value = 16;
              trkMain.ValueChanged += new TomShane.Neoforce.Controls.EventHandler(trkMain_ValueChanged);

              lblTrack = new Label(manager);
              lblTrack.Init();
              lblTrack.Parent = pnlControls;
              lblTrack.Left = 16;
              lblTrack.Top = 96;
              lblTrack.Width = pnlControls.Width - 32;
              lblTrack.Anchor = Anchors.Left | Anchors.Top | Anchors.Right;
              lblTrack.Alignment = Alignment.TopRight;
              lblTrack.TextColor = new Color(32, 32, 32);
              trkMain_ValueChanged(this, null); // forcing label redraw with init values

              mnuListBox = new ContextMenu(manager);

              MenuItem i1 = new MenuItem("This is very long text");
              MenuItem i2 = new MenuItem("Menu", true);
              MenuItem i3 = new MenuItem("Item", false);
              //i3.Enabled = false;
              MenuItem i4 = new MenuItem("Separated", true);

              MenuItem i11 = new MenuItem();
              MenuItem i12 = new MenuItem();
              MenuItem i13 = new MenuItem();
              MenuItem i14 = new MenuItem();

              MenuItem i111 = new MenuItem();
              MenuItem i112 = new MenuItem();
              MenuItem i113 = new MenuItem();

              mnuListBox.Items.AddRange(new MenuItem[]{i1,i2, i3, i4});
              i2.Items.AddRange(new MenuItem[] { i11, i12, i13, i14 });
              i13.Items.AddRange(new MenuItem[] { i111, i112, i113 });

              lstMain = new ListBox(manager);
              lstMain.Init();
              lstMain.Parent = this;
              lstMain.Top = TopPanel.Height + 8;
              lstMain.Left = grpEdit.Left + grpEdit.Width + 8;
              lstMain.Width = ClientWidth - lstMain.Left - 8;
              lstMain.Height = ClientHeight - 16 - BottomPanel.Height - TopPanel.Height;
              lstMain.Anchor = Anchors.Top | Anchors.Right | Anchors.Bottom;
              lstMain.HideSelection = false;
              lstMain.Items.AddRange(colors);
              lstMain.ContextMenu = mnuListBox;

              prgMain = new ProgressBar(manager);
              prgMain.Init();
              prgMain.Parent = this.BottomPanel;
              prgMain.Left = lstMain.Left;
              prgMain.Top = 10;
              prgMain.Width = lstMain.Width;
              prgMain.Height = 16;
              prgMain.Anchor = Anchors.Top | Anchors.Right;
              prgMain.Mode = ProgressBarMode.Infinite;
              prgMain.Passive = false;

              btnDisable = new Button(manager);
              btnDisable.Init();
              btnDisable.Parent = BottomPanel;
              btnDisable.Left = 8;
              btnDisable.Top = 8;
              btnDisable.Text = "Disable";
              btnDisable.Click += new Controls.EventHandler(btnDisable_Click);
              btnDisable.TextColor = Color.FromNonPremultiplied(255, 64, 32, 200);

              btnProgress = new Button(manager);
              btnProgress.Init();
              btnProgress.Parent = BottomPanel;
              btnProgress.Left = prgMain.Left - 16;
              btnProgress.Top = prgMain.Top;
              btnProgress.Height = 16;
              btnProgress.Width = 16;
              btnProgress.Text = "!";
              btnProgress.Anchor = Anchors.Top | Anchors.Right;
              btnProgress.Click += new Controls.EventHandler(btnProgress_Click);

              mnuMain = new MainMenu(manager);

              mnuMain.Items.Add(i2);
              mnuMain.Items.Add(i13);
              mnuMain.Items.Add(i3);
              mnuMain.Items.Add(i4);

              MainMenu = mnuMain;

              ToolBarPanel tlp = new ToolBarPanel(manager);
              ToolBarPanel = tlp;

              ToolBar tlb = new ToolBar(manager);
              ToolBar tlbx = new ToolBar(manager);
              tlb.FullRow = true;
              tlbx.Row = 1;
              tlbx.FullRow = false;

              tlp.Add(tlb);
              tlp.Add(tlbx);

              /*
              tlb.Init();
              tlb.Width = 256;
              tlb.Parent = ToolBarPanel;*/

              //tlbx.Init();
              /*
              tlbx.Width = 512;
              tlbx.Top = 25;
              tlbx.Parent = ToolBarPanel;*/

             /*
              ToolBarButton tb1 = new ToolBarButton(manager);
              tb1.Init();
              tb1.Parent = tlb;
              tb1.Left = 10;
              tb1.Top = 1;
              tb1.Glyph = new Glyph(Manager.Skin.Images["Icon.Warning"].Resource);
              tb1.Glyph.SizeMode = SizeMode.Stretched;  */

              StatusBar stb = new StatusBar(Manager);
              StatusBar = stb;

              DefaultControl = txtEdit;

              OutlineMoving = true;
              OutlineResizing = true;

              BottomPanel.BringToFront();

              SkinChanged += new TomShane.Neoforce.Controls.EventHandler(TaskControls_SkinChanged);
              TaskControls_SkinChanged(null, null);
        }
        public void InitializeThirdPage()
        {
            stackview2 = new StackView();
            tbcMain.AddPage();
            TabPage third = tbcMain.TabPages[2];
            third.Text = "Other";

            backPanel2 = new Panel(manager);
            backPanel2.Height = third.Height;
            backPanel2.Width = third.Width;
            //backPanel2.Width = second.Width + 20;
            backPanel2.AutoScroll = true;
            backPanel2.Init();
            third.Add(backPanel2);

            HeightCounter4 = 0;
            VertPadding4 = 0;

            ConsolePanel = new CollapsePanel(manager, backPanel2, "Console"); stackview2.AddPanel(ConsolePanel);
            PresetsPanel = new CollapsePanel(manager, backPanel2, "Presets"); stackview2.AddPanel(PresetsPanel);
            CheckBoxes = new CollapsePanel(manager, backPanel2, "CheckBoxes", extended: false); stackview2.AddPanel(CheckBoxes);
            //c14 = new CollapsePanel(manager, backPanel2, "fourth", extended: false); stackview2.AddPanel(c14);
            //c15 = new CollapsePanel(manager, backPanel2, "fifth", extended: false); stackview2.AddPanel(c15);
            //c16 = new CollapsePanel(manager, backPanel2, "sixth", extended: false); stackview2.AddPanel(c16);
            //c17 = new CollapsePanel(manager, backPanel2, "seventh", extended: false); stackview2.AddPanel(c17);
            //c18 = new CollapsePanel(manager, backPanel2, "eighth", extended: false); stackview2.AddPanel(c18);

            backPanel2.Color = UserInterface.TomDark;

            tbcMain.SelectedPage = tbcMain.TabPages[2];
            #region  /// Page 3 ///
            GroupPanel parent;
            #region /// Console ///
            parent = ConsolePanel.panel;

            #region  /// Console textbox ///
            consoletextbox = new TextBox(manager);
            consoletextbox.Init();
            consoletextbox.Parent = parent;

            consoletextbox.Left = LeftPadding;
            consoletextbox.Top = HeightCounter2;
            HeightCounter2 += VertPadding + consoletextbox.Height;
            consoletextbox.Width = parent.Width - LeftPadding * 2;
            consoletextbox.Height = consoletextbox.Height + 3;

            consoletextbox.ToolTip.Text = "Enter a command, and push enter";
            consoletextbox.KeyUp += consolePressed;
            #endregion

            #region  /// Enter Button ///
            Button btnEnter = new Button(manager);
            btnEnter.Init();
            btnEnter.Parent = parent;

            btnEnter.Left = LeftPadding;
            btnEnter.Top = HeightCounter2;
            btnEnter.Width = (parent.Width - LeftPadding * 2) / 2;

            btnEnter.Text = "Enter";
            btnEnter.Click += consolePressed;
            #endregion

            #region  /// Clear ///
            Button btnClear = new Button(manager);
            btnClear.Init();
            btnClear.Parent = parent;

            btnClear.Left = LeftPadding + btnEnter.Width;
            btnClear.Top = HeightCounter2; HeightCounter2 += VertPadding + btnClear.Height;
            btnClear.Width = (parent.Width - LeftPadding * 2) / 2;

            btnClear.Text = "Clear";
            btnClear.Click += btnClear_Click;
            #endregion
            #endregion
            ConsolePanel.Collapse();

            #region /// Presets ///
            parent = PresetsPanel.panel;
            PresetsPanel.ExpandedHeight = 175;
            HeightCounter4 = VertPadding4;

            lstPresets = new ListBox(manager);
            lstPresets.Init();
            lstPresets.Parent = parent;
            lstPresets.Top = HeightCounter4;
            lstPresets.Left = LeftPadding;
            lstPresets.Width = parent.Width - LeftPadding * 2;
            lstPresets.Height = third.Height / 4; HeightCounter += VertPadding + lstPresets.Height;
            lstPresets.Anchor = Anchors.Top | Anchors.Left | Anchors.Bottom;
            lstPresets.HideSelection = false;
            lstPresets.ItemIndexChanged += lstPresets_ItemIndexChanged;

            // go to cmbPresets to find the preset synching reference.

            #region /// Presets ContextMenu ///
            presetContextMenu = new ContextMenu(manager);
            deletePresetMenuItem = new MenuItem("Delete Preset");
            deletePresetMenuItem.Click += deletePresetMenuItem_Click;
            presetContextMenu.Items.Add(deletePresetMenuItem);
            presetContextMenu.Enabled = false;
            #endregion
            lstPresets.ContextMenu = presetContextMenu;

            CheckBoxes.ExpandedHeight = 150;

            HeightCounter4 = 0;

            cbUserLevel = new ComboBox(manager);
            cbUserLevel.Init();
            cbUserLevel.Parent = CheckBoxes.panel;
            cbUserLevel.Top = HeightCounter4;
            cbUserLevel.Width = 150;
            HeightCounter4 += cbUserLevel.Height;
            foreach(string ul in Enum.GetNames(typeof(UserLevel)))
            {
                cbUserLevel.Items.Add(ul);
            }
            cbUserLevel.ItemIndexChanged += (s, e) =>
            {
                userLevel = (UserLevel)cbUserLevel.ItemIndex;

            };
            int count = 0;
            foreach(object s in cbUserLevel.Items)
            {
                if (s.ToString().Equals(userLevel.ToString()))
                {
                    cbUserLevel.ItemIndex = count;
                }
                count++;
            }

            #endregion

            Dictionary<string, EventHandler> checkBoxHandlers = new Dictionary<string, EventHandler>(){
                { "FullScreen", (o,e) => {
                    if ((o as CheckBox).Checked) game.setResolution(resolutions.AutoFullScreen, true);
                    else game.setResolution(resolutions.WSXGA_1680x1050, false);
                } },
                { "Hide Links", (o,e) => {
                    game.room.DrawLinks = !(o as CheckBox).Checked;
                } },
            };

            foreach (string key in checkBoxHandlers.Keys)
            {
                CreateCheckBox(key, checkBoxHandlers[key]);
            }

            tbcMain.SelectedPage = tbcMain.TabPages[0];
            #endregion
        }
예제 #15
0
        public void Initialize()
        {
            manager.Initialize();

            #region /// Master ///
            master = new SideBar(manager);
            master.Init();
            master.Name = "Sidebar";
            master.Width = Width;
            master.Height = OrbIt.game.MainWindow.ClientArea.Height;
            master.Visible = true;
            master.Anchor = Anchors.Top | Anchors.Left | Anchors.Bottom;

            ui.game.MainWindow.Add(master);
            #endregion

            #region  /// tabcontrol ///
            tbcMain = new TabControl(manager);
            tbcMain.Init();
            //tbcMain.BackColor = Color.Transparent;
            //tbcMain.Color = Color.Transparent;
            tbcMain.Parent = master;
            tbcMain.Left = 0;
            tbcMain.Top = 0;
            tbcMain.Width = master.Width - 5;
            tbcMain.Height = master.Height - 40;
            tbcMain.Anchor = Anchors.All;
            activeTabControl = tbcMain;
            #endregion

            #region  /// Page1 ///

            tbcMain.AddPage();
            tbcMain.TabPages[0].Text = "First";
            TabPage first = tbcMain.TabPages[0];
            tbcMain.SelectedIndex = 0;

            #region  /// Title ///
            title1 = new Label(manager);
            title1.Init();
            title1.Parent = first;

            title1.Top = HeightCounter;
            title1.Text = "Node List";
            title1.Width = 130;
            title1.Left = first.Width / 2 - title1.Width / 2; //TODO : Center auto
            HeightCounter += VertPadding + title1.Height;
            title1.Anchor = Anchors.Left;
            #endregion

            #region  /// List Main ///
            lstMain = new ListBox(manager);
            lstMain.Init();
            lstMain.Parent = first;

            lstMain.Top = HeightCounter;
            lstMain.Left = LeftPadding;
            lstMain.Width = first.Width - LeftPadding * 2;
            lstMain.Height = first.Height / 5; HeightCounter += VertPadding + lstMain.Height;
            lstMain.Anchor = Anchors.Top | Anchors.Left | Anchors.Bottom;

            lstMain.HideSelection = false;
            lstMain.ItemIndexChanged += lstMain_ItemIndexChanged;
            lstMain.Click += lstMain_Click;
            lstMain.Refresh();
            //room.nodes.CollectionChanged += nodes_Sync;

            mainNodeContextMenu = new ContextMenu(manager);
            ConvertIntoList = new MenuItem("Make Default of new Group.");
            ConvertIntoList.Click += ConvertIntoList_Click;
            PromoteToDefault = new MenuItem("Make Default of current Group");
            PromoteToDefault.Click += PromoteToDefault_Click;
            mainNodeContextMenu.Items.Add(ConvertIntoList);
            lstMain.ContextMenu = mainNodeContextMenu;

            ui.SetScrollableControl(lstMain, lstMain_ChangeScrollPosition);
            #endregion

            #region  /// List Picker ///

            cbListPicker = new ComboBox(manager);
            cbListPicker.Init();
            cbListPicker.Parent = first;
            cbListPicker.MaxItems = 20;

            cbListPicker.Width = first.Width - LeftPadding * 6;
            cbListPicker.Left = LeftPadding;
            cbListPicker.Top = HeightCounter;
            cbListPicker.Items.Add("Other Objects");
            cbListPicker.ItemIndex = 0;
            //cbListPicker.
            cbListPicker.Click += cbListPicker_Click;
            cbListPicker.ItemIndexChanged += cbListPicker_ItemIndexChanged;

            #endregion

            #region /// Delete Group Button ///

            btnDeleteGroup = new Button(manager);
            btnDeleteGroup.Init();
            btnDeleteGroup.Parent = first;
            btnDeleteGroup.Left = LeftPadding + cbListPicker.Width + 5;
            btnDeleteGroup.Width = 15;
            btnDeleteGroup.Height = cbListPicker.Height;
            btnDeleteGroup.Top = HeightCounter; HeightCounter += VertPadding + cbListPicker.Height;
            btnDeleteGroup.Text = "X";
            btnDeleteGroup.Click += btnDeleteGroup_Click;

            #endregion

            #region  /// Remove Node Button ///
            btnRemoveNode = new Button(manager);
            btnRemoveNode.Init();
            btnRemoveNode.Parent = first;

            btnRemoveNode.Top = HeightCounter;
            btnRemoveNode.Width = first.Width / 2 - LeftPadding;
            btnRemoveNode.Height = 24;
            btnRemoveNode.Left = LeftPadding;

            btnRemoveNode.Text = "Remove Node";
            btnRemoveNode.Click += btnRemoveNode_Click;
            #endregion

            #region  /// Remove All Nodes Button ///
            btnRemoveAllNodes = new Button(manager);
            btnRemoveAllNodes.Init();
            btnRemoveAllNodes.Parent = first;

            btnRemoveAllNodes.Top = HeightCounter;
            //btnRemoveAllNodes.Width = first.Width / 2 - LeftPadding;
            btnRemoveAllNodes.Width = first.Width / 2 - LeftPadding;
            btnRemoveAllNodes.Height = 24; HeightCounter += VertPadding + btnRemoveAllNodes.Height;
            btnRemoveAllNodes.Left = LeftPadding + btnRemoveNode.Width;

            btnRemoveAllNodes.Text = "Remove All";
            btnRemoveAllNodes.Click += btnRemoveAllNodes_Click;
            #endregion

            #region  /// Add Componenet ///
            btnAddComponent = new Button(manager);
            btnAddComponent.Init();
            btnAddComponent.Parent = first;

            btnAddComponent.Top = HeightCounter;
            btnAddComponent.Width = first.Width / 2 - LeftPadding;
            btnAddComponent.Height = 20;
            btnAddComponent.Left = LeftPadding;

            btnAddComponent.Text = "Add Component";
            btnAddComponent.Click += btnAddComponent_Click;
            #endregion

            #region  /// Default Node ///
            btnDefaultNode = new Button(manager);
            btnDefaultNode.Init();
            btnDefaultNode.Parent = first;

            btnDefaultNode.Top = HeightCounter;
            btnDefaultNode.Width = first.Width / 2 - LeftPadding;
            btnDefaultNode.Height = 20; HeightCounter += VertPadding + btnDefaultNode.Height;
            btnDefaultNode.Left = LeftPadding + btnRemoveNode.Width;

            btnDefaultNode.Text = "Default Node";
            btnDefaultNode.Click += btnDefaultNode_Click;
            #endregion

            #region  /// Presets Dropdown ///
            cbPresets = new ComboBox(manager);
            cbPresets.Init();
            cbPresets.Parent = first;
            cbPresets.MaxItems = 20;
            cbPresets.Width = 160;
            cbPresets.Left = LeftPadding;
            cbPresets.Top = HeightCounter; HeightCounter += cbPresets.Height;
            Assets.NodePresets.CollectionChanged += NodePresets_Sync;
            cbPresets.ItemIndexChanged += cbPresets_ItemIndexChanged;
            cbPresets.Click += cmbPresets_Click;
            #endregion

            inspectorArea = new InspectorArea(this, first, LeftPadding, HeightCounter);

            HeightCounter += inspectorArea.Height;

            #region  /// Apply to Group ///
            btnApplyToAll = new Button(manager);
            btnApplyToAll.Init();
            btnApplyToAll.Parent = first;

            btnApplyToAll.Text = "Apply To Group";
            btnApplyToAll.Top = HeightCounter;
            btnApplyToAll.Width = first.Width / 2 - LeftPadding;
            btnApplyToAll.Height = 20; //HeightCounter += VertPadding + btnApplyToAll.Height;
            btnApplyToAll.Left = LeftPadding;
            btnApplyToAll.Click += applyToAllNodesMenuItem_Click;
            #endregion

            #region  /// Save as Preset ///
            btnSaveNode = new Button(manager);
            btnSaveNode.Init();
            btnSaveNode.Text = "Save Node";
            btnSaveNode.Top = HeightCounter;
            btnSaveNode.Width = first.Width / 2 - LeftPadding;
            btnSaveNode.Height = 20; HeightCounter += VertPadding + btnSaveNode.Height;
            btnSaveNode.Left = LeftPadding + btnApplyToAll.Width;
            btnSaveNode.Parent = first;
            btnSaveNode.Click += btnSaveNode_Click;
            #endregion

            #endregion

            #region  /// Page 2 ///
            tbcMain.AddPage();
            tbcMain.TabPages[1].Text = "Second";
            TabPage second = tbcMain.TabPages[1];
            HeightCounter = 0;

            #endregion

            inspectorArea.ResetInspectorBox(ActiveDefaultNode);

            InitializeSecondPage();
            InitializeThirdPage();
        }
예제 #16
0
		private void InitializeControls() {
			_manager.Initialize();
			_manager.AutoCreateRenderTarget = true;

			_tabControl = new TabControl(_manager);
			_tabControl.Init();
			_tabControl.Left = 600;
			_tabControl.Top = 0;
			_tabControl.Width = Width;
			_tabControl.Height = Height;
			_tabControl.Show();
			#region WavePage
			_wavePage = _tabControl.AddPage();
			_wavePage.Text = "Waves";

			#region Constructors
			_health = new Label(_manager);
			_health.Init();
			_texture = new Label(_manager);
			_texture.Init();
			_speed = new Label(_manager);
			_speed.Init();
			_number = new Label(_manager);
			_number.Init();

			_waves = new ListBox(_manager);
			_waves.Init();
			_deleteWaveButton = new Button(_manager);
			_deleteWaveButton.Init();
			_addWaveButton = new Button(_manager);
			_addWaveButton.Init();
			_currentWave = new ListBox(_manager);
			_currentWave.Init();
			_addCreepsButton = new Button(_manager);
			_addCreepsButton.Init();
			_numberOfCreeps = new TextBox(_manager);
			_numberOfCreeps.Init();
			_speedOfCreeps = new TextBox(_manager);
			_speedOfCreeps.Init();
			_healthOfCreeps = new TextBox(_manager);
			_healthOfCreeps.Init();
			_creepTexture = new ComboBox(_manager);
			_creepTexture.Init();
			#endregion

			#region Properties
			_texture.Text = "Textur";
			_texture.Top = 2;
			_texture.Left = 2;
			_texture.Parent = _wavePage;
			_wavePage.Add(_texture);

			_creepTexture.Items.AddRange(new[] { "Slyder", "Drone", "Ape", "Paw" });
			_creepTexture.Text = "Slyder";
			_creepTexture.Width = 80;
			_creepTexture.Left = 2;
			_creepTexture.Top = _texture.Top + _texture.Height + 2;
			_creepTexture.TextColor = Color.LightGray;
			_creepTexture.Parent = _wavePage;

			_health.Text = "Gesundheit";
			_health.Top = 2;
			_health.Left = _creepTexture.Left + _creepTexture.Width + 5;
			_health.Parent = _wavePage;

			_healthOfCreeps.Left = _health.Left;
			_healthOfCreeps.Top = _health.Top + _health.Height + 2;
			_healthOfCreeps.Width = _health.Width;
			_healthOfCreeps.TextColor = Color.LightGray;
			_healthOfCreeps.Parent = _wavePage;

			_speed.Text = "Geschwindigkeit";
			_speed.Left = _health.Left + _health.Width + 5;
			_speed.Top = 2;
			_speed.Width = 93;
			_speed.Parent = _wavePage;

			_speedOfCreeps.Left = _speed.Left;
			_speedOfCreeps.Top = _speed.Top + _speed.Height + 2;
			_speedOfCreeps.Width = _speed.Width;
			_speedOfCreeps.TextColor = Color.LightGray;
			_speedOfCreeps.Parent = _wavePage;

			_number.Text = "Anzahl";
			_number.Top = 2;
			_number.Left = _speed.Left + _speed.Width + 5;
			_number.Width = 40;
			_number.Parent = _wavePage;

			_numberOfCreeps.Left = _number.Left;
			_numberOfCreeps.Top = _number.Top + _number.Height + 2;
			_numberOfCreeps.Width = _number.Width;
			_numberOfCreeps.TextColor = Color.LightGray;
			_numberOfCreeps.Parent = _wavePage;

			_addCreepsButton.Text = "Creeps hinzufügen";
			_addCreepsButton.Top = _numberOfCreeps.Top + _numberOfCreeps.Height - _addCreepsButton.Height;
			_addCreepsButton.Left = _numberOfCreeps.Left + _numberOfCreeps.Width + 5;
			_addCreepsButton.Width = 120;
			_addCreepsButton.Parent = _wavePage;

			_currentWave.Left = 2;
			_currentWave.Top = _creepTexture.Top + _creepTexture.Height + 5;
			_currentWave.Width = _addCreepsButton.Left + _addCreepsButton.Width;
			_currentWave.Height = 150;
			_currentWave.TextColor = Color.LightGray;
			_currentWave.Parent = _wavePage;

			_addWaveButton.Text = "Wave hinzufügen";
			_addWaveButton.Left = 2;
			_addWaveButton.Top = _currentWave.Top + _currentWave.Height + 5;
			_addWaveButton.Width = 150;
			_addWaveButton.Parent = _wavePage;

			_deleteWaveButton.Text = "Wave löschen";
			_deleteWaveButton.Left = _addWaveButton.Left + _addWaveButton.Width + 5;
			_deleteWaveButton.Top = _currentWave.Top + _currentWave.Height + 5;
			_deleteWaveButton.Width = _addWaveButton.Width;
			_deleteWaveButton.Parent = _wavePage;

			_waves.Left = 2;
			_waves.Top = _addWaveButton.Top + _addWaveButton.Height + 5;
			_waves.Width = _currentWave.Width;
			_waves.Height = 150;
			_waves.TextColor = Color.LightGray;
			_waves.Parent = _wavePage;
			_waves.ItemIndexChanged += _waves_ItemIndexChanged;
			#endregion

			#region Events
			_addCreepsButton.Click += AddCreepsButton_Click;
			_addWaveButton.Click += AddWaveButton_Click;
			_deleteWaveButton.Click += DeleteWaveButton_Click;
			#endregion
			#endregion

			#region SavePage
			_savePage = _tabControl.AddPage();
			_savePage.Text = "Speichern & Laden";
			_path = new TextBox(_manager);
			_path.Init();
			_path.Top = 2;
			_path.Left = 2;
			_path.Width = 200;
			_path.Parent = _savePage;
			_path.ReadOnly = true;

			_fileNameButton = new Button(_manager);
			_fileNameButton.Init();
			_fileNameButton.Text = "...";
			_fileNameButton.Width = 17;
			_fileNameButton.Height = _fileNameButton.Width;
			_fileNameButton.Top = _path.Top + _path.Height / 2 - _fileNameButton.Height / 2;
			_fileNameButton.Left = _path.Left + _path.Width + 2;
			_fileNameButton.Parent = _savePage;
			_fileNameButton.Click += delegate {
											var dlg = new SaveFileDialog {
												Filter = "Level-Dateien|*.xml",
												InitialDirectory =
													Path.GetFullPath(
													Path.GetDirectoryName(
														Assembly.GetExecutingAssembly().Location) +
													@"\..\Content\Map")
											};
											dlg.ShowDialog();
											_path.Text = dlg.FileName;
										};

			_saveButton = new Button(_manager);
			_saveButton.Init();
			_saveButton.Top = _path.Top + _path.Height + 2;
			_saveButton.Left = 2;
			_saveButton.Text = "Speichern";
			_saveButton.Width = 120;
			_saveButton.Parent = _savePage;
			_saveButton.Click += delegate {
										if (_path.Text.Length > 0) {
											string fileName = _path.Text;
											Save(fileName);
										}
									};

			LoadButton = new Button(_manager);
			LoadButton.Init();
			LoadButton.Left = 2;
			LoadButton.Top = 50;
			LoadButton.Text = "Laden";
			LoadButton.Width = 120;
			LoadButton.Parent = _savePage;
			LoadButton.Click += LoadButton_Click;
			#endregion
			_manager.Add(_tabControl);
		}
예제 #17
0
        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;
        }