Exemple #1
0
        public void Load(Game1 game)
        {
            Mult = new Vector2(game.resolutionx, game.resolutiony) / new Vector2(1320, 840);

            Input.Load(game);



            AllMenus[0]  = new InGameMenu();
            AllMenus[1]  = new StartMenu();
            AllMenus[2]  = new MainMenu();
            AllMenus[3]  = new GameModeMenu();
            AllMenus[4]  = new ScoreMenu();
            AllMenus[5]  = new PlayMenu();
            AllMenus[6]  = new SignInPickerMenu();
            AllMenus[7]  = new GameSettingsMenu();
            AllMenus[8]  = new MapMenu();
            AllMenus[9]  = new NetworkSessionMenu();
            AllMenus[10] = new OnlineMenu();
            AllMenus[11] = new ErrorMessage();
            AllMenus[12] = new HowToMenu();
            AllMenus[13] = new SplashMenu();
            AllMenus[14] = new OptionsMenu();

            MenuCurrent = AllMenus[1];
            MenuTarget  = AllMenus[1];

            foreach (BasicMenuObject menu in AllMenus)
            {
                menu.Load(game);
            }
        }
Exemple #2
0
        public void GoToHighest()
        {
            IsFadingIn  = true;
            IsFadingOut = false;
            UseFade     = false;

            bool found = false;

            for (int i = 0; i <= MaxTiers; i++)
            {
                if (!found)
                {
                    foreach (BasicMenuObject menu in AllMenus)
                    {
                        if (!found)
                        {
                            if (menu.MenuAlpha == 1)
                            {
                                if (menu != MenuCurrent)
                                {
                                    if (menu.Tier == i)
                                    {
                                        found      = true;
                                        MenuTarget = menu;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        public override void Draw(Game1 game, BasicMenuObject host, Vector2 CurrentDrawPos, Vector2 Mult)
        {
            Vector4 vec = new Vector4(0.3f, 0.3f, 0.6f, 1) * Alpha;

            Color DrawColor = new Color(vec);



            string    Text    = Name;
            Rectangle HUDRECT = new Rectangle();

            HUDRECT.Height = (int)((game.Loader.font.MeasureString(Text).Y + 20) * Mult.Y);
            HUDRECT.Width  = (int)((game.Loader.font.MeasureString(Text).X + 10) * Mult.X);
            HUDRECT.Y      = (int)((CurrentDrawPos.Y - 10) * Mult.Y);
            HUDRECT.X      = (int)((CurrentDrawPos.X - 5) * Mult.X);
            game.spriteBatch.Draw(game.Loader.Temp, HUDRECT, DrawColor);

            if (IsArrows)
            {
                HUDRECT.Width = (int)((game.Loader.font.MeasureString(Text).Y + 10) * Mult.Y);
                HUDRECT.Y     = (int)((CurrentDrawPos.Y - 10) * Mult.Y);
                HUDRECT.X     = (int)((CurrentDrawPos.X - 5) * Mult.X - ((game.Loader.font.MeasureString(Text).Y + 10) * 1f * Mult.Y));
                game.spriteBatch.Draw(game.Loader.MenuArrow, HUDRECT, DrawColor);

                HUDRECT.X = (int)((CurrentDrawPos.X - 5) * Mult.X + ((game.Loader.font.MeasureString(Text).X + 10) * Mult.X));
                game.spriteBatch.Draw(game.Loader.MenuArrow, HUDRECT, null, DrawColor, 0, Vector2.Zero, SpriteEffects.FlipHorizontally, 0);
            }

            Text = Name;

            //game.spriteBatch.DrawString(game.Loader.font, Text, CurrentDrawPos+new Vector2(2), Color.Black);
            game.spriteBatch.DrawString(game.Loader.font, Text, CurrentDrawPos * Mult, Color.White, 0, Vector2.Zero, Mult, SpriteEffects.None, 0);

            // CurrentDrawPos += host.DrawSeperation;
        }
Exemple #4
0
 public void GoTo(string Target, bool usefade)
 {
     foreach (BasicMenuObject menu in AllMenus)
     {
         if (menu.MyType == Target)
         {
             OldMenu     = MenuCurrent.MyType;
             UseFade     = usefade;
             IsFadingOut = true;
             IsFadingIn  = false;
             MenuTarget  = menu;
         }
     }
 }
        //public float DrawVal = 0;

        public void Update(Game1 game, int InputX, int InputY, BasicMenuObject Host)
        {
            // DrawVal = InputY;
            if (Y == InputY)
            {
                Alpha += 0.05f;
            }
            else
            {
                Alpha -= 0.05f;
            }

            //if (Alpha > 1)
            //    Alpha = 1;
            //if (Alpha < 0)
            //    Alpha = 0;


            Alpha = MathHelper.Clamp(Alpha, 0, 1);
        }
 public abstract void Draw(Game1 game, BasicMenuObject host, Vector2 CurrentDrawPos, Vector2 Mult);
Exemple #7
0
        public void Update(Game1 game)
        {
            AlphaTextAlpha -= 0.15f;

            if (!IsInGame && MenuCurrent != AllMenus[1] && MenuCurrent != AllMenus[13])
            {
                if (!game.IsInMenu)
                {
                    game.EndGame();
                    game.NewScreen();
                }

                HandleInput(game);
                HandleSignIn(game);
            }
            else if (MenuCurrent == AllMenus[1] || MenuCurrent == AllMenus[13])
            {
                CloseTimer++;
                if (CloseTimer > 200)
                {
                    CloseTimer = 0;
                    if (MenuCurrent == AllMenus[13])
                    {
                        GoTo("Main", true);
                    }
                    else
                    {
                        GoTo("Splash", true);
                    }
                }
            }

            if (MenuCurrent != null)
            {
            }
            if (MenuCurrent != null)
            {
                MenuCurrent.Update(game);
            }

            foreach (BasicMenuObject menu in AllMenus)
            {
                float ChangeAmount = 0.1f;

                // if (MenuCurrent == AllMenus[1])
                //   ChangeAmount = 10f;
                if (MenuCurrent == AllMenus[1] && MenuCurrent != MenuTarget)
                {
                    ChangeAmount = 0.01f;
                }
                if (MenuCurrent == AllMenus[13] && MenuCurrent != MenuTarget)
                {
                    ChangeAmount = 0.01f;
                }

                if (menu == MenuCurrent && menu == MenuTarget)
                {
                    menu.MenuAlpha += ChangeAmount;
                }
                else
                {
                    if (MenuCurrent.Tier <= menu.Tier && menu != MenuCurrent || MenuTarget.Tier <= menu.Tier && menu != MenuTarget)
                    {
                        menu.MenuAlpha -= ChangeAmount;
                    }
                }
                menu.MenuAlpha = MathHelper.Clamp(menu.MenuAlpha, 0, 1);


                if (menu == MenuCurrent)
                {
                    MenuCurrent.ControlLines(game);
                }
            }

            int reps = 1;

            if (!UseFade)
            {
                reps = 4;
            }
            for (int i = 0; i < reps; i++)
            {
                if (IsFadingIn)
                {
                    PageFade -= 0.025f;
                    if (PageFade < 0)
                    {
                        IsFadingIn = false;
                        PageFade   = 0;
                    }
                }
                if (IsFadingOut)
                {
                    IsFadingIn = false;
                    PageFade  += 0.025f;
                    if (PageFade > 1)
                    {
                        GoToNewMenu(game);

                        MenuCurrent = MenuTarget;
                        if (MenuCurrent.MyType != "InGame")
                        {
                            IsInGame = false;
                        }
                        else
                        {
                            IsInGame = true;
                        }
                        BeginNewMenu(game);
                        MenuCurrent.GoToMenu(game);
                        IsFadingOut = false;
                        IsFadingIn  = true;

                        PageFade = 1;
                    }
                }
            }
        }
Exemple #8
0
        public override void Draw(Game1 game, BasicMenuObject host, Vector2 CurrentDrawPos, Vector2 Mult)
        {
            //Alpha = 1;
            //MyScore.Name = "test";

            Vector4 vec       = new Vector4(0.3f, 0.3f, 0.6f, 1);
            Color   DrawColor = Color.White;


            string[] text = new string[6];
            if (game.gamemode != Game1.GameMode.KeepAway)
            {
                if (!Base)
                {
                    text[0] = MyScore.Name;
                    text[1] = MyScore.Kills.ToString();
                    text[2] = MyScore.Deaths.ToString();
                    text[3] = MyScore.Suicides.ToString();

                    if (game.gamemode == Game1.GameMode.DeathMatch || game.gamemode == Game1.GameMode.TeamDeathMatch)
                    {
                        text[4] = MyScore.GunUpgrades.ToString();
                        text[5] = MyScore.AbilityUpgrades.ToString();
                    }
                    else
                    {
                        text[4] = null;
                        text[5] = null;
                    }

                    DrawColor = new Color(MyScore.ColorVec);
                }
                else
                {
                    text[0] = "Player";
                    text[1] = "Kills";
                    text[2] = "Deaths";
                    text[3] = "Suicides";

                    if (game.gamemode == Game1.GameMode.DeathMatch || game.gamemode == Game1.GameMode.TeamDeathMatch)
                    {
                        text[4] = "Gun Upgrades";
                        text[5] = "Ability Upgrades";
                    }
                    else
                    {
                        text[4] = null;
                        text[5] = null;
                    }
                }
            }
            else
            {
                if (!Base)
                {
                    text[0] = MyScore.Name;
                    text[1] = MyScore.FlagScore.ToString();
                    text[2] = MyScore.Kills.ToString();
                    text[3] = MyScore.Deaths.ToString();
                    text[4] = MyScore.Suicides.ToString();
                    text[5] = null;

                    DrawColor = new Color(MyScore.ColorVec);
                }
                else
                {
                    text[0] = "Player";
                    text[1] = "Flag Score";
                    text[2] = "Kills";
                    text[3] = "Deaths";
                    text[4] = "Suicides";
                    text[5] = null;
                }
            }

            Rectangle HUDRECT = new Rectangle();


            HUDRECT.Height = (int)((game.Loader.font.MeasureString("Test").Y + 20) * Mult.Y);
            HUDRECT.Width  = (int)(10000 * Mult.X);
            HUDRECT.Y      = (int)((CurrentDrawPos.Y - 10) * Mult.Y);
            HUDRECT.X      = (int)(-2500 * Mult.X);
            game.spriteBatch.Draw(game.Loader.MenuWindow, HUDRECT, DrawColor);

            foreach (string Text in text)
            {
                if (Text != null)
                {
                    CurrentDrawPos.X += -game.Loader.font.MeasureString(Text).X / 2;



                    //Text = "test";
                    //game.spriteBatch.DrawString(game.Loader.font, Text, CurrentDrawPos+new Vector2(2,2), Color.Black);
                    game.spriteBatch.DrawString(game.Loader.font, Text, CurrentDrawPos * Mult, Color.White, 0, Vector2.Zero, Mult, SpriteEffects.None, 0);

                    CurrentDrawPos.X += game.Loader.font.MeasureString(Text).X / 2;

                    CurrentDrawPos.X += 200;
                }
            }
            // CurrentDrawPos += host.DrawSeperation;
        }