Beispiel #1
0
    public override void OnClick()
    {
        MessageBox box;

        if (!blocked)
        {
            if (toBuy)
            {
                box = new MessageBox("Do you really want to learn " + spell.GetName() + "?");
                box.AddButton("Yes", () => {
                    Game.client.Send(GameMsg.BuySpell, new StringMessage(spell.GetId()));
                    screen.ShowMessageBox(null);
                    currentState = State.Disabled;
                });
                box.AddButton("No", () => screen.ShowMessageBox(null));
            }
            else
            {
                box = new MessageBox("Do you really want to forget " + spell.GetName() + "?");
                box.AddButton("Yes", () => {
                    Game.client.Send(GameMsg.DropSpell, new StringMessage(spell.GetId()));
                    screen.ShowMessageBox(null);
                });
                box.AddButton("No", () => screen.ShowMessageBox(null));
            }
        }
        else
        {
            box = new MessageBox("You currently can't learn this spell,\nyou need to forget one first.");
            box.AddButton("Got it", () => {
                screen.ShowMessageBox(null);
            });
        }
        screen.ShowMessageBox(box);
    }
    public void OnEndBattle(NetworkMessage msg)
    {
        MessageBox msgBox = new MessageBox(msg.ReadMessage <StringMessage>().value);

        if (game.IsHost())
        {
            msgBox.AddButton("Continue", () => {
                (game.GetServerHandler() as BattleServerHandler).OpenVendor();
                game.GetOpenScreen().CloseMessageBox();
            });
        }
        else
        {
            msgBox.AddButton("Continue", () => {
                if (game.GetOpenScreen() is VendorScreen)
                {
                    game.GetOpenScreen().CloseMessageBox();
                }
                else
                {
                    msgBox.SetText("Waiting on the host to continue...");
                }
            });
        }
        game.GetOpenScreen().ShowMessageBox(msgBox);
    }
    public void OnShowMessage(NetworkMessage msg)
    {
        string     text   = msg.ReadMessage <StringMessage>().value;
        MessageBox msgBox = new MessageBox(text);

        msgBox.AddButton("Got it", () => game.GetOpenScreen().CloseMessageBox());
        game.GetOpenScreen().ShowMessageBox(msgBox);
    }
    public void OnEndGame(NetworkMessage msg)
    {
        MessageBox msgBox = new MessageBox(msg.ReadMessage <StringMessage>().value);

        msgBox.AddButton("Back to menu", () => {
            game.CancelConnection();
            game.OpenScreen(new MainScreen(game, RB.DisplaySize));
        });
        game.GetOpenScreen().ShowMessageBox(msgBox);
    }
    public void OnOpenVendor(NetworkMessage msg)
    {
        PlayerPawn   pawn   = msg.ReadMessage <GameMsg.MsgPawn>().pawn as PlayerPawn;
        VendorScreen screen = new VendorScreen(game, RB.DisplaySize, pawn);
        MessageBox   msgBox = new MessageBox("Congratulations! This area is cleared");

        game.OpenClientHandler(new VendorClientHandler(game, pawn, screen));
        msgBox.AddButton("Continue", () => {
            game.OpenScreen(screen);
        });
        game.GetOpenScreen().ShowMessageBox(msgBox);
    }
Beispiel #6
0
        public void LoadContent(ContentManager contentManager)
        {
            //Load fonts
            arial30     = contentManager.Load <SpriteFont>("Fonts/Arial_30");
            arial15     = contentManager.Load <SpriteFont>("Fonts/Arial_15");
            arial16Bold = contentManager.Load <SpriteFont>("Fonts/Arial_16_Bold");
            segoeUI18   = contentManager.Load <SpriteFont>("Fonts/SegoeUI_18");

            testTexture = contentManager.Load <Texture2D>("Textures/UI/MessageBox");

            background = contentManager.Load <Texture2D>("Textures/Login/Background");

            //Load controls
            usernameTextBox = new TextBox(contentManager.Load <Texture2D>("Textures/UI/TextBox"), arial15, "digot", new Rectangle(
                                              (int)((GameWindow.Instance.GraphicsDevice.Viewport.Width - 180) * 0.5), (int)(GameWindow.Instance.GraphicsDevice.Viewport.Height * 0.5) - 15, 180, 34)
                                          );

            passwordTextBox = new TextBox(contentManager.Load <Texture2D>("Textures/UI/TextBox"), arial15, "", new Rectangle(
                                              (int)((GameWindow.Instance.GraphicsDevice.Viewport.Width - 180) * 0.5), (int)(GameWindow.Instance.GraphicsDevice.Viewport.Height * 0.5) + 55, 180, 34)
                                          );

            passwordTextBox.RealText = "test";
            passwordTextBox.UpdateVisualText();

            loginStatusBox = new MessageBox(contentManager.Load <Texture2D>("Textures/UI/MessageBox"), new Vector2((
                                                                                                                       GameWindow.Instance.GraphicsDevice.Viewport.Width - 320) * 0.5f, (GameWindow.Instance.GraphicsDevice.Viewport.Height - 80) * 0.5f), new Vector2(320, 80), "Hallo", segoeUI18);
            loginStatusBox.TextColor = Color.White;

            button = new Button("Cancel", new Vector2(10, 10), new Vector2(120, 30), arial16Bold,
                                contentManager.Load <Texture2D>("Textures/UI/BlueButtonIdle"),
                                contentManager.Load <Texture2D>("Textures/UI/BlueButtonHover"),
                                contentManager.Load <Texture2D>("Textures/UI/BlueButtonClicked"));

            button.Boundries = new Rectangle(22, 5, 80, (int)button.Size.Y - 10);

            loginStatusBox.AddButton(button);

            button.OnClick += (sender, args) => Debug.WriteLine("Hallo!");

            usernameTextBox.Color   = Color.White;
            usernameTextBox.OnEnter = ProcessLogin;

            passwordTextBox.Color       = Color.White;
            passwordTextBox.OnEnter     = ProcessLogin;
            passwordTextBox.PasswordBox = true;
        }
Beispiel #7
0
 public static void Show(string message)
 {
     var alert = new MessageBox{ Message = message };
     alert.AddButton ("OK");
     alert.Show ();
 }