Example #1
0
        public TabNewWorld()
        {
            Icon = new Sprite(Resources.TileIcons, new Point(1, 2));

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

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

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

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

            worldTypeList.SelectFirst();

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

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

            Content = new LayoutDock()
            {
                Padding  = new Spacing(16),
                Children =
                {
                    new WidgetLabel {
                        Text = "New World", Font = Resources.FontAlagard, Dock = Dock.Top
                    },
                    generateButton,
                    worldOptions,
                }
            };
        }
 /// <summary> 
 /// Required method for Designer support - do not modify 
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.components = new System.ComponentModel.Container();
     this.elementText = new XEditNet.Widgets.WidgetTextBox();
     this.elementList = new System.Windows.Forms.TreeView();
     this.imageList = new System.Windows.Forms.ImageList(this.components);
     this.showValid = new System.Windows.Forms.CheckBox();
     this.label1 = new System.Windows.Forms.Label();
     this.SuspendLayout();
     //
     // elementText
     //
     this.elementText.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
         | System.Windows.Forms.AnchorStyles.Right)));
     this.elementText.BackColor = System.Drawing.Color.FloralWhite;
     this.elementText.Location = new System.Drawing.Point(8, 24);
     this.elementText.Name = "elementText";
     this.elementText.Size = new System.Drawing.Size(208, 20);
     this.elementText.TabIndex = 1;
     this.elementText.Text = "";
     this.elementText.TextChanged += new System.EventHandler(this.ElementTextChanged);
     this.elementText.Enter += new System.EventHandler(this.ElementTextFocus);
     //
     // elementList
     //
     this.elementList.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
         | System.Windows.Forms.AnchorStyles.Left)
         | System.Windows.Forms.AnchorStyles.Right)));
     this.elementList.BackColor = System.Drawing.Color.FloralWhite;
     this.elementList.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
     this.elementList.FullRowSelect = true;
     this.elementList.HideSelection = false;
     this.elementList.ImageList = this.imageList;
     this.elementList.Location = new System.Drawing.Point(8, 48);
     this.elementList.Name = "elementList";
     this.elementList.ShowRootLines = false;
     this.elementList.Size = new System.Drawing.Size(208, 152);
     this.elementList.Sorted = true;
     this.elementList.TabIndex = 2;
     this.elementList.DoubleClick += new System.EventHandler(this.DoubleClickElement);
     //
     // imageList
     //
     this.imageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit;
     this.imageList.ImageSize = new System.Drawing.Size(14, 14);
     this.imageList.TransparentColor = System.Drawing.Color.Transparent;
     //
     // showValid
     //
     this.showValid.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     this.showValid.Checked = true;
     this.showValid.CheckState = System.Windows.Forms.CheckState.Checked;
     this.showValid.Location = new System.Drawing.Point(8, 203);
     this.showValid.Name = "showValid";
     this.showValid.Size = new System.Drawing.Size(192, 24);
     this.showValid.TabIndex = 4;
     this.showValid.Text = "Only Show &Valid Items";
     this.showValid.CheckedChanged += new System.EventHandler(this.ToggleShowValid);
     //
     // label1
     //
     this.label1.Location = new System.Drawing.Point(6, 8);
     this.label1.Name = "label1";
     this.label1.Size = new System.Drawing.Size(100, 16);
     this.label1.TabIndex = 5;
     this.label1.Text = "Filter Elements:";
     //
     // ElementListPanelBase
     //
     this.Controls.Add(this.label1);
     this.Controls.Add(this.showValid);
     this.Controls.Add(this.elementList);
     this.Controls.Add(this.elementText);
     this.Name = "ElementListPanelBase";
     this.Size = new System.Drawing.Size(223, 231);
     this.ResumeLayout(false);
 }
        public MenuAddMinimapWaypoint(GameState gameState) : base(gameState)
        {
            PauseGame     = true;
            EscapeToClose = true;

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

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

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

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