Esempio n. 1
0
        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            // TODO: Add your initialization code here
            DrawScripts.AnimSprite _spStartB = new DrawScripts.AnimSprite(this.Game);
            _spStartB.texture    = this.Game.Content.Load <Texture2D>("Assets\\MainMenu\\Start");
            _spStartB.position   = new Vector2(this.Game.GraphicsDevice.Viewport.Width / 2, this.Game.GraphicsDevice.Viewport.Height / 4);
            _spStartB.animations = new List <Rectangle>();
            _spStartB.animations.Add(new Rectangle(0, 0, _spStartB.texture.Width, _spStartB.texture.Height));
            _spStartB.center      = new Vector2(_spStartB.texture.Width / 2, _spStartB.texture.Height / 2);
            _spStartB.scale       = new Vector2(0.5f, 0.5f);
            _spStartB.currentAnim = 0;
            _spStartB.slika       = true;
            this.Game.Components.Add(_spStartB);

            DrawScripts.AnimSprite _spLeaderBoardB = new DrawScripts.AnimSprite(this.Game);
            _spLeaderBoardB.texture    = this.Game.Content.Load <Texture2D>("Assets\\MainMenu\\Leaderboard");
            _spLeaderBoardB.position   = new Vector2(this.Game.GraphicsDevice.Viewport.Width / 2, this.Game.GraphicsDevice.Viewport.Height / 2.7f);
            _spLeaderBoardB.animations = new List <Rectangle>();
            _spLeaderBoardB.animations.Add(new Rectangle(0, 0, _spLeaderBoardB.texture.Width, _spLeaderBoardB.texture.Height));
            _spLeaderBoardB.center      = new Vector2(_spLeaderBoardB.texture.Width / 2, _spLeaderBoardB.texture.Height / 2);
            _spLeaderBoardB.scale       = new Vector2(0.5f, 0.5f);
            _spLeaderBoardB.currentAnim = 0;
            _spLeaderBoardB.slika       = true;
            this.Game.Components.Add(_spLeaderBoardB);

            DrawScripts.AnimSprite _spExitB = new DrawScripts.AnimSprite(this.Game);
            _spExitB.texture    = this.Game.Content.Load <Texture2D>("Assets\\MainMenu\\Exit");
            _spExitB.position   = new Vector2(this.Game.GraphicsDevice.Viewport.Width / 2, this.Game.GraphicsDevice.Viewport.Height / 2);
            _spExitB.animations = new List <Rectangle>();
            _spExitB.animations.Add(new Rectangle(0, 0, _spExitB.texture.Width, _spExitB.texture.Height));
            _spExitB.center      = new Vector2(_spExitB.texture.Width / 2, _spExitB.texture.Height / 2);
            _spExitB.scale       = new Vector2(0.5f, 0.5f);
            _spExitB.currentAnim = 0;
            _spExitB.slika       = true;
            this.Game.Components.Add(_spExitB);


            _UI = new List <DrawScripts.AnimSprite>();
            _UI.Add(_spStartB);
            _UI.Add(_spLeaderBoardB);
            _UI.Add(_spExitB);

            DrawScripts.DrawMenu _draw = new DrawScripts.DrawMenu(this.Game, _UI);
            this.Game.Components.Add(_draw);

            this.Game.IsMouseVisible = true;
            base.Initialize();
        }
Esempio n. 2
0
        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            // TODO: Add your initialization code here
            DrawScripts.AnimSprite _spMainMenuB = new DrawScripts.AnimSprite(this.Game);
            _spMainMenuB.texture    = this.Game.Content.Load <Texture2D>("Assets\\MainMenu\\Mainmenu");
            _spMainMenuB.position   = new Vector2(this.Game.GraphicsDevice.Viewport.Width / 3.7f, this.Game.GraphicsDevice.Viewport.Height - 30);
            _spMainMenuB.animations = new List <Rectangle>();
            _spMainMenuB.animations.Add(new Rectangle(0, 0, _spMainMenuB.texture.Width, _spMainMenuB.texture.Height));
            _spMainMenuB.center      = new Vector2(_spMainMenuB.texture.Width / 2, _spMainMenuB.texture.Height / 2);
            _spMainMenuB.scale       = new Vector2(0.5f, 0.5f);
            _spMainMenuB.currentAnim = 0;
            _spMainMenuB.slika       = true;
            this.Game.Components.Add(_spMainMenuB);

            DrawScripts.AnimSprite _spRetryB = new DrawScripts.AnimSprite(this.Game);
            _spRetryB.texture    = this.Game.Content.Load <Texture2D>("Assets\\MainMenu\\Retry");
            _spRetryB.position   = new Vector2(this.Game.GraphicsDevice.Viewport.Width / 2, this.Game.GraphicsDevice.Viewport.Height - 30);
            _spRetryB.animations = new List <Rectangle>();
            _spRetryB.animations.Add(new Rectangle(0, 0, _spRetryB.texture.Width, _spRetryB.texture.Height));
            _spRetryB.center      = new Vector2(_spRetryB.texture.Width / 2, _spRetryB.texture.Height / 2);
            _spRetryB.scale       = new Vector2(0.5f, 0.5f);
            _spRetryB.currentAnim = 0;
            _spRetryB.slika       = true;
            this.Game.Components.Add(_spRetryB);

            DrawScripts.AnimSprite _spExitB = new DrawScripts.AnimSprite(this.Game);
            _spExitB.texture    = this.Game.Content.Load <Texture2D>("Assets\\MainMenu\\Exit");
            _spExitB.position   = new Vector2(this.Game.GraphicsDevice.Viewport.Width / 1.37f, this.Game.GraphicsDevice.Viewport.Height - 30);
            _spExitB.animations = new List <Rectangle>();
            _spExitB.animations.Add(new Rectangle(0, 0, _spExitB.texture.Width, _spExitB.texture.Height));
            _spExitB.center      = new Vector2(_spExitB.texture.Width / 2, _spExitB.texture.Height / 2);
            _spExitB.scale       = new Vector2(0.5f, 0.5f);
            _spExitB.currentAnim = 0;
            _spExitB.slika       = true;
            this.Game.Components.Add(_spExitB);

            DrawScripts.AnimSprite _LeaderBoardTextHead = new DrawScripts.AnimSprite(this.Game);
            _LeaderBoardTextHead.font     = this.Game.Content.Load <SpriteFont>("Assets\\Font\\Font");
            _LeaderBoardTextHead.slika    = false;
            _LeaderBoardTextHead.text     = "Name -- Number of waves";
            _LeaderBoardTextHead.position = new Vector2(((int)this.Game.GraphicsDevice.Viewport.Width / 2) - 100, 20);
            this.Game.Components.Add(_LeaderBoardTextHead);


            // 14 izpisev je lepa stevilka
            _LeaderBoardText          = new DrawScripts.AnimSprite(this.Game);
            _LeaderBoardText.font     = this.Game.Content.Load <SpriteFont>("Assets\\Font\\Font");
            _LeaderBoardText.slika    = false;
            _LeaderBoardText.text     = "neki -- 13";
            _LeaderBoardText.position = new Vector2(((int)this.Game.GraphicsDevice.Viewport.Width / 2) - 100, 50);
            this.Game.Components.Add(_LeaderBoardText);


            _UI = new List <DrawScripts.AnimSprite>();
            _UI.Add(_spMainMenuB);
            _UI.Add(_spRetryB);
            _UI.Add(_spExitB);
            _UI.Add(_LeaderBoardTextHead);
            _UI.Add(_LeaderBoardText);

            DrawScripts.DrawMenu _draw = new DrawScripts.DrawMenu(this.Game, _UI);
            this.Game.Components.Add(_draw);

            PrevisuMouseVale = 0;

            top          = 0;
            bot          = 14;
            _LeaderBoard = new List <string[]>();
            fillLeaderBoard();
            makeTextbetween();
            this.Game.IsMouseVisible = true;
            base.Initialize();
        }
Esempio n. 3
0
        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            // TODO: Add your initialization code here
            DrawScripts.AnimSprite _spMainMenuB = new DrawScripts.AnimSprite(this.Game);
            _spMainMenuB.texture    = this.Game.Content.Load <Texture2D>("Assets\\MainMenu\\Mainmenu");
            _spMainMenuB.position   = new Vector2(this.Game.GraphicsDevice.Viewport.Width / 2.7f, this.Game.GraphicsDevice.Viewport.Height - 30);
            _spMainMenuB.animations = new List <Rectangle>();
            _spMainMenuB.animations.Add(new Rectangle(0, 0, _spMainMenuB.texture.Width, _spMainMenuB.texture.Height));
            _spMainMenuB.center      = new Vector2(_spMainMenuB.texture.Width / 2, _spMainMenuB.texture.Height / 2);
            _spMainMenuB.scale       = new Vector2(0.5f, 0.5f);
            _spMainMenuB.currentAnim = 0;
            _spMainMenuB.slika       = true;
            this.Game.Components.Add(_spMainMenuB);

            DrawScripts.AnimSprite _spSaveB = new DrawScripts.AnimSprite(this.Game);
            _spSaveB.texture    = this.Game.Content.Load <Texture2D>("Assets\\MainMenu\\Save");
            _spSaveB.position   = new Vector2(this.Game.GraphicsDevice.Viewport.Width / 1.5f, this.Game.GraphicsDevice.Viewport.Height - 30);
            _spSaveB.animations = new List <Rectangle>();
            _spSaveB.animations.Add(new Rectangle(0, 0, _spSaveB.texture.Width, _spSaveB.texture.Height));
            _spSaveB.center      = new Vector2(_spSaveB.texture.Width / 2, _spSaveB.texture.Height / 2);
            _spSaveB.scale       = new Vector2(0.5f, 0.5f);
            _spSaveB.currentAnim = 0;
            _spSaveB.slika       = true;
            this.Game.Components.Add(_spSaveB);

            DrawScripts.AnimSprite _spInputBack = new DrawScripts.AnimSprite(this.Game);
            _spInputBack.texture    = this.Game.Content.Load <Texture2D>("Assets\\MainMenu\\InputBackGround");
            _spInputBack.position   = new Vector2(this.Game.GraphicsDevice.Viewport.Width / 2, this.Game.GraphicsDevice.Viewport.Height / 2);
            _spInputBack.animations = new List <Rectangle>();
            _spInputBack.animations.Add(new Rectangle(0, 0, _spInputBack.texture.Width, _spInputBack.texture.Height));
            _spInputBack.center      = new Vector2(_spInputBack.texture.Width / 2, _spInputBack.texture.Height / 2);
            _spInputBack.scale       = new Vector2(0.5f, 0.5f);
            _spInputBack.currentAnim = 0;
            _spInputBack.slika       = true;
            this.Game.Components.Add(_spInputBack);

            DrawScripts.AnimSprite _EndScreenTextHeade = new DrawScripts.AnimSprite(this.Game);
            _EndScreenTextHeade.font     = this.Game.Content.Load <SpriteFont>("Assets\\Font\\Font");
            _EndScreenTextHeade.slika    = false;
            _EndScreenTextHeade.text     = "            You died, \n            at " + Waves + " waves. \n \n enter your name for the Leaderboard!";
            _EndScreenTextHeade.position = new Vector2(((int)this.Game.GraphicsDevice.Viewport.Width / 2) - 200, 20);
            this.Game.Components.Add(_EndScreenTextHeade);

            _inputText          = new DrawScripts.AnimSprite(this.Game);
            _inputText.font     = this.Game.Content.Load <SpriteFont>("Assets\\Font\\Font");
            _inputText.slika    = false;
            _inputText.text     = "";//17 max leght za ime
            _inputText.position = new Vector2(((int)this.Game.GraphicsDevice.Viewport.Width / 2) - 86, (this.Game.GraphicsDevice.Viewport.Height / 2) - 10);
            this.Game.Components.Add(_inputText);


            _UI = new List <DrawScripts.AnimSprite>();
            _UI.Add(_spMainMenuB);
            _UI.Add(_spSaveB);
            _UI.Add(_spInputBack);
            _UI.Add(_EndScreenTextHeade);
            _UI.Add(_inputText);

            DrawScripts.DrawMenu _draw = new DrawScripts.DrawMenu(this.Game, _UI);
            this.Game.Components.Add(_draw);

            crke = new Dictionary <Keys, string>();
            crke.Add(Keys.A, "a");
            crke.Add(Keys.B, "b");
            crke.Add(Keys.C, "c");
            crke.Add(Keys.D, "d");
            crke.Add(Keys.E, "e");
            crke.Add(Keys.F, "f");
            crke.Add(Keys.G, "g");
            crke.Add(Keys.H, "h");
            crke.Add(Keys.I, "i");
            crke.Add(Keys.J, "j");
            crke.Add(Keys.K, "k");
            crke.Add(Keys.L, "l");
            crke.Add(Keys.M, "m");
            crke.Add(Keys.N, "n");
            crke.Add(Keys.O, "o");
            crke.Add(Keys.P, "p");
            crke.Add(Keys.R, "r");
            crke.Add(Keys.S, "s");
            crke.Add(Keys.T, "t");
            crke.Add(Keys.U, "u");
            crke.Add(Keys.V, "v");
            crke.Add(Keys.Z, "z");
            crke.Add(Keys.Space, " ");

            keyStatesOld = new Dictionary <Keys, Boolean>();
            keyStatesOld.Add(Keys.A, false);
            keyStatesOld.Add(Keys.B, false);
            keyStatesOld.Add(Keys.C, false);
            keyStatesOld.Add(Keys.D, false);
            keyStatesOld.Add(Keys.E, false);
            keyStatesOld.Add(Keys.F, false);
            keyStatesOld.Add(Keys.G, false);
            keyStatesOld.Add(Keys.H, false);
            keyStatesOld.Add(Keys.I, false);
            keyStatesOld.Add(Keys.J, false);
            keyStatesOld.Add(Keys.K, false);
            keyStatesOld.Add(Keys.L, false);
            keyStatesOld.Add(Keys.M, false);
            keyStatesOld.Add(Keys.N, false);
            keyStatesOld.Add(Keys.O, false);
            keyStatesOld.Add(Keys.P, false);
            keyStatesOld.Add(Keys.R, false);
            keyStatesOld.Add(Keys.S, false);
            keyStatesOld.Add(Keys.T, false);
            keyStatesOld.Add(Keys.U, false);
            keyStatesOld.Add(Keys.V, false);
            keyStatesOld.Add(Keys.Z, false);
            keyStatesOld.Add(Keys.Back, false);
            keyStatesOld.Add(Keys.Space, false);

            keyStatesNew = new Dictionary <Keys, Boolean>();
            keyStatesNew.Add(Keys.A, false);
            keyStatesNew.Add(Keys.B, false);
            keyStatesNew.Add(Keys.C, false);
            keyStatesNew.Add(Keys.D, false);
            keyStatesNew.Add(Keys.E, false);
            keyStatesNew.Add(Keys.F, false);
            keyStatesNew.Add(Keys.G, false);
            keyStatesNew.Add(Keys.H, false);
            keyStatesNew.Add(Keys.I, false);
            keyStatesNew.Add(Keys.J, false);
            keyStatesNew.Add(Keys.K, false);
            keyStatesNew.Add(Keys.L, false);
            keyStatesNew.Add(Keys.M, false);
            keyStatesNew.Add(Keys.N, false);
            keyStatesNew.Add(Keys.O, false);
            keyStatesNew.Add(Keys.P, false);
            keyStatesNew.Add(Keys.R, false);
            keyStatesNew.Add(Keys.S, false);
            keyStatesNew.Add(Keys.T, false);
            keyStatesNew.Add(Keys.U, false);
            keyStatesNew.Add(Keys.V, false);
            keyStatesNew.Add(Keys.Z, false);
            keyStatesNew.Add(Keys.Back, false);
            keyStatesNew.Add(Keys.Space, false);

            this.Game.IsMouseVisible = true;
            base.Initialize();
        }