This class is used for statically holding all GameInfo objects, one per game.
Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TitleScreen"/> class.
 /// </summary>
 public TitleScreen()
     : base()
 {
     GameClock.Reset();
     this.boxArtDisplay     = new BoxArtDisplay(this, new Vector2(528, 590), new Vector2(-50, -100));
     this.gameInfoDisplay   = new GameInfoDisplay(this, this.boxArtDisplay.boxArtMenu, new Vector2(1342, 195), 668, new Vector2(1013, 240), new Vector2(1342, 325));
     this.ScoreBoardDisplay = new ScoreboardDisplay(this, new Vector2(180, 10), new Vector2(1342, 755));
     GameInfoCollection.ShiftIndex(-GameInfoCollection.CurrentIndex);
     this.FadingOut = true;
 }
        /// <summary>
        /// Shifts the entries by the specified amount.
        /// </summary>
        /// <param name="amount">The amount.</param>
        public void Shift(int amount)
        {
            int newAmount = this.images[this.lastOffset].GetShiftAmount(amount);

            GameInfoCollection.ShiftIndex(newAmount);

            // Shift each element in images to the correct starting location.
            int currentOffset = this.lastOffset + newAmount;

            if (currentOffset < 2 * GameInfoCollection.GameInfos.Count)
            {
                currentOffset += GameInfoCollection.GameInfos.Count;
                for (int i = 0; i < this.images.Count; i++)
                {
                    this.images[i].Position.Set(this.images[i].Position.Value.X - this.fullOffset.X, this.images[i].Position.Value.Y - this.fullOffset.Y);
                }
            }
            else if (currentOffset > 3 * GameInfoCollection.GameInfos.Count)
            {
                currentOffset -= GameInfoCollection.GameInfos.Count;
                for (int i = 0; i < this.images.Count; i++)
                {
                    this.images[i].Position.Set(this.images[i].Position.Value.X + this.fullOffset.X, this.images[i].Position.Value.Y + this.fullOffset.Y);
                }
            }

            float layerDepth   = 0.95f;
            int   listIndex    = currentOffset;
            int   change       = 1;
            bool  lastMultiply = false;

            for (int i = 0; i < this.images.Count; i++)
            {
                int     nowIndex = (listIndex + 1000000 * this.images.Count) % this.images.Count;
                Vector2 temp     = this.basePosition + (currentOffset - nowIndex) * this.boxArtOffset;
                this.images[nowIndex].Position.GoTo(temp.X, temp.Y, 0.25f, true);
                this.images[nowIndex].LayerDepth = layerDepth;
                listIndex = currentOffset + change;
                if (!lastMultiply)
                {
                    change      *= -1;
                    lastMultiply = true;
                    layerDepth  -= 0.1f;
                }
                else
                {
                    change      += (change < 0 ? -1 : 1);
                    lastMultiply = false;
                }
            }

            this.lastOffset = currentOffset;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Updates this instance.
        /// </summary>
        public override void Update()
        {
            base.Update();

            // Check if user is selecting "up" or "down". Only do this if this is on the top of the screen stack...
            if (this.IsOnTop())
            {
                if (GameWorld.controller.ContainsBool(ActionType.SelectionUp) ||
                    GameWorld.controller.ContainsBool(ActionType.SelectionLeft) && GameInfoCollection.CurrentIndex != GameInfoCollection.GameInfos.Count - 1)
                {
                    if (!GameWorld.controller.ContainsBool(ActionType.DPadUp) && !GameWorld.controller.ContainsBool(ActionType.DPadDown))
                    {
                        this.boxArtDisplay.Shift(-1);
                    }
                }
                if (GameWorld.controller.ContainsBool(ActionType.SelectionDown) ||
                    GameWorld.controller.ContainsBool(ActionType.SelectionRight) && GameInfoCollection.CurrentIndex != GameInfoCollection.GameInfos.Count - 1)
                {
                    if (!GameWorld.controller.ContainsBool(ActionType.DPadUp) && !GameWorld.controller.ContainsBool(ActionType.DPadDown))
                    {
                        this.boxArtDisplay.Shift(1);
                    }
                }

                if (GameInfoCollection.CurrentIndex != GameInfoCollection.GameInfos.Count - 1 &&
                    GameWorld.controller.ContainsBool(ActionType.Select))
                {
                    this.Disposed = true;
                    GameInfoCollection.LauchGame();
                    GameWorld.audio.PlaySound("menuClick");
                }

                if (GameWorld.controller.ContainsBool(ActionType.GoBack))
                {
                    GameInfoCollection.ShiftIndex(-GameInfoCollection.CurrentIndex);
                    this.Disposed = true;
                    GameWorld.screens.Play(new StartScreen());
                    GameWorld.audio.PlaySound("menuGoBack");
                    return;
                }

                if (GameInfoCollection.CurrentIndex != GameInfoCollection.GameInfos.Count - 1 &&
                    GameWorld.controller.ContainsBool(ActionType.XButton))
                {
                    // Only pop up an instructions screen if there is no instructions screen.
                    bool found = false;
                    foreach (Screen screen in GameWorld.screens)
                    {
                        if (screen is InstructionsScreen)
                        {
                            found = true;
                            break;
                        }
                    }

                    if (!found)
                    {
                        GameWorld.screens.Play(new InstructionsScreen(GameInfoCollection.GameInfos[GameInfoCollection.CurrentIndex].InstructionsImageName));
                        GameWorld.audio.PlaySound("menuClick");
                    }
                }
            }

            this.boxArtDisplay.Update();
            this.gameInfoDisplay.Update();
            this.ScoreBoardDisplay.Update();
        }