Пример #1
0
        public LessonBrowser()
        {
            LessonData lessonData = LessonAccess.Instance.CurrentLessonData;

            m_LessonStageFactory = lessonData.LessonStageFactory;

            if (m_LessonStageFactory.LessonStages.Count > 0)
            {
                m_DefaultActiveState = false;
                ApplyDefaultState(lessonData.ShapeDataFactory);

                LessonStage firstStage = m_LessonStageFactory.LessonStages[0];
                m_AppliedActions.Push(firstStage);
                firstStage.ApplyActions();

                HandleLessonStageNumberChanged(LessonAccess.Instance.CurrentLessonStageNumber);
            }
            else
            {
                m_DefaultActiveState = true;
                ApplyDefaultState(lessonData.ShapeDataFactory);
            }

            AddDisposable(EventBus.Subscribe(this));
        }
Пример #2
0
        public void HandleLessonStageNumberChanged(int stageNumber)
        {
            if (stageNumber < 0 || stageNumber >= m_LessonStageFactory.LessonStages.Count)
            {
                return;
            }

            while (stageNumber >= m_AppliedActions.Count)
            {
                LessonStage stage = m_LessonStageFactory.LessonStages[m_AppliedActions.Count];
                m_AppliedActions.Push(stage);
                stage.ApplyActions();
            }

            while (stageNumber < m_AppliedActions.Count - 1)
            {
                m_AppliedActions.Pop().RollbackActions();
            }
        }