Example #1
0
 /// <summary>
 /// Creates a new title screen.
 /// </summary>
 public TitleScreen(FishingGameContext context)
 {
     _context          = context;
     ShowBeneath       = true;
     TransitionOnTime  = 0f;
     TransitionOffTime = 1.5f;
 }
Example #2
0
        private MenuScreen BuildBadges(Badges badges, FishingGameContext context, ContentManager content)
        {
            BadgesScreen badgesScreen = new BadgesScreen(badges, context);

            badgesScreen.LoadContent(content);
            return(badgesScreen);
        }
Example #3
0
        public MenuScreen Create(Options options, Badges badges, FishingGameContext context, ContentManager content)
        {
            _menuFont  = content.Load <SpriteFont>("Fonts/Text");         // use a common font
            _menuSound = content.Load <SoundEffect>("Sounds/MenuSelect"); // use a common selected sound

            MenuScreen screen = new MenuScreen(context);

            screen.IsRoot = true;
            screen.LoadContent(content);

            MenuScreen badgesScreen  = BuildBadges(badges, context, content);
            MenuScreen optionsScreen = BuildOptions(options, context, content);
            MenuScreen confirmScreen = BuildExitConfirm(context, content);
            MenuScreen upsellScreen  = BuildExitUpsell(context, content);

            screen.AddEntry(BuildTextEntry(Resources.MenuResume, (s, a) => screen.Stack.Pop()));
            if (Guide.IsTrialMode)
            {
                MenuEntry purchase = BuildTextEntry(Resources.MenuPurchase, (s, a) => ShowPurchaseScreen(context));
                screen.AddEntry(purchase);
                context.Trial.TrialModeEnded += delegate(object s, EventArgs a) { screen.RemoveEntry(purchase); screen.LayoutEntries(); };
            }
            screen.AddEntry(BuildTextEntry(Resources.MenuBadges, (s, a) => screen.Stack.Push(badgesScreen)));
            screen.AddEntry(BuildTextEntry(Resources.MenuHelpOptions, (s, a) => screen.Stack.Push(optionsScreen)));
            screen.AddEntry(BuildTextEntry(Resources.MenuExit, (s, a) => screen.Stack.Push(Guide.IsTrialMode ? upsellScreen : confirmScreen)));
            screen.LayoutEntries();

            return(screen);
        }
Example #4
0
        private MenuScreen BuildExitUpsell(FishingGameContext context, ContentManager content)
        {
            MenuScreen screen = new MenuScreen(context);

            screen.LoadContent(content);

            MenuEntry purchase = BuildTextEntry(Resources.MenuPurchase, (s, a) => ShowPurchaseScreen(context));

            screen.AddEntry(purchase);
            screen.AddEntry(BuildTextEntry(Resources.MenuExitNo, (s, a) => screen.Stack.Pop()));
            screen.AddEntry(BuildTextEntry(Resources.MenuExitYes, (s, a) => screen.Stack.PopAll()));
            screen.LayoutEntries();

            context.Trial.TrialModeEnded += delegate(object s, EventArgs a) { if (screen.State == ScreenState.Active)
                                                                              {
                                                                                  screen.Stack.Pop();
                                                                              }
            };

            UpsellOverlay upsell = new UpsellOverlay(Resources.UpsellMessageExit, content);

            screen.AddDecoration(upsell.Sprite);

            return(screen);
        }
Example #5
0
        public GameOverScreen(FishingGameContext context)
        {
            _context = context;

            ShowBeneath       = true;
            TransitionOnTime  = 1f;
            TransitionOffTime = 0f;
        }
Example #6
0
        /// <summary>
        /// Creates a new gameplay screen.
        /// </summary>
        public GameplayScreen(FishingGameContext context)
        {
            _context = context;
            _context.Input.ControllerDisconnected += (s, a) => PauseGame();
            _context.Game.Exiting         += (s, a) => ExitGame();
            _context.Trial.TrialModeEnded += (s, a) => ConfigureStorage();

            _camera = new CameraSprite(_context.Game.GraphicsDevice);
            _state  = GameState.Story;
        }
Example #7
0
        private MenuScreen BuildExitConfirm(FishingGameContext context, ContentManager content)
        {
            MenuScreen screen = new MenuScreen(context);

            screen.LoadContent(content);
            screen.AddEntry(BuildTextEntry(Resources.MenuExitNo, (s, a) => screen.Stack.Pop()));
            screen.AddEntry(BuildTextEntry(Resources.MenuExitYes, (s, a) => screen.Stack.PopAll()));
            screen.LayoutEntries();
            return(screen);
        }
Example #8
0
        /// <summary>
        /// Creates a new menu screen.
        /// </summary>
        public MenuScreen(FishingGameContext context)
        {
            _context = context;

            ShowBeneath       = true;
            TransitionOnTime  = 0.4f;
            TransitionOffTime = 0.2f;
            NumVisibleEntries = 5;
            Spacing           = 10f;
        }
Example #9
0
        public StoreScreen(FishingGameContext context) : base(context)
        {
            ShowBeneath       = true;
            TransitionOnTime  = 0.25f;
            TransitionOffTime = 0.25f;
            IsRoot            = true;
            ShowBackOnRoot    = true;
            NumVisibleEntries = 3;
            Spacing           = 8;

            context.Trial.TrialModeEnded += (o, a) => BuildScreen();
        }
Example #10
0
        /// <summary>
        /// Creates a new fishing state view.
        /// </summary>
        /// <param name="state">The fishing state to draw.</param>
        /// <param name="context">The context from which to load the content.</param>
        public FishingView(FishingState state, FishingGameContext context)
        {
            _state = state;
            _state.ActionChanged += OnActionChanged;
            _state.Event         += OnFishingEvent;

            _rod  = _state.RodSprites[_state.Rod];
            _lure = _state.LureSprites[_state.Lure];
            _line = _state.LineSprite;

            _context = context;
        }
Example #11
0
        private MenuScreen BuildSettings(Options options, FishingGameContext context, ContentManager content)
        {
            Func <bool, string> getStateString = (b) => b ? Resources.MenuOn : Resources.MenuOff;

            var effectsEntry = BuildOptionEntry(Resources.MenuSoundEffects, getStateString(options.SoundEffectsToggle),
                                                (s, a) =>
            {
                options.SoundEffectsToggle         = !options.SoundEffectsToggle;
                ((TextMenuEntry)s).TextSprite.Text = getStateString(options.SoundEffectsToggle);
            });
            var musicEntry = BuildOptionEntry(Resources.MenuMusic, getStateString(options.MusicToggle),
                                              (s, a) =>
            {
                options.MusicToggle = !options.MusicToggle;
                ((TextMenuEntry)s).TextSprite.Text = getStateString(options.MusicToggle);
            });
            var vibrationEntry = BuildOptionEntry(Resources.MenuVibration, getStateString(options.VibrationToggle),
                                                  (s, a) =>
            {
                options.VibrationToggle            = !options.VibrationToggle;
                ((TextMenuEntry)s).TextSprite.Text = getStateString(options.VibrationToggle);
            });
            var timerEntry = BuildOptionEntry(Resources.MenuTimer, getStateString(options.TimerToggle),
                                              (s, a) =>
            {
                options.TimerToggle = !options.TimerToggle;
                ((TextMenuEntry)s).TextSprite.Text = getStateString(options.TimerToggle);
            });

            MenuScreen screen = new MenuScreen(context);

            screen.LoadContent(content);
            screen.AddEntry(effectsEntry);
            screen.AddEntry(musicEntry);
            screen.AddEntry(vibrationEntry);
            screen.AddEntry(timerEntry);
            screen.LayoutEntries();

            // update the text when the screen is displayed because the storage device might have changed
            screen.StateChanged += (s, a) =>
            {
                Screen scr = (Screen)s;
                if (scr.State == ScreenState.TransitionOn || scr.State == ScreenState.Active)
                {
                    effectsEntry.TextSprite.Text   = getStateString(options.SoundEffectsToggle);
                    musicEntry.TextSprite.Text     = getStateString(options.MusicToggle);
                    vibrationEntry.TextSprite.Text = getStateString(options.VibrationToggle);
                    timerEntry.TextSprite.Text     = getStateString(options.TimerToggle);
                }
            };

            return(screen);
        }
Example #12
0
        private MenuScreen BuildCredits(FishingGameContext context, ContentManager content)
        {
            MenuScreen screen = new MenuScreen(context);

            screen.LoadContent(content);
            screen.AddEntry(BuildTextEntry(Resources.MenuCredits1));
            screen.AddEntry(BuildTextEntry(Resources.MenuCredits2));
            screen.AddEntry(BuildTextEntry(Resources.MenuCredits3));
            screen.AddEntry(BuildTextEntry(Resources.MenuCredits4));
            screen.AddEntry(BuildTextEntry(Resources.MenuCredits5));
            screen.LayoutEntries();
            return(screen);
        }
Example #13
0
        private MenuScreen BuildControls(FishingGameContext context, ContentManager content)
        {
            MenuScreen screen = new MenuScreen(context);

            screen.LoadContent(content);

            SpriteDescriptor controlsDesc = content.Load <SpriteDescriptorTemplate>("Sprites/Controls").Create();

            controlsDesc.GetSprite <TextSprite>("AText").Text     = Resources.MenuControlsA;
            controlsDesc.GetSprite <TextSprite>("BText").Text     = Resources.MenuControlsB;
            controlsDesc.GetSprite <TextSprite>("StartText").Text = Resources.MenuControlsStart;
            screen.AddEntry(BuildImageEntry(controlsDesc.Sprite));

            screen.LayoutEntries();
            return(screen);
        }
Example #14
0
        private MenuScreen BuildOptions(Options options, FishingGameContext context, ContentManager content)
        {
            MenuScreen screen = new MenuScreen(context);

            screen.LoadContent(content);

            MenuScreen controlsScreen = BuildControls(context, content);
            MenuScreen creditsScreen  = BuildCredits(context, content);
            MenuScreen settingsScreen = BuildSettings(options, context, content);

            screen.AddEntry(BuildTextEntry(Resources.MenuControls, (s, a) => screen.Stack.Push(controlsScreen)));
            screen.AddEntry(BuildTextEntry(Resources.MenuCredits, (s, a) => screen.Stack.Push(creditsScreen)));
            screen.AddEntry(BuildTextEntry(Resources.MenuSettings, (s, a) => screen.Stack.Push(settingsScreen)));

            screen.LayoutEntries();
            return(screen);
        }
Example #15
0
 public BadgesScreen(Badges badges, FishingGameContext context) : base(context)
 {
     _badges           = badges;
     NumVisibleEntries = 3;
     Spacing           = 8;
 }
Example #16
0
 /// <summary>
 /// Shows the marketplace purchase screen if possible, or a warning otherwise.
 /// </summary>
 private void ShowPurchaseScreen(FishingGameContext context)
 {
     context.Input.Controller.Value.PurchaseContent();
 }