Esempio n. 1
0
        public void Initialize()
        {
            gameOverPosition.X = 320;
            gameOverPosition.Y = 130;

            device = graphics.GraphicsDevice;

            gameState = new GameState();
            gameStart = new GameStart(device.PresentationParameters.BackBufferWidth, device.PresentationParameters.BackBufferHeight);
            gameState.setState(GameState.state.Start);

            board = new GameBoard(new Vector2(33, 25), new Vector2(device.PresentationParameters.BackBufferWidth, device.PresentationParameters.BackBufferHeight));
            darwin = new Darwin(board);
            //firstZombie = new Zombie(10, 10, 15, 5, 15, 5, board);
            //secondZombie = new Zombie(10, 16, 15, 5, 15, 5, board);
            //thirdZombie = new Zombie(12, 10, 15, 5, 15, 5, board);

            Vector2[] myPath = new Vector2[4];
            myPath[0] = new Vector2(8, 4);
            myPath[1] = new Vector2(8, 19);
            myPath[2] = new Vector2(25, 19);
            myPath[3] = new Vector2(25, 4);

            leaderZombie = new CongaLeaderZombie(8, 4, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath, darwin, board);

            followerZombies = new List<CongaFollowerZombie>();

            // all conga paths for the different conga zombies are created here along with all conga zombies
            myPath = new Vector2[8];
            myPath[0] = new Vector2(8,4);
            myPath[1] = new Vector2(8, 12);
            myPath[2] = new Vector2(8,19);
            myPath[3] = new Vector2(17, 19);
            myPath[4] = new Vector2(25,19);
            myPath[5] = new Vector2(25, 12);
            myPath[6] = new Vector2(25,4);
            myPath[7] = new Vector2(17, 4);

            followerZombies.Add(new CongaFollowerZombie(10,4,board.getNumSquaresX(),0,board.getNumSquaresY(),0,myPath,leaderZombie,darwin,board));
            followerZombies.Add(new CongaFollowerZombie(12, 4, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath, leaderZombie,darwin, board));
            followerZombies.Add(new CongaFollowerZombie(14, 4, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath, leaderZombie,darwin, board));

            myPath = new Vector2[8];
            myPath[2] = new Vector2(8, 4);
            myPath[3] = new Vector2(8, 12);
            myPath[4] = new Vector2(8, 19);
            myPath[5] = new Vector2(17, 19);
            myPath[6] = new Vector2(25, 19);
            myPath[7] = new Vector2(25, 12);
            myPath[0] = new Vector2(25, 4);
            myPath[1] = new Vector2(17, 4);

            followerZombies.Add(new CongaFollowerZombie(25, 8, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath,leaderZombie, darwin, board));
            followerZombies.Add(new CongaFollowerZombie(25, 10, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath,leaderZombie, darwin, board));
            followerZombies.Add(new CongaFollowerZombie(25, 14, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath,leaderZombie, darwin, board));

            myPath = new Vector2[8];
            myPath[4] = new Vector2(8, 4);
            myPath[5] = new Vector2(8, 12);
            myPath[6] = new Vector2(8, 19);
            myPath[7] = new Vector2(17, 19);
            myPath[0] = new Vector2(25, 19);
            myPath[1] = new Vector2(25, 12);
            myPath[2] = new Vector2(25, 4);
            myPath[3] = new Vector2(17, 4);

            followerZombies.Add(new CongaFollowerZombie(22, 19, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath,leaderZombie, darwin, board));
            followerZombies.Add(new CongaFollowerZombie(16, 19, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath,leaderZombie, darwin, board));
            followerZombies.Add(new CongaFollowerZombie(14, 19, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath,leaderZombie, darwin, board));

            myPath = new Vector2[8];
            myPath[6] = new Vector2(8, 4);
            myPath[7] = new Vector2(8, 12);
            myPath[0] = new Vector2(8, 19);
            myPath[1] = new Vector2(17, 19);
            myPath[2] = new Vector2(25, 19);
            myPath[3] = new Vector2(25, 12);
            myPath[4] = new Vector2(25, 4);
            myPath[5] = new Vector2(17, 4);

            followerZombies.Add(new CongaFollowerZombie(8, 12, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath,leaderZombie, darwin, board));
            followerZombies.Add(new CongaFollowerZombie(8, 15, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath,leaderZombie, darwin, board));

            myPath = new Vector2[8];

            myPath[3] = new Vector2(8, 4);
            myPath[4] = new Vector2(8, 12);
            myPath[5] = new Vector2(8, 19);
            myPath[6] = new Vector2(17, 19);
            myPath[7] = new Vector2(25, 19);
            myPath[0] = new Vector2(25, 16);
            myPath[1] = new Vector2(25, 4);
            myPath[2] = new Vector2(17, 4);

            followerZombies.Add(new CongaFollowerZombie(29, 17, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath,leaderZombie, darwin, board));
            followerZombies.Add(new CongaFollowerZombie(29, 15, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath,leaderZombie, darwin, board));
            followerZombies.Add(new CongaFollowerZombie(29, 16, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath,leaderZombie, darwin, board));
            followerZombies.Add(new CongaFollowerZombie(29, 13, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath,leaderZombie, darwin, board));

            myPath = new Vector2[8];
            myPath[7] = new Vector2(8, 4);
            myPath[0] = new Vector2(8, 7);
            myPath[1] = new Vector2(8, 19);
            myPath[2] = new Vector2(17, 19);
            myPath[3] = new Vector2(25, 19);
            myPath[4] = new Vector2(25, 12);
            myPath[5] = new Vector2(25, 4);
            myPath[6] = new Vector2(17, 4);

            followerZombies.Add(new CongaFollowerZombie(4, 7, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath,leaderZombie, darwin, board));
            followerZombies.Add(new CongaFollowerZombie(4, 9, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath,leaderZombie, darwin, board));
            followerZombies.Add(new CongaFollowerZombie(4, 8, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath,leaderZombie, darwin, board));
            followerZombies.Add(new CongaFollowerZombie(4, 10, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath,leaderZombie, darwin, board));

            leaderZombie.setFollowers(followerZombies);

            String zombieString = "This a zombie,\n don't near him \nas a human!!";
            zombieMessage = new MessageBox(board.getPosition(12, 8).X, board.getPosition(10, 10).Y, zombieString);

            String darwinString = "This is darwin,\n move with arrows, \n z to transform, \n a for actions";
            darwinMessage = new MessageBox(board.getPosition(12, 8).X, board.getPosition(10, 10).Y, darwinString);

            String switchString = "This is a switch\n face it and press A\n to see what happens!!";
            switchMessage = new MessageBox(board.getPosition(12, 8).X, board.getPosition(10, 10).Y, switchString);

            stairs = new Stairs(board);

            BasicObject[] removableWalls = setRemovableWallsSwitchOne();

            BasicObject switchSquare = new BasicObject(board);
            switchSquare.X = 31;
            switchSquare.Y = 8;

            firstSwitch = new Switch(switchSquare, board, removableWalls);

            BasicObject[] removableWalls2 = setRemovableWallsSwitchTwo();

            BasicObject switchSquare2 = new BasicObject(board);
            switchSquare2.X = 1;
            switchSquare2.Y = 15;

            secondSwitch = new Switch(switchSquare2, board, removableWalls2);

            // Initial starting position
            darwin.setGridPosition(16, 22);

            if (board.isGridPositionOpen(darwin))
            {
                board.setGridPositionOccupied(darwin.X, darwin.Y);
                darwin.setPosition(board.getPosition(darwin).X, board.getPosition(darwin).Y);
            }

            // Darwin's lag movement
            counterReady = counter = 5;

            if (board.isGridPositionOpen(16, 1))
            {
                stairs.setGridPosition(16, 1);
                stairs.setDestination(board.getPosition(16, 1));
            }

            zTime = new ZombieTime(board);
            zTimeReset = new ZombieTime(board);

            setPotionPosition(28, 7);
            setPotion2Position(1, 7);

            setWallsInLevelFour();

            setDanceFloor();
        }
Esempio n. 2
0
        public void Initialize()
        {
            gameOverPosition.X = 320;
            gameOverPosition.Y = 130;

            device = graphics.GraphicsDevice;

            gameState = new GameState();
            gameStart = new GameStart(device.PresentationParameters.BackBufferWidth, device.PresentationParameters.BackBufferHeight);
            gameState.setState(GameState.state.Level);

            board = new GameBoard(new Vector2(33, 25), new Vector2(device.PresentationParameters.BackBufferWidth, device.PresentationParameters.BackBufferHeight));
            darwin = new Darwin(board);

            String zombieString = "This a zombie,\n don't near him \nas a human!!";
            zombieMessage = new MessageBox(board.getPosition(12, 8).X, board.getPosition(10, 10).Y, zombieString);

            String darwinString = "This is darwin,\n move with arrows, \n z to transform, \n a for actions";
            darwinMessage = new MessageBox(board.getPosition(12, 8).X, board.getPosition(10, 10).Y, darwinString);

            stairs = new Stairs(board);
            if (board.isGridPositionOpen(5, 18))
            {
                stairs.setGridPosition(5, 18);
            }

            // Initial starting position
            darwin.setGridPosition(6, 18);
            if (board.isGridPositionOpen(darwin))
            {
                board.setGridPositionOccupied(darwin.X, darwin.Y);
                darwin.setPosition(board.getPosition(darwin).X, board.getPosition(darwin).Y);
            }

            // Darwin's lag movement
            counterReady = counter = 5;

            zTime = new ZombieTime(board);
            zTimeReset = new ZombieTime(board);

            setPotionPosition(27, 5);

            setBoxes();
            setBoxPattern();
            pattern = new BoxPattern(board, spotsForPattern);

            setVortexes();

            setWalls();

            snake = new Snake(10, 9, 27, 5, 18, 5, board);
            snake2 = new Snake(8, 15, 27, 5, 18, 5, board);
            snake3 = new Snake(21, 9, 27, 5, 18, 5, board);
            snake4 = new Snake(21, 15, 27, 5, 18, 5, board);

            northZombie = new PyroZombie(15, 3, 25, 4, 3, 3, board);
            northZombie.setGridPosition(15, 3);
            northZombie.setCurrentPatrolPoint(new Vector2(27, 3));
            northZombie.setNextPatrolPoint(new Vector2(5, 3));
            
            southZombie = new PyroZombie(15, 20, 25, 4, 20, 20, board);
            southZombie.setGridPosition(15, 20);
            southZombie.setCurrentPatrolPoint(new Vector2(5, 20));
            southZombie.setNextPatrolPoint(new Vector2(27, 20));
           
            eastZombie = new PyroZombie(29, 11, 29, 29, 19, 4, board);
            eastZombie.setGridPosition(29, 11);
            eastZombie.setCurrentPatrolPoint(new Vector2(29, 17));
            eastZombie.setNextPatrolPoint(new Vector2(29, 6));

            westZombie = new PyroZombie(3, 11, 3, 3, 19, 4, board);
            westZombie.setGridPosition(3, 11);
            westZombie.setCurrentPatrolPoint(new Vector2(3, 5));
            westZombie.setNextPatrolPoint(new Vector2(3, 18));

            flames = new LinkedList<Flame>();

        }
Esempio n. 3
0
 void RightMission_OnClick(object sender, EventArgs e)
 {
     GameSelectedPlanets.Clear();
     textSettings.Width = 700 - 28;
     textManager.Text = selectedMission.Description;
     textManager.Parse();
     InternalPause = false;
     Manager.Enabled = false;
     MainMenuContract.Enabled = false;
     SinglePlayerContract.Enabled = true;
     RCS.PreCache<Texture2D>("selection_planet_ingame");
     LoadMission(selectedMission);
     if (TutorialMode)
     {
         if (TutorialProgress == 5)
         {
             MessageBox = new MessageBox("", 700, 300, Font, RCS.GetObject<Texture2D>("Corner"), RCS.GetObject<Texture2D>("Border"), RCS.GetObject<Texture2D>("BackgroundPattern"));
             MessageBox.Depth = 0.1f;
             MessageBox.Show(false);
             MessageBox.Origin = new Vector2(350, 150);
             MessageBox.Position = new Vector2(Width / 2, Height / 2);
             MessageBox.Text = LocalizationData.Tutorial5;
         }
     }
     else
         MessageBox = null;
     GameState = GameState.Singleplayer;
     AI = new AIManager();
 }
Esempio n. 4
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            Locale = LocalizationData.Locale;
            Locale = "ru";
            RCS = GetService(typeof(IResourceCacheService)) as IResourceCacheService;
            // Create a new SpriteBatch, which can be used to draw textures.
            factory.GetHexFill(410, new Vector2(512, 512));
            //Load splash screen
            Splash = Content.Load<Texture2D>(string.Format("Splash_{0}",Locale));
            spriteBatch.Begin();
            spriteBatch.Draw(Splash, Vector2.Zero, Color.White);
            spriteBatch.End();

            GraphicsDevice.Present();
            SoundContent = new ContentManager(this, "Content");
            soundTrack = SoundContent.Load<Song>(string.Format("Sound/Music/Song{0}", (DateTime.Now.Second % 5) + 1));
            MenuItemSelected = Content.Load<SoundEffect>("Sound\\Effects\\10");
            DoResearch = Content.Load<SoundEffect>("Sound\\Effects\\08");
            PlanetSelected = Content.Load<SoundEffect>("Sound\\Effects\\07");
            PlanetSelectedInstance = PlanetSelected.CreateInstance();
            FleetSend = Content.Load<SoundEffect>("Sound\\Effects\\08");

            MediaPlayer.MediaStateChanged += new EventHandler<EventArgs>(MediaPlayer_MediaStateChanged);
            if (MediaPlayer.GameHasControl)
            {
                MediaPlayer.Play(soundTrack);
            }

            SOMAWP7.SomaAd PublicAd = new SOMAWP7.SomaAd();
            PublicAd.Kws = "Space,Gods,Veles,Conflict,Windows,Phone,Cosmos,Astronomy,Sci-Fi,Russia";
            PublicAd.Adspace = 65766349;   // Developer Ads
            PublicAd.Pub = 923863405;       // Developer Ads
            PublicAd.AdSpaceHeight = 50;
            PublicAd.AdSpaceWidth = 300;

            //AdGameComponent.Initialize(this, "c8eda0b9-c5d9-4dc8-856b-8f0791cd3ddd");
            //AdGameComponent.Current.CountryOrRegion = System.Globalization.RegionInfo.CurrentRegion.TwoLetterISORegionName;
            //DrawableAd bannerAd = AdGameComponent.Current.CreateAd("10040438", new Rectangle(0, 0, 300, 50), true);

            adManager = new AdManager(PublicAd);

            RCS.PreCache<Texture2D>("Menues/Main/MainOverlay");

            #region Load Stuff

            GameOverlay = RCS.GetObject<Texture2D>("battle_03v");
            //
            //
            //
            //IResourceObject<Texture2D> StrategicOverlay = RCS.GetObject<Texture2D>("Menues/Strategic/Strategy");

            //RCS.PreCache<Texture2D>("selection");
            RCS.PreCache<Texture2D>("Menues/11v");
            RCS.PreCache<Texture2D>("Menues/LeftButton");
            RCS.PreCache<Texture2D>("Menues/RightButton");
            RCS.PreCache<Texture2D>("Menues/Base/bg_ext");
            Font = Content.Load<SpriteFont>("GameFont");
            IResourceObject<Texture2D> MainButton = RCS.GetObject<Texture2D>("Menues/Main/button");
            IResourceObject<Texture2D> CampaingButton = RCS.GetObject<Texture2D>("Menues/Campaing/SelectionButton");
            Campaign campaign1 = new Campaign();
            Campaign campaign2 = new Campaign();
            Campaign tutorial = new Campaign();
            using (XmlReader reader = XmlReader.Create(string.Format("Campaigns/Campaign1_{0}.xml", Locale)))
            {
                campaign1.Load(reader);
            }
            using (XmlReader reader = XmlReader.Create(string.Format("Campaigns/Campaign2_{0}.xml", Locale)))
            {
                campaign2.Load(reader);
            }
            using (XmlReader reader = XmlReader.Create(string.Format("Campaigns/Tutorial_{0}.xml", Locale)))
            {
                tutorial.Load(reader);
            }

            textSettings = new TextManagerSettings();
            textSettings.Font = Font;
            textSettings.Offset = new Vector2(425, 60);
            textSettings.Width = 310;
            textManager = new TextManager();
            textManager.Settings = textSettings;
            textManager.Text = campaign1.ShortDescription;
            textManager.Parse();

            selectedCampaing = tutorial;
            selectedEpisode = selectedCampaing.Episodes[0];
            selectedMission = selectedEpisode.Missions[0];
            #endregion
            #region Main Menu
            IResourceObject<Texture2D> MainOverlay = RCS.GetObject<Texture2D>("Menues/Main/MainOverlay");
            IAnimator<Vector2> MainAnimatorOut = new SmoothVectorAnimator();
            MainAnimatorOut.AtStart = Vector2.Zero;
            MainAnimatorOut.AtEnd = new Vector2(-120, 425);
            MainAnimatorOut.Duration = 450;

            IAnimator<Vector2> MainAnimatorIn = new LinearVectorAnimator();
            MainAnimatorIn.AtStart = new Vector2(120, -425);
            MainAnimatorIn.AtEnd = Vector2.Zero;
            MainAnimatorIn.Duration = 375;

            Manager = new MenuManager();
            Manager.ExitOnBack = true;

            Menu One = new Menu(MainAnimatorIn, MainAnimatorOut, BuildMessageBox());
            One.Controls.Add(new Image() { Texture = MainOverlay, Position = Vector2.Zero, Depth = 0.5f });
            Manager.Menues.Add("Main", One);
            bool Nab = playerData.FirstLoad || (playerData.GetProgress("Campaing1") == 1 && playerData.GetProgress("Campaing2") == 1 && playerData.GetProgress("Campaing3") == 1);
            One.Controls.Add(new AdControl(adManager) { Position = new Vector2(417, 411), Scale = 1, Depth = 0 });
            {
                if (Nab)
                {
                    HybridButton tb = new HybridButton(MainButton, MainButton, new Vector2(120 - 15 * 0, 85 + 0 * 55));
                    tb.Text = LocalizationData.NewGame;
                    tb.TextPosition = new Vector2(15, -47);
                    tb.Sound = MenuItemSelected.CreateInstance();
                    tb.UseSound = true;
                    tb.Font = Font;
                    tb.Depth = 0.9f;
                    tb.HoverColor = new Color(50, 238, 50);
                    tb.Origin = new Vector2(0, MainButton.Instance.Height - 7);
                    tb.NextMenu = "Difficulty";
                    One.Controls.Add(tb);
                }
                else
                {
                    HybridButton tb = new HybridButton(MainButton, MainButton, new Vector2(120 - 15 * 0, 85 + 0 * 55));
                    tb.Text = LocalizationData.Continue;
                    tb.TextPosition = new Vector2(15, -47);
                    tb.Font = Font;
                    tb.Depth = 0.9f;
                    tb.Sound = MenuItemSelected.CreateInstance();
                    tb.HoverColor = new Color(50, 238, 50);
                    tb.UseSound = true;
                    tb.Origin = new Vector2(0, MainButton.Instance.Height - 7);
                    tb.NextMenu = "Campaing";
                    One.Controls.Add(tb);
                }
            }
            {
                if (Nab)
                {
                    HybridButton tb = new HybridButton(MainButton, MainButton, new Vector2(120 - 15 * 1, 85 + 1 * 55));
                    tb.Text = LocalizationData.Continue;
                    tb.TextPosition = new Vector2(15, -47);
                    tb.Font = Font;
                    tb.Depth = 0.9f;
                    tb.Sound = MenuItemSelected.CreateInstance();
                    tb.HoverColor = new Color(50, 238, 50);
                    tb.UseSound = true;
                    tb.Origin = new Vector2(0, MainButton.Instance.Height - 7);
                    tb.NextMenu = "Campaing";
                    One.Controls.Add(tb);
                }
                else
                {
                    HybridButton tb = new HybridButton(MainButton, MainButton, new Vector2(120 - 15 * 1, 85 + 1 * 55));
                    tb.Text = LocalizationData.NewGame;
                    tb.TextPosition = new Vector2(15, -47);
                    tb.Sound = MenuItemSelected.CreateInstance();
                    tb.HoverColor = new Color(50, 238, 50);
                    tb.UseSound = true;
                    tb.Font = Font;
                    tb.Depth = 0.9f;
                    tb.Origin = new Vector2(0, MainButton.Instance.Height - 7);
                    tb.NextMenu = "Difficulty";
                    One.Controls.Add(tb);
                }

            }
            {
                HybridButton tb = new HybridButton(MainButton, MainButton, new Vector2(120 - 15 * 2, 85 + 2 * 55));
                tb.Text = LocalizationData.Multiplayer;
                tb.TextPosition = new Vector2(15, -47);
                tb.NextMenu = "MultiplayerMain";
                tb.HoverColor = new Color(50, 238, 50);
                tb.Sound = MenuItemSelected.CreateInstance();
                tb.UseSound = true;
                tb.Font = Font;
                tb.Depth = 0.9f;
                tb.Origin = new Vector2(0, MainButton.Instance.Height - 7);
                One.Controls.Add(tb);
            }
            {
                HybridButton tb = new HybridButton(MainButton, MainButton, new Vector2(120 - 15 * 3, 85 + 3 * 55));
                tb.Text = LocalizationData.Rate;
                tb.TextPosition = new Vector2(15, -47);
                tb.Sound = MenuItemSelected.CreateInstance();
                tb.HoverColor = new Color(50, 238, 50);
                tb.UseSound = true;
                tb.Font = Font;
                tb.Depth = 0.9f;
                tb.Origin = new Vector2(0, MainButton.Instance.Height - 7);
                tb.OnClick += new EventHandler(Rate_OnClick);
                One.Controls.Add(tb);
            }
            {
                HybridButton tb = new HybridButton(MainButton, MainButton, new Vector2(120 - 15 * 4, 85 + 4 * 55));
                tb.Text = LocalizationData.Share;
                tb.TextPosition = new Vector2(15, -47);
                tb.Sound = MenuItemSelected.CreateInstance();
                tb.HoverColor = new Color(50, 238, 50);
                tb.OnClick += new EventHandler(share_OnClick);
                tb.UseSound = true;
                tb.Font = Font;
                tb.Depth = 0.9f;
                tb.Origin = new Vector2(0, MainButton.Instance.Height - 7);
                One.Controls.Add(tb);
            }
            /*
            {
                HybridButton tb = new HybridButton(MainButton, MainButton, new Vector2(120 - 15 * 4, 85 + 4 * 55));
                tb.Text = "Editor";
                tb.OnClick+=new EventHandler(EnterEditorMode);
                tb.TextPosition = new Vector2(15, -47);
                tb.HoverColor = new Color(50, 238, 50);
                tb.Sound = MenuItemSelected.CreateInstance();
                tb.UseSound = true;
                tb.Font = Font;
                tb.Depth = 0.9f;
                tb.Origin = new Vector2(0, MainButton.Instance.Height - 7);
                One.Controls.Add(tb);
            }
            */
            {
                HybridButton tb = new HybridButton(MainButton, MainButton, new Vector2(120 - 15 * 5, 85 + 5 * 55));
                tb.Text = LocalizationData.Exit;
                tb.TextPosition = new Vector2(15, -47);
                tb.HoverColor = new Color(50, 238, 50);
                tb.Sound = MenuItemSelected.CreateInstance();
                tb.UseSound = true;
                tb.Font = Font;
                tb.Depth = 0.9f;
                tb.Origin = new Vector2(0, MainButton.Instance.Height - 7);
                tb.NextMenu = "%Exit%"; //Change
                One.Controls.Add(tb);
            }
            #endregion
            #region Campaing Menu
            RCS.PreCache<Texture2D>("Menues/Base/Base");
            RCS.PreCache<Texture2D>("Menues/Campaing/Overlay");
            IResourceObject<Texture2D> CampaingOverlay = RCS.GetObject<Texture2D>("Menues/Campaing/Overlay");
            IAnimator<Vector2> CampaingOut = new SmoothVectorAnimator();
            CampaingOut.AtStart = Vector2.Zero;
            CampaingOut.AtEnd = new Vector2(0, 480);
            CampaingOut.Duration = 500;

            IAnimator<Vector2> CampaingIn = new SmoothVectorAnimator();
            CampaingIn.AtStart = new Vector2(0, -480);
            CampaingIn.AtEnd = Vector2.Zero;
            CampaingIn.Duration = 500;
            Menu Two = new Menu(CampaingIn, CampaingOut, BuildMessageBox());
            Two.Controls.Add(new Image() { Texture = CampaingOverlay, Position = Vector2.Zero, Depth = 0.5f });
            Two.Controls.Add(new AdControl(adManager) { Position = new Vector2(252, 415), Scale = 1, Depth = 0 });
            Two.OnDraw += CampaignOnDraw;
            Manager.Menues.Add("Campaing", Two);
            {
                HybridButton tb = new HybridButton(CampaingButton, CampaingButton, new Vector2(57, 45 + 0 * 53));
                tb.Origin = new Vector2(0, 0);
                tb.Depth = 0.51f;
                tb.Color = Color.LightGreen;
                tb.HoverColor = new Color(50, 238, 50);
                tb.Font = Font;
                tb.UseSound = true;
                tb.Sound = MenuItemSelected.CreateInstance();
                tb.Text = tutorial.Name;
                tb.Tag = tutorial;
                tb.OnClick += CampaignSelected;
                tb.TextPosition = new Vector2(20, CampaingButton.Instance.Height / 4);
                Two.Controls.Add(tb);
            }
            {
                HybridButton tb = new HybridButton(CampaingButton, CampaingButton, new Vector2(57, 45 + 1 * 53));
                tb.Origin = new Vector2(0, 0);
                tb.Depth = 0.51f;
                tb.Font = Font;
                tb.HoverColor = new Color(50, 238, 50);
                tb.UseSound = true;
                tb.Sound = MenuItemSelected.CreateInstance();
                tb.Text = campaign1.Name;
                tb.Tag = campaign1;
                tb.OnClick += CampaignSelected;
                tb.TextPosition = new Vector2(20, CampaingButton.Instance.Height / 4);
                Two.Controls.Add(tb);
            }
            {
                HybridButton tb = new HybridButton(CampaingButton, CampaingButton, new Vector2(57, 45 + 2 * 53));
                tb.Origin = new Vector2(0, 0);
                tb.Depth = 0.51f;
                tb.Font = Font;
                tb.HoverColor = new Color(50, 238, 50);
                tb.UseSound = true;
                tb.Sound = MenuItemSelected.CreateInstance();
                tb.Text = campaign2.Name;
                tb.Tag = campaign2;
                tb.OnClick += CampaignSelected;
                tb.TextPosition = new Vector2(20, CampaingButton.Instance.Height / 4);
                Two.Controls.Add(tb);
            }
            //{
            //    HybridButton tb = new HybridButton(CampaingButton, CampaingButton, new Vector2(57, 45 + 1 * 53));
            //    tb.Origin = new Vector2(0, 0);
            //    tb.Depth = 0.51f;
            //    tb.Font = Font;
            //    tb.Text = campaign2.Name;
            //    tb.Tag = campaign2;
            //    tb.OnClick += CampaignSelected;
            //    tb.TextPosition = new Vector2(20, CampaingButton.Height / 4);
            //    Two.Controls.Add(tb);
            //}
            HybridButton Left = new HybridButton(RCS.GetObject<Texture2D>("Menues/LeftButton"), RCS.GetObject<Texture2D>("Menues/LeftButton"), new Vector2(43, 444));
            Left.Origin = new Vector2(0, 62);
            Left.NextMenu = "%Back%";
            Left.HoverColor = new Color(50, 238, 50);
            Left.CanOffset = false;
            Left.UseSound = true;
            Left.Sound = MenuItemSelected.CreateInstance();
            Left.Depth = 0.01f;
            Left.Font = Font;
            Left.TextPosition = -Left.Origin + new Vector2(50, 23);
            Left.Text = LocalizationData.Back;
            HybridButton Right = new HybridButton(RCS.GetObject<Texture2D>("Menues/RightButton"), RCS.GetObject<Texture2D>("Menues/RightButton"), new Vector2(757, 444));
            Right.Origin = new Vector2(172, 62);
            Right.CanOffset = false;
            Right.Depth = 0.01f;
            Right.HoverColor = new Color(50, 238, 50);
            Right.UseSound = true;
            Right.Sound = MenuItemSelected.CreateInstance();
            Right.NextMenu = "Base";
            Right.Font = Font;
            Right.TextPosition = -Right.Origin + new Vector2(60, 23);
            Right.Text = LocalizationData.Play;
            Two.Controls.Add(Left);
            Two.Controls.Add(Right);
            #endregion
            #region Base Menu

            IAnimator<Vector2> Empty = new SmoothVectorAnimator();
            Empty.AtStart = Vector2.Zero;
            Empty.AtEnd = Vector2.Zero;
            Empty.Duration = 0;

            #endregion

            MultiplayerMenu multiplayerMenu = new MultiplayerMenu();
            Manager.Menues.Add("MultiplayerMain", multiplayerMenu);

            //Define the strategic menu, but don't bother giving it any controls
            Menu Strategic = new Menu(Empty, Empty, BuildMessageBox());
            Manager.Menues.Add("Strategic", Strategic);
            Strategic.OnDraw += new EventHandler(Strategic_OnDraw);

            //Define the mission menu too
            Menu MissionSelection = new Menu(Empty, Empty, BuildMessageBox());
            Manager.Menues.Add("Mission", MissionSelection);
            MissionSelection.OnDraw += new EventHandler(MissionSelection_OnDraw);

            Menu DifficultySelection = new Menu(MainAnimatorIn, MainAnimatorOut, BuildMessageBox());
            DifficultySelection.NotReturnable = true;
            Manager.Menues.Add("Difficulty", DifficultySelection);
            /*
            HybridButton Easy = new HybridButton(MainButton, MainButton, new Vector2(120 - 15 * 0, 85 + 0 * 55));
            Easy.Tag = "Easy";
            Easy.OnClick += new EventHandler(Easy_OnClick);
            Easy.Text = LocalizationData.DifficultyEasy;
            Easy.Font = Font;
            Easy.UseSound = true;
            Easy.Sound = MenuItemSelected.CreateInstance();
            Easy.Depth = 0.9f;
            Easy.NextMenu = "Campaing";
            Easy.Origin = new Vector2(0, MainButton.Instance.Height - 7);
            Easy.TextPosition = new Vector2(15, -47);
            */

            HybridButton Medium = new HybridButton(MainButton, MainButton, new Vector2(120 - 15 * 0, 85 + 0 * 55));
            Medium.Tag = "Medium";
            Medium.OnClick += Easy_OnClick;
            Medium.UseSound = true;
            Medium.HoverColor = new Color(50, 238, 50);
            Medium.Sound = MenuItemSelected.CreateInstance();
            Medium.Text = LocalizationData.DifficultyEasy;
            Medium.NextMenu = "Campaing";
            Medium.Font = Font;
            Medium.Depth = 0.9f;
            Medium.Origin = new Vector2(0, MainButton.Instance.Height - 7);
            Medium.TextPosition = new Vector2(15, -47);

            HybridButton Hard = new HybridButton(MainButton, MainButton, new Vector2(120 - 15 * 1, 85 + 1 * 55));
            Hard.Tag = "Hard";
            Hard.OnClick += Easy_OnClick;
            Hard.UseSound = true;
            Hard.HoverColor = new Color(50, 238, 50);
            Hard.Sound = MenuItemSelected.CreateInstance();
            Hard.Text = LocalizationData.DifficultyMedium;
            Hard.Font = Font;
            Hard.NextMenu = "Campaing";
            Hard.Depth = 0.9f;
            Hard.Origin = new Vector2(0, MainButton.Instance.Height - 7);
            Hard.TextPosition = new Vector2(15, -47);

            HybridButton Insane = new HybridButton(MainButton, MainButton, new Vector2(120 - 15 * 2, 85 + 2 * 55));
            Insane.Tag = "Insane";
            Insane.OnClick += Easy_OnClick;
            Insane.Text = LocalizationData.DifficultyHard;
            Insane.UseSound = true;
            Insane.HoverColor = new Color(50, 238, 50);
            Insane.Sound = MenuItemSelected.CreateInstance();
            Insane.Font = Font;
            Insane.NextMenu = "Campaing";
            Insane.Depth = 0.9f;
            Insane.Origin = new Vector2(0, MainButton.Instance.Height - 7);
            Insane.TextPosition = new Vector2(15, -47);

            HybridButton DiffBack = new HybridButton(MainButton, MainButton, new Vector2(120 - 15 * 3, 85 + 3 * 55));
            DiffBack.Text = LocalizationData.Back;
            DiffBack.Font = Font;
            DiffBack.HoverColor = new Color(50, 238, 50);
            DiffBack.UseSound = true;
            DiffBack.Sound = MenuItemSelected.CreateInstance();
            DiffBack.NextMenu = "%Back%";
            DiffBack.Depth = 0.9f;
            DiffBack.Origin = new Vector2(0, MainButton.Instance.Height - 7);
            DiffBack.TextPosition = new Vector2(15, -47);
            DifficultySelection.Controls.Add(new AdControl(adManager) { Position = new Vector2(417, 411), Scale = 1, Depth = 0 });
            //DifficultySelection.Controls.Add(Easy);
            DifficultySelection.Controls.Add(Medium);
            DifficultySelection.Controls.Add(Hard);
            DifficultySelection.Controls.Add(Insane);
            DifficultySelection.Controls.Add(DiffBack);
            DifficultySelection.Controls.Add(new Image() { Texture = MainOverlay, Position = Vector2.Zero, Depth = 0.5f });

            PauseManager = new MenuManager();
            PauseManager.ExitOnBack = false;
            PauseManager.Enabled = false;
            Menu PauseMenu = new Menu(MainAnimatorIn, MainAnimatorOut, BuildMessageBox());
            PauseManager.Menues.Add("Pause", PauseMenu);
            PauseManager.SetMenu("Pause");
            HybridButton Continue = new HybridButton(MainButton, MainButton, new Vector2(120 - 15 * 0, 85 + 0 * 55));
            Continue.UseSound = true;
            Continue.Sound = MenuItemSelected.CreateInstance();
            Continue.OnClick += new EventHandler(Continue_OnClick);
            Continue.Text = LocalizationData.Continue;
            Continue.Font = Font;
            Continue.HoverColor = new Color(50, 238, 50);
            Continue.Depth = 0.6f;
            Continue.Origin = new Vector2(0, MainButton.Instance.Height - 7);
            Continue.TextPosition = new Vector2(15, -47);
            PauseMenu.Controls.Add(new AdControl(adManager) { Position = new Vector2(417, 411), Scale = 1, Depth = 0 });

            HybridButton ChangeDifficulty = new HybridButton(MainButton, MainButton, new Vector2(120 - 15 * 1, 85 + 1 * 55));
            ChangeDifficulty.UseSound = true;
            ChangeDifficulty.HoverColor = new Color(50, 238, 50);
            ChangeDifficulty.Sound = MenuItemSelected.CreateInstance();
            ChangeDifficulty.Text = LocalizationData.Difficulty;
            ChangeDifficulty.Font = Font;
            ChangeDifficulty.Depth = 0.6f;
            ChangeDifficulty.Origin = new Vector2(0, MainButton.Instance.Height - 7);
            ChangeDifficulty.TextPosition = new Vector2(15, -47);
            ChangeDifficulty.NextMenu = "Difficulty";

            HybridButton Exit = new HybridButton(MainButton, MainButton, new Vector2(120 - 15 * 2, 85 + 2 * 55));
            Exit.OnClick += new EventHandler(Exit_OnClick);
            Exit.HoverColor = new Color(50, 238, 50);
            Exit.UseSound = true;
            Exit.Sound = MenuItemSelected.CreateInstance();
            Exit.Text = LocalizationData.Exit;
            Exit.Font = Font;
            Exit.Depth = 0.6f;
            Exit.Origin = new Vector2(0, MainButton.Instance.Height - 7);
            Exit.TextPosition = new Vector2(15, -47);
            PauseMenu.Controls.Add(Continue);
            PauseMenu.Controls.Add(Exit);
            PauseMenu.Controls.Add(ChangeDifficulty);
            PauseMenu.Controls.Add(new Image() { Texture = MainOverlay, Position = Vector2.Zero, Depth = 0.5f });

            Menu PauseMenuDifficulty = new Menu(MainAnimatorIn, MainAnimatorOut, BuildMessageBox());
            PauseManager.Menues.Add("Difficulty",PauseMenuDifficulty);
            /*
            HybridButton PauseMenuDifficultyEasy = new HybridButton(MainButton, MainButton, new Vector2(120 - 15 * 0, 85 + 0 * 55));
            PauseMenuDifficultyEasy.Tag = "Easy";
            PauseMenuDifficultyEasy.OnClick += new EventHandler(PauseMenuDifficultyEasy_OnClick);
            PauseMenuDifficultyEasy.Text = LocalizationData.DifficultyEasy;
            PauseMenuDifficultyEasy.Font = Font;
            PauseMenuDifficultyEasy.UseSound = true;
            PauseMenuDifficultyEasy.Sound = MenuItemSelected.CreateInstance();
            PauseMenuDifficultyEasy.Depth = 0.9f;
            PauseMenuDifficultyEasy.NextMenu = "%Back%";
            PauseMenuDifficultyEasy.Origin = new Vector2(0, MainButton.Instance.Height - 7);
            PauseMenuDifficultyEasy.TextPosition = new Vector2(15, -47);
            */

            HybridButton PauseMenuDifficultyMedium = new HybridButton(MainButton, MainButton, new Vector2(120 - 15 * 0, 85 + 0 * 55));
            PauseMenuDifficultyMedium.Tag = "Medium";
            PauseMenuDifficultyMedium.HoverColor = new Color(50, 238, 50);
            PauseMenuDifficultyMedium.OnClick += new EventHandler(PauseMenuDifficultyEasy_OnClick);
            PauseMenuDifficultyMedium.UseSound = true;
            PauseMenuDifficultyMedium.Sound = MenuItemSelected.CreateInstance();
            PauseMenuDifficultyMedium.Text = LocalizationData.DifficultyEasy;
            PauseMenuDifficultyMedium.NextMenu = "%Back%";
            PauseMenuDifficultyMedium.Font = Font;
            PauseMenuDifficultyMedium.Depth = 0.9f;
            PauseMenuDifficultyMedium.Origin = new Vector2(0, MainButton.Instance.Height - 7);
            PauseMenuDifficultyMedium.TextPosition = new Vector2(15, -47);

            HybridButton PauseMenuDifficultyHard = new HybridButton(MainButton, MainButton, new Vector2(120 - 15 * 1, 85 + 1 * 55));
            PauseMenuDifficultyHard.Tag = "Hard";
            PauseMenuDifficultyHard.HoverColor = new Color(50, 238, 50);
            PauseMenuDifficultyHard.OnClick += new EventHandler(PauseMenuDifficultyEasy_OnClick);
            PauseMenuDifficultyHard.UseSound = true;
            PauseMenuDifficultyHard.Sound = MenuItemSelected.CreateInstance();
            PauseMenuDifficultyHard.Text = LocalizationData.DifficultyMedium;
            PauseMenuDifficultyHard.Font = Font;
            PauseMenuDifficultyHard.NextMenu = "%Back%";
            PauseMenuDifficultyHard.Depth = 0.9f;
            PauseMenuDifficultyHard.Origin = new Vector2(0, MainButton.Instance.Height - 7);
            PauseMenuDifficultyHard.TextPosition = new Vector2(15, -47);

            HybridButton PauseMenuDifficultyInsane = new HybridButton(MainButton, MainButton, new Vector2(120 - 15 * 2, 85 + 2 * 55));
            PauseMenuDifficultyInsane.Tag = "Insane";
            PauseMenuDifficultyInsane.HoverColor = new Color(50, 238, 50);
            PauseMenuDifficultyInsane.OnClick += new EventHandler(PauseMenuDifficultyEasy_OnClick);
            PauseMenuDifficultyInsane.Text = LocalizationData.DifficultyHard;
            PauseMenuDifficultyInsane.UseSound = true;
            PauseMenuDifficultyInsane.Sound = MenuItemSelected.CreateInstance();
            PauseMenuDifficultyInsane.Font = Font;
            PauseMenuDifficultyInsane.NextMenu = "%Back%";
            PauseMenuDifficultyInsane.Depth = 0.9f;
            PauseMenuDifficultyInsane.Origin = new Vector2(0, MainButton.Instance.Height - 7);
            PauseMenuDifficultyInsane.TextPosition = new Vector2(15, -47);

            HybridButton PauseMenuDifficultyDiffBack = new HybridButton(MainButton, MainButton, new Vector2(120 - 15 * 3, 85 + 3 * 55));
            PauseMenuDifficultyDiffBack.Text = LocalizationData.Back;
            PauseMenuDifficultyDiffBack.Font = Font;
            PauseMenuDifficultyDiffBack.HoverColor = new Color(50, 238, 50);
            PauseMenuDifficultyDiffBack.UseSound = true;
            PauseMenuDifficultyDiffBack.Sound = MenuItemSelected.CreateInstance();
            PauseMenuDifficultyDiffBack.NextMenu = "%Back%";
            PauseMenuDifficultyDiffBack.Depth = 0.9f;
            PauseMenuDifficultyDiffBack.Origin = new Vector2(0, MainButton.Instance.Height - 7);
            PauseMenuDifficultyDiffBack.TextPosition = new Vector2(15, -47);
            PauseMenuDifficulty.Controls.Add(new AdControl(adManager) { Position = new Vector2(417, 411), Scale = 1, Depth = 0 });
            //PauseMenuDifficulty.Controls.Add(PauseMenuDifficultyEasy);
            PauseMenuDifficulty.Controls.Add(PauseMenuDifficultyMedium);
            PauseMenuDifficulty.Controls.Add(PauseMenuDifficultyHard);
            PauseMenuDifficulty.Controls.Add(PauseMenuDifficultyInsane);
            PauseMenuDifficulty.Controls.Add(PauseMenuDifficultyDiffBack);
            PauseMenuDifficulty.Controls.Add(new Image() { Texture = MainOverlay, Position = Vector2.Zero, Depth = 0.5f });

            Manager.SetMenu("Main");
            Manager.Enabled = true;

            PopupMB = new MessageBox("", 700, 300, Font, RCS.GetObject<Texture2D>("Corner"), RCS.GetObject<Texture2D>("Border"), RCS.GetObject<Texture2D>("BackgroundPattern"));
            PopupMB.Depth = 0.01f;
            PopupMB.OnClosed += new Action(PopupMB_OnClosed);
            PopupMB.Origin = new Vector2(350, 150);
            PopupMB.Position = new Vector2(400, 240);
            PopupTextManager = new TextManager();
            PopupTextManager.Settings = PopupTextSettings = new TextManagerSettings();
            PopupTextSettings.Depth = 0;
            PopupTextSettings.Font = Font;
            PopupTextSettings.Origin = new Vector2(400, 240);
            PopupTextManager.Settings.Offset = new Vector2(100 - 34, 105);
            PopupTextSettings.Width = 700 - 28;

            textSettings.Depth = 0.49f;
            IInputService input = Atom.Shared.Globals.Engine.GetService(typeof(IInputService)) as IInputService;
            MainMenuContract = input.CreateContract();
            MainMenuContract.SubscribedTouchEvents = TouchStates.OnDrag | TouchStates.OnDoubleTap | TouchStates.OnTap | TouchStates.OnFlick;
            MainMenuContract.TouchEventHandler += new EventHandler<TouchEventArgs>(contract_TouchEventHandler);
            SinglePlayerContract = input.CreateContract();
            SinglePlayerContract.Enabled = false;
            SinglePlayerContract.SubscribedTouchEvents = TouchStates.OnDrag | TouchStates.OnTap | TouchStates.OnDoubleTap | TouchStates.OnPinch | TouchStates.OnFlick;
            SinglePlayerContract.TouchEventHandler += new EventHandler<TouchEventArgs>(SinglePlayerContract_TouchEventHandler);

            Manager.OnEndMenuChange += new EventHandler<MenuChangeEventArgs>(Manager_OnEndMenuChange);
            Manager.OnBeginMenuChange += new EventHandler<MenuChangeEventArgs>(Manager_OnBeginMenuChange);
            Background = RCS.GetObject<Texture2D>("Menues/11v");
            foreach (KeyValuePair<string, Menu> menu in Manager.Menues)
            {
                menu.Value.InitializeControls();
            }
        }
Esempio n. 5
0
 internal static MessageBox BuildMessageBox(Vector2 dimensions)
 {
     IResourceCacheService RCS = Globals.Engine.GetService<IResourceCacheService>();
     MessageBox MessageBox = new MessageBox("", (int)dimensions.X, (int)dimensions.Y, Font, RCS.GetObject<Texture2D>("Corner"), RCS.GetObject<Texture2D>("Border"), RCS.GetObject<Texture2D>("BackgroundPattern"));
     MessageBox.Depth = 0.1f;
     MessageBox.Origin = new Vector2(dimensions.X/2, dimensions.Y/2);
     MessageBox.Position = new Vector2(400, 240);
     return MessageBox;
 }