Exemplo n.º 1
0
        // All these methods pertain to event handling.
        // You shouldn't have to change this.

        public SceneSystem()
        {
            // Create an array of collections containing scene objects for
            // every client state.
            this._UIObject = new List <SceneObject> [(int)GameState.Length];
            for (int i = 0; i < this._UIObject.Length; i++)
            {
                this._UIObject[i] = new List <SceneObject>();
            }

            // Load all the graphical surfaces.
            this.LoadSurfaces();

            // Load all the hard-coded scene objects.
            this.LoadSceneObjects();

            // Load messageboxes for each scene.
            foreach (var scene in _UIObject)
            {
                var msgBackground = new Objects.Image()
                {
                    Name    = "msgBackground",
                    Width   = 960,
                    Height  = 640,
                    Surface = GetSurface("whitebox"),
                    Visible = false
                };
                var msgMessage = new Objects.Label()
                {
                    Name      = "msgMessage",
                    Width     = 960,
                    Height    = 50,
                    Top       = 200,
                    TextColor = new SFML.Graphics.Color(0, 0, 0, 255),
                    FontSize  = 35,
                    Visible   = false
                };
                var msgButton = new Objects.Button()
                {
                    Name      = "msgButton",
                    Width     = 200,
                    Height    = 50,
                    Top       = 350,
                    Left      = 350,
                    Surface   = GetSurface("orangefade"),
                    Caption   = "Okay",
                    TextColor = new SFML.Graphics.Color(0, 0, 0, 255),
                    Visible   = false
                };

                scene.Add(msgBackground);
                scene.Add(msgMessage);
                scene.Add(msgButton);
            }
        }
Exemplo n.º 2
0
        private void LoadMainMenu()
        {
            var col = _UIObject[(int)GameState.MainMenu];

            var imgBackground = new Objects.Image()
            {
                Name    = "imgBackground",
                Width   = GraphicsManager.WindowWidth,
                Height  = GraphicsManager.WindowHeight,
                Surface = GetSurface("background")
            };

            col.Add(imgBackground);

            var imgLogo = new Objects.Image()
            {
                Name     = "imgLogo",
                Width    = 500,
                Height   = 250,
                Top      = 50,
                Left     = 250,
                Surface  = GetSurface("logo"),
                Dragable = true
            };

            col.Add(imgLogo);

            var cmdLogin = new Button()
            {
                Name      = "cmdLogin",
                Caption   = "Login",
                FontSize  = 12,
                TextColor = Color.Black,
                Left      = 350,
                Surface   = GetSurface("orangefade"),
                Width     = 100,
                Height    = 30
            };

            col.Add(cmdLogin);

            var cmdRegister = new Button()
            {
                Name      = "cmdRegister",
                Caption   = "Register",
                FontSize  = 12,
                TextColor = Color.Black,
                Left      = 475,
                Surface   = GetSurface("orangefade"),
                Width     = 100,
                Height    = 30
            };

            col.Add(cmdRegister);

            var txtUsername = new Textbox()
            {
                Name      = "txtUsername",
                Width     = 300,
                Top       = 100,
                MaxLength = 12,
                TextColor = Color.Black,
                FontSize  = 12,
                Height    = 25,
                Left      = 300,
                Surface   = GetSurface("whitebox"),
                Visible   = false
            };

            col.Add(txtUsername);

            var txtPassword = new Textbox()
            {
                Name      = "txtPassword",
                Width     = 300,
                Top       = 150,
                MaxLength = 12,
                TextColor = Color.Black,
                FontSize  = 12,
                Height    = 25,
                Left      = 300,
                Surface   = GetSurface("whitebox"),
                Visible   = false
            };

            col.Add(txtPassword);


            var cmdReturn = new Button()
            {
                Name      = "cmdReturn",
                Width     = 300,
                Height    = 50,
                Caption   = "Return",
                TextColor = Color.White,
                Surface   = GetSurface("orangefade"),
                Visible   = false,
                Left      = 300,
                FontSize  = 12
            };

            col.Add(cmdReturn);

            var cmdRegisterUser = new Button()
            {
                Name   = "cmdRegisterUser",
                Top    = 200,
                Left   = 400,
                Width  = 100,
                Height = 25,


                Caption   = "Register User",
                FontSize  = 12,
                TextColor = Color.Black,

                Surface = GetSurface("orangefade"),
                Visible = false
            };

            col.Add(cmdRegisterUser);

            var cmdLoginUser = new Button()
            {
                Name   = "cmdLoginUser",
                Top    = 200,
                Left   = 400,
                Width  = 100,
                Height = 25,


                Caption   = "Login User",
                FontSize  = 12,
                TextColor = Color.Black,

                Surface = GetSurface("orangefade"),
                Visible = false
            };

            col.Add(cmdLoginUser);
        }