예제 #1
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();
        }
예제 #2
0
        public void SwitchCategories(string category)
        {
            if (category != _selectedCategory)
            {
                GuiScrollableCollection scrollableCollection = (GuiScrollableCollection)_guiDrawable[_catalogLocation];
                foreach (GuiCatalogTile catalogItem in scrollableCollection.Collection)
                {
                    catalogItem.ClickEditSettingsEvent -= GuiCatalogTileButtonWasClicked;
                }

                scrollableCollection.ClearCollection();

                foreach (CatalogItem catalogItem in _catalogManager.GetExercisesByType(category))
                {
                    GuiCatalogTile guiCatalogTile = new GuiCatalogTile(
                        Game,
                        catalogItem.ID,
                        catalogItem.Name,
                        catalogItem.Description,
                        scrollableCollection.ItemSize,
                        scrollableCollection.GetNextPosition()
                        );

                    guiCatalogTile.ClickEditSettingsEvent += GuiCatalogTileButtonWasClicked;

                    scrollableCollection.AddCatalogItem(guiCatalogTile);
                }

                scrollableCollection.LoadContent(Game, contentManager, SharedSpriteBatch);

                Exercise[] selected = _catalogManager.GetSelectedWorkouts();

                foreach (GuiCatalogTile catalogTile in scrollableCollection.Collection)
                {
                    foreach (Exercise exercise in selected)
                    {
                        if (exercise.Id == catalogTile.ItemID)
                        {
                            catalogTile.SilentSetChecked();
                        }
                    }
                }

                _selectedCategory = category;
            }
        }