Exemple #1
0
        private Lesson ParseLesson(LessonResult lessonResult)
        {
            var startTimeString = lessonResult.StartTime.ToString().PadLeft(4, '0');
            var startHours      = Int32.Parse(startTimeString.Remove(2, 2));
            var startMinutes    = Int32.Parse(startTimeString.Remove(0, 2));

            var endTimeString = lessonResult.EndTime.ToString().PadLeft(4, '0');
            var endHours      = Int32.Parse(endTimeString.Remove(2, 2));
            var endMinutes    = Int32.Parse(endTimeString.Remove(0, 2));


            var subject = lessonResult.Elements.Where(c => c.Type == ElementType.Subject).First();
            var teacher = lessonResult.Elements.Where(c => c.Type == ElementType.Teacher).First();
            var room    = lessonResult.Elements.Where(c => c.Type == ElementType.Student).First();

            Abstractions.Models.LessonStatus status = Abstractions.Models.LessonStatus.Normal;

            if (lessonResult.Status.Cancelled == true)
            {
                status = Abstractions.Models.LessonStatus.Canceled;
            }
            else if (lessonResult.Status.Exam == true)
            {
                status = Abstractions.Models.LessonStatus.Exam;
            }
            else if (lessonResult.Status.Event)
            {
                status = Abstractions.Models.LessonStatus.Event;
            }
            else if (teacher.State == ElementState.Regular || lessonResult.Status.Standard == true)
            {
                status = Abstractions.Models.LessonStatus.Normal;
            }

            var lesson = new Lesson()
            {
                StartTime         = lessonResult.Date.AddMinutes((startHours * 60) + startMinutes),
                EndTime           = lessonResult.Date.AddMinutes((endHours * 60) + endMinutes),
                Name              = subject.Name,
                FullName          = subject.LongName,
                Teacher           = teacher.Name,
                FullTeacherName   = teacher.LongName,
                TeacherIsAbnormal = teacher.State == ElementState.Substituted,
                Room              = room.Name,
                RoomFullName      = room.LongName,
                RoomIsAbnormal    = lessonResult.Status.RoomSubstitution ?? room.State == ElementState.Substituted,
                SchoolHour        = lessonResult.Hour,
                LessonStatus      = status,
                ID = lessonResult.ID
            };

            return(lesson);
        }
Exemple #2
0
        IEnumerator ShowResultInternal()
        {
            var theaterData = IngameManager.Instance.Theater.ApplySendResultData();

            TheaterAppeal.text   = theaterData.Item1.ToString("N0");
            TheaterMoney.text    = theaterData.Item2.ToString();
            TheaterTotalFan.text = theaterData.Item3.ToString();
            yield return(TheaterResult.Appear_C());

            yield return(new WaitUntil(() => nextClicked));

            nextClicked = false;
            yield return(TheaterResult.Disappear_C());

            var workData = IngameManager.Instance.Work.ApplySendResultData();

            WorkMoney.text = workData.Item1.ToString();
            WorkHonor.text = workData.Item2.ToString();
            WorkFan.text   = workData.Item3.ToString();
            yield return(WorkResult.Appear_C());

            yield return(new WaitUntil(() => nextClicked));

            nextClicked = false;
            yield return(WorkResult.Disappear_C());

            var lessonData = IngameManager.Instance.Lesson.ApplySendResultData();

            LessonVocal.text   = lessonData.Item1[0].ToString();
            LessonDance.text   = lessonData.Item1[1].ToString();
            LessonVisual.text  = lessonData.Item1[2].ToString();
            LessonVariety.text = lessonData.Item1[3].ToString();
            LessonMoney.text   = lessonData.Item2.ToString();
            yield return(LessonResult.Appear_C());

            yield return(new WaitUntil(() => nextClicked));

            nextClicked = false;
            yield return(LessonResult.Disappear_C());

            var CDData = IngameManager.Instance.CD.ApplySendResultData();

            if (CDData.Item1 == true)
            {
                if (CDData.Item5 > 0)
                {
                    CDTurnLeft.text = CDData.Item5.ToString();
                    yield return(CDResult1.Appear_C());

                    yield return(new WaitUntil(() => nextClicked));

                    nextClicked = false;
                    yield return(CDResult1.Disappear_C());
                }
                else
                {
                    CDAppeal.text   = CDData.Item2.ToString();
                    CDMoney.text    = CDData.Item3.ToString();
                    CDTotalFan.text = CDData.Item4.ToString();
                    yield return(CDResult2.Appear_C());

                    yield return(new WaitUntil(() => nextClicked));

                    nextClicked = false;
                    yield return(CDResult2.Disappear_C());
                }
            }

            var ConcertData = IngameManager.Instance.Concert.ApplySendResultData();

            if (ConcertData.Item1 == true)
            {
                if (ConcertData.Item2 > 0)
                {
                    ConcertTurnLeft.text = ConcertData.Item2.ToString();
                    yield return(ConcertResult1.Appear_C());

                    yield return(new WaitUntil(() => nextClicked));

                    nextClicked = false;
                    yield return(ConcertResult1.Disappear_C());
                }
                else
                {
                    ConcertMoney.text    = ConcertData.Item3[0].ToString();
                    ConcertReqSeat.text  = ConcertData.Item3[1].ToString();
                    ConcertFillSeat.text = ConcertData.Item3[2].ToString();
                    ConcertScale.text    = ConcertData.Item4;
                    ConcertBool.text     = ConcertData.Item5 ? "성공!" : "실패...";
                    yield return(ConcertResult2.Appear_C());

                    yield return(new WaitUntil(() => nextClicked));

                    nextClicked = false;
                    yield return(ConcertResult2.Disappear_C());
                }
            }

            int spendMoney = 0;

            foreach (var idol in IngameManager.Instance.Data.Idols)
            {
                spendMoney += idol.Value.Cost;
            }
            IngameManager.Instance.Data.Money -= spendMoney;
            IdolCount.text      = IngameManager.Instance.Data.Idols.Count.ToString();
            IdolSpendMoney.text = spendMoney.ToString();
            yield return(IdolPay.Appear_C());

            yield return(new WaitUntil(() => nextClicked));

            nextClicked = false;
            yield return(IdolPay.Disappear_C());

            if (IngameManager.Instance.Data.Money < 0)
            {
                SceneChanger.Instance.ChangeScene("GameOver");
            }

            if (ConcertData.Item4 == "돔 투어" && ConcertData.Item5 == true)
            {
                SceneChanger.Instance.ChangeScene("GameClear");
            }
        }
        public void UpdateUserScores(Lesson lesson)
        {
            LessonResult result = previousScores.FirstOrDefault(
                lr => lr.LessonId == lesson.EntryId 
                && lr.UserEmail == loginService.CurrentUser.Email);

            if (result == null)
            {
                result = new LessonResult()
                {
                    LessonId = lesson.EntryId,
                    UserEmail = loginService.CurrentUser.Email,
                    IsPassingScore = lesson.IsPassingScore,
                    FinalScore = lesson.Score
                };

                previousScores.Add(result);
            }
            else
            {
                result.IsPassingScore = lesson.IsPassingScore;
                result.FinalScore = lesson.Score;
            }

            int totalLessonCount = ActiveCourse.Lessons.SelectMany( l=> l.Lessons ).Count( l => l.IsScored );
            int completedLessonCount = ActiveCourse.Lessons.SelectMany( l => l.Lessons ).Count( l => l.IsPassingScore );
            int overallPercentComplete = completedLessonCount * 100 / totalLessonCount;
            bool isPassed = totalLessonCount == completedLessonCount;

            ActiveCourse.PercentComplete = overallPercentComplete;
            ActiveCourse.IsCoursePassed = isPassed;
            ActiveCourse.DatePassed = DateTime.Now;

            CourseResult courseResult = new CourseResult()
            {
                CourseId = this.activeCourse.ID,
                UserEmail = loginService.CurrentUser.Email,
                IsPassingScore = ActiveCourse.IsCoursePassed,
                PercentComplete = ActiveCourse.PercentComplete,
                PassingDate = ActiveCourse.DatePassed
            };

            UpdateUserLessonScoreCommand command = new UpdateUserLessonScoreCommand(result, courseResult);
            command.Execute();
        }