Exemplo n.º 1
0
        public PhoneMainMenuScreen()
            : base("Menu")
        {
            // Create a button to start the game
            Button playButton = new Button("PLAY");

            playButton.Tapped += playButton_Tapped;
            MenuButtons.Add(playButton);

            // Create a button to the highscore
            Button highscoreButton = new Button("Leaderboard");

            highscoreButton.Tapped += new EventHandler <EventArgs>(highscoreButton_Tapped);
            MenuButtons.Add(highscoreButton);

            // Create two buttons to toggle sound effects and music. This sample just shows one way
            // of making and using these buttons; it doesn't actually have sound effects or music
            BooleanButton musicButton = new BooleanButton("Music", true);

            musicButton.Tapped += musicButton_Tapped;
            MenuButtons.Add(musicButton);

            Button creditButton = new Button("Credits");

            creditButton.Tapped += new EventHandler <EventArgs>(creditButton_Tapped);
            MenuButtons.Add(creditButton);
        }
Exemplo n.º 2
0
        public FinishGameScreen(int score, int turns)
            : base("Complete")
        {
            Button scoreButton = new InfoButton("Score: " + score);

            MenuButtons.Add(scoreButton);

            Button turnButton = new InfoButton("Attempts: " + turns);

            MenuButtons.Add(turnButton);

            Button scoreHistoryButton = new Button("Score History");

            scoreHistoryButton.Tapped += scoreHistoryButton_Tapped;
            MenuButtons.Add(scoreHistoryButton);

            Button newGameButton = new Button("New Game");

            newGameButton.Tapped += newGameButton_Tapped;
            MenuButtons.Add(newGameButton);

            Button exitButton = new Button("Back to Menu");

            exitButton.Tapped += exitButton_Tapped;
            MenuButtons.Add(exitButton);
        }
Exemplo n.º 3
0
        public PhoneMainMenuScreen()
            : base("Clockwise")
        {
            // Create a button to start the game
            Button playButton = new Button("Play");

            playButton.Tapped += playButton_Tapped;
            MenuButtons.Add(playButton);

            // Create two buttons to toggle sound effects and music. This sample just shows one way
            // of making and using these buttons; it doesn't actually have sound effects or music

            /*
             * BooleanButton sfxButton = new BooleanButton("Sound  ", true);
             * sfxButton.Tapped += sfxButton_Tapped;
             * MenuButtons.Add(sfxButton);
             */

            // Create a button to start the game
            Button highscoreButton = new Button("Score History");

            highscoreButton.Tapped += highScore_Tapped;
            MenuButtons.Add(highscoreButton);

            // Create a button to start the game
            Button aboutButton = new Button("About");

            aboutButton.Tapped += aboutButton_Tapped;
            MenuButtons.Add(aboutButton);
        }
Exemplo n.º 4
0
        private void InitilizeLanguages()
        {
            lettre      = lang.AffectationLANG("Lettres_mini_String", langue);
            retour      = lang.AffectationLANG("Retour", langue);
            valider     = lang.AffectationLANG("BOUTON_Valider", langue);
            facile      = lang.AffectationLANG("Facile", langue);
            difficile   = lang.AffectationLANG("Difficile", langue);
            aleatoire   = lang.AffectationLANG("Aleatoire", langue);
            mots_facile = lang.AffectationLANG("mots_facile", langue);

            facile    = facile.ToUpper();
            difficile = difficile.ToUpper();

            Vector2 _size     = new Vector2(200, 60);
            Vector2 _position = new Vector2(30, 600);

            gauche_position     = new Vector2(80, 500);
            droite_position     = new Vector2(320, 500);
            position_difficulte = new Vector2(240, 200);
            position_text1      = new Vector2(30, 350);
            position_text2      = new Vector2(30, 400);

            Button Retour  = new Button(retour.ToUpper(), _size, _position, new Color(255, 65, 67), new Color(255, 3, 2), Color.White);
            Button Valider = new Button(valider.ToUpper(), _size, new Vector2(_position.X + _size.X + 20, _position.Y), new Color(106, 181, 1), new Color(126, 215, 2), Color.White);

            Retour.Tapped  += Quitter;
            Valider.Tapped += ValiderSelected;

            MenuButtons.Add(Retour);
            MenuButtons.Add(Valider);
        }
Exemplo n.º 5
0
        /// <summary>
        ///     Подготовка данных для отрисовки заголовка страницы(панели с кнопками)
        /// </summary>
        /// <returns></returns>
        protected string RenderHeader()
        {
            using (var w = new StringWriter())
            {
                var btnEdit = MenuButtons.Find(btn => btn.ID == "btnEdit");
                RemoveMenuButton(btnEdit);
                var btnSave = MenuButtons.Find(btn => btn.ID == "btnSave");
                RemoveMenuButton(btnSave);
                var btnApply = MenuButtons.Find(btn => btn.ID == "btnApply");
                RemoveMenuButton(btnApply);
                var btnReCheck = MenuButtons.Find(btn => btn.ID == "btnReCheck");
                RemoveMenuButton(btnReCheck);
                var btnRefresh = MenuButtons.Find(btn => btn.ID == "btnRefresh");
                RemoveMenuButton(btnRefresh);

                var btnMove = new Button
                {
                    ID           = "btnMove",
                    V4Page       = this,
                    Text         = Resx.GetString("Users_lblMoveEquipment"),
                    Title        = Resx.GetString("Users_lblMoveEquipment"),
                    IconJQueryUI = ButtonIconsEnum.Copy,
                    Width        = 205,
                    OnClick      = "Move();"
                };
                AddMenuButton(btnMove);

                RenderButtons(w);

                return(w.ToString());
            }
        }
Exemplo n.º 6
0
        private void LoadMenu()
        {
            var firstButton = MenuButtons.FirstOrDefault();

            foreach (var el in MenuButtons)
            {
                //el.Selected = false;
                el.MenuButtonClick += el_MenuButtonClick;
                MenuPanel.Children.Add(el.MenuButton);
                if (MenuPanel.Children.Count == 5)
                {
                    MenuPanel.Children.Add(new Border()
                    {
                        Height = 0.5, Margin = new Thickness(0, 2, 0, 2), HorizontalAlignment = HorizontalAlignment.Stretch, Background = Application.Current.FindResource("LightGrayTextForegroundColor") as Brush
                    });
                }
                ContentPanel.Children.Add(el.ContentPanel);
            }
            foreach (var el in subComponents)
            {
                el.ContentPanel.Visibility = System.Windows.Visibility.Hidden;
                el.SubComponentAction     += el_SubComponentAction;
                ContentSubPanel.Children.Add(el.ContentPanel);
            }

            ContentPanel.Children.Add(accountSettingsUserControl);

            if (firstButton != null)
            {
                el_MenuButtonClick(firstButton, null);
            }
        }
Exemplo n.º 7
0
        public PhoneMainMenuScreen()
            : base("  Planetary \n  Escape")
        {
            // Create a button to start the game
            Button playButton = new Button("Enter");

            playButton.Tapped += playButton_Tapped;
            MenuButtons.Add(playButton);

            // Create two buttons to toggle
            //  effects and music. This sample just shows one way
            // of making and using these buttons; it doesn't actually have sound effects or music
            //BooleanButton sfxButton = new BooleanButton("SoundFx", ScreenManager.GetSetting("enableSoundFx", true));
            BooleanButton sfxButton = new BooleanButton("SoundFx", true);

            sfxButton.Tapped += sfxButton_Tapped;
            MenuButtons.Add(sfxButton);

            //BooleanButton musicButton = new BooleanButton("Music", ScreenManager.GetSetting("enableMusic", true));
            BooleanButton musicButton = new BooleanButton("Music", true);

            musicButton.Tapped += musicButton_Tapped;
            MenuButtons.Add(musicButton);

            Button creditButton = new Button("Credits");

            creditButton.Tapped += creditButton_Tapped;
            MenuButtons.Add(creditButton);

            //BooleanButton vibrateButton = new BooleanButton("Vibration", true);
            //vibrateButton.Tapped += vibrateButton_Tapped;
            //MenuButtons.Add(vibrateButton);
        }
Exemplo n.º 8
0
 // Update is called once per frame
 void Update()
 {
     if (MenuButtons.gamestate == MenuButtons.GameState.Name)
     {
         foreach (char c in Input.inputString)
         {
             if (c == "\b"[0])    //\b = backspace
             {
                 if (guiText.text.Length != 0)
                 {
                     guiText.text = guiText.text.Substring(0, guiText.text.Length - 1);
                 }
                 //print(guiText.text);
             }
             else
             {
                 if (c == "\n"[0] || c == "\r"[0])    //\n = enter
                 {
                     //print("User entered his name: " + guiText.text);
                     PlayerStats.playerName = guiText.text;
                     MenuButtons.PlayGame();
                     //print(PlayerProps.name);
                 }
                 else
                 {
                     guiText.text += c;
                 }
                 //print(guiText.text);
             }
         }
     }
 }
        public PhoneMainMenuScreen()
            : base("Racing Rage")
        {
            // Create a button to start the game
            Button playButton = new Button("Play");

            playButton.Tapped += playButton_Tapped;
            MenuButtons.Add(playButton);
            playButton.Size = new Vector2(300, 100);

            BooleanButton musicButton = new BooleanButton("Music", true);

            musicButton.Tapped += musicButton_Tapped;
            MenuButtons.Add(musicButton);

            BooleanButton sfxButton = new BooleanButton("Sound", true);

            sfxButton.Tapped += sfxButton_Tapped;
            MenuButtons.Add(sfxButton);

            Button controlButton = new Button("Control: Gyro");

            controlButton.Tapped += controlButton_Tapped;
            MenuButtons.Add(controlButton);

            Button creditsButton = new Button("Credits");

            creditsButton.Tapped += creditsButton_Tapped;
            MenuButtons.Add(creditsButton);
        }
        /// <summary>
        ///     Подготовка данных для отрисовки заголовка страницы(панели с кнопками)
        /// </summary>
        /// <returns></returns>
        protected string RenderDocumentHeader()
        {
            using (var w = new StringWriter())
            {
                try
                {
                    var btnEdit = MenuButtons.Find(btn => btn.ID == "btnEdit");
                    RemoveMenuButton(btnEdit);

                    var btnSave = MenuButtons.Find(btn => btn.ID == "btnSave");
                    btnSave.Text    = Resx.GetString("cmdOK") + "&nbsp;(F2)";
                    btnSave.OnClick = "cmdasync('cmd', 'SaveAndClose');";
                    if (!((DocPage)ParentPage).DocEditable)
                    {
                        RemoveMenuButton(btnSave);
                    }

                    var btnApply = MenuButtons.Find(btn => btn.ID == "btnApply");
                    btnApply.OnClick = "cmdasync('cmd', 'SaveData');";
                    if (!((DocPage)ParentPage).DocEditable)
                    {
                        RemoveMenuButton(btnApply);
                    }

                    var btnReCheck = MenuButtons.Find(btn => btn.ID == "btnReCheck");
                    RemoveMenuButton(btnReCheck);

                    if (((DocPage)ParentPage).DocEditable && factUsl.PositionId != null && factUsl.PositionId != 0)
                    {
                        var btnClear = new Button
                        {
                            ID           = "btnDelete",
                            V4Page       = this,
                            Text         = Resx.GetString("cmdDelete"),
                            Title        = Resx.GetString("cmdDeleteTitle"),
                            IconJQueryUI = ButtonIconsEnum.Delete,
                            Width        = 105,
                            OnClick      =
                                string.Format("if(confirm('{0} {1}?')) cmdasync('cmd', 'DeleteData');",
                                              Resx.GetString("msgDeleteConfirm"), factUsl.ResourceRus)
                        };

                        AddMenuButton(btnClear);
                    }

                    RenderButtons(w);
                }
                catch (Exception e)
                {
                    var dex = new DetailedException(Resx.GetString("TTN_errFailedGenerateButtons") + ": " + e.Message,
                                                    e);
                    Logger.WriteEx(dex);
                    throw dex;
                }

                return(w.ToString());
            }
        }
Exemplo n.º 11
0
        public void EnableMenu(MenuButtons btn)
        {
            var session = Player.GetGameSession();

            if (session != null)
            {
                Packet.Builder.LegacyModule(session, "0|UI|MBA|EB|" + (int)btn);
            }
        }
Exemplo n.º 12
0
 public static void chooseTower4()
 {
     KeyboardManager.SetOthersToFalse();
     Nodes.turret4 = true;
     MenuButtons.UpdateUIStatsInfo(Tower4AvatarStatic, Tower4.Tower4Name, Tower4.Tower4LevelStat, "", Tower4.Tower4Optionally, Tower4.Tower4Stats1, "", Tower4.Tower4Stats2, "", Tower4.Tower4Stats3, "", Tower4.Tower4Stats4, "", Tower4.Tower4Stats5, "");
     MenuButtons.UIStatsEnemyEnabled = false;
     MenuButtons.UIStatsEnabled      = true;
     UIStatsTowerEnabled             = true;
 }
Exemplo n.º 13
0
        /// <summary>已重载。删除关联数据</summary>
        /// <returns></returns>
        protected override int OnDelete()
        {
            if (MenuButtons != null)
            {
                MenuButtons.Delete();
            }

            return(base.OnDelete());
        }
Exemplo n.º 14
0
 private void SetText(MenuButtons button)
 {
     if (_nextText != button)
     {
         _nextText      = button;
         _doFadeOut     = true;
         _buttonPressed = false;
     }
 }
Exemplo n.º 15
0
 void Update()
 {
     if (secretStage == true && Input.GetKey(KeyCode.H) && Input.GetKey(KeyCode.O) && Input.GetKey(KeyCode.N))
     {
         MenuButtons transScript = selected.GetComponent <MenuButtons>();
         transScript.levelName = "honey";
         FindObjectOfType <MenuButtons>().FadeToScene(1);
     }
 }
Exemplo n.º 16
0
 private void btnSettings_MouseDown(object sender, MouseButtonEventArgs e)
 {
     if (e.LeftButton == MouseButtonState.Pressed)
     {
         MenuButtons?.Invoke(this, MenuList.settings);
         resetButton();
         btnSettings.Foreground = (Brush)FindResource("PrimaryHueMidBrush");
     }
 }
Exemplo n.º 17
0
        public LostLifeMenuScreen()
            : base("You Lost a Life!")
        {
            // Create the  "Lost Life Button"

            Button tryagainButton = new Button("Try Again!");

            tryagainButton.Tapped += tryagainButton_Tapped;
            MenuButtons.Add(tryagainButton);
        }
        public EndGameScreen()
        {
            var content           = MatchGame.instance.Content;
            var menuButtonTexture = Resources.MenuButton;
            var menuButton        = new Button(menuButtonTexture, new Point((viewport.Width - menuButtonTexture.Width) / 2, 300));

            menuButton.Clicked += OkButtonClicked;
            MenuButtons.Add(menuButton);
            gameOverScreen = Resources.GameOverScreen;
        }
Exemplo n.º 19
0
 public static void chooseTower2()
 {
     KeyboardManager.SetOthersToFalse();
     Nodes.turret2 = true;
     MenuButtons.UpdateUIStatsInfo(Tower2AvatarStatic, Tower2.Tower2Name, Tower2.Tower2LevelStat, "", Tower2.Tower2Optionally, Tower2.Tower2Stats1, "", Tower2.Tower2Stats2, "", Tower2.Tower2Stats3, "", Tower2.Tower2Stats4, "", Tower2.Tower2Stats5, "");
     MenuButtons.UIStatsEnemyEnabled = false;
     MenuButtons.UIStatsEnabled      = true;
     UIStatsTowerEnabled             = true;
     PublicGameobjects.showRange     = false;
 }
Exemplo n.º 20
0
 void Awake()
 {
     Tower1Level  = GameStats.Tower1Level;
     Tower1Cost   = GameStats.Tower1Cost;
     Tower1Damage = GameStats.Tower1Damage;
     range        = GameStats.Tower1Range;
     fireRate     = GameStats.Tower1FireRate;
     UpdateInfo();
     MenuButtons.chooseTower1();
 }
Exemplo n.º 21
0
 void Awake()
 {
     Tower2Level  = GameStats.Tower2Level;
     Tower2Cost   = GameStats.Tower2Cost;
     Tower2Damage = GameStats.Tower2Damage;
     range        = GameStats.Tower2Range;
     fireRate     = GameStats.Tower2FireRate;
     UpdateInfo();
     MenuButtons.chooseTower2();
 }
Exemplo n.º 22
0
 private void Start()
 {
     menuButtons    = GameObject.FindGameObjectWithTag("InGameCanvas").GetComponent <MenuButtons>();
     gameController = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameController>();
     rate           = 0.07f;
     if (menuButtons.gameStarted)
     {
         decSize = true;
     }
 }
Exemplo n.º 23
0
 private void Start()
 {
     i = 1;
     horizontalSpeed = 300f;
     speed           = 475f;
     isInverted      = false;
     isTimeStopped   = false;
     changeProfile   = false;
     rb          = gameObject.GetComponent <Rigidbody>();
     menuButtons = GameObject.FindGameObjectWithTag("InGameCanvas").GetComponent <MenuButtons>();
 }
Exemplo n.º 24
0
 public void UpdateUIStats()
 {
     UpdateInfo();
     MenuButtons.UpdateUIStatsInfo(Tower4Avatar, Tower4Name, Tower4LevelStat, Tower4LevelStatUpgrade, Tower4Optionally, Tower4Stats1, Tower4Stats1Upgrade, Tower4Stats2, Tower4Stats2Upgrade, Tower4Stats3, Tower4Stats3Upgrade, Tower4Stats4, Tower4Stats4Upgrade, Tower4Stats5, Tower4Stats5Upgrade);
     MenuButtons.UIStatsEnemyEnabled          = false;
     MenuButtons.UIStatsEnabled               = true;
     MenuButtons.UIUpgradeAndSellButtonToggle = true;
     MenuButtons.towerToDo              = gameObject;
     PublicGameobjects.showRange        = true;
     PublicGameobjects.circleRangePos   = Tower4circleRangePos;
     PublicGameobjects.circleRangeScale = Tower4circleRangeScale;
 }
Exemplo n.º 25
0
        public MainMenuScreen()
        {
            var viewport = MatchGame.instance.spriteBatch.GraphicsDevice.Viewport;
            var width    = (viewport.Width - Resources.PlayButton.Width) / 2;
            var height   = (viewport.Height - Resources.PlayButton.Height) / 2;

            var playButton = new Button(Resources.PlayButton, new Point(width, height));

            playButton.Clicked += PlayGameMenuClicked;

            MenuButtons.Add(playButton);
        }
Exemplo n.º 26
0
 /// <summary>
 /// This binds the <paramref name="childMenu"/> menu to the <paramref name="menuItem"/> and sets the menu's parent to <paramref name="parentMenu"/>.
 /// </summary>
 /// <param name="parentMenu"></param>
 /// <param name="childMenu"></param>
 /// <param name="menuItem"></param>
 public static void BindMenuItem(Menu parentMenu, Menu childMenu, MenuItem menuItem)
 {
     AddSubmenu(parentMenu, childMenu);
     if (MenuButtons.ContainsKey(menuItem))
     {
         MenuButtons[menuItem] = childMenu;
     }
     else
     {
         MenuButtons.Add(menuItem, childMenu);
     }
 }
Exemplo n.º 27
0
        public static void DoManualPatches()
        {
            if (!Localizer.Config.CompatibleMode)
            {
                MenuButtons.Execute();
            }

            if (Localizer.Config.EnableModBrowserMirror &&
                LanguageManager.Instance.ActiveCulture == GameCulture.Chinese)
            {
                ModBrowserMirror.Execute();
            }
        }
Exemplo n.º 28
0
        private void InitilizeLanguages()
        {
            valider          = lang.AffectationLANG("BOUTON_Valider", langue);
            changer_nom      = lang.AffectationLANG("Menu_changer_nom", langue);
            lettre_max       = lang.AffectationLANG("Menu_changer_nom_lettres_max", langue);
            nom              = lang.AffectationLANG("Nom", langue);
            theme_string     = lang.AffectationLANG("Themes", langue);
            vibration_string = lang.AffectationLANG("Vibration", langue);
            voir_score       = lang.AffectationLANG("Score_String", langue);
            aide             = lang.AffectationLANG("Aide", langue);
            rate             = lang.AffectationLANG("Noter", langue);

            Button theme1;

            if (theme == "classic")
            {
                theme1 = new Button("Classic", new Vector2(align_x2, y1));
            }
            else
            {
                theme1 = new Button("Tuiles", new Vector2(align_x2, y1));
            }

            Button nom_joueur  = new Button(_nom_joueur, new Vector2(align_x2, y2));
            Button _voir_score = new Button(voir_score, new Vector2(align_x2, y4));
            Button AideBouton  = new Button(aide, new Vector2(align_x2, y5));
            Button RateBouton  = new Button(rate, new Vector2(align_x2, y6));

            BooleanButton vibrationButton = new BooleanButton(vibrate, new Vector2(align_x2, y3));

            Vector2 _size     = new Vector2(200, 60);
            Vector2 _position = new Vector2(150, 700);
            Button  Retour    = new Button(valider.ToUpper(), _size, _position, new Color(106, 181, 1), new Color(126, 215, 2), Color.White);


            theme1.Tapped          += ThemeVoid;
            nom_joueur.Tapped      += ChangerNom;
            vibrationButton.Tapped += ChangerVibrate;
            _voir_score.Tapped     += VoirScore;
            AideBouton.Tapped      += GoAide;
            RateBouton.Tapped      += Rating;
            Retour.Tapped          += Quitter;

            MenuButtons.Add(theme1);
            MenuButtons.Add(nom_joueur);
            MenuButtons.Add(vibrationButton);
            MenuButtons.Add(_voir_score);
            MenuButtons.Add(AideBouton);
            MenuButtons.Add(RateBouton);
            MenuButtons.Add(Retour);
        }
Exemplo n.º 29
0
    void Awake()
    {
        Time.timeScale = 1;

        if (!m_instance)
        {
            m_instance = this;
        }

        else
        {
            Destroy(this.gameObject);
        }
    }
Exemplo n.º 30
0
        /// <summary>
        /// Generates all of the buttons for the
        /// game over menu.
        /// </summary>
        private void MakeButtons()
        {
            var rec = new Rectangle(100, 300, 400, 100);

            for (int i = 0; i < NumberOfButtons; i++)
            {
                Button b = new Button(i, Color.Gray, rec);
                rec = new Rectangle(rec.X, rec.Y + rec.Height + 20, rec.Width, rec.Height);
                MenuButtons.Add(b);
            }

            MenuButtons[MainMenuIndex].GameState = StateManager.EGameState.MainMenu;
            MenuButtons[ExitIndex].GameState     = StateManager.EGameState.Exit;
        }
Exemplo n.º 31
0
    void PlayButtonCallback()
    {
        if (!introDone)
            return;
        pressedButton = MenuButtons.play;

        Outro();
    }
Exemplo n.º 32
0
 void RankButtonCallback()
 {
     if (!introDone)
         return;
     pressedButton = MenuButtons.rank;
     Outro();
 }
Exemplo n.º 33
0
        /// <summary>
        /// Update menu/title screen (buttons)
        /// </summary>
        /// <param name="gameTime"></param>
        public void Update(GameTime gameTime)
        {
            this.fadeInOut -= 0.05f;
            if (this.fadeInOut < 0) { this.fadeInOut = 0f; }

            #region Titlescreen
            if (mode == MenuMode.Titlescreen)
            {

                if (startPressed == false)
                {
                    startPressAlpha += startPressAlphaDelta;
                    if (startPressAlpha > 1f || startPressAlpha < 0f) startPressAlphaDelta = -startPressAlphaDelta;

                    //Wait for a player to press start
                    if (deviceOkP1 == false)
                    {
                        for (PlayerIndex index = PlayerIndex.One; index <= PlayerIndex.Four; index++)
                        {
                            if (GamePad.GetState(index).Buttons.Start == ButtonState.Pressed)
                            {
                                //It will become Player 1
                                player1device = new Device(DeviceType.Gamepad, (int)index);
                                deviceOkP1 = true;
                                break;
                            }
                        }
                    }
                    else
                    {
                        if (TGPAContext.Instance.Player1 == null)
                        {
                            if (deviceOkP1)
                            {
                                //Ask for sign in
                                if (Device.DeviceHasProfile(player1device) == false)
                                {
                                    if (Guide.IsVisible == false)
                                    {
                                        signInRequested = true;
                                        Guide.ShowSignIn(1, false);
                                    }
                                    else
                                    {
                                        if (signInRequested)
                                        {
                                            signInRequested = false;
                                            deviceOkP1 = false;
                                            player1device = null;
                                        }
                                    }
                                }

                                else
                                {
                                    TGPAContext.Instance.Player1 = new Player(PlayerIndex.One, player1device);
            #if XBOX
                                    TGPAContext.Instance.Player1.Name = TGPAContext.Instance.Player1.XboxProfile.Gamertag;
            #endif
                                }
                            }
                        }
                        else
                        {
                            //Assign eventually a new controller for P1
                            if (deviceOkP1)
                            {
                                TGPAContext.Instance.Player1.Device = player1device;
                            }

                            startPressed = true;
                        }
                    }
                }
                else
                {
                    if (TGPAContext.Instance.Player1 == null)
                        throw new Exception("No player WTF");

                    if (TGPAContext.Instance.InputManager.PlayerPressButtonBack(TGPAContext.Instance.Player1))
                    {
                        TGPAContext.Instance.CurrentGameState = GameState.Credits;
                    }
                    else
                    {
                        //Buy from title screen
                        if (TGPAContext.Instance.IsTrialMode)
                        {
                            if (TGPAContext.Instance.InputManager.PlayerPressYButton(TGPAContext.Instance.Player1))
                            {
                                if (Guide.IsVisible == false)
                                {
                                    //Player need rights
                                    SignedInGamer xboxProfile = Device.DeviceProfile(TGPAContext.Instance.Player1.Device);

                                    if (xboxProfile.Privileges.AllowPurchaseContent)
                                    {
                                        Guide.ShowMarketplace((PlayerIndex)TGPAContext.Instance.Player1.Device.Index);
                                    }
                                    else
                                    {
                                        Guide.BeginShowMessageBox(LocalizedStrings.GetString("BuyFailTitle"), LocalizedStrings.GetString("BuyFailContent"), new List<string> { "OK" }, 0, MessageBoxIcon.Warning, null, null);
                                    }
                                }
                            }
                        }

                    }

                    KeyboardState keyboard = Keyboard.GetState();

                    //Mouse and menus
                    Rectangle startRect = new Rectangle(
                        StartButton.X, StartButton.Y,
                        StartButton.X + StartButton.Width,
                        StartButton.Y + StartButton.Height);

                    Rectangle optionsRect = new Rectangle(
                         OptionsButton.X, OptionsButton.Y,
                         OptionsButton.X + OptionsButton.Width,
                         OptionsButton.Y + OptionsButton.Height);

                    Rectangle exitRect = new Rectangle(
                                         QuitButton.X, QuitButton.Y,
                         QuitButton.X + QuitButton.Width,
                         QuitButton.Y + QuitButton.Height);

                    //PC Management
                    #region Mouse input
                    if (TGPAContext.Instance.Player1.IsPlayingOnWindows() && TGPAContext.Instance.IsActive)
                    {
                        if (buttonGoDst.Contains(TGPAContext.Instance.MousePoint))
                        {
                            Focus = MenuButtons.Play;

                            if (TGPAContext.Instance.InputManager.PlayerPressButtonConfirm(TGPAContext.Instance.Player1))
                                TGPAContext.Instance.CurrentGameState = GameState.LevelSelectionScreen;

                        }
                        else if (buttonOptionsDst.Contains(TGPAContext.Instance.MousePoint))
                        {
                            Focus = MenuButtons.Options;

                            if (TGPAContext.Instance.InputManager.PlayerPressButtonConfirm(TGPAContext.Instance.Player1))
                            {
                                changeModeAfterAlphaBlending(MenuMode.Options);
                                InitializeOptionsValues(false);
                            }

                        }
                        else if (buttonExitDst.Contains(TGPAContext.Instance.MousePoint))
                        {
                            Focus = MenuButtons.Exit;

                            if ((InputManager.IsClic(previousMouseState, Mouse.GetState())) || (TGPAContext.Instance.InputManager.PlayerPressButtonConfirm(TGPAContext.Instance.Player1)))
                                TGPAContext.Instance.CurrentGameState = GameState.Exit;

                        }
                        else
                        {
                            Focus = MenuButtons.None;
                        }
                    }
                    #endregion

                    switch (focus)
                    {
                        case MenuButtons.Play:

                            if ((TGPAContext.Instance.InputManager.PlayerPressButtonConfirm(TGPAContext.Instance.Player1)))
                                TGPAContext.Instance.CurrentGameState = GameState.LevelSelectionScreen;

                            if (TGPAContext.Instance.InputManager.PlayerPressDown(TGPAContext.Instance.Player1))
                                focus = MenuButtons.Options;

                            if (TGPAContext.Instance.InputManager.PlayerPressUp(TGPAContext.Instance.Player1))
                                focus = MenuButtons.Exit;

                            break;

                        case MenuButtons.Options:

                            if ((TGPAContext.Instance.InputManager.PlayerPressButtonConfirm(TGPAContext.Instance.Player1)))
                            {
                                changeModeAfterAlphaBlending(MenuMode.Options);
                                InitializeOptionsValues(false);
                            }

                            if (TGPAContext.Instance.InputManager.PlayerPressDown(TGPAContext.Instance.Player1))
                                focus = MenuButtons.Exit;

                            if (TGPAContext.Instance.InputManager.PlayerPressUp(TGPAContext.Instance.Player1))
                                focus = MenuButtons.Play;

                            break;

                        case MenuButtons.Exit:

                            if ((TGPAContext.Instance.InputManager.PlayerPressButtonConfirm(TGPAContext.Instance.Player1)))
                                TGPAContext.Instance.CurrentGameState = GameState.Exit;

                            if (TGPAContext.Instance.InputManager.PlayerPressDown(TGPAContext.Instance.Player1))
                                focus = MenuButtons.Play;

                            if (TGPAContext.Instance.InputManager.PlayerPressUp(TGPAContext.Instance.Player1))
                                focus = MenuButtons.Options;

                            break;
            #if XBOX
                    case MenuButtons.None:
                        focus = MenuButtons.Play;
                        break;
            #endif
                    }
                    previousMouseState = Mouse.GetState();
                }

            }
            #endregion
            #region Option screen
            else if (mode == MenuMode.Options)
            {
                this.optionsSection.Update(gameTime);

                //Set focus
                if (TGPAContext.Instance.Player1.IsPlayingOnWindows() == false)
                {
                    #region Pad Management

                    TGPAControl control = null;

                    if (TGPAContext.Instance.InputManager.PlayerPressDown(TGPAContext.Instance.Player1))
                    {
                        if (optionsSection.CurrentLine + 1 < optionsSection.Lines)
                        {
                            control = optionsSection.GetControl(optionsSection.CurrentLine + 1, optionsSection.CurrentColumn);
                        }

                        if (control == null)
                        {
                            control = optionsSection.GetControl(0, optionsSection.CurrentColumn);
                        }

                        if (control != null)
                        {
                            optionsSection.UnsetFocus();
                            optionsSection.SetFocus(control);
                        }
                    }
                    else if (TGPAContext.Instance.InputManager.PlayerPressUp(TGPAContext.Instance.Player1))
                    {
                        if (optionsSection.CurrentLine - 1 < optionsSection.Lines)
                        {
                            control = optionsSection.GetControl(optionsSection.CurrentLine - 1, optionsSection.CurrentColumn);
                        }

                        if (control == null)
                        {
                            control = optionsSection.GetControl(optionsSection.Lines - 1, optionsSection.CurrentColumn);
                        }

                        if (control != null)
                        {
                            optionsSection.UnsetFocus();
                            optionsSection.SetFocus(control);
                        }
                    }
                    #endregion
                }
            #if WINDOWS
                else
                {
                    bool leave = false;

                    for (int i = 0; i < optionsSection.Lines; i++)
                    {
                        for (int j = 0; j < optionsSection.Columns; j++)
                        {
                            TGPAControl control = optionsSection.GetControl(i, j);

                            if (control != null)
                            {
                                if (control.DstRect.Intersects(TGPAContext.Instance.MouseDst))
                                {
                                    if (control != optionsSection.FocusedControl)
                                    {
                                        optionsSection.UnsetFocus();
                                        optionsSection.SetFocus(control);
                                    }
                                    leave = true;
                                    break;
                                }
                            }

                            if (leave) break; //As beautiful as a GOTO
                        }
                        if (leave) break;
                    }
                }
                if (TGPAContext.Instance.MouseDst.Intersects(buttonOptionsBackDst))
                {
                    buttonOptionsBackSrc.Y = 50;
                    bool exit = TGPAContext.Instance.InputManager.PlayerPressButtonConfirm(TGPAContext.Instance.Player1);

                    if (exit)
                    {
                        changeModeAfterAlphaBlending(MenuMode.Titlescreen);
                        TGPAContext.Instance.Saver.Save();
                    }
                }
                else
                {
                    buttonOptionsBackSrc.Y = 0;
                }
            #endif
                if (TGPAContext.Instance.InputManager.PlayerPressButtonBack(TGPAContext.Instance.Player1))
                {
                    changeModeAfterAlphaBlending(MenuMode.Titlescreen);
                    TGPAContext.Instance.Saver.Save();
                }

            }
            #endregion

            #region Animation

            stuffTimer += gameTime.ElapsedGameTime.Milliseconds;

            //Update stuff
            List<FlyingStuff> fsToDelete = new List<FlyingStuff>();
            foreach (FlyingStuff fs in flyingStuff)
            {
                fs.Update(gameTime);

                if (fs.KillMe)
                {
                    fsToDelete.Add(fs);
                }
            }

            foreach (FlyingStuff deadfs in fsToDelete)
            {
                flyingStuff.Remove(deadfs);
            }

            if (stuffTimer - stuffCooldown > 0f)
            {
                flyingStuff.Add(new FlyingStuff());
                stuffTimer = 0f;
                stuffCooldown = RandomMachine.GetRandomFloat(750, 6000);
            }

            for (int i = 0; i < 2; i++)
            {
                Vector2 loc = new Vector2(610, 625);
                loc.X += RandomMachine.GetRandomInt(-35, 35);
                loc.Y += RandomMachine.GetRandomInt(-35, 35);

                loc.Y = (loc.Y / 768) * TGPAContext.Instance.ScreenHeight;

                Smoke s = new Smoke(loc, RandomMachine.GetRandomVector2(30f, 150f, -40f, -120f), 0.03f, 0.04f, 0.14f, 1,
                                1f, RandomMachine.GetRandomInt(0, 4));

                pmanager.AddParticle(s, true);
            }

            //anim
            elapsed += gameTime.ElapsedGameTime.Milliseconds;

            if (elapsed > time)
            {
                anim = (anim == 0) ? 1 : 0;
                foreSrc.Y = anim * 440;
                elapsed = 0;
                time = 200 + (float)(RandomMachine.GetRandomFloat(-100, 300));
            }

            pmanager.UpdateParticles((float)gameTime.ElapsedGameTime.TotalSeconds);

            #endregion

            this.magicAlpha -= magicAlphaDelta;

            if (this.magicAlpha < 0) {
                this.magicAlpha = 0f;
                this.magicAlphaDelta = -magicAlphaDelta;

                //Change mode
                if (nextMode != mode)
                {
                    mode = nextMode;
                }
            }
            if (this.magicAlpha > 1) { this.magicAlpha = 1f; }
        }
Exemplo n.º 34
0
        public void Initialize(bool drawPushStart)
        {
            mode = MenuMode.Titlescreen;

            magicAlpha = 1f;
            magicAlphaDelta = 0f;

            deviceOkP1 = false;
            #if XBOX
            signInRequested = false;
            startPressed = drawPushStart ? false : true;
            startPressAlpha = 0.75f;
            startPressAlphaDelta = 0.01f;
            #else
            startPressed = true;
            startPressAlpha = 0f;
            startPressAlphaDelta = 0f;
            #endif
            this.fadeInOut = 1f;

            float ratio = TGPAContext.Instance.ScreenHeight / 768;
            src = new Rectangle(0, 0, 1024, 768);
            foreDst = new Rectangle(0, TGPAContext.Instance.ScreenHeight - (439 * (TGPAContext.Instance.ScreenHeight / 768)), 804 * (TGPAContext.Instance.ScreenWidth / 1024), 439 * (TGPAContext.Instance.ScreenHeight / 768));
            foreSrc = new Rectangle(0, 0, 804, 439);
            dst = new Rectangle(0, 0, TGPAContext.Instance.ScreenWidth, TGPAContext.Instance.ScreenHeight);

            focus = MenuButtons.Play;

            buttonGo = new Rectangle(0, 0, 286, 113);
            buttonGoDst = buttonGo;
            buttonGoDst.X = 670;
            buttonGoDst.Y = 380;

            buttonOptions = new Rectangle(0, 130, 166, 117);
            buttonOptionsDst = buttonOptions;
            buttonOptionsDst.X = 720;
            buttonOptionsDst.Y = 480;

            buttonExit = new Rectangle(0, 256, 219, 118);
            buttonExitDst = buttonExit;
            buttonExitDst.X = 730;
            buttonExitDst.Y = 580;

            confirm = false;

            flyingStuff = new List<FlyingStuff>();
            stuffCooldown = 1500f;
            stuffTimer = 0f;

            //Options
            //***********************************************************
            InitializeOptions();
        }
Exemplo n.º 35
0
 void ShareButtonCallback()
 {
     if (!introDone)
         return;
     pressedButton = MenuButtons.share;
     Outro();
 }