Пример #1
0
        public void ReplaySelected()
        {
            gui = new ReplayTile(new Vector2(500f, 500f), Vector2.Zero, "fileId", "Name of the exercise", 0);

            gui.OnSelected += OnSelect;
            gui.LoadContent(game, contentManager, spriteBatch);

            MouseState currentMouseState =
                new MouseState(
                    50,
                    50,
                    0,
                    ButtonState.Released,
                    ButtonState.Released,
                    ButtonState.Released,
                    ButtonState.Released,
                    ButtonState.Released
                );

            MouseState oldMouseState =
                new MouseState(
                    currentMouseState.X,
                    currentMouseState.Y,
                    currentMouseState.ScrollWheelValue,
                    ButtonState.Pressed,
                    currentMouseState.MiddleButton,
                    currentMouseState.RightButton,
                    currentMouseState.XButton1,
                    currentMouseState.XButton2
                );

            Assert.IsEmpty(_replayId);

            gui.Update(currentMouseState, oldMouseState, new Rectangle(currentMouseState.X, currentMouseState.Y, 1, 1), new GameTime());

            Assert.AreEqual("fileId", _replayId);
        }
Пример #2
0
        /// <summary>
        /// The method to use when the summary screen
        /// should be triggered to open when an event occurs
        /// </summary>
        public void QueueIsDone(object sender, EventArgs args)
        {
            GuiScrollableCollection scrollableCollection = (GuiScrollableCollection)_guiDrawable[_catalogLocation];

            scrollableCollection.ClearCollection();

            ExerciseGameComponent[] exercises = _exerciseQueue.Exercises;
            foreach (ExerciseGameComponent exercise in exercises)
            {
                for (int i = 0; i < exercise.RepetitionToFileId.Count; i = i + 1)
                {
                    ReplayTile replayTile = new ReplayTile(
                            scrollableCollection.ItemSize,
                            scrollableCollection.GetNextPosition(),
                            exercise.RepetitionToFileId[i],
                            exercise.Name,
                            i
                        );

                    replayTile.OnSelected += replayTileSelected;

                    scrollableCollection.AddCatalogItem(replayTile);
                }
            }

            scrollableCollection.LoadContent(Game, contentManager, SharedSpriteBatch);

            ScreenState = UserInterface.ScreenState.Active;
            base.Transition();
        }