예제 #1
0
        public EpilogueMenu()
        {
            IResourceCacheService RCS = Globals.Engine.GetService<IResourceCacheService>();
            IAnimator<Vector2> Empty = new SmoothVectorAnimator();
            Empty.AtStart = Vector2.Zero;
            Empty.AtEnd = Vector2.Zero;
            Empty.Duration = 0;

            InVectorAnimator = Empty;
            OutVectorAnimator = Empty;
            Controls.Add(new Image() { Texture = RCS.GetObject<Texture2D>("Menues/Base/Base"), Position = Vector2.Zero, Depth = 0.48f });
            Controls.Add(new Image() { Texture = RCS.GetObject<Texture2D>("Menues/Base/bg_ext"), Position = new Vector2(0, 0), Depth = 0.6f });
            Controls.Add(new AdControl(GameBase.adManager) { Position = new Vector2(252, 415), Scale = 1, Depth = 0 });
            HybridButton RightBase = new HybridButton(RCS.GetObject<Texture2D>("Menues/RightButton"), RCS.GetObject<Texture2D>("Menues/RightButton"), new Vector2(757, 444));
            RightBase.Origin = new Vector2(172, 62);
            RightBase.CanOffset = false;
            RightBase.Depth = 0.01f;
            RightBase.NextMenu = "Campaing";
            RightBase.Font = GameBase.Font;
            RightBase.TextPosition = -RightBase.Origin + new Vector2(60, 23);
            RightBase.Text = LocalizationData.Select;
            Controls.Add(RightBase);
            textManager = new TextManager();
            textManager.Settings.Width = 670;
            textManager.Settings.Offset = new Vector2(67, 54);
            textManager.Settings.Font = GameBase.Font;
            textManager.Settings.Depth = 0.49f;
            NotReturnable = true;
            InitializeControls();
        }
예제 #2
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();
            }
        }
예제 #3
0
        void Manager_OnBeginMenuChange(object sender, MenuChangeEventArgs e)
        {
            offsetVelocity = Vector2.Zero;
            if (e.Menu == Manager.Menues["Campaing"])
            {
                selectedEpisode = selectedCampaing.Episodes[0];
                selectedMission = selectedEpisode.Missions[0];
                TutorialMode = selectedCampaing.InternalName == "Tutorial";
                TutorialProgress = 0;
                textManager.Text = selectedCampaing.Name + "\n\n\n" + selectedCampaing.ShortDescription;
                textManager.Parse();

                RCS.PreCache<Texture2D>("Menues/Strategic/Strategy");
                RCS.PreCache<Texture2D>("Menues/Strategic/06");
                RCS.PreCache<Texture2D>("Menues/Strategic/Hex2");
                RCS.PreCache<Texture2D>("Menues/Strategic/Screen");
                RCS.PreCache<Texture2D>("Menues/Strategic/science_screen");

                for (int i = 1; i <= 4; i++)
                {
                    //Load science
                    for (int j = 1; j <= 6; j++)
                    {
                        RCS.PreCache<Texture2D>(string.Format("Science/{0}_{1}", i, j));
                    }
                }
                RCS.PreCache<Texture2D>("Menues/Strategic/selection_tactical");
                textSettings.Width = 310;
                textSettings.Offset = new Vector2(425, 60);
                textManager.Text = selectedCampaing.Name + "\n\n\n" + selectedCampaing.ShortDescription;
                textManager.Parse();
                RCS.PreCache<Texture2D>("Menues/Strategic/06");
                if (SSL == null)
                {
                    SSL = new SpriteSheetLoader();

                    ScienceAnimator.AtStart = new Vector2(462, 8);
                    ScienceAnimator.AtEnd = new Vector2(25, 319);
                    ScienceAnimator.Duration = 1000;

                    ScienceAnimatorReversed.AtEnd = new Vector2(462, 8);
                    ScienceAnimatorReversed.AtStart = new Vector2(25, 319);
                    ScienceAnimatorReversed.Duration = 1000;

                    IAnimator<Vector2> Empty = new SmoothVectorAnimator();
                    Empty.AtStart = Vector2.Zero;
                    Empty.AtEnd = Vector2.Zero;
                    Empty.Duration = 0;
                    IResourceObject<Texture2D> BaseOverlay = RCS.GetObject<Texture2D>("Menues/Base/Base");
                    Menu Three = new Menu(Empty, Empty, BuildMessageBox());
                    Three.OnDraw += CampaignDescriptionOnDraw;
                    Manager.Menues.Add("Base", Three);
                    Three.Controls.Add(new Image() { Texture = BaseOverlay, Position = Vector2.Zero, Depth = 0.48f });
                    Three.Controls.Add(new Image() { Texture = RCS.GetObject<Texture2D>("Menues/Base/bg_ext"), Position = new Vector2(0, 0), Depth = 0.6f });
                    Three.Controls.Add(new AdControl(adManager) { Position = new Vector2(252, 415), Scale = 1, Depth = 0 });
                    HybridButton LeftBase = new HybridButton(RCS.GetObject<Texture2D>("Menues/LeftButton"), RCS.GetObject<Texture2D>("Menues/LeftButton"), new Vector2(43, 444));
                    LeftBase.Origin = new Vector2(0, 62);
                    LeftBase.NextMenu = "%Back%";
                    LeftBase.CanOffset = false;
                    LeftBase.Depth = 0.01f;
                    LeftBase.Font = Font;
                    LeftBase.HoverColor = new Color(50, 238, 50);
                    LeftBase.UseSound = true;
                    LeftBase.Sound = MenuItemSelected.CreateInstance();
                    LeftBase.TextPosition = -LeftBase.Origin + new Vector2(50, 23);
                    LeftBase.Text = LocalizationData.Back;
                    HybridButton RightBase = new HybridButton(RCS.GetObject<Texture2D>("Menues/RightButton"), RCS.GetObject<Texture2D>("Menues/RightButton"), new Vector2(757, 444));
                    RightBase.Origin = new Vector2(172, 62);
                    RightBase.CanOffset = false;
                    RightBase.Depth = 0.01f;
                    RightBase.HoverColor = new Color(50, 238, 50);
                    RightBase.UseSound = true;
                    RightBase.Sound = MenuItemSelected.CreateInstance();
                    RightBase.NextMenu = "Strategic";
                    RightBase.Font = Font;
                    RightBase.TextPosition = -RightBase.Origin + new Vector2(60, 23);
                    RightBase.Text = LocalizationData.Select;
                    Three.Controls.Add(LeftBase);
                    Three.Controls.Add(RightBase);

                    EpilogueMenu eMenu = new EpilogueMenu();
                    Manager.Menues.Add("Epilogue", eMenu);

                }

            }
            else if (e.Menu == Manager.Menues["Strategic"])
            {
                if (TutorialMode)
                {
                    if (TutorialProgress == 0)
                    {
                        e.Menu.MessageBox.Text = LocalizationData.Tutorial0;
                        e.Menu.MessageBox.Show(true);
                        e.Menu.MessageBox.OnClosed += new Action(MessageBox_OnClosed);
                        TutorialProgress++;
                    }
                }
                if (GalaxyImage == null)
                    GalaxyImage = new Image() { Texture = RCS.GetObject<Texture2D>("Menues/Strategic/06"), CanOffset = true, Depth = 0.9f };

                ScienceDNA = RCS.GetObject<Texture2D>("Menues/Strategic/science_screen");
                textManager.Settings.Width = 200;
                textManager.Settings.Offset = new Vector2(545, 50);
                textManager.Text = "";
                textManager.Parse();

                e.Menu.Controls.Clear();
                e.Menu.Controls.Add(new AdControl(adManager) { Position = new Vector2(252, 415), Scale = 1, Depth = 0 });
                HybridButton LeftStrategic = new HybridButton(RCS.GetObject<Texture2D>("Menues/LeftButton"), RCS.GetObject<Texture2D>("Menues/LeftButton"), new Vector2(43, 444));
                LeftStrategic.Origin = new Vector2(0, 62);
                LeftStrategic.NextMenu = "%Back%";
                LeftStrategic.UseSound = true;
                LeftStrategic.HoverColor = new Color(50, 238, 50);
                LeftStrategic.Sound = MenuItemSelected.CreateInstance();
                LeftStrategic.CanOffset = false;
                LeftStrategic.Depth = 0.01f;
                LeftStrategic.Font = Font;
                LeftStrategic.TextPosition = -LeftStrategic.Origin + new Vector2(50, 23);
                LeftStrategic.Text = LocalizationData.Back;
                HybridButton RightStrategic = new HybridButton(RCS.GetObject<Texture2D>("Menues/RightButton"), RCS.GetObject<Texture2D>("Menues/RightButton"), new Vector2(757, 444));
                RightStrategic.Origin = new Vector2(172, 62);
                RightStrategic.NextMenu = "Mission";
                RightStrategic.CanOffset = false;
                RightStrategic.UseSound = true;
                RightStrategic.HoverColor = new Color(50, 238, 50);
                RightStrategic.Sound = MenuItemSelected.CreateInstance();
                RightStrategic.Depth = 0.01f;
                RightStrategic.Font = Font;
                RightStrategic.TextPosition = -RightStrategic.Origin + new Vector2(60, 23);
                RightStrategic.Text = LocalizationData.Select;

                e.Menu.Controls.Add(new Image() { Texture = RCS.GetObject<Texture2D>("Menues/Strategic/Strategy"), Position = Vector2.Zero, Depth = 0.1f });
                e.Menu.Controls.Add(new Image() { Texture = RCS.GetObject<Texture2D>("Menues/Strategic/Screen"), Position = Vector2.Zero, Depth = 0.7f });
                e.Menu.Controls.Add(GalaxyImage);
                e.Menu.Controls.Add(LeftStrategic);
                e.Menu.Controls.Add(RightStrategic);

                int TextureNumber = playerData.Research["Growth"] + 1;
                if (TextureNumber >= 6)
                {
                    TextureNumber = 6;
                }
                TexturedButton Science1 = new TexturedButton(RCS.GetObject<Texture2D>(string.Format("Science/1_{0}", TextureNumber)), RCS.GetObject<Texture2D>(string.Format("Science/1_{0}", TextureNumber)), new Vector2(100, 10) - new Vector2(37, 319));
                TextureNumber = playerData.Research["Speed"] + 1;
                if (TextureNumber >= 6)
                {
                    TextureNumber = 6;
                }
                TexturedButton Science2 = new TexturedButton(RCS.GetObject<Texture2D>(string.Format("Science/2_{0}", TextureNumber)), RCS.GetObject<Texture2D>(string.Format("Science/2_{0}", TextureNumber)), new Vector2(100 + 164, 10) - new Vector2(37, 319));
                TextureNumber = playerData.Research["Attack"] + 1;
                if (TextureNumber >= 6)
                {
                    TextureNumber = 6;
                }
                TexturedButton Science3 = new TexturedButton(RCS.GetObject<Texture2D>(string.Format("Science/3_{0}", TextureNumber)), RCS.GetObject<Texture2D>(string.Format("Science/3_{0}", TextureNumber)), new Vector2(100, 10 + 164) - new Vector2(37, 319));
                TextureNumber = playerData.Research["Defense"] + 1;
                if (TextureNumber >= 6)
                {
                    TextureNumber = 6;
                }
                TexturedButton Science4 = new TexturedButton(RCS.GetObject<Texture2D>(string.Format("Science/4_{0}", TextureNumber)), RCS.GetObject<Texture2D>(string.Format("Science/1_{0}", TextureNumber)), new Vector2(100 + 164, 10 + 164) - new Vector2(37, 319));

                Science1.Visible = Science1.Enabled = true;
                Science1.Scale = 0.640625f;
                Science2.Visible = Science2.Enabled = true;
                Science2.Scale = 0.640625f;
                Science3.Visible = Science3.Enabled = true;
                Science3.Scale = 0.640625f;
                Science4.Visible = Science4.Enabled = true;
                Science4.Scale = 0.640625f;
                Science1.Tag = "Science1";
                Science2.Tag = "Science2";
                Science3.Tag = "Science3";
                Science4.Tag = "Science4";
                Science1.OnClick += ScienceOnClick;
                Science2.OnClick += ScienceOnClick;
                Science3.OnClick += ScienceOnClick;
                Science4.OnClick += ScienceOnClick;
                Science1.UseSound = true;
                Science2.UseSound = true;
                Science3.UseSound = true;
                Science4.UseSound = true;
                Science1.Sound = MenuItemSelected.CreateInstance();
                Science2.Sound = MenuItemSelected.CreateInstance();
                Science3.Sound = MenuItemSelected.CreateInstance();
                Science4.Sound = MenuItemSelected.CreateInstance();
                e.Menu.Controls.Add(Science1);
                e.Menu.Controls.Add(Science2);
                e.Menu.Controls.Add(Science3);
                e.Menu.Controls.Add(Science4);
                int tC = 4;
                Control[] controls = (from c in e.Menu.Controls where CheckScienceTag(c.Tag) select c).ToArray();
                foreach (Control control in controls)
                {
                    Image image = new Image();
                    image.CanOffset = false;
                    image.Position = (control as TexturedButton).Position;
                    image.Enabled = true;
                    image.Visible = true;
                    image.Scale = 1f;
                    image.Depth = 0.72f;
                    image.Color = Color.White;
                    image.Tag = "Science" + (tC.ToString());
                    tC++;
                    image.Texture = RCS.GetObject<Texture2D>("Science/science_icon_bg");
                    e.Menu.Controls.Add(image);
                }
                EpisodeProgressCounter = 0;
                HexControl hexControl = new HexControl(RCS.GetObject<Texture2D>("Menues/Strategic/Hex2"), factory.GetHexFill(410, new Vector2(512, 512)));
                hexControl.Depth = 0.8f;
                foreach (Episode episode in selectedCampaing.Episodes)
                {
                    if (EpisodeProgressCounter < playerData.GetProgress(selectedCampaing.InternalName))
                    {
                        selectedEpisode = episode;
                        selectedMission = selectedEpisode.Missions[0];
                        hexControl[episode.Position].Color = Color.Yellow * 0.7f;
                        EpisodeProgressCounter += episode.Missions.Count;
                    }
                    else
                    {
                        hexControl[episode.Position].Color = Color.White * 0.8f;
                    }

                    if (EpisodeProgressCounter < playerData.GetProgress(selectedCampaing.InternalName))
                    {
                        hexControl[episode.Position].Color = new Color(53, 234, 28) * 0.7f;
                        foreach (int cell in episode.Cells)
                            hexControl[cell].Color = new Color(53, 234, 28) * 0.7f;
                    }
                    hexControl[episode.Position].Tag = episode;
                    hexControl[episode.Position].OnClick += new Action<Cell>(hexControl_OnClick);
                }
                textManager.Text = selectedEpisode.Name + "\n\n\n\n\n" + selectedEpisode.Description;
                textManager.Parse();
                e.Menu.Controls.Add(hexControl);
                /*
                foreach (Episode episode in selectedCampaing.Episodes)
                {
                    AnimatedButton animated = new AnimatedButton(SSL.DescriptorList["StrategicEpisodeSelection"]);
                    animated.Position = episode.Position;
                    animated.Origin = new Vector2(32, 32);
                    if (EpisodeProgressCounter < playerData.GetProgress(selectedCampaing.InternalName))
                    {
                        animated.Enabled = true;
                        EpisodeProgressCounter += episode.Missions.Count;
                    }
                    else
                    {
                        animated.Enabled = false;
                    }

                    animated.CanOffset = true;
                    animated.Depth = 0.8f;
                    animated.Color = animated.Enabled ? Color.Khaki : Color.Gray;
                    animated.Tag = episode;
                    animated.OnClick += new EventHandler(animated_OnClick);
                    e.Menu.Controls.Add(animated);

                }
                */
                EpisodeProgressCounter = 0;
                foreach (Episode ep in selectedCampaing.Episodes)
                {
                    if (ep != selectedEpisode)
                        EpisodeProgressCounter += ep.Missions.Count;
                    else
                        break;
                }

                e.Menu.InitializeControls();
            }
            else if (e.Menu == Manager.Menues["Mission"])
            {
                if (TutorialMode)
                    if (TutorialProgress == 4)
                    {
                        e.Menu.MessageBox.Text = LocalizationData.Tutorial4;
                        e.Menu.MessageBox.Show(true);
                        TutorialProgress++;
                    }
                MissionOffset = Vector2.Zero;
                textManager.Settings.Width = 200;
                textManager.Settings.Offset = new Vector2(545, 50);

                e.Menu.Controls.Clear();
                e.Menu.Controls.Add(new AdControl(adManager) { Position = new Vector2(252, 415), Scale = 1, Depth = 0 });
                HybridButton LeftMission = new HybridButton(RCS.GetObject<Texture2D>("Menues/LeftButton"), RCS.GetObject<Texture2D>("Menues/LeftButton"), new Vector2(43, 444));
                LeftMission.Origin = new Vector2(0, 62);
                LeftMission.NextMenu = "%Back%";
                LeftMission.CanOffset = false;
                LeftMission.Depth = 0.01f;
                LeftMission.HoverColor = new Color(50, 238, 50);
                LeftMission.UseSound = true;
                LeftMission.Sound = MenuItemSelected.CreateInstance();
                LeftMission.Font = Font;
                LeftMission.TextPosition = -LeftMission.Origin + new Vector2(50, 23);
                LeftMission.Text = LocalizationData.Back;
                HybridButton RightMission = new HybridButton(RCS.GetObject<Texture2D>("Menues/RightButton"), RCS.GetObject<Texture2D>("Menues/RightButton"), new Vector2(757, 444));
                RightMission.Origin = new Vector2(172, 62);
                RightMission.CanOffset = false;
                RightMission.Depth = 0.01f;
                RightMission.HoverColor = new Color(50, 238, 50);
                RightMission.Font = Font;
                RightMission.UseSound = true;
                RightMission.Sound = MenuItemSelected.CreateInstance();
                RightMission.TextPosition = -RightMission.Origin + new Vector2(60, 23);
                RightMission.Text = LocalizationData.Play;
                RightMission.OnClick += new EventHandler(RightMission_OnClick);

                e.Menu.Controls.Add(LeftMission);
                e.Menu.Controls.Add(RightMission);
                e.Menu.Controls.Add(new Image() { Texture = RCS.GetObject<Texture2D>("Menues/Strategic/Strategy"), Position = Vector2.Zero, Depth = 0.1f });
                e.Menu.Controls.Add(new Image() { Texture = RCS.GetObject<Texture2D>("Menues/Strategic/Screen"), Position = Vector2.Zero, Depth = 0.7f });
                e.Menu.Controls.Add(PopupMB);

                int Counter = EpisodeProgressCounter;
                if (EpisodeProgressCounter == playerData.GetProgress(selectedCampaing.InternalName) - 1)
                {
                    if (!String.IsNullOrWhiteSpace(selectedEpisode.EpisodePopup))
                    {
                        PopupTextManager.Text = selectedEpisode.EpisodePopup;
                        PopupTextManager.Parse();
                        PopupMB.Show(true);
                    }
                }
                foreach (Mission mission in selectedEpisode.Missions)
                {
                    Vector2 Position = Vector2.Zero;
                    if (Counter - EpisodeProgressCounter == 0 || Counter - EpisodeProgressCounter == selectedEpisode.Missions.Count - 1)
                    {
                        Position = new Vector2(150 + (Counter - EpisodeProgressCounter) * 256, 240);
                    }
                    else
                    {
                        bool Even = (Counter - EpisodeProgressCounter - 1) % 2 == 0;
                        if (Even)
                        {
                            Position = new Vector2(150 + (Counter - EpisodeProgressCounter) * 256, 140);
                        }
                        else
                        {
                            Position = new Vector2(150 + (Counter - EpisodeProgressCounter) * 256, 340);
                        }
                    }
                    Position.Y -= 30;
                    TexturedButton tb = new TexturedButton(RCS.GetObject<Texture2D>("Menues/Strategic/selection_tactical"), RCS.GetObject<Texture2D>("Menues/Strategic/selection_tactical"), Position);
                    tb.CanOffset = true;
                    tb.Scale = 0.5f;
                    tb.Origin = new Vector2(128, 128);
                    tb.Color = Counter < playerData.GetProgress(selectedCampaing.InternalName) ? Color.White : Color.Black;
                    if (tb.Color == Color.White)
                        selectedMission=mission;
                    tb.Depth = 0.8f;
                    tb.Enabled = Counter < playerData.GetProgress(selectedCampaing.InternalName) ? true : false;
                    tb.Tag = mission;
                    tb.OnClick += new EventHandler(tb_OnClick);
                    e.Menu.Controls.Add(tb);
                    Counter++;

                }
                (from control in e.Menu.Controls where control.Tag == selectedMission select control).First().Color = Color.Gray;
                textManager.Text = selectedMission.Name + "\n\n\n\n\n" + selectedMission.Description;
                textManager.Parse();
                e.Menu.InitializeControls();
            }
        }
예제 #4
0
        public MultiplayerMenu()
            : base()
        {
            RCS = Globals.Engine.GetService<IResourceCacheService>();
            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;

            InVectorAnimator = MainAnimatorIn;
            OutVectorAnimator = MainAnimatorOut;
            IResourceObject<Texture2D> MainOverlay = RCS.GetObject<Texture2D>("Menues/Main/MainOverlay");
            IResourceObject<Texture2D> MainButton = RCS.GetObject<Texture2D>("Menues/Main/button");
            RCS.PreCache<Texture2D>("Menues/Multiplayer/ProgressWheel");

            this.MessageBox = GameBase.BuildMessageBox(new Vector2(300,100));
            this.MessageBox.Parent = this;
            this.MessageBox.OnClosed += MessageBox_OnClosed;

            Controls.Add(new Image() { Texture = MainOverlay, Position = Vector2.Zero, Depth = 0.5f });
            Controls.Add(new AdControl(GameBase.adManager) { Position = new Vector2(252, 415), Scale = 1, Depth = 0 });
            {
                HybridButton tb = new HybridButton(MainButton, MainButton, new Vector2(120 - 15 * 0, 85 + 0 * 55));
                tb.Text = LocalizationData.QuickMatch;
                tb.TextPosition = new Vector2(15, -47);
                tb.OnClick += tb_OnClick;
                //tb.Sound = MenuItemSelected.CreateInstance();
                //tb.UseSound = true;
                tb.Font = GameBase.Font;
                tb.Depth = 0.9f;
                tb.HoverColor = new Color(50, 238, 50);
                tb.Origin = new Vector2(0, MainButton.Instance.Height - 7);
                //.NextMenu = LocalizationData.QuickMatch;
                Controls.Add(tb);
            }
            {
                HybridButton tb = new HybridButton(MainButton, MainButton, new Vector2(120 - 15 * 1, 85 + 1 * 55));
                tb.Text = LocalizationData.Back;
                tb.TextPosition = new Vector2(15, -47);
                //tb.Sound = MenuItemSelected.CreateInstance();
                //tb.UseSound = true;
                tb.Font = GameBase.Font;
                tb.Depth = 0.9f;
                tb.HoverColor = new Color(50, 238, 50);
                tb.Origin = new Vector2(0, MainButton.Instance.Height - 7);
                tb.OnClick += OnBack;
                tb.NextMenu = "%Back%";
                Controls.Add(tb);
            }
            progressBar = new Image();
            progressBar.Texture = RCS.GetObject<Texture2D>("Menues/Multiplayer/ProgressWheel");
            progressBar.Origin = new Vector2(25, 25);
            progressBar.Position = new Vector2(400, 230);
            progressBar.Scale = 1f;
            progressBar.Visible = false;
            progressBar.Enabled = true;

            InitializeControls();
        }