コード例 #1
0
    private void GameManager_OnStepFinished()
    {
        var nextStepIndex = stepList.Data.IndexOf(_currentStep) + 1;

        _currentStep = stepList.Data[nextStepIndex];

        RunStep(_currentStep);
    }
コード例 #2
0
    void RunStep(LessonStep step)
    {
        MessageBus.OnSpeechActive.Send(true);

        SoundController.Instance.PlaySound1(step.id, () =>
        {
            MessageBus.OnSpeechActive.Send(false);

            Observable.Timer(System.TimeSpan.FromSeconds(step.actionTime))
            .Subscribe(_ => MessageBus.OnStepFinished.Send())
            .AddTo(_disposables);
        });
    }
コード例 #3
0
        public static LessonStep ToApiModel(this Primitives.LessonStepData lessonStepData)
        {
            var result = new LessonStep
            {
                CourseId            = lessonStepData.CourseId,
                LessonId            = lessonStepData.LessonId,
                Id                  = lessonStepData.Id,
                EducationalMaterial = new EducationalMaterial
                {
                    Article     = lessonStepData.EducationalMaterialData.Article,
                    Description = lessonStepData.EducationalMaterialData.DescriptionData.ToApiModel()
                },
                Questions = lessonStepData.Questions.Select(question => question.ToApiModel()).ToList()
            };

            return(result);
        }
コード例 #4
0
 private void RunStep(LessonStep value)
 {
     MessageBus.OnStepRun.Send(value);
     //OnStepRun?.Invoke(value);
 }
コード例 #5
0
    //private void Awake()
    //{

    //}


    //private void OnDestroy()
    //{
    //    GameManager.OnStepFinished -= GameManager_OnStepFinished;
    //    GameManager.OnLessonStart -= GameManager_OnLessonStart;
    //}

    private void GameManager_OnLessonStart()
    {
        _currentStep = stepList.Data[0];
        RunStep(_currentStep);
    }
コード例 #6
0
    private void LessonManager_OnStepRun(LessonStep step)
    {
        switch (step.id)
        {
        case LessonStepID.step01:
        {
            RunStep(step);
        }
        break;

        case LessonStepID.step02:
        {
            deviceManager.volumeDevice.SetActive(true, () =>
                {
                    Observable.Timer(System.TimeSpan.FromSeconds(1))
                    .Subscribe(_ => RunStep(step))
                    .AddTo(_disposables);
                });
        }
        break;

        case LessonStepID.step03:
        {
            RunStep(step);
        }
        break;

        case LessonStepID.step04:
        {
            RunStep(step);
        }
        break;

        case LessonStepID.step05:
        {
            RunStep(step);
        }
        break;

        case LessonStepID.step06:
        {
            RunStep(step);
        }
        break;

        case LessonStepID.step07:
        {
            RunStep(step);
        }
        break;

        case LessonStepID.step08:
        {
            deviceManager.volumeDevice.SetActive(false, () =>
                {
                    deviceManager.pitchDevice.SetActive(true, () =>
                    {
                        Observable.Timer(System.TimeSpan.FromSeconds(1))
                        .Subscribe(_ => RunStep(step))
                        .AddTo(_disposables);
                    });
                });
        }
        break;

        case LessonStepID.step09:
            RunStep(step);
            break;

        case LessonStepID.step10:
            RunStep(step);
            break;

        case LessonStepID.step11:
            RunStep(step);
            break;

        case LessonStepID.step12:
            RunStep(step);
            break;

        case LessonStepID.step13:
            RunStep(step);
            break;

        case LessonStepID.step14:
        {
            MessageBus.OnSpeechActive.Send(true);
            //OnSpeechActive?.Invoke(true);
            soundController.PlaySound1(step.id, () => { MessageBus.OnSpeechActive.Send(false); });
        }
        break;

        default:
            break;
        }
    }
コード例 #7
0
        private LessonNode ParseStep(StringWithIndex text)
        {
            text = text.Trim();
            var step = new LessonStep(text);

            // Divide the parts
            var parts = text.SplitWithoutModification("\n#");

            // The header includes the title and the instructions
            var header      = parts[0];
            var headerParts = header.SplitAfterFirstLine();

            // Parse the step title
            var titlePart = headerParts[0];

            step.Children.Add(new LessonStepTitle(titlePart.TrimStart("# STEP = ")));

            // Add instructions - the first section (no header)
            var instructionsPart = headerParts[1];

            step.Children.Add(ParseInstructions(instructionsPart));

            // Add Goal
            var goalPart = parts.First(p => p.Text.StartsWith("\n## GOAL"));

            step.Children.Add(ParseGoal(goalPart));

            // Add Summary
            var summaryPart = parts.First(p => p.Text.StartsWith("\n## SUMMARY"));

            step.Children.Add(ParseSummary(summaryPart));

            // Add Test
            var testPart = parts.FirstOrDefault(p => p.Text.StartsWith("\n## TEST"));

            if (testPart != null)
            {
                step.Children.Add(ParseTest(testPart));
            }

            // Add Explanation
            var explanationPart = parts.FirstOrDefault(p => p.Text.StartsWith("\n## EXPLANATION"));

            if (explanationPart != null)
            {
                step.Children.Add(ParseExplanation(explanationPart));
            }

            // Add File
            var filePart = parts.FirstOrDefault(p => p.Text.StartsWith("\n## FILE = "));

            if (filePart != null)
            {
                step.Children.Add(ParseFile(filePart));
            }


            // TODO: Add other parts

            // Order children
            var ordered = step.Children.OrderBy(c => c.Content.Index).ToList();

            step.Children.Clear();
            step.AddChildren(ordered);

            return(step);
        }