示例#1
0
        private void SetupUsernameMenu()
        {
            UsernameLabel = new Gwen.Control.Label(BaseCanvas);
            UsernameLabel.SetText("Enter Desired Username" +
                                  "\n(This is how your score will be represented in the Highscores page.)" +
                                  "\n(Name must be between 1 and 16 characters, and be ASCII encodable.(0-9, a-Z))");
            UsernameLabel.AutoSizeToContents = true;
            UsernameLabel.SetPosition(300, 150);

            UsernameBox = new Gwen.Control.TextBox(BaseCanvas);
            UsernameBox.SetSize(180, 35);
            UsernameBox.SetPosition(300, 200);

            UsernameContinue = new Gwen.Control.Button(BaseCanvas);
            UsernameContinue.SetText("Continue");
            UsernameContinue.SetSize(150, 30);
            UsernameContinue.SetPosition(300, 260);
            UsernameContinue.Clicked += (B, Args) =>
            {
                if (UsernameBox.Text != "" && UsernameBox.Text.Length <= 16)
                {
                    ActiveScreen = Screen.Menu;
                }
            };
        }
示例#2
0
        public void SetupMenu()
        {
            SingleplayerButton = new Gwen.Control.Button(BaseCanvas);
            SingleplayerButton.SetText("Singleplayer");
            SingleplayerButton.SetSize(300, 100);
            SingleplayerButton.SetPosition(200, 100);
            SingleplayerButton.Clicked += (B, Args) =>
            {
                ActiveScreen      = Screen.Game;
                ActiveSessionType = SessionType.Singleplayer;
            };

            MultiplayerButton = new Gwen.Control.Button(BaseCanvas);
            MultiplayerButton.SetText("Multiplayer");
            MultiplayerButton.SetSize(300, 100);
            MultiplayerButton.SetPosition(200, 240);
            MultiplayerButton.Clicked += (B, Args) =>
            {
                ActiveScreen      = Screen.NetworkedSessionMenu;
                ActiveSessionType = SessionType.Multiplayer;
            };

            HighscoresButton = new Gwen.Control.Button(BaseCanvas);
            HighscoresButton.SetText("Highscores");
            HighscoresButton.SetSize(300, 100);
            HighscoresButton.SetPosition(200, 380);
            HighscoresButton.Clicked += (B, Args) =>
            {
                GetHighscoresCallback();
                ActiveScreen = Screen.Highscores;
            };
        }
示例#3
0
        public void SetupHighscores()
        {
            NoDataFailure = new Gwen.Control.Label(BaseCanvas);
            NoDataFailure.SetText("No Highscore Data Retrieved");
            NoDataFailure.AutoSizeToContents = true;
            NoDataFailure.SetPosition(100, 150);

            TopScoresLabel = new Gwen.Control.Label(BaseCanvas);
            TopScoresLabel.SetText("Highscores");
            TopScoresLabel.SetSize(100, 50);
            TopScoresLabel.SetPosition(250, 50);

            TopScoresList = new Gwen.Control.ListBox(BaseCanvas);
            TopScoresList.SetSize(220, 210);
            TopScoresList.SetPosition(180, 70);

            TopScoresBackButton = new Gwen.Control.Button(BaseCanvas);
            TopScoresBackButton.SetText("Back");
            TopScoresBackButton.AutoSizeToContents = true;
            TopScoresBackButton.SetPosition(50, 350);
            TopScoresBackButton.Clicked += (B, Args) =>
            {
                ActiveScreen = Screen.Menu;
            };
        }
示例#4
0
        public void SetupNetworkedSessionMenu()
        {
            ServerSelectorLabel = new Gwen.Control.Label(BaseCanvas);
            ServerSelectorLabel.SetText("Server");
            ServerSelectorLabel.AutoSizeToContents = true;
            ServerSelectorLabel.SetPosition(50, 0);

            ServerSelector = new Gwen.Control.ComboBox(BaseCanvas);
            ServerSelector.AddItem("Server A");
            ServerSelector.AddItem("Server B");
            ServerSelector.AddItem("Server C");
            ServerSelector.AddItem("Server D");
            ServerSelector.AddItem("Server E");
            ServerSelector.AddItem("Server F");
            ServerSelector.AddItem("Server G");
            ServerSelector.AddItem("Server H");
            ServerSelector.AddItem("Server I");
            ServerSelector.AddItem("Server J");
            ServerSelector.AddItem("Custom Server...");
            ServerSelector.SetSize(200, 50);
            ServerSelector.SetPosition(50, 20);
            ServerSelector.TextColor = Color.Black;
            ServerSelector.UpdateColors();

            CustomServerLabel = new Gwen.Control.Label(BaseCanvas);
            CustomServerLabel.SetText("Address                                           Port");
            CustomServerLabel.AutoSizeToContents = true;
            CustomServerLabel.SetPosition(50, 180);

            CustomServerAddress = new Gwen.Control.TextBox(BaseCanvas);
            CustomServerAddress.SetSize(200, 30);
            CustomServerAddress.SetPosition(50, 200);

            CustomServerPort = new Gwen.Control.TextBox(BaseCanvas);
            CustomServerPort.SetSize(70, 30);
            CustomServerPort.SetPosition(254, 200);

            SessionConnect = new Gwen.Control.Button(BaseCanvas);
            SessionConnect.SetText("Connect");
            SessionConnect.SetSize(200, 50);
            SessionConnect.SetPosition(260, 380);
            SessionConnect.Clicked += (B, Args) =>
            {
                ActiveScreen = Screen.Connecting;
            };

            BackButton = new Gwen.Control.Button(BaseCanvas);
            BackButton.SetText("Back");
            BackButton.AutoSizeToContents = true;
            BackButton.SetPosition(50, 450);
            BackButton.Clicked += (B, Args) =>
            {
                ActiveScreen = Screen.Menu;
            };
        }
示例#5
0
 private void LoadPowders()
 {
     _bottomMenuBox.DeleteAllChildren();
     Gwen.Control.Button _sandButton = new Gwen.Control.Button(_bottomMenuBox);
     _sandButton.Font.Size = 12;
     _sandButton.SetSize(80, 28);
     _sandButton.SetText("Sand");
     _sandButton.SetToolTipText("Sand");
     _sandButton.SetPosition(2, 7);
     _sandButton.Name     = "SandElement";
     _sandButton.Clicked += OnButtonClick;
 }
示例#6
0
        public void SetupLocal(World LocalWorldInst, Snake LocalSnakeInst)
        {
            this.LocalWorldInst = LocalWorldInst;
            this.LocalSnakeInst = LocalSnakeInst;

            LocalSizeBox           = new Gwen.Control.TextBox(BaseCanvas);
            LocalSizeBox.TextColor = Color.Black;
            LocalSizeBox.SetPosition(0, Rows * RowHeight);

            ReturnToMenuButton = new Gwen.Control.Button(BaseCanvas);
            ReturnToMenuButton.SetText("Return to Menu");
            ReturnToMenuButton.AutoSizeToContents = true;
            ReturnToMenuButton.SetPosition(0, Rows * RowHeight + 60);
            ReturnToMenuButton.Clicked += (B, Args) =>
            {
                ActiveScreen = Screen.Menu;

                SessionLeaveCallback();
            };
        }
示例#7
0
        private void LoadElementCatagories()
        {
            Gwen.Control.Button _powdersButton = new Gwen.Control.Button(_sideMenuBox);
            _powdersButton.Font      = _powdersButton.Font.Copy();
            _powdersButton.Font.Size = 8;
            _powdersButton.SetSize(80, 20);
            _powdersButton.SetToolTipText("Powders");
            _powdersButton.SetText("Powders");
            _powdersButton.SetPosition(0, 0);
            _powdersButton.Name     = "PowdersMenu";
            _powdersButton.Clicked += OnButtonClick;

            Gwen.Control.Button _liquidsButton = new Gwen.Control.Button(_sideMenuBox);

            _liquidsButton.Font      = _liquidsButton.Font.Copy();
            _liquidsButton.Font.Size = 8;
            _liquidsButton.SetSize(80, 20);
            _liquidsButton.SetToolTipText("Liquids");
            _liquidsButton.SetText("Liquids");
            _liquidsButton.SetPosition(0, 22);
            _liquidsButton.Name     = "LiquidsMenu";
            _liquidsButton.Clicked += OnButtonClick;
        }
示例#8
0
文件: HUD.cs 项目: riordanp/panjin
        public void showItemModal(TriggerGiveItem sender)
        {
            Gwen.Control.WindowControl w = new Gwen.Control.WindowControl(_canvas, "Items", true);
            w.Width = 200;
            w.Height = 120;
//w.DeleteOnClose = true;

            Gwen.Control.ImagePanel img = new Gwen.Control.ImagePanel(w);
            img.ImageName = "./assets/" + sender.item.iconName;
            img.SetPosition(5, 10);
            img.SetSize(32, 32);

            Gwen.Control.CheckBox check = new Gwen.Control.CheckBox(w);
            check.SetPosition(w.Width - 29, 32 / 2 + 3);
            check.IsChecked = true;

            Gwen.Control.Label itemName = new Gwen.Control.Label(w);
            itemName.Text = sender.item.name;
            itemName.SetPosition(48, 14);

            Gwen.Control.Label itemDescription = new Gwen.Control.Label(w);
            Gwen.Font descFont = defaultFont;
            descFont.Size = 9;
            itemDescription.Width = 200;
            itemDescription.Text = sender.item.description;
            itemDescription.Font = descFont;
            itemDescription.SetPosition(48, 25);

            Gwen.Control.Button takeAll = new Gwen.Control.Button(w);
            takeAll.SetText("Take All");
            takeAll.TextColor = System.Drawing.Color.White;
            takeAll.TextColorOverride = System.Drawing.Color.FromArgb(236, 236, 255);
            takeAll.Width = 60;
            takeAll.X = 5;
            takeAll.Y = w.Height - takeAll.Height - 40;
            takeAll.Clicked += delegate {
                if (sender._amount > 0)
                {
                    while(sender._amount > 0)
                    {
                        Engine.player.inventory.Add(sender.item);
                        if (Engine.player.activeWeapon.name == null && sender.item.GetType().IsSubclassOf(typeof(Weapon))) 
                        {
                            Engine.player.activeWeapon = (Panjin.Weapon)Engine.player.inventory[Engine.player.inventory.Count -1];
                        }
                        sender._amount--;
                    }
                    w.SetPosition(-99, -99);
                    w.Hide();
                    w.Close();
                }
                else
                {
                    w.SetPosition(-99, -99);
                    w.Hide();
                    w.Close();
                }
            };




            Gwen.Control.Button takeSelected = new Gwen.Control.Button(w);
            takeSelected.SetText("Take Selected");
            takeSelected.Width = 80;
            takeSelected.TextColor = System.Drawing.Color.White;
            takeSelected.TextColorOverride = System.Drawing.Color.FromArgb(236, 236, 255);
            takeSelected.X = w.Width - takeSelected.Width - 17;
            takeSelected.Y = w.Height - takeSelected.Height - 40;
        }
示例#9
0
文件: HUD.cs 项目: riordanp/panjin
        public void showRespawnModal(Vector2i spawn)
        {
            Gwen.Control.WindowControl w = new Gwen.Control.WindowControl(_canvas, "Respawn", true);
            w.Width = 150;
            w.Height = 100;
            w.IsClosable = false;
            Align.Center(w);
            Gwen.Control.Label text = new Gwen.Control.Label(w);
            text.Text = "You Died!";
            text.SetPosition(5, 10);

            Gwen.Control.Button respawn = new Gwen.Control.Button(w);
            respawn.SetText("Respawn");
            respawn.TextColor = System.Drawing.Color.White;
            respawn.TextColorOverride = System.Drawing.Color.FromArgb(236, 236, 255);
            respawn.Width = 60;
            respawn.X = w.Width / 2 - (respawn.Width/2);
            respawn.Y = w.Height - respawn.Height - 40;
            respawn.Clicked += delegate
            {
                //Engine.map.entities.Add(new Player(spawn));
                Log.WriteError("Not currently implemented in this refactoring!");
                Engine.view.Center = new Vector2f(spawn.X*16, spawn.Y*16);
                w.Close();
            };
        }