Exemplo n.º 1
0
        public TabMultiplayerConnect()
        {
            Icon             = new Sprite(Ressources.TileIcons, new Point(1, 3));
            connectIpTextBox = new SingleLineTextBoxWidget(24, "localhost", Ressources.FontRomulus)
            {
                Padding = new Margins(8)
            };
            connectPortTextBox = new SingleLineTextBoxWidget(24, "7777", Ressources.FontRomulus)
            {
                Padding = new Margins(8)
            };
            var connectButton = new Button {
                Text = "Connect", Dock = Dock.Bottom
            }
            .RegisterMouseClickEvent(Connect);

            var connectionOptions = new FlowLayout
            {
                Flow      = FlowDirection.TopToBottom,
                Dock      = Dock.Fill,
                Childrens =
                {
                    new Label {
                        Text = "IP:", Padding = new Margins(8), TextAlignement = DrawText.Alignement.Left
                    },
                    connectIpTextBox,
                    new Label {
                        Text = "Port:", Padding = new Margins(8), TextAlignement = DrawText.Alignement.Left
                    },
                    connectPortTextBox,
                }
            };

            Content = new Container()
            {
                Childrens =
                {
                    new Label {
                        Text = "Connect", Font = Ressources.FontAlagard, Dock = Dock.Top
                    },
                    connectButton,
                    connectionOptions
                }
            };
        }
Exemplo n.º 2
0
        public TabNewWorld()
        {
            Icon = new Sprite(Ressources.TileIcons, new Point(1, 2));

            var worldNameTextBox = new SingleLineTextBoxWidget(24, "new world", Ressources.FontRomulus)
            {
                Padding = new Margins(8)
            };

            var worldSeedtextBox = new SingleLineTextBoxWidget(24, Rise.Rnd.Next().ToString(), Ressources.FontRomulus)
            {
                Padding = new Margins(8)
            };

            var worldTypeList = new ListWidget()
            {
                UnitBound = new Rectangle(0, 0, 256, 128), AlowUnselecting = false
            };

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

            worldTypeList.SelectFirst();

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

            var worldOptions = new FlowLayout
            {
                Flow      = FlowDirection.TopToBottom,
                Dock      = Dock.Fill,
                Childrens =
                {
                    new Label {
                        Text = "World name:", Padding = new Margins(8), TextAlignement = DrawText.Alignement.Left
                    },
                    worldNameTextBox,
                    new Label {
                        Text = "Seed:", Padding = new Margins(8), TextAlignement = DrawText.Alignement.Left
                    },
                    worldSeedtextBox,
                    new Label {
                        Text = "World type:", Padding = new Margins(8), TextAlignement = DrawText.Alignement.Left
                    },
                    worldTypeList
                }
            };

            Content = new Container()
            {
                Childrens =
                {
                    new Label {
                        Text = "New World", Font = Ressources.FontAlagard, Dock = Dock.Top
                    },
                    generateButton,
                    worldOptions,
                }
            };
        }