コード例 #1
0
 public TextManager(string text, TextManagerSettings settings)
 {
     this.Settings = settings;
     this.Text = text;
 }
コード例 #2
0
ファイル: GameBase.cs プロジェクト: Nessphoro/VelesConflict
        /// <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
 public TextManager()
 {
     Settings = new TextManagerSettings();
 }