예제 #1
0
        public override void Initialize()
        {
            creditWindow = new Window(manager);
            creditWindow.Init();
            creditWindow.Width = 300;
            creditWindow.Height = 200;
            creditWindow.Center();
            creditWindow.Text = "Credits";
            creditWindow.Visible = false;
            creditWindow.IconVisible = false;
            manager.Add(creditWindow);

            textBox = new TextBox(manager);
            textBox.Init();
            textBox.Parent = creditWindow;
            textBox.Left = 8;
            textBox.Top = 8;
            textBox.Width = creditWindow.ClientArea.Width - 16;
            textBox.Height = creditWindow.Height - 48;
            textBox.Anchor = Anchors.All;
            textBox.Mode = TextBoxMode.Multiline;
            textBox.ReadOnly = true;

            string text = "Makers of The Little Cheese Boy Editor:\n"+ GetCreators();

            text += "\n\nSpecial Thanks to Alexander Brodén and \nMattias Liljeson for their great work \non The Little Cheese Boy!";

            textBox.Text = text;

            textBox.ScrollBars = ScrollBars.None;
            textBox.CanFocus = false;
            textBox.TextColor = Color.White;
        }
예제 #2
0
        private UnitInfoDialog(Manager manager)
            : base(manager)
        {
            Init();

            Height = 300;
            Width = 500;

            txtBox = new TextBox(manager);
            txtBox.Init();
            txtBox.Width = ClientWidth;
            txtBox.Height = ClientHeight - 30;
            txtBox.Left = 0;
            txtBox.Top = 0;
            txtBox.Parent = this;

            okButton = new Button(manager);
            okButton.Init();
            okButton.Text = "OK";
            okButton.Width = txtBox.Width; ;
            okButton.Height = 30;
            okButton.Top = txtBox.Height;
            okButton.Parent = this;
            okButton.Click += new TomShane.Neoforce.Controls.EventHandler(okButton_Click);

            manager.Add(this);
        }
예제 #3
0
        /// <summary>
        /// Default Constructor
        /// </summary>
        /// <param name="manager"></param>
        public DetoxChatWindow(Manager manager)
            : base(manager)
        {
            // Initialize class properties..
            this._messages = new EventedList<ChatMessage>();
            this._messages.ItemAdded += ChatMessages_OnItemAdded;
            this._isBackgroundVisible = true;

            // Initialize base control..
            base.Init();
            base.Width = 350;
            base.Height = 150;
            base.Alpha = 255;
            base.MinimumWidth = 64;
            base.MinimumHeight = 64;
            base.CanFocus = true;
            base.Movable = true;
            base.Resizable = true;
            base.ClientArea.Draw += ClientArea_OnDraw;
            //
            //
            //
            this._chatInput = new TextBox(manager);
            this._chatInput.Init();
            this._chatInput.Anchor = Anchors.Left | Anchors.Right | Anchors.Bottom;
            this._chatInput.AutoSelection = false;
            this._chatInput.Detached = false;
            this._chatInput.Left = 0;
            this._chatInput.Top = base.Height - this._chatInput.Height;
            this._chatInput.Visible = true;
            this._chatInput.KeyDown += ChatInput_OnKeyDown;
            this._chatInput.FocusGained += ChatInput_OnFocusGained;
            this._chatInput.FocusLost += ChatInput_OnFocusLost;
            //
            //
            //
            this._chatScroller = new ScrollBar(manager, Orientation.Vertical)
                {
                    Anchor = Anchors.Right | Anchors.Top | Anchors.Bottom,
                    Left = base.Width - 16,
                    PageSize = 1,
                    Range = 1,
                    Top = 2,
                    Value = 0
                };
            this._chatScroller.ValueChanged += ChatScroller_OnValueChanged;
            this._chatScroller.Init();
            //
            //
            //
            base.Add(this._chatInput, false);
            base.Add(this._chatScroller, false);
            manager.Add(this);

            // Update the control positions..
            this.PositionControls();
            base.Left = 5;
            base.Top = Terraria.MainGame.Window.ClientBounds.Height - base.Height - 5;
        }
예제 #4
0
        public override void LoadContent(ContentManager contentloader)
        {
            _guiman = new Manager(_gamemanager.Game, _gamemanager.Graphics, "Default");
            _guiman.Initialize();

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

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

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

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

            _guiman.Add(_settingsmenu);

            _gamemanager.Game.IsMouseVisible = true;
        }
예제 #5
0
        /// <summary>
        /// Shows the simple input dialog.
        /// </summary>
        public void ShowSimpleInputDialog(Manager manager, string caption, string text, string initialValue,
            TomShane.Neoforce.Controls.EventHandler okBtnEventHandler)
        {
            window = new Window(manager);
            window.Init();
            window.Width = 450;
            window.Height = 150;
            window.Text = caption;
            window.Closing += OnSimpleInputDialogClosing;
            window.Visible = true;

            Label label = new Label(manager);
            label.Init();
            label.Text = text;
            label.Width = 400;
            label.Height = 20;
            label.Left = 5;
            label.Top = 5;
            label.Parent = window;

            TextBox textBox = new TextBox(manager);
            textBox.Init();
            textBox.Width = 400;
            textBox.Height = 20;
            textBox.Left = 5;
            textBox.Top = 40;
            textBox.Text = initialValue;
            textBox.Parent = window;

            Button btnSimpleInputDialogOk = new Button(manager);
            btnSimpleInputDialogOk.Init();
            btnSimpleInputDialogOk.Text = "Ok";
            btnSimpleInputDialogOk.Width = 100;
            btnSimpleInputDialogOk.Height = 30;
            btnSimpleInputDialogOk.Left = 5;
            btnSimpleInputDialogOk.Top = 75;
            btnSimpleInputDialogOk.Click += okBtnEventHandler;
            btnSimpleInputDialogOk.Click += OnClickBtnSimpleInputDialogOk;
            btnSimpleInputDialogOk.Tag = textBox; // Textbox as Tag, to access the value
            btnSimpleInputDialogOk.Parent = window;

            Button btnSimpleInputDialogCancel = new Button(manager);
            btnSimpleInputDialogCancel.Init();
            btnSimpleInputDialogCancel.Text = "Cancel";
            btnSimpleInputDialogCancel.Width = 100;
            btnSimpleInputDialogCancel.Height = 30;
            btnSimpleInputDialogCancel.Left = 110;
            btnSimpleInputDialogCancel.Top = 75;
            btnSimpleInputDialogCancel.Click += OnClickBtnSimpleInputDialogCancel;
            btnSimpleInputDialogCancel.Parent = window;

            manager.Add(window);
        }
예제 #6
0
        public CreateWorldDialog(Manager manager, LobbyWindow parent)
            : base(manager)
        {
            roomList = parent;
            //Setup the window
            Text = "Create World";
            TopPanel.Visible = false;
            Resizable = false;
            Width = 250;
            Height = 190;
            Center();

            //Add controls
            lblName = new Label(manager) { Left = 8, Top = 8, Text = "Name:", Width = this.ClientWidth - 16 };
            lblName.Init();
            Add(lblName);

            txtName = new TextBox(manager) { Left = 8, Top = lblName.Bottom + 4, Width = this.ClientWidth - 16 };
            txtName.Init();
            txtName.TextChanged += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e)
            {
                if (txtName.Text.Length > Bricklayer.Common.Networking.Messages.CreateRoomMessage.MaxNameLength)
                    txtName.Text = txtName.Text.Truncate(Bricklayer.Common.Networking.Messages.CreateRoomMessage.MaxNameLength);
            });
            Add(txtName);

            lblDescription = new Label(manager) { Left = 8, Top = txtName.Bottom + 4, Text = "Description:", Width = this.ClientWidth - 16 };
            lblDescription.Init();
            Add(lblDescription);

            txtDescription = new TextBox(manager) { Left = 8, Top = lblDescription.Bottom + 4, Width = this.ClientWidth - 16, Height = 34, Mode = TextBoxMode.Multiline, ScrollBars = ScrollBars.None };
            txtDescription.Init();
            txtDescription.TextChanged += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e)
            {
                //Filter the text by checking for length and lines
                if (txtDescription.Text.Length > Bricklayer.Common.Networking.Messages.CreateRoomMessage.MaxDescriptionLength)
                    txtDescription.Text = txtDescription.Text.Truncate(Bricklayer.Common.Networking.Messages.CreateRoomMessage.MaxDescriptionLength);
                int newLines = txtDescription.Text.Count(c => c == '\n');
                if (newLines >= Bricklayer.Common.Networking.Messages.CreateRoomMessage.MaxDescriptionLines)
                {
                    txtDescription.Text = txtDescription.Text.Substring(0, txtDescription.Text.Length - 1);
                    txtDescription.CursorPosition = 0;
                }
            });
            Add(txtDescription);

            createBtn = new Button(manager) { Top = 8, Text = "Create" };
            createBtn.Init();
            createBtn.Left = (Width / 2) - (createBtn.Width / 2);
            createBtn.Click += CreateBtn_Click;
            BottomPanel.Add(createBtn);
        }
예제 #7
0
        public AddServerDialog(Manager manager, ServerWindow parent, int index, bool edit, string name, string address)
            : base(manager)
        {
            //Are we editing a server or adding one (They use same dialog)
            Edit = edit;
            Index = index;
            ServerList = parent;
            //Setup the window
            Text = Edit ? "Edit Server" : "Add Server";
            TopPanel.Visible = false;
            Resizable = false;
            Width = 250;
            Height = 180;
            Center();

            //Add controls
            NameLbl = new Label(manager) { Left = 8, Top = 8, Text = "Name:", Width = this.ClientWidth - 16 };
            NameLbl.Init();
            Add(NameLbl);

            NameTxt = new TextBox(manager) { Left = 8, Top = NameLbl.Bottom + 4, Width = this.ClientWidth - 16 };
            NameTxt.Init();
            NameTxt.Text = name;
            NameTxt.TextChanged += NameTxt_TextChanged;
            Add(NameTxt);

            AddressLbl = new Label(manager) { Left = 8, Top = NameTxt.Bottom + 8,
                Text = string.Format("Address: (Default port is {0})", Bricklayer.Common.GlobalSettings.DefaultPort),
                Width = this.ClientWidth - 16 };
            AddressLbl.Init();
            Add(AddressLbl);

            AddressTxt = new TextBox(manager) { Left = 8, Top = AddressLbl.Bottom + 4, Width = this.ClientWidth - 16 };
            AddressTxt.Init();
            AddressTxt.Text = address;
            AddressTxt.TextChanged += AddressTxt_TextChanged;
            Add(AddressTxt);

            SaveBtn = new Button(manager) { Top = 8, Text = Edit ? "Save" : "Add", };
            SaveBtn.Init();
            SaveBtn.Left = (Width / 2) - (SaveBtn.Width / 2);
            SaveBtn.Click += SaveBtn_Click;
            SaveBtn.Enabled = false;
            BottomPanel.Add(SaveBtn);

            if (Edit)
                Validate(); //Validate existing text
        }
예제 #8
0
        public AddServerDialog(Manager manager, ServerWindow parent, int index, bool edit, string name, string address)
            : base(manager)
        {
            //Are we editing a server or adding one (They use same dialog)
            Edit = edit;
            Index = index;
            ServerList = parent;
            //Setup the window
            Text = Edit ? "Edit Server" : "Add Server";
            TopPanel.Visible = false;
            Resizable = false;
            Width = 250;
            Height = 180;
            Center();

            //Add controls
            NameLbl = new Label(manager) { Left = 8, Top = 8, Text = "Name:", Width = this.ClientWidth - 16 };
            NameLbl.Init();
            Add(NameLbl);

            NameTxt = new TextBox(manager) { Left = 8, Top = NameLbl.Bottom + 4, Width = this.ClientWidth - 16 };
            NameTxt.Init();
            NameTxt.Text = name;
            Add(NameTxt);

            AddressLbl = new Label(manager) { Left = 8, Top = NameTxt.Bottom + 8, Text = "Address: (Default port is 14242)", Width = this.ClientWidth - 16 };
            AddressLbl.Init();
            Add(AddressLbl);

            AddressTxt = new TextBox(manager) { Left = 8, Top = AddressLbl.Bottom + 4, Width = this.ClientWidth - 16 };
            AddressTxt.Init();
            AddressTxt.Text = address;
            Add(AddressTxt);

            SaveBtn = new Button(manager) { Top = 8, Text = Edit ? "Save" : "Add", };
            SaveBtn.Init();
            SaveBtn.Left = (Width / 2) - (SaveBtn.Width / 2);
            SaveBtn.Click += SaveBtn_Click;
            BottomPanel.Add(SaveBtn);
        }
        private void ItemCreatorDelegate(DetailedItem item, object obj)
        {
            //editGroupWindow = new EditNodeWindow(sidebar, "All Players", room.groups.playerGroup.Name);
            //editGroupWindow.componentView.SwitchGroup(room.groups.playerGroup);
            //editGroupWindow.componentView.SwitchNode(n, false);
            if (obj == null) return;
            if (obj is InspectorInfo)
            {
                InspectorInfo inspectorItem = (InspectorInfo)obj;

                if (inspectorItem.methodInfo != null)
                {
                    Button btnInvoke = new Button(manager);
                    btnInvoke.Init();
                    btnInvoke.Parent = item.panel;
                    btnInvoke.TextColor = Color.Blue;
                    btnInvoke.Width = 50;
                    btnInvoke.Left = item.panel.Width - btnInvoke.Width - btnInvoke.Width - 5;
                    btnInvoke.Height = item.buttonHeight;
                    btnInvoke.ToolTip.Text = "Invoke Method";
                    btnInvoke.Name = "method_button_invoke";
                    btnInvoke.Text = "Do";
                    item.AddControl(btnInvoke);
                }

                if (inspectorItem.obj == null) return;
                object o = inspectorItem.obj;
                bool isToggle = Utils.isToggle(o);

                if (o != null)
                {
                    if (o is Node)
                    {
                        //item.label.Text = "Root";
                        Node n = (Node)o;
                        Button btnEdit = new Button(manager);
                        btnEdit.Init();
                        btnEdit.Parent = item.panel;
                        btnEdit.Width = 30;
                        btnEdit.Left = item.panel.Width - btnEdit.Width - 10;
                        btnEdit.Top = 2;
                        btnEdit.Height = item.buttonHeight;

                        EventHandler editnode = (s, e) =>
                        {
                            //item.isSelected = true;
                            EditNodeWindow editNodeWindow = new EditNodeWindow(sidebar, inspectorItem.Name(), n.name, ViewType.Node);
                            editNodeWindow.componentView.SwitchNode(n, false);
                        };

                        btnEdit.Text = "Edit";
                        btnEdit.ToolTip.Text = "Edit";
                        btnEdit.TextColor = UserInterface.TomShanePuke;

                        btnEdit.Click += editnode;
                    }
                    else if (o is Link)
                    {
                        Link link = (Link)o;
                        Button btnEdit = new Button(manager);
                        btnEdit.Init();
                        btnEdit.Parent = item.panel;
                        btnEdit.Width = 30;
                        btnEdit.Left = item.panel.Width - btnEdit.Width - 10;
                        btnEdit.Top = 2;
                        btnEdit.Height = item.buttonHeight;
                        EventHandler editlink = (s, e) =>
                        {
                            EditLinkWindow editLinkWindow = new EditLinkWindow(sidebar, link, inspectorItem.Name());
                        };
                        btnEdit.Text = "Edit";
                        btnEdit.ToolTip.Text = "Edit";
                        btnEdit.TextColor = UserInterface.TomShanePuke;

                        btnEdit.Click += editlink;
                    }
                    else if (o is Body || o is Component)
                    {
                        item.label.Text = o.GetType().ToString().LastWord('.');
                    }
                    if (o is Component)
                    {
                        Component comp = (Component)o;

                        Button btnEnabled = new Button(manager);
                        btnEnabled.Init();
                        btnEnabled.Parent = item.panel;
                        btnEnabled.TextColor = Color.Red;
                        btnEnabled.Width = 25;
                        btnEnabled.Left = item.panel.Width - btnEnabled.Width - 20;
                        btnEnabled.Top = 3;
                        btnEnabled.Height = item.buttonHeight;
                        btnEnabled.ToolTip.Text = "Toggle Active";
                        btnEnabled.Name = "component_button_enabled";
                        SetButtonBool(btnEnabled, comp.active);
                        item.AddControl(btnEnabled);

                        //check for essential
                        if (!comp.isEssential())
                        {
                            Button btnRemove = new Button(manager);
                            btnRemove.Init();
                            btnRemove.Parent = item.panel;
                            btnRemove.TextColor = Color.Red;
                            btnRemove.Left = btnEnabled.Left - 20;
                            btnRemove.Top = 3;
                            btnRemove.Height = item.buttonHeight;
                            btnRemove.Width = item.buttonWidth;
                            btnRemove.Text = "-";
                            btnRemove.ToolTip.Text = "Remove";
                            btnRemove.Name = "component_button_remove";
                            item.AddControl(btnRemove);
                        }
                    }
                    else if (o is int || o is Single || o is byte || isToggle)
                    {
                        int w = 60;
                        TextBox textbox = new TextBox(manager);
                        textbox.ClientMargins = new Margins();
                        textbox.Init();
                        textbox.Parent = item.panel;
                        textbox.TextColor = UserInterface.TomShanePuke;
                        textbox.Left = backPanel.Width - w - 26;
                        textbox.Width = w;
                        textbox.Height = textbox.Height - 4;

                        textbox.Name = "number_textbox";
                        if (isToggle)
                        {
                            textbox.Name = "toggle_textbox";

                            Button btnEnabled = new Button(manager);
                            btnEnabled.Init();
                            btnEnabled.Parent = item.panel;
                            btnEnabled.TextColor = Color.Red;
                            btnEnabled.Width = 25;
                            btnEnabled.Left = textbox.Left - btnEnabled.Width;
                            //btnEnabled.Top = 3;
                            btnEnabled.Height = item.buttonHeight;
                            btnEnabled.ToolTip.Text = "Toggle Active";
                            btnEnabled.Name = "toggle_button_enabled";
                            SetButtonBool(btnEnabled, (o as dynamic).enabled);
                            item.AddControl(btnEnabled);

                            //item.AddControl(checkbox);

                            //textbox.Text = (o as dynamic).valueString(); // too slow.
                            textbox.Text = "...";
                        }
                        else textbox.Text = o.ToString();
                        textbox.ClientArea.Top += 2;
                        textbox.ClientArea.Left += 4;
                        textbox.FocusLost += delegate
                        {
                            textbox.SendMessage(Message.KeyUp, new KeyEventArgs(Microsoft.Xna.Framework.Input.Keys.Enter));
                        };
                        textbox.ClientArea.Move += delegate
                        {
                            marginalize(textbox);
                        };
                        item.AddControl(textbox);
                        Type primitiveType = !isToggle ? o.GetType() : ((dynamic)o).value.GetType();

                        Button up = new Button(manager);
                        up.SetSize(textbox.ClientArea.Height, textbox.ClientArea.Height / 2);
                        up.Anchor = Anchors.Right;
                        up.Init();
                        up.Left = textbox.ClientArea.Width - up.Width;
                        sidebar.ui.SetScrollableControl(up, List_ChangeScrollPosition);

                        up.ToolTip.Text = "Increment : RightClick = byOne, MiddleClick = byTen, RightClick = Double";
                        up.MouseDown += (s, e) =>
                        {
                            switch (e.Button)
                            {
                                case MouseButton.Left:
                                    textbox.Text = textbox.Text.increment(primitiveType, NumBoxMode.byOne);
                                    break;
                                case MouseButton.Right:
                                    textbox.Text = textbox.Text.increment(primitiveType, NumBoxMode.quadratic);
                                    break;
                                case MouseButton.Middle:
                                    textbox.Text = textbox.Text.increment(primitiveType, NumBoxMode.byTen);
                                    break;
                            }
                            textbox.SendMessage(Message.KeyUp, new KeyEventArgs(Microsoft.Xna.Framework.Input.Keys.Enter));
                            marginalize(textbox);
                        };
                        textbox.Add(up);

                        Button down = new Button(manager);
                        down.SetSize(textbox.ClientArea.Height, textbox.ClientArea.Height / 2);
                        down.Anchor = Anchors.Right;
                        down.Top = up.Height;
                        down.Init();
                        down.ToolTip.Text = "Decrement : RightClick = byOne, MiddleClick = byTen, RightClick = half";
                        down.MouseDown += (s, e) =>
                        {
                            switch (e.Button)
                            {
                                case MouseButton.Left:
                                    textbox.Text = textbox.Text.decrement(primitiveType, NumBoxMode.byOne);
                                    break;
                                case MouseButton.Right:
                                    textbox.Text = textbox.Text.decrement(primitiveType, NumBoxMode.quadratic);
                                    break;
                                case MouseButton.Middle:
                                    textbox.Text = textbox.Text.decrement(primitiveType, NumBoxMode.byTen);
                                    break;
                            }
                            textbox.SendMessage(Message.KeyUp, new KeyEventArgs(Microsoft.Xna.Framework.Input.Keys.Enter));
                            marginalize(textbox);
                        };
                        down.Left = textbox.ClientArea.Width - down.Width;
                        sidebar.ui.SetScrollableControl(down, List_ChangeScrollPosition);
                        textbox.Add(down);

                        //todo: make tiny + and - buttons
                    }
                    else if (o is string)
                    {
                        int w = 60;
                        TextBox textbox = new TextBox(manager);
                        textbox.ClientMargins = new Margins();
                        textbox.Init();
                        textbox.Parent = item.panel;
                        textbox.TextColor = UserInterface.TomShanePuke;
                        textbox.Left = backPanel.Width - w - 26;
                        textbox.Width = w;
                        textbox.Height = textbox.Height - 4;
                        textbox.Text = o.ToString();
                        textbox.Name = "string_textbox";
                        item.AddControl(textbox);

                        textbox.ClientArea.Top += 2;
                        textbox.ClientArea.Left += 2;
                        textbox.KeyPress += delegate
                        {
                            if (!textbox.Text.Equals(""))
                            {
                                textbox.ClientArea.Top += 2;
                                textbox.ClientArea.Left += 2;
                            }
                        };

                    }
                    else if (o is bool)
                    {
                        Button btnEnabled = new Button(manager);
                        btnEnabled.Init();
                        btnEnabled.Parent = item.panel;
                        btnEnabled.TextColor = Color.Red;
                        btnEnabled.Width = 25;
                        btnEnabled.Left = item.panel.Width - btnEnabled.Width - 20;
                        //btnEnabled.Top = 3;
                        btnEnabled.Height = item.buttonHeight;
                        btnEnabled.ToolTip.Text = "Toggle Enabled";
                        btnEnabled.Name = "bool_button_enabled";
                        SetButtonBool(btnEnabled, (bool)o);
                        item.AddControl(btnEnabled);
                    }
                    else if (o.GetType().IsEnum)
                    {
                        int w = 95;
                        ComboBox combobox = new ComboBox(manager);
                        combobox.ClientMargins = new Margins();
                        combobox.Init();
                        combobox.TextColor = UserInterface.TomShanePuke;
                        combobox.Parent = item.panel;
                        combobox.Left = backPanel.Width - w - 26;
                        combobox.Height = combobox.Height - 4;
                        combobox.Width = w;
                        combobox.MaxItems = 15;
                        int i = 0;
                        foreach(string s in Enum.GetNames(o.GetType()))
                        {
                            combobox.Items.Add(s);
                            if (s.Equals(o.ToString())) combobox.ItemIndex = i;
                            i++;
                        }
                        combobox.Name = "enum_combobox";
                        item.AddControl(combobox);

                        combobox.ClientArea.Top += 2;
                        combobox.ClientArea.Left += 2;
                        combobox.ItemIndexChanged += delegate
                        {
                            if (!combobox.Text.Equals(""))
                            {
                                combobox.ClientArea.Top += 2;
                                combobox.ClientArea.Left += 2;
                            }
                        };
                    }

                }
            }
        }
예제 #10
0
파일: Forms.cs 프로젝트: Eamnon/Emergence
        public void GuiInitialize(Manager manager, GraphicsDeviceManager graphics)
        {
            // Create and setup Window control.
            BottomBar = new Window(manager);
            BottomBar.Init();
            BottomBar.Width = graphics.PreferredBackBufferWidth;
            BottomBar.Height = 100;
            BottomBar.Top = graphics.PreferredBackBufferHeight - BottomBar.Height;
            BottomBar.Left = 0;
            BottomBar.BorderVisible = false;
            BottomBar.Movable = false;
            BottomBar.Resizable = false;
            BottomBar.Visible = true;

            // Create Alert Text
            textbox = new TextBox(manager);
            textbox.Init();
            textbox.Text = "In philosophy and science, emergence is the way complex systems and patterns arise out of a multiplicity of relatively simple interactions.";
            textbox.Width = 830;
            textbox.Height = 20;
            textbox.ReadOnly = true;
            textbox.Passive = true;
            textbox.Left = (1024 / 2) - (textbox.Width / 2);
            textbox.Top = 0;
            textbox.Parent = BottomBar;

            #region BottomBar
            // Create Tool Select.
            radStimulant = new RadioButton(manager);
            radStimulant.Init();
            radStimulant.Parent = BottomBar;
            radStimulant.Left = (1024 / 2) - (textbox.Width / 2);
            radStimulant.Top = 30;
            radStimulant.Width = 100;
            radStimulant.Height = 16;
            radStimulant.Text = "Stimulant";
            radStimulant.Checked = false;
            radStimulant.Click += new MouseEventHandler(Tool_Click);

            radPoison = new RadioButton(manager);
            radPoison.Init();
            radPoison.Parent = BottomBar;
            radPoison.Left = (1024 / 2) - (textbox.Width / 2) + 110;
            radPoison.Top = 30;
            radPoison.Width = 100;
            radPoison.Height = 16;
            radPoison.Text = "Poison";
            radPoison.Checked = false;
            radPoison.Click += new MouseEventHandler(Tool_Click);

            radMutigen = new RadioButton(manager);
            radMutigen.Init();
            radMutigen.Parent = BottomBar;
            radMutigen.Left = (1024 / 2) - (textbox.Width / 2) + 220;
            radMutigen.Top = 30;
            radMutigen.Width = 100;
            radMutigen.Height = 16;
            radMutigen.Text = "Mutigen";
            radMutigen.Checked = false;
            radMutigen.Click += new MouseEventHandler(Tool_Click);

            radGrab = new RadioButton(manager);
            radGrab.Init();
            radGrab.Parent = BottomBar;
            radGrab.Left = (1024 / 2) - (textbox.Width / 2) + 330;
            radGrab.Top = 30;
            radGrab.Width = 100;
            radGrab.Height = 16;
            radGrab.Text = "Grab";
            radGrab.Checked = true;
            radGrab.Click += new MouseEventHandler(Tool_Click);

            // Create Settings button.
            btnSettings = new Button(manager);
            btnSettings.Init();
            btnSettings.Text = "Settings";
            btnSettings.Width = 72;
            btnSettings.Height = 24;
            btnSettings.Left = 10;
            btnSettings.Top = 10;
            btnSettings.Anchor = Anchors.Bottom;
            btnSettings.Parent = BottomBar;
            btnSettings.Click += new MouseEventHandler(btnSettings_Click);

            // Create Sample button.
            btnSample = new Button(manager);
            btnSample.Init();
            btnSample.Text = "Sample";
            btnSample.Width = 72;
            btnSample.Height = 24;
            btnSample.Left = 10;
            btnSample.Top = 44;
            btnSample.Anchor = Anchors.Bottom;
            btnSample.Parent = BottomBar;
            btnSample.Click += new MouseEventHandler(btnSample_Click);

            // Create Edit button.
            btnEdit = new Button(manager);
            btnEdit.Init();
            btnEdit.Text = "Edit";
            btnEdit.Width = 72;
            btnEdit.Height = 24;
            btnEdit.Left = textbox.Left + textbox.Width - btnEdit.Width;
            btnEdit.Top = textbox.Top + textbox.Height + 10;
            btnEdit.Anchor = Anchors.Bottom;
            btnEdit.Parent = BottomBar;
            btnEdit.Click += new MouseEventHandler(btnEdit_Click);

            // Create Save Button.
            btnSave = new Button(manager);
            btnSave.Init();
            btnSave.Text = "Save";
            btnSave.Width = 72;
            btnSave.Height = 24;
            btnSave.Left = 1024 - btnSave.Width - 10;
            btnSave.Top = 10;
            btnSave.Anchor = Anchors.Bottom;
            btnSave.Parent = BottomBar;

            // Create Load Button.
            btnLoad = new Button(manager);
            btnLoad.Init();
            btnLoad.Text = "Load";
            btnLoad.Width = 72;
            btnLoad.Height = 24;
            btnLoad.Left = 1024 - btnLoad.Width - 10;
            btnLoad.Top = 44;
            btnLoad.Anchor = Anchors.Bottom;
            btnLoad.Parent = BottomBar;
            #endregion

            #region SettingsPane
            //Create Settings Pane
            wndSettings = new Window(manager);
            wndSettings.Init();
            wndSettings.Text = "Settings";
            wndSettings.Width = 400;
            wndSettings.Height = 300;
            wndSettings.Top = 20;
            wndSettings.Left = 20;
            wndSettings.Resizable = false;
            wndSettings.Visible = false;

            //Create Environment settings

            lblMutRate = new Label(manager);
            lblMutRate.Init();
            lblMutRate.Parent = wndSettings;
            lblMutRate.Left = 10;
            lblMutRate.Top = 10;
            lblMutRate.Text = "Mutation rate:";
            lblMutRate.Width = 130;
            lblMutRate.Height = 20;

            spnMutRate = new SpinBox(manager, SpinBoxMode.Range);
            spnMutRate.Init();
            spnMutRate.ReadOnly = true;
            spnMutRate.Width = 60;
            spnMutRate.Height = 20;
            spnMutRate.Top = 30;
            spnMutRate.Left = 10;
            spnMutRate.Maximum = 10;
            spnMutRate.Minimum = 0;
            spnMutRate.Rounding = 0;
            spnMutRate.Value = Game1.Globals.MutationRate;
            spnMutRate.Step = 1;
            spnMutRate.Passive = true;
            spnMutRate.Text = Convert.ToString(spnMutRate.Value);
            spnMutRate.Parent = wndSettings;

            lblSolar = new Label(manager);
            lblSolar.Init();
            lblSolar.Parent = wndSettings;
            lblSolar.Left = 10;
            lblSolar.Top = 60;
            lblSolar.Text = "Solar Radiation:";
            lblSolar.Width = 130;
            lblSolar.Height = 20;

            spnSolar = new SpinBox(manager, SpinBoxMode.Range);
            spnSolar.Init();
            spnSolar.ReadOnly = true;
            spnSolar.Width = 60;
            spnSolar.Height = 20;
            spnSolar.Top = 80;
            spnSolar.Left = 10;
            spnSolar.Maximum = 10;
            spnSolar.Minimum = 0;
            spnSolar.Rounding = 0;
            spnSolar.Step = 1;
            spnSolar.Value = Game1.Globals.SolarIntensity;
            spnSolar.Passive = true;
            spnSolar.Text = Convert.ToString(spnSolar.Value);
            spnSolar.Parent = wndSettings;

            lblLifeSpan = new Label(manager);
            lblLifeSpan.Init();
            lblLifeSpan.Parent = wndSettings;
            lblLifeSpan.Left = 10;
            lblLifeSpan.Top = 110;
            lblLifeSpan.Text = "Life in Mins:";
            lblLifeSpan.Width = 130;
            lblLifeSpan.Height = 20;

            spnLifeSpan = new SpinBox(manager, SpinBoxMode.Range);
            spnLifeSpan.Init();
            spnLifeSpan.ReadOnly = true;
            spnLifeSpan.Width = 60;
            spnLifeSpan.Height = 20;
            spnLifeSpan.Top = 130;
            spnLifeSpan.Left = 10;
            spnLifeSpan.Maximum = 30;
            spnLifeSpan.Minimum = 0;
            spnLifeSpan.Rounding = 0;
            spnLifeSpan.Step = 1;
            spnLifeSpan.Value = Game1.Globals.SymetLifespan;
            spnLifeSpan.Passive = true;
            spnLifeSpan.Text = Convert.ToString(spnLifeSpan.Value);
            spnLifeSpan.Parent = wndSettings;

            lblSpeed = new Label(manager);
            lblSpeed.Init();
            lblSpeed.Parent = wndSettings;
            lblSpeed.Left = 10;
            lblSpeed.Top = 160;
            lblSpeed.Text = "Game Speed:";
            lblSpeed.Width = 130;
            lblSpeed.Height = 20;

            spnSpeed = new SpinBox(manager, SpinBoxMode.Range);
            spnSpeed.Init();
            spnSpeed.ReadOnly = true;
            spnSpeed.Width = 60;
            spnSpeed.Height = 20;
            spnSpeed.Top = 180;
            spnSpeed.Left = 10;
            spnSpeed.Maximum = 10;
            spnSpeed.Minimum = 0;
            spnSpeed.Rounding = 0;
            spnSpeed.Step = 1;
            spnSpeed.Value = Game1.Globals.SymetSpeed;
            spnSpeed.Text = Convert.ToString(spnSpeed.Value);
            spnSpeed.Passive = true;
            spnSpeed.Parent = wndSettings;

            // Create Done Button.
            btnSettingsClose = new Button(manager);
            btnSettingsClose.Init();
            btnSettingsClose.Text = "Done";
            btnSettingsClose.Width = 72;
            btnSettingsClose.Height = 24;
            btnSettingsClose.Left = 400 - 92;
            btnSettingsClose.Top = 300 - 64;
            btnSettingsClose.Anchor = Anchors.Bottom;
            btnSettingsClose.Parent = wndSettings;
            btnSettingsClose.Click += new MouseEventHandler(btnDone_Click);
            #endregion

            // Add the window controls to the manager processing queue.
            manager.Add(BottomBar);
            manager.Add(wndSettings);
        }
예제 #11
0
        private Panel CreateNewWorldInterface()
        {
            var panel = new Panel(ControlManager.Manager) { Width = 856, Height = 467, AutoScroll = true, Left = 300, Top = 50 };
            panel.Init();
            ControlManager.Add(panel);

            var newNameLabel = new Label(ControlManager.Manager) { Text = "New World Name :: ", Width = 200, Left = 16, Top = 16, Parent = panel };
            var newName = new TextBox(ControlManager.Manager) { Name = "worldName", Parent = panel, Top = 16, Left = newNameLabel.Left + newNameLabel.Width, Width = 200 };
            newName.Init();

            var createWorld = new Button(ControlManager.Manager) { Text = "Create world", Top = 200, Left = 100, Width = 200, Parent = panel };
            createWorld.Init();
            createWorld.Click += (sender, args) => CreateNewWorld(newName.Text);

            return panel;
        }
예제 #12
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);
        }
예제 #13
0
 private void ChangeGameType(TextBox ageLimit, int index)
 {
     if (index == 1) {
         ageLimit.Text = "";
         ageLimit.Enabled = true;
     } else {
         ageLimit.Text = "N/A";
         ageLimit.Enabled = false;
     }
 }
예제 #14
0
파일: Logic.cs 프로젝트: Rfvgyhn/Neoforce
        ////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////
        void btnRandom_Click(object sender, Controls.EventArgs e)
        {
            Window win = new Window(Manager);
              Button btn = new Button(Manager);
              TextBox txt = new TextBox(Manager);

              win.Init();
              btn.Init();
              txt.Init();

              win.ClientWidth = 320;
              win.ClientHeight = 160;

              win.MinimumWidth = 128;
              win.MinimumHeight = 128;

              Random r = new Random((int)Central.Frames);
              win.ClientWidth += r.Next(-100, +100);
              win.ClientHeight += r.Next(-100, +100);

              win.Left = r.Next(200, Manager.ScreenWidth - win.ClientWidth / 2);
              win.Top = r.Next(0, Manager.ScreenHeight - win.ClientHeight / 2);
              win.Closed += new WindowClosedEventHandler(win_Closed);

            /*
              win.Width = 1024;
              win.Height = 768;
              win.Left = 220;
              win.Top = 0;
              win.StayOnBack = true;
              win.SendToBack();
            */
              btn.Anchor = Anchors.Bottom;
              btn.Left = (win.ClientWidth / 2) - (btn.Width / 2);
              btn.Top = win.ClientHeight - btn.Height - 8;
              btn.Text = "OK";

              win.Text = "Window (" + win.Width.ToString() + "x" + win.Height.ToString() + ")";

              txt.Parent = win;
              txt.Left = 8;
              txt.Top = 8;
              txt.Width = win.ClientArea.Width - 16;
              txt.Height = win.ClientArea.Height - 48;
              txt.Anchor = Anchors.All;
              txt.Mode = TextBoxMode.Multiline;
              txt.Text = "This is a Multiline TextBox.\n" +
                 "Allows to edit large texts,\n" +
                 "copy text to and from clipboard,\n" +
                 "select text with mouse or keyboard\n" +
                 "and much more...";

              txt.SelectAll();
              txt.Focused = true;
              //txt.ReadOnly = true;

              txt.ScrollBars = ScrollBars.Both;

              win.Add(btn, true);
              win.Show();
              Manager.Add(win);
        }
예제 #15
0
        /// <summary>
        /// Initialize the components that make up the window, including the window itself.
        /// </summary>
        private void Initialize()
        {
            Window = new Window(manager);
            Window.Init();
            Window.Text = "Console";
            Window.Left = windowFrame.X;
            Window.Top = windowFrame.Y;
            Window.Width = windowFrame.Width;
            Window.Height = windowFrame.Height;
            Window.Alpha = 200;
            Window.BorderVisible = true;
            Window.CaptionVisible = false;
            Window.BackColor = Color.Black;
            Window.Center();

            TextArea = new ConsoleArea(manager);
            TextArea.Init();
            TextArea.Text = "";
            TextArea.Width = windowFrame.Width - 15;
            TextArea.Height = windowFrame.Height - 40;
            TextArea.Enabled = true;
            TextArea.CanFocus = false;
            TextArea.BackgroundColor = Color.Black;
            TextArea.TextColor = Color.Green;
            TextArea.TextPosition = ConsoleArea.TextOrigin.BOTTOM;
            TextArea.Parent = Window;

            Input = new TextBox(manager);
            Input.Init();
            Input.Text = "";
            Input.Color = Color.Black;
            Input.TextColor = Color.Green;
            Input.Top = TextArea.Top + TextArea.Height + 2;
            Input.Width = windowFrame.Width - 15;
            Input.Height = 20;
            Input.Enabled = true;
            Input.Parent = Window;
        }
예제 #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 void Init()
        {
            // Create and setup Window control.
            window = new Window(manager);
            window.Init();
            window.Text = "Login";
            window.Width = 300;
            window.Height = 225;
            window.Center();
            window.Visible = true;
            window.CloseButtonVisible = false;

            unLbl = new Label(manager);
            unLbl.Init();
            unLbl.Text = "User Name: ";
            unLbl.Width = 72;
            unLbl.Height = 24;
            unLbl.Left = 40;
            unLbl.Top = 40;
            unLbl.Anchor = Anchors.Left;
            unLbl.Parent = window;

            pwLbl = new Label(manager);
            pwLbl.Init();
            pwLbl.Text = "Password: "******"";
            unTxt.Width = 124;
            unTxt.Height = 24;
            unTxt.Left = 125;
            unTxt.Top = 40;
            unTxt.Anchor = Anchors.Right;
            unTxt.Parent = window;
            unTxt.KeyPress += new KeyEventHandler(Txt_KeyPress);

            pwTxt = new TextBox(manager);
            pwTxt.Init();
            pwTxt.Text = "";
            pwTxt.Width = 124;
            pwTxt.Height = 24;
            pwTxt.Left = 125;
            pwTxt.Top = 70;
            pwTxt.Anchor = Anchors.Right;
            pwTxt.Mode = TextBoxMode.Password;
            pwTxt.Parent = window;
            pwTxt.KeyPress += new KeyEventHandler(Txt_KeyPress);

            login = new Button(manager);
            login.Init();
            login.Text = "Login";
            login.Width = 80;
            login.Height = 24;
            login.Left = window.ClientWidth - pwTxt.Width + 7;
            login.Top = window.ClientHeight - login.Height - 50;
            login.Anchor = Anchors.Top;
            login.Parent = window;

            exit = new Button(manager);
            exit.Init();
            exit.Text = "Exit";
            exit.Width = 80;
            exit.Height = 24;
            exit.Left = unLbl.Left;
            exit.Top = login.Top;
            exit.Anchor = Anchors.Top;
            exit.Parent = window;

            regArea = new CursorChangeArea(manager);
            regArea.Init();
            regArea.Text = "Register";
            regArea.Width = 58;
            regArea.Height = 16;
            regArea.Color = new Color(80, 80, 80, 255);
            regArea.TextColor = Color.LightBlue;
            regArea.Left = exit.Left;
            regArea.Top = exit.Top + exit.Height + 15;
            regArea.Anchor = Anchors.Left;
            regArea.Parent = window;
            regArea.MousePress += new MouseEventHandler(reg_MousePress);
            regArea.ToolTip.Text = "Visit VTank registration site";

            passArea = new CursorChangeArea(manager);
            passArea.Init();
            passArea.Text = "Forgot password?";
            passArea.Width = 110;
            passArea.Height = 16;
            passArea.Color = new Color(80, 80, 80, 255);
            passArea.TextColor = Color.LightBlue;
            passArea.Left = login.Left + login.Width - passArea.Width;
            passArea.Top = exit.Top + exit.Height + 15;
            passArea.Anchor = Anchors.Left;
            passArea.Parent = window;
            passArea.MousePress += new MouseEventHandler(pass_MousePress);
            passArea.ToolTip.Text = "Visit password recovery site";
        }
예제 #18
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);
        }
예제 #19
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
        }
 public static void marginalize(TextBox t)
 {
     t.ClientArea.Top = 2;
     t.ClientArea.Left = 4;
 }
예제 #21
0
파일: Game1.cs 프로젝트: slicedpan/demo
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.

            spriteBatch = new SpriteBatch(GraphicsDevice);

            #region models

            boxmodel = Content.Load<Model>("primitives/box");
            lppbox = Content.Load<Model>("primitives/lit/box");
            lppsphere = Content.Load<Model>("primitives/lit/sphere");
            lppcapsule = Content.Load<Model>("primitives/lit/capsule");
            lppcylinder = Content.Load<Model>("primitives/lit/cylinder");
            cylindermodel = Content.Load<Model>("primitives/cylinder");
            spheremodel = Content.Load<Model>("primitives/sphere");
            capsulemodel = Content.Load<Model>("primitives/capsule");
            floormodel = Content.Load<Model>("floor/floor");
            boxdata = Content.Load<PhysicsInfo>("walls/roomphys");
            circleimg = Content.Load<Texture2D>("textures/circle");
            Model blockman = Content.Load<Model>("floor/floor");
            //Model skullmodel = Content.Load<Model>("skull/skull");
            Model wallmodel = Content.Load<Model>("room/room");
            PhysicsInfo skullphys = Content.Load<PhysicsInfo>("skull/skullphys");
            ShadowEffect = Content.Load<Effect>("shaders/Shadow");
            Model sceneModel = Content.Load<Model>("scene/scenetest");
            PhysicsInfo scenePhys = Content.Load<PhysicsInfo>("scene/scenetestphys");

            #endregion

            #region Effects
            NormalEffect = Content.Load<Effect>("shaders/LPPNormalEffect");
            BasicEffect = Content.Load<Effect>("shaders/LPPBasicEffect");
            TexturedEffect = Content.Load<Effect>("shaders/LPPTexturedEffect");
            MainEffect = Content.Load<Effect>("shaders/LPPMainEffect");
            #endregion
            Vector3 lowerButton = new Vector3(134.988f, 61.178f, 126.411f) * (2.54f / 64.0f);
            Vector3 upperButton = new Vector3(134.988f, 64.803f, 126.411f) * (2.54f / 64.0f);
            float convFactor = 2.54f / 64.0f;

            Console.Parse("physdebug false");
            Console.Parse("drawconstraints false");
            Console.Parse("drawedgemask false");
            Console.Parse("drawdepth false");
            Console.Parse("drawnormal false");
            Console.Parse("drawall false");
            Console.Parse("drawspheres false");
            Console.Parse("blur true");
            Console.Parse("drawshadowmap false");
            Console.Parse("drawlightbuffer false");
            Console.Parse("showPosition true");

            Console.LoadContent(Content);

            /*boxdata = new PhysicsInfo();
            boxdata.CreateBox(new Vector3(-1, -1, -1), Matrix.Identity, Vector3.One);
            boxdata.CreateBox(new Vector3(1, 1, 1), Matrix.Identity, Vector3.One);
            boxdata.CreateSphere(new Vector3(1, 3, 1), 1);*/

            // TODO: use this.Content to load your game content here
            projmatrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45), (float)graphics.PreferredBackBufferWidth / (float)graphics.PreferredBackBufferHeight, 0.01f, 2500.0f);
            /*
            fallingBox = new Component(new Vector3(3.6f, 7.5f, -2.4f), Quaternion.Identity, Vector3.One / 2.0f);
            fallingBox.SetCollision(skullphys, false);
            fallingBox.Mesh = new LPPMesh(skullmodel);
            fallingBox.Mesh.Occlude = true;
            Actors.Add(new Actor(fallingBox));*/

            /*immovableBox = new TriangleMeshActor(floormodel, Vector3.Zero, Vector3.One / 8.0f);
            immovableBox.Mesh = new LPPMesh(floormodel);
            immovableBox.Mesh.Occlude = true;

            Entities.Add(new Entity(immovableBox));*/

            immovableBox = new TriangleMeshComponent(wallmodel, Vector3.Zero, Vector3.One / (64.0f / 2.54f));
            var lppmesh = new LPPMesh(wallmodel);

            var scene = new Component(new LPPMesh(sceneModel), new Vector3(3.8f, 7.5f, -3.0f), Quaternion.Identity, Vector3.One / 64.0f);
            scene.SetCollision(scenePhys, true);
            Actors.Add(new Actor(scene));
            Actors.Add(new LiftButton(upperButton, Vector3.One / 64.0f, "lift up"));
            Actors.Add(new LiftButton(lowerButton, Vector3.One / 64.0f, "lift down"));

            lppmesh.SpecularPower = 1.0f;
            lppmesh.Shininess = 1.0f;

            immovableBox.Mesh = lppmesh;

            Actors.Add(new Actor(immovableBox));

            Actors.Add(new CeilingLamp(new Vector3(-1.5f, 11.9f, 1.68f), 0.75f));
            Actors.Add(new Ladder(new Vector3(13.735f, 5.0f, -2.32f), 1.0f, 3.5f, 0.5f));
            lift = new Lift(Vector3.Zero, 1 / 64.0f);
            Actors.Add(lift);

            Actors.Add(new PulsingLight(new Vector3(12.86f, 3.43f, 5.84f), Color.Red, 7.5f, 1.0f, 0.2f, 3.0d));
            Actors.Add(new BareBulb(new Vector3(-14.5f, 11.4f, 3f), Vector3.One / 64.0f, Color.Wheat, 10.0f, 0.6f));
            font = Content.Load<SpriteFont>("font");

            RasterizerState rs = RasterizerState.CullCounterClockwise;
            GraphicsDevice.RasterizerState = rs;

            bs = GraphicsDevice.BlendState;

            cam = new Camera();
            cam.Aspect = (float)scrwidth / (float)scrheight;
            cam.Viewport = new Viewport(0, 0, scrwidth, scrheight);
            cam.NearClip = 0.01f;
            cam.FarClip = 100.0f;
            cam.Transform = Matrix.Identity;

            characterController = new CharacterController(new Vector3(-1.0f, 2.0f, 7.311f), 3.0f, 0.75f, 0.1f, 0.2f);
            characterInput = new CharacterControllerInput(space, cam);
            characterInput.CharacterController = characterController;
            characterInput.Activate();

            camcontrol = new CameraController(cam, Vector3.Zero, Vector2.Zero);
            Actors.Add(new Actor(new FollowLight(12.5f, 1.0f, Color.White, cam)));
            lppRenderer = new LPPRenderer(GraphicsDevice, Content, scrwidth, scrheight);

            for (int i = /*200*/0; i > 0; --i)
            {
                space.Update(0.0166f);
            }

            window = new Dialog(Manager);
            window.SetPosition(0, 0);
            window.SetSize(512, 512);
            window.Text = "Console";
            textBox = new TextBox(Manager);
            textBox.SetPosition(32, 32);
            window.Add(textBox, false);
            Manager.Add(window);
        }
예제 #22
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
        }
        public CreateGroupWindow(Sidebar sidebar)
        {
            this.sidebar = sidebar;
            this.manager = sidebar.manager;
            sidebar.CreatingGroup = true;
            //sidebar.ui.game.SwitchToTempRoom();
            //temproom = sidebar.ui.game.tempRoom;
            //tempgroup = g;// sidebar.ActiveGroup;//temproom.groups.generalGroups.childGroups.ElementAt(0).Value;

            neoSidebar = new NeoSidebar(manager);
            neoSidebar.Init();
            int tomtom = 5;
            neoSidebar.ClientArea.BackColor = UserInterface.TomDark;
            neoSidebar.BackColor = Color.Black;
            neoSidebar.BevelBorder = BevelBorder.All;
            Margins tomtomtomtom = new Margins(tomtom, tomtom, tomtom, tomtom);
            neoSidebar.ClientMargins = tomtomtomtom;

            neoSidebar.Left = sidebar.master.Left;
            neoSidebar.Width = sidebar.Width;
            neoSidebar.Top = 0;
            neoSidebar.Height = OrbIt.ScreenHeight;
            //poop.Text = "Create Group";
            //poop.Closed += delegate { UserInterface.GameInputDisabled = false; sidebar.CreatingGroup = false; sidebar.ui.game.SwitchToMainRoom(); sidebar.groupsView.createGroupWindow = null; };
            //window.ShowModal();
            manager.Add(neoSidebar);

            int width = 120;
            int offset = neoSidebar.Width - width - 20;

            TitlePanel titlePanelCreateGroup = new TitlePanel(sidebar, neoSidebar, "Create Group", true);
            titlePanelCreateGroup.btnBack.Click += (s, e) => Close();

            HeightCounter += titlePanelCreateGroup.Height;

            Label lblName = new Label(manager);
            lblName.Init();
            lblName.Parent = neoSidebar;
            lblName.Left = LeftPadding;
            lblName.Top = HeightCounter;
            lblName.Width = width;
            lblName.Text = "Group Name:";

            TextBox txtName = new TextBox(manager);
            txtName.Init();
            txtName.Parent = neoSidebar;
            txtName.Top = HeightCounter;
            txtName.Width = width;
            txtName.Left = offset;
            HeightCounter += txtName.Height + LeftPadding;

            Button btnRandomName = new Button(manager);
            btnRandomName.Init();
            btnRandomName.Parent = neoSidebar;
            btnRandomName.Top = HeightCounter;
            btnRandomName.Width = txtName.Width;
            btnRandomName.Left = offset;
            btnRandomName.Text = "Random Name";
            HeightCounter += txtName.Height + LeftPadding;
            btnRandomName.Click += (s, e) =>
            {
                txtName.Text = Utils.RandomName();
            };

            RadioButton rdEmpty = new RadioButton(manager);
            rdEmpty.Init();
            rdEmpty.Parent = neoSidebar;
            rdEmpty.Top = HeightCounter;
            rdEmpty.Left = LeftPadding;
            rdEmpty.Text = "Default";
            rdEmpty.Checked = true;
            HeightCounter += rdEmpty.Height + LeftPadding;

            RadioButton rdExisting = new RadioButton(manager);
            rdExisting.Init();
            rdExisting.Parent = neoSidebar;
            rdExisting.Top = HeightCounter;
            rdExisting.Left = LeftPadding;
            rdExisting.Text = "Existing";
            rdExisting.Checked = false;
            rdExisting.Width = width;

            ComboBox cbExisting = new ComboBox(manager);
            cbExisting.Init();
            cbExisting.Parent = neoSidebar;
            cbExisting.Top = HeightCounter;
            cbExisting.Width = width;
            cbExisting.Left = offset;
            foreach(Group gg in sidebar.game.room.groups.general.childGroups.Values)
            {
                cbExisting.Items.Add(gg);
            }
            cbExisting.ItemIndex = 0;
            cbExisting.Enabled = false;
            HeightCounter += cbExisting.Height + LeftPadding;

            RadioButton rdTemplate = new RadioButton(manager);
            rdTemplate.Init();
            rdTemplate.Parent = neoSidebar;
            rdTemplate.Top = HeightCounter;
            rdTemplate.Left = LeftPadding;
            rdTemplate.Text = "Template";
            rdTemplate.Checked = false;
            rdTemplate.Width = width;

            ComboBox cbTemplate = new ComboBox(manager);
            cbTemplate.Init();
            cbTemplate.Parent = neoSidebar;
            cbTemplate.Top = HeightCounter;
            cbTemplate.Width = width;
            cbTemplate.Left = offset;
            foreach (Node n in Assets.NodePresets)
            {
                cbTemplate.Items.Add(n);
            }
            if (Assets.NodePresets.Count > 0) cbTemplate.ItemIndex = 0;
            cbTemplate.Enabled = false;
            HeightCounter += cbTemplate.Height + LeftPadding;

            componentView = new ComponentView(sidebar, neoSidebar, 0, HeightCounter, ViewType.Group);
            componentView.Height = 150;
            componentView.Width = neoSidebar.Width - LeftPadding * 4;

            neoSidebar.Width += 100;
            neoSidebar.Width -= 100;
            tempgroup = new Group(sidebar.room, sidebar.room.defaultNode.CreateClone(sidebar.room), null, "tempgroup", false);

            SetGroup(sidebar.room.defaultNode);

            rdEmpty.Click += (s, e) =>
            {
                cbExisting.Enabled = false;
                cbTemplate.Enabled = false;
                SetGroup(sidebar.room.defaultNode);
            };
            rdExisting.Click += (s, e) =>
            {
                cbExisting.Enabled = true;
                cbTemplate.Enabled = false;
                ComboUpdate(cbExisting);
            };
            cbExisting.ItemIndexChanged += (s, e) =>
            {
                ComboUpdate(cbExisting);
            };
            rdTemplate.Click += (s, e) =>
            {
                cbExisting.Enabled = false;
                cbTemplate.Enabled = true;
                ComboUpdate(cbTemplate);
            };
            cbTemplate.ItemIndexChanged += (s, e) =>
            {
                ComboUpdate(cbTemplate);
            };

            btnCreateGroup = new Button(manager);
            btnCreateGroup.Init();
            btnCreateGroup.Parent = neoSidebar;
            btnCreateGroup.Top = componentView.bottomArea.Top + componentView.bottomArea.Height + LeftPadding * 2;
            btnCreateGroup.Text = "Create Group";
            btnCreateGroup.Width = width;
            btnCreateGroup.Left = neoSidebar.Width / 2 - btnCreateGroup.Width / 2;

            btnCreateGroup.Click += (s, e) =>
            {
                if (String.IsNullOrWhiteSpace(txtName.Text))
                    PopUp.Toast("Please enter a group name.");
                else if(sidebar.game.room.groups.general.childGroups.Keys.Contains(txtName.Text))
                    PopUp.Toast("Group already exists.");
                else{

                    OrbIt.game.room = sidebar.game.room;
                    Node newNode = tempgroup.defaultNode.CreateClone(sidebar.game.room);
                    newNode.body.color = ColorChanger.randomColorHue();
                    newNode.basicdraw.UpdateColor();
                    Group newGroup = new Group(sidebar.game.room, newNode, sidebar.game.room.groups.general, txtName.Text.Trim());
                    newNode.name = txtName.Text.Trim();
                    newNode.group = newGroup;
                    sidebar.groupsView.UpdateGroups();
                    foreach(DetailedItem item in sidebar.groupsView.viewItems)
                    {
                        if (item.obj == newGroup)
                        {
                            sidebar.groupsView.SelectItem(item);
                            break;
                        }
                    }
                    Close();
                }
            };
        }
예제 #24
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);
        }
예제 #25
0
        private void Init(Vector2 pos, int width)
        {
            // Create and setup Window control.
            //window = new Window(manager);
            //window.Init();
            //window.Text = "Login";
            //window.Width = width+30;
            //window.Height = 20;
            //window.Top = (int)pos.Y;
            //window.Left = (int)pos.X;
            //window.Visible = true;
            //window.CloseButtonVisible = false;
            //window.CaptionVisible = false;
            //window.BorderVisible = true;
            //window.Resizable = false;
            //window.Movable = false;

            txtBox = new TextBox(manager);
            txtBox.Init();
            txtBox.Text = "";
            txtBox.Width = width;
            txtBox.Height = 24;
            txtBox.Anchor = Anchors.All;
            txtBox.Top = (int)pos.Y;
            txtBox.Left = (int)pos.X;
            //txtBox.Parent = window;
            txtBox.BackColor = new Color(0, 0, 0, 100);
            txtBox.TextColor = new Color(255, 255, 255, 255);
            txtBox.KeyPress += new KeyEventHandler(Txt_KeyPress);
        }
        private EditNodeWindow(Sidebar sidebar, ViewType viewType)
        {
            this.sidebar = sidebar;
            this.manager = sidebar.manager;
            neoSidebar = new NeoSidebar(manager);
            neoSidebar.Init();
            int tomtom = 5;
            neoSidebar.ClientArea.BackColor = UserInterface.TomDark;
            neoSidebar.BackColor = Color.Black;
            neoSidebar.BevelBorder = BevelBorder.All;
            Margins tomtomtomtom = new Margins(tomtom, tomtom, tomtom, tomtom);
            neoSidebar.ClientMargins = tomtomtomtom;

            neoSidebar.Left = sidebar.master.Left;
            neoSidebar.Width = sidebar.Width;
            neoSidebar.Top = 0;
            neoSidebar.Resizable = false;
            neoSidebar.Movable = false;
            neoSidebar.Height = OrbIt.ScreenHeight;
            neoSidebar.Text = "Edit";
            manager.Add(neoSidebar);

            int width = 120;
            int offset = neoSidebar.Width - width - 20;

            titlePanelEditNode = new TitlePanel(sidebar, neoSidebar, "Edit", true);
            titlePanelEditNode.btnBack.Click += (s, e) =>
            {
                sidebar.groupsView.UpdateGroups();
                manager.Remove(neoSidebar);
            };

            HeightCounter += titlePanelEditNode.Height;

            lblName = new Label(manager);
            lblName.Init();
            lblName.Parent = neoSidebar;
            lblName.Left = LeftPadding;
            lblName.Top = HeightCounter;
            lblName.Width = width;

            txtName = new TextBox(manager);
            txtName.Init();
            txtName.Parent = neoSidebar;
            txtName.Top = HeightCounter;
            txtName.Width = width;
            txtName.Left = offset;
            HeightCounter += txtName.Height + LeftPadding;
            txtName.TextColor = Color.Black;
            txtName.Enabled = false;

            componentView = new ComponentView(sidebar, neoSidebar, 0, HeightCounter, viewType);
            componentView.Width = neoSidebar.Width - 20;
            componentView.insView.Height += componentView.insView.Height / 2;

            neoSidebar.Width += 100;
            neoSidebar.Width -= 100;
        }
        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
        }
예제 #28
0
        public LobbyWindow(Manager manager)
            : base(manager)
        {
            //Setup the window
            CaptionVisible = false;
            TopPanel.Visible = false;
            Movable = false;
            Resizable = false;
            Width = 700;
            Height = 500;
            Shadow = true;
            Center();

            //Group panels
            grpLobby = new GroupPanel(Manager) { Width = ClientWidth / 2, Height = ClientHeight - BottomPanel.Height + 2, Text = "Rooms" };
            grpLobby.Init();
            Add(grpLobby);

            grpServer = new GroupPanel(Manager) { Left = (ClientWidth / 2) - 1, Width = (ClientWidth / 2) + 1, Height = ClientHeight - BottomPanel.Height + 2, Text = "Server" };
            grpServer.Init();
            Add(grpServer);

            //Top controls
            txtSearch = new TextBox(Manager) { Left = 8, Top = 8, Width = (ClientWidth / 4) - 16, };
            txtSearch.Init();
            txtSearch.Text = searchStr;
            txtSearch.TextChanged += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e)
            {
                RefreshRooms();
            });
            //Show "Search..." text, but make it dissapear on focus
            txtSearch.FocusGained += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e)
            {
                if (txtSearch.Text.Trim() == searchStr)
                    txtSearch.Text = string.Empty;
            });
            txtSearch.FocusLost += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e)
            {
                if (txtSearch.Text.Trim() == string.Empty)
                    txtSearch.Text = searchStr;
            });
            grpLobby.Add(txtSearch);

            cmbSort = new ComboBox(Manager) { Left = txtSearch.Right + 8, Top = 8, Width = (ClientWidth / 4) - 16 - 20, };
            cmbSort.Init();
            cmbSort.Items.AddRange(sortFilters);
            cmbSort.ItemIndex = 0;
            cmbSort.ItemIndexChanged += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e)
            {
                RefreshRooms();
            });
            grpLobby.Add(cmbSort);

            btnReload = new Button(Manager) { Left = cmbSort.Right + 8, Top = 8, Width = 20, Height = 20, Text = string.Empty, };
            btnReload.Init();
            btnReload.Glyph = new Glyph(ContentPack.Textures["gui\\icons\\refresh"]);
            btnReload.ToolTip.Text = "Refresh";
            btnReload.Click += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e)
            {
                Game.NetManager.Send(new RequestMessage(MessageTypes.Lobby));
            });
            grpLobby.Add(btnReload);

            //Main room list
            RoomListCtrl = new ControlList<LobbyDataControl>(Manager) { Left = 8, Top = txtSearch.Bottom + 8, Width = grpLobby.Width - 16, Height = grpLobby.Height - 16 - txtSearch.Bottom - 24 };
            RoomListCtrl.Init();
            grpLobby.Add(RoomListCtrl);

            //Server info labels
            lblName = new Label(Manager) { Text = "Loading...", Top = 8, Font = FontSize.Default20, Left = 8, Alignment = Alignment.MiddleCenter, Height = 30, Width = grpServer.ClientWidth - 16 };
            lblName.Init();
            grpServer.Add(lblName);

            lblDescription = new Label(Manager) { Text = string.Empty, Top = 8 + lblName.Bottom, Left = 8, Alignment = Alignment.MiddleCenter, Width = grpServer.ClientWidth - 16 };
            lblDescription.Init();
            grpServer.Add(lblDescription);

            lblInfo = new Label(Manager) { Text = string.Empty, Top = 8 + lblDescription.Bottom, Left = 8, Alignment = Alignment.TopLeft, Width = grpServer.ClientWidth - 16, Height = grpServer.Height };
            lblInfo.Init();
            grpServer.Add(lblInfo);
            //Bottom buttons
            btnCreate = new Button(Manager) { Top = 8, Text = "Create" };
            btnCreate.Left = (ClientWidth / 2) - (btnCreate.Width / 2);
            btnCreate.Init();
            btnCreate.Click += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e)
            {
                CreateWorldDialog window = new CreateWorldDialog(manager, this);
                window.Init();
                Manager.Add(window);
                window.Show();
            });
            BottomPanel.Add(btnCreate);

            btnJoin = new Button(Manager) { Right = btnCreate.Left - 8, Top = 8, Text = "Join" };
            btnJoin.Init();
            btnJoin.Click += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e)
            {
                JoinRoom(RoomListCtrl.ItemIndex);
            });
            BottomPanel.Add(btnJoin);

            btnDisconnect = new Button(Manager) { Left = btnCreate.Right + 8, Top = 8, Text = "Quit" };
            btnDisconnect.Init();
            btnDisconnect.Click += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e)
            {
                Game.NetManager.Disconnect("Left Lobby");
                Game.CurrentGameState = GameState.Login;
                Interface.MainWindow.ScreenManager.SwitchScreen(new LoginScreen());
            });
            BottomPanel.Add(btnDisconnect);

            //When finished, request server send lobby data
            Game.NetManager.Send(new RequestMessage(MessageTypes.Lobby));
        }
예제 #29
0
        public ServerWindow(Manager manager)
            : base(manager)
        {
            //Setup server pinger/query
            Pinger = new ServerPinger();
            //Setup the window
            CaptionVisible = false;
            Caption.Text = "Welcome to Bricklayer!";
            Description.Text = "An open source, fully moddable and customizable 2D\nbuilding game built with the community in mind.";
            Movable = false;
            Resizable = false;
            Width = 450;
            Height = 350;
            Shadow = true;
            Center();

            //Player config
            NameLbl = new Label(Manager) { Left = 8, Top = TopPanel.Bottom + 10, Width = 64, Text = "Username:"******"Color:" };
            ColorLbl.Init();
            Add(ColorLbl);

            BodyClr = new ColorPicker(Manager) { Left = ColorLbl.Right + 4, Top = TopPanel.Bottom + 8, Width = 128, Saturation = GlobalSettings.ColorSaturation, Value = GlobalSettings.ColorValue };
            BodyClr.Init();
            BodyClr.ValueChanged += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e)
            {
                BodyImg.Color = BodyClr.SelectedColor;
                Game.MyColor = BodyClr.SelectedColor;
                Game.MyHue = BodyClr.Hue;
            });
            Add(BodyClr);

            BodyImg = new ImageBox(Manager) { Left = BodyClr.Right + 6, Top = TopPanel.Bottom + 8, Width = 18, Height = 18, Color = Game.MyColor, Image = ContentPack.Textures["entity\\body"] };
            BodyImg.Init();
            Add(BodyImg);

            SmileyImg = new ImageBox(Manager) { Left = BodyClr.Right + 6, Top = TopPanel.Bottom + 8, Width = 18, Height = 18, Image = ContentPack.Textures["entity\\smileys"], SourceRect = new Rectangle(0, 0, 18, 18) };
            SmileyImg.Init();
            SmileyImg.ToolTip.Text = "I love this color!";
            Add(SmileyImg);

            BodyClr.Hue = Game.MyHue;
            //Create main server list
            ServerListCtrl = new ControlList<ServerDataControl>(manager) { Left = 8, Top = TopPanel.Bottom + 34, Width = ClientWidth - 16, Height = ClientHeight - TopPanel.Height - BottomPanel.Height - 42 };
            ServerListCtrl.Init();
            Add(ServerListCtrl);
            RefreshServerList();

            //Add BottomPanel controls
            JoinBtn = new Button(manager) { Text = "Connect", Left = 24, Top = 8, Width = 100, };
            JoinBtn.Init();
            JoinBtn.Click += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e)
            {
                //Logical place to save name/color settings
                IO.SaveSettings(new Settings() { Username = Game.Username, Color = Game.MyHue, ContentPack = Game.ContentPackName, Resolution = new Point(Game.Resolution.Width, Game.Resolution.Height), UseVSync = Game.MainWindow.Manager.Graphics.SynchronizeWithVerticalRetrace });
                //Connect
                if (ServerListCtrl.Items.Count > 0)
                {
                    if ((ServerListCtrl.Items[ServerListCtrl.ItemIndex] as ServerDataControl).Ping != null && (ServerListCtrl.Items[ServerListCtrl.ItemIndex] as ServerDataControl).Ping.Error)
                        return;
                    //Create a world and connect
                    JoinBtn.Enabled = false;
                    JoinBtn.Text = "Connecting...";
                    Game.NetManager.Connect(Servers[ServerListCtrl.ItemIndex].IP, Servers[ServerListCtrl.ItemIndex].Port);
                }
            });
            BottomPanel.Add(JoinBtn);

            AddBtn = new Button(manager) { Text = "Add", Left = JoinBtn.Right + 8, Top = 8, Width = 64, };
            AddBtn.Init();
            AddBtn.Click += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e)
            {
                AddServerDialog window = new AddServerDialog(manager, this,ServerListCtrl.ItemIndex, false, string.Empty, string.Empty);
                window.Init();
                Manager.Add(window);
                window.Show();
            });
            BottomPanel.Add(AddBtn);

            EditBtn = new Button(manager) { Text = "Edit", Left = AddBtn.Right + 8, Top = 8, Width = 64, };
            EditBtn.Init();
            EditBtn.Click += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e)
            {
                if (ServerListCtrl.Items.Count > 0)
                {
                    AddServerDialog window = new AddServerDialog(manager, this, ServerListCtrl.ItemIndex, true, Servers[ServerListCtrl.ItemIndex].Name, Servers[ServerListCtrl.ItemIndex].GetHostString());
                    window.Init();
                    Manager.Add(window);
                    window.Show();
                }
            });
            BottomPanel.Add(EditBtn);

            RemoveBtn = new Button(manager) { Text = "Remove", Left = EditBtn.Right + 8, Top = 8, Width = 64 };
            RemoveBtn.Init();
            RemoveBtn.Click += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e)
            {
                if (ServerListCtrl.Items.Count > 0)
                {
                    MessageBox confirm = new MessageBox(manager, MessageBoxType.YesNo, "Are you sure you would like to remove\nthis server from your server list?", "[color:Red]Confirm Removal[/color]");
                    confirm.Init();
                    confirm.Closed += new WindowClosedEventHandler(delegate(object sender, WindowClosedEventArgs args)
                    {
                        if ((sender as Dialog).ModalResult == ModalResult.Yes) //If user clicked yes
                        {
                            Servers.RemoveAt(ServerListCtrl.ItemIndex);
                            ServerListCtrl.Items.RemoveAt(ServerListCtrl.ItemIndex);
                            IO.WriteServers(Servers);
                            RefreshServerList();
                        }
                    });
                    Manager.Add(confirm);
                    confirm.Show();
                }
            });
            BottomPanel.Add(RemoveBtn);

            RefreshBtn = new Button(manager) { Text = "Refresh", Left = RemoveBtn.Right + 8, Top = 8, Width = 64 };
            RefreshBtn.Init();
            RefreshBtn.Click += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e)
            {
                RefreshServerList();
            });
            BottomPanel.Add(RefreshBtn);
            MainWindow.ScreenManager.FadeIn();
            validateUsername();
        }
        public void UpdatePanel(InspectorInfo inspectorItem)
        {
            //if (activeInspectorItem == inspectorItem) return;
            if (inspectorItem.membertype == member_type.previouslevel) return;

            if (panelControls.Keys.Count > 0) DisableControls();

            grouppanel.Visible = true;
            grouppanel.Refresh();

            activeInspectorItem = inspectorItem;

            //grouppanel.Text = activeInspectorItem.ToString(); //.Name();
            grouppanel.Text = activeInspectorItem.Name();

            if (!activeInspectorItem.HasPanelElements()) return;

            editType = activeInspectorItem.obj.GetType();
            object value = activeInspectorItem.GetValue();
            if (value == null) return;

            if (editType == typeof(int) || editType == typeof(Single) || editType == typeof(string) || editType == typeof(byte))
            {
                //System.Console.WriteLine("It's an int or float.");
                TextBox txtbox = new TextBox(grouppanel.Manager);
                txtbox.Init();
                txtbox.Parent = grouppanel;
                txtbox.Left = LeftPadding;
                txtbox.Top = 10;
                txtbox.Width = 80;
                txtbox.Height = txtbox.Height + 3;
                txtbox.KeyUp += delegate (object sender, KeyEventArgs e) {
                    if (!txtbox.Text.Equals("") && e.Key == Microsoft.Xna.Framework.Input.Keys.Enter)
                    {
                        btnModify_Click(sender, e);
                    }
                };

                //txtbox.BackColor = Color.Green;

                //txtbox.DrawBorders = true;
                //txtbox.Text = activeInspectorItem.obj.ToString();

                txtbox.Text = value.ToString();

                Button btnModify = new Button(grouppanel.Manager);
                btnModify.Init();
                btnModify.Parent = grouppanel;
                btnModify.Left = LeftPadding * 2 + txtbox.Width;
                btnModify.Top = 10;
                btnModify.Width = 80;
                btnModify.Text = "Modify";
                btnModify.Click += btnModify_Click;

                panelControls.Add("txtbox", txtbox);
                panelControls.Add("btnModify", btnModify);

                if (editType == typeof(int) || editType == typeof(Single) || editType == typeof(byte))
                {
                    Slider trkMain = new Slider(grouppanel.Manager);
                    trkMain.Init();
                    trkMain.Parent = grouppanel;
                    trkMain.Left = LeftPadding;
                    trkMain.Top = 20 + btnModify.Height;
                    trkMain.Width = txtbox.Width + btnModify.Width + LeftPadding;
                    trkMain.Anchor = Anchors.Left | Anchors.Top | Anchors.Right;
                    int val = Convert.ToInt32(value);

                    //int range = Math.Max(100, val * 2);
                    trkMain.Range = Math.Max(100, val * 2);

                    trkMain.Value = val;
                    //trkMain.
                    trkMain.ValueChanged += new TomShane.Neoforce.Controls.EventHandler(trkMain_ValueChanged);
                    trkMain.Click += delegate(object sender, TomShane.Neoforce.Controls.EventArgs e)
                    {
                        MouseEventArgs me = (MouseEventArgs)e;
                        if (me.Button != MouseButton.Right) return;
                        int relpos = me.Position.X - 810; //MAGIC NUMBER HACK OMG
                        int sliderpos = (int)(((float)trkMain.Value / (float)trkMain.Range) * trkMain.Width);
                        if (relpos < sliderpos) trkMain.Range = trkMain.Range / 2;
                        else trkMain.Range = trkMain.Range * 2;
                    };
                    //trkMain.
                    trkMain.btnSlider.MouseUp += trkMain_MouseUp;
                    //trkMain.btnSlider.MouseUp += new TomShane.Neoforce.Controls.MouseEventHandler(trkMain_MouseUp);
                    panelControls.Add("trkMain", trkMain);
                }

            }
            else if (editType == typeof(bool))
            {
                //System.Console.WriteLine("It's a boolean.");
                CheckBox chkbox = new CheckBox(grouppanel.Manager);
                chkbox.Init();
                chkbox.Parent = grouppanel;
                chkbox.Left = LeftPadding;
                chkbox.Top = 10;
                chkbox.Width = 120;
                chkbox.Checked = (bool)value;
                chkbox.Text = activeInspectorItem.Name() + " (" + value + ")";
                chkbox.CheckedChanged += new TomShane.Neoforce.Controls.EventHandler(chkbox_CheckedChanged);
                panelControls.Add("chkbox", chkbox);

            }
            else if (editType.IsSubclassOf(typeof(Enum)))
            {
                //System.Console.WriteLine("ENUM!");
                ComboBox cb = new ComboBox(grouppanel.Manager);
                cb.Init();
                cb.Parent = grouppanel;
                cb.MaxItems = 20;
                cb.Left = LeftPadding;
                cb.Top = 10;
                cb.Width = 120;
                foreach (string enumname in Enum.GetNames(editType))
                {
                    cb.Items.Add(enumname);
                }
                cb.ItemIndex = (int)value;
                cb.ItemIndexChanged += cb_ItemIndexChanged;
                panelControls.Add("cb", cb);
            }

            grouppanel.Refresh();
        }
예제 #31
0
        public static void makePopup(UserInterface ui, opt[] options, String title = "Hey! Listen!", ConfirmDelegate action = null)
        {
            Manager manager = ui.game.Manager;
            bool confirmed = false;
            object[] answer = new object[options.Length];

            bool[] answered = new bool[options.Length];
            ConfirmDelegate emptyDelegate = delegate{ return true;};
            action = action ?? emptyDelegate;
            Dialog window = new Dialog(manager);
            window.Text = title;
            window.Init();
            window.ShowModal();
            window.Caption.Text = "";
            window.Description.Text = "";
            window.Width = 200;
            window.Height = 200;
            window.SetPosition(20, OrbIt.ScreenHeight / 4);
            int heightCounter = window.Caption.Top;
            int i = 0;

            Button btnOk = new Button(manager);
            btnOk.Top = window.Description.Top + window.Description.Height;
            btnOk.Anchor = Anchors.Top;
            btnOk.Parent = window;
            btnOk.Text = "Ok";
            btnOk.Left = btnOk.Left = window.Width / 2 - btnOk.Width / 2;
            btnOk.Init();

            foreach (opt opt in options)
            {
                if (opt.type.In(OptType.info,OptType.prompt))
                {
                    Label info = new Label(manager);
                    info.Init();
                    info.Parent = window;
                    info.Left = VertPadding;
                    info.Width = window.Width - VertPadding * 5;
                    string message = ((string)opt.content).wordWrap(MAX_CHARS_PER_LINE);
                    info.Text = message;
                    info.Height = (info.Text.Count(x => x == '\n')+1) * info.Height;
                    info.Top = heightCounter; heightCounter += info.Height + VertPadding;
                }
                if (opt.type == OptType.dropDown)
                {
                    ComboBox cbBox = new ComboBox(manager);
                    cbBox.Init();
                    cbBox.Parent = window;
                    cbBox.MaxItems = 20; // TODO : ERROR?
                    cbBox.Width = window.Width - VertPadding * 5;
                    cbBox.Left = VertPadding;
                    cbBox.Top = heightCounter; heightCounter += cbBox.Height + VertPadding;
                    ObservableCollection<object> q = (ObservableCollection<object>)opt.content;
                    foreach (object o in q) cbBox.Items.Add(o);
                    q.CollectionChanged += delegate(object s, NotifyCollectionChangedEventArgs e) { cbBox.Items.syncToOCDelegate(e); };
                    int qq = i; answer[qq] = null;
                    cbBox.ItemIndexChanged += delegate {  answer[qq] = (cbBox.Items.ElementAt(cbBox.ItemIndex)); };
                    cbBox.ItemIndexChanged += opt.action;
                }
                if (opt.type == OptType.textBox)
                {
                    TextBox tbName = new TextBox(manager);
                    tbName.Init();
                    tbName.Parent = window;
                    tbName.Width = window.Width - VertPadding * 5;
                    tbName.Left = VertPadding;
                    tbName.Top = heightCounter; heightCounter += tbName.Height + VertPadding;
                    int qq = i; answer[qq] = null;
                    tbName.TextChanged += delegate { answer[qq] = tbName.Text; };
                    tbName.KeyUp += delegate(object sender, KeyEventArgs e)
                    {
                        if (e.Key == Keys.Enter)
                        { confirmed = true; if (action(true, answer)) window.Close(); }
                    };
                    tbName.TextChanged += opt.action;
                }

                if (opt.type == OptType.radialButton)
                {
                    GroupPanel gp = new GroupPanel(manager);
                    gp.Init();
                    gp.Parent = window;
                    gp.Width = window.Width - VertPadding * 5;
                    gp.Left = VertPadding;
                    int qq = i; answer[qq] = -1;
                    for (int j = 0; j < ((string[])opt.content).Length; j++)
                    {
                        RadioButton rb = new RadioButton(manager);
                        rb.Init();
                        rb.Parent = gp;
                        rb.Text = (string)opt.content;
                        int jj = j;
                        rb.Click += delegate { answer[qq] = jj; };
                        rb.Click += opt.action;
                    }
                    gp.Top = heightCounter; heightCounter += gp.Height + VertPadding;
                }
                if (opt.type == OptType.checkBox)
                {
                    CheckBox cb = new CheckBox(manager);
                    cb.Init();
                    cb.Parent = window;
                    cb.Width = window.Width - VertPadding * 5;
                    cb.Left = VertPadding;
                    cb.Top = heightCounter; heightCounter += cb.Height + VertPadding;
                    int qq = i; answer[qq] = false;
                    cb.Text = (string)opt.content;
                    cb.Click += delegate { answer[qq] = cb.Checked; };
                    cb.Click += opt.action;
                }
                i++;
            }
            if (options.Any<opt>(x => x.type != OptType.info))
            {
                btnOk.Left = VertPadding;
                Button btnCancel = new Button(manager);
                btnCancel.Init();
                btnCancel.Parent = window;
                btnCancel.Top = heightCounter;
                btnCancel.Text = "Cancel";
                btnCancel.Left = VertPadding * 2 + btnOk.Width;
                btnCancel.Click += delegate { window.Close(); action(false, answer); };
            }

            btnOk.Click += delegate {
                confirmed = true;
                window.Close(ModalResult.Cancel);
                bool res = action(true, answer);
                if (!res)
                {
                    window.Show();
                };
            };
            btnOk.Top = heightCounter;
            window.Closing += delegate { if (confirmed == false) action(false, answer); };
            window.Height = (btnOk.Top) + 70;
            manager.Add(window);
        }