Esempio n. 1
0
        public OptionsMenu()
            : base(null, true)
        {
            InitProps(new Vector2(-10, 10), new Vector2(20, 20), new Color(0.3f, 0.3f, 0.3f, 0.75f), "Options", Color.White);

            Window closeButton = new Button(this);
            closeButton.InitProps(Position + new Vector2(1, -1), new Vector2(8, 2), new Color(0.1f, 0.1f, 0.1f, 1), "Back", Color.White);
            closeButton.OnClick = delegate ()
            {
                Destroy();
            };
        }
Esempio n. 2
0
            public NewCharacterWindow():base(null,true)
            {
                zHeroClass = HeroClass.Invalid;
                InitProps(new Vector2(-11, 5), new Vector2(22, 15), new Color(0.3f, 0.3f, 0.3f, 0.75f), "", Color.White);
                CloseWithEscape = true;

                zNametextbox = new TextBox(this);
                zNametextbox.InitProps(Position + new Vector2(1, -7), new Vector2(14, 1.5f), new Color(0.1f, 0.1f, 0.1f, 1), "", Color.White);
                zNametextbox.MaxLength = 18;

                Window elfbutton = new Button(this);
                elfbutton.InitProps(Position + new Vector2(1, -1), new Vector2(4, 2), new Color(0.1f, 0.1f, 0.1f, 1), "Elf", Color.White);
                elfbutton.OnClick = delegate ()
                {
                    DisplayCharSprite(HeroClass.Elf);
                };

                Window knightbutton = new Button(this);
                knightbutton.InitProps(elfbutton.Position + new Vector2(5, 0), new Vector2(4, 2), new Color(0.1f, 0.1f, 0.1f, 1), "Knight", Color.White);
                knightbutton.OnClick = delegate ()
                {
                    DisplayCharSprite(HeroClass.Knight);
                };

                Window wizardbutton = new Button(this);
                wizardbutton.InitProps(knightbutton.Position + new Vector2(5, -0), new Vector2(4, 2), new Color(0.1f, 0.1f, 0.1f, 1), "Wizard", Color.White);
                wizardbutton.OnClick = delegate ()
                {
                    DisplayCharSprite(HeroClass.Wizard);
                };

                Window createbutton = new Button(this);
                createbutton.InitProps(Position + new Vector2(16.5f, -7), new Vector2(4, 2), new Color(0.1f, 0.1f, 0.1f, 1), "Create", Color.White);
                createbutton.OnClick = CreateNewCharacter;

                Window backbutton = new Button(this);
                backbutton.InitProps(createbutton.Position + new Vector2(0, -3), new Vector2(4, 2), new Color(0.1f, 0.1f, 0.1f, 1), "Back", Color.White);
                backbutton.OnClick = Destroy;

                zCharSprite = new Window(this);
                zCharSprite.InitProps(Position + new Vector2(15, -1), new Vector2(4, 4), Color.White, "", Color.White);
                zCharSprite.Visible = false;
            }
Esempio n. 3
0
            public MainWindow() : base()
            {
                InitProps(new Vector2(-21, 16), new Vector2(10, 16), new Color(0.3f, 0.3f, 0.3f, 0.75f), "", Color.White);

                Window newCharButton = new Button(this);
                newCharButton.InitProps(Position + new Vector2(1, -1), new Vector2(8, 2), new Color(0.1f, 0.1f, 0.1f, 1), "New Character", Color.White);
                newCharButton.OnClick = delegate ()
                {
                    new NewCharacterWindow();
                };

                Window playbutton = new Button(this);
                playbutton.InitProps(Position + new Vector2(1, -4), new Vector2(8, 2), new Color(0.1f, 0.1f, 0.1f, 1), "Play", Color.White);                
                playbutton.Visible = false;
                playbutton.OnClick = delegate ()
                {
                    new PlayWindow();
                };

                Window delcharbutton = new Button(this);
                delcharbutton.InitProps(Position + new Vector2(1, -7), new Vector2(8, 2), new Color(0.4f, 0.1f, 0.1f, 1), "Delete Character", Color.White);
                delcharbutton.Visible = false;
                delcharbutton.OnClick = delegate ()
                {
                    MainMenu m = (MainMenu)ScreenManager.CurrentScreen;
                    m.DeleteCharacterRoutine();
                };
                //event set visible if something is selected
                Globals.EventManager.AddEvent(delegate ()
                {
                    if (Collect)
                        return 0;
                    MainMenu m = (MainMenu)ScreenManager.CurrentScreen;
                    delcharbutton.Visible = m.zSelectedChar != null;
                    playbutton.Visible = m.zSelectedChar != null;
                    return 1;
                }, "delcharbuttonvisibility");

                Window optionsbutton = new Button(this);
                optionsbutton.InitProps(Position + new Vector2(1, -10), new Vector2(8, 2), new Color(0.1f, 0.1f, 0.1f, 1), "Options", Color.White);
                optionsbutton.OnClick = delegate ()
                {
                    new OptionsMenu();
                };

                Window exitbutton = new Button(this);
                exitbutton.InitProps(Position + new Vector2(1, -13), new Vector2(8, 2), new Color(0.1f, 0.1f, 0.1f, 1), "Exit", Color.White);
                exitbutton.OnClick = delegate ()
                {
                    FlatRedBallServices.Game.Exit();
                };
            }
Esempio n. 4
0
            public PlayWindow() : base(null, true)
            {
                InitProps(new Vector2(-11, 5), new Vector2(22, 10), new Color(0.3f, 0.3f, 0.3f, 0.75f), "", Color.White);
                CloseWithEscape = true;

                var zServerLabel = new Window(this);
                zServerLabel.InitProps(Position + new Vector2(1, -1), new Vector2(4, 2), new Color(0.1f, 0.1f, 0.1f, 0), "Server", Color.White);

                zServer = new TextBox(this);
                zServer.InitProps(zServerLabel.Position + new Vector2(5, 0), new Vector2(15, 1.5f), new Color(0.1f, 0.1f, 0.1f, 1), Ini.Server, Color.White);
                zServer.MaxLength = 30;

                var portlabel = new Window(this);
                portlabel.InitProps(Position + new Vector2(1, -4), new Vector2(3, 2), new Color(0.1f, 0.1f, 0.1f, 0), "Port", Color.White);


                zPort = new TextBox(this);
                zPort.InitProps(portlabel.Position + new Vector2(5, 0), new Vector2(15, 1.5f), new Color(0.1f, 0.1f, 0.1f, 1), Ini.Port, Color.White);
                zPort.MaxLength = 5;

                Window startbutton = new Button(this);
                startbutton.InitProps(Position + new Vector2(1, -7), new Vector2(4, 2), new Color(0.1f, 0.1f, 0.1f, 1), "Start", Color.White);
                startbutton.OnClick = delegate ()
                {
                    Globals.Ip = "127.0.0.1";
                    MainMenu m = (MainMenu)ScreenManager.CurrentScreen;
                    if (TryPort())
                        m.Start();
                    else
                        new MessageBox("Invalid port");
                };

                Window joinbutton = new Button(this);
                joinbutton.InitProps(Position + new Vector2(6, -7), new Vector2(4, 2), new Color(0.1f, 0.1f, 0.1f, 1), "Join", Color.White);
                joinbutton.OnClick = delegate()
                {
                    Globals.Ip = zServer.Text == string.Empty ? "localhost" : zServer.Text;
                    MainMenu m = (MainMenu)ScreenManager.CurrentScreen;
                    if (TryPort())
                        m.Join();
                    else
                        new MessageBox("Invalid port");
                };

                Window closebutton = new Button(this);
                closebutton.InitProps(Position + new Vector2(11, -7), new Vector2(4, 2), new Color(0.1f, 0.1f, 0.1f, 1), "Back", Color.White);
                closebutton.OnClick = delegate ()
                {
                    Destroy();
                };
            }