예제 #1
0
        public override void Update(GameTime gameTime)
        {
            // Si el dispositivo esta listo:
            if (StorageSession.IsDeviceInitialize && storageRequest)
            {
                storageRequest = false;

                // Cargamos el progreso del jugador:
                if (!Guide.IsTrialMode && StorageSession.FileExists(Session.SaveGameFilename))
                {
                    Session.GameProgress = StorageSession.LoadData <GameDefinitions.SaveGame>(Session.SaveGameFilename);
                }
                else // Si no hubiera archivo de progresos creamos progresos nuevos para el usuario:
                {
                    Session.GameProgress = new GameDefinitions.SaveGame();
                }

                // Cargamos la configuracion del usuario:
                if (StorageSession.FileExists(Session.SettingsFilename))
                {
                    Session.Settings = StorageSession.LoadData <GameDefinitions.GameSettings>(Session.SettingsFilename);
                }
                else
                {
                    Session.Settings = new GameDefinitions.GameSettings();
                }

                // Aplicamos la configuracion y restauramos progresos:
                Session.Apply();

                SetParams();
            }
        }
예제 #2
0
        public override void Update(GameTime gameTime)
        {
            if (GetPlayerIndex())
            {
                // Si el perfil no tiene iniciada sesion:
                if (!IsPlayerSignedIn((PlayerIndex)playerIndex, false) && !Guide.IsVisible)
                {
                    Guide.ShowSignIn(1, false);
                    requestSignin = true;
                }
                else if (IsPlayerSignedIn((PlayerIndex)playerIndex, false)) // Si el perfil tiene iniciada sesion:
                {
                    StorageSession.SelectDevice((PlayerIndex)playerIndex);
                }

                start = true;
            }

            if (IsPlayerSignedIn((PlayerIndex)playerIndex, false) && requestSignin && !Guide.IsVisible) // Si el perfil tiene iniciada sesion:
            {
                StorageSession.SelectDevice((PlayerIndex)playerIndex);
                requestSignin = false;
            }

            // Si el dispositivo esta listo:
            if (StorageSession.IsDeviceInitialize && start)
            {
                {
                    Manager.UIInput.Player = (PlayerIndex)playerIndex;

                    // Cargamos el progreso del jugador:
                    if (!Guide.IsTrialMode && StorageSession.FileExists(Session.SaveGameFilename))
                    {
                        Session.GameProgress = StorageSession.LoadData <GameDefinitions.SaveGame>(Session.SaveGameFilename);
                    }
                    else // Si no hubiera archivo de progresos creamos progresos nuevos para el usuario:
                    {
                        Session.GameProgress = new GameDefinitions.SaveGame();
                    }

                    // Cargamos la configuracion del usuario:
                    if (StorageSession.FileExists(Session.SettingsFilename))
                    {
                        Session.Settings = StorageSession.LoadData <GameDefinitions.GameSettings>(Session.SettingsFilename);
                    }
                    else
                    {
                        Session.Settings = new GameDefinitions.GameSettings();
                    }

                    // Aplicamos la configuracion y restauramos progresos:
                    Session.Apply();

                    // Saltamos al menu principal:
                    Manager.GameStates.ChangeState("menu");
                }
            }

            // Codigo encargado de actualizar los elementos visuales del menu:
            if (flag == 0 && timer.Value > new Random().Next(1500, 5000))
            {
                timer.Reset();
                flag            = 1;
                lightLamp.Color = Color.Gray;
            }
            else if (flag == 1 && timer.Value > 50)
            {
                timer.Reset();
                flag            = 0;
                lightLamp.Color = Color.White;
            }

            fan.Update(gameTime);

            if (!scaleAnimationFinish)
            {
                if (logo.Scale > 1)
                {
                    joss.Scale   -= 0.05f;
                    logo.Scale   -= 0.05f;
                    layer1.Scale += 0.025f;
                }
                else if (logo.Scale < 1)
                {
                    joss.Scale           = 1;
                    logo.Scale           = 1;
                    layer1.Scale         = 1;
                    scaleAnimationFinish = true;
                    glitch.Now();
                }
            }
            else
            {
                layer1.Location -= new Vector2(1, 0);
                layer2.Location -= new Vector2(1, 0);
                layer2.Visible   = true;
                if (layer1.Location.X == -1280)
                {
                    layer1.Location = new Vector2(1280, 0);
                }
                if (layer2.Location.X == -1280)
                {
                    layer2.Location = new Vector2(1280, 0);
                }

                footstep.Visible       = true;
                footstepShadow.Visible = true;

                if (timer2.Value >= 500)
                {
                    timer2.Reset();
                    pressStart.Visible       = !pressStart.Visible;
                    pressStartShadow.Visible = pressStart.Visible;
                }
            }

            base.Update(gameTime);
        }