Beispiel #1
0
        public Lesson1 CreateUserAndStartLesson1(User user)
        {
            //next sanitize the data before further steps

            foreach (PropertyInfo propertyInfo in user.GetType().GetProperties())
            {
                //get the value of the property

                object value = propertyInfo.GetValue(user, null);
                //do sanitization only for string
                if (value.GetType() == typeof(string))
                {
                    value = Regex.Replace(value.ToString(), @"[^A-Za-z0-9 _\.-{}]", "");
                    propertyInfo.SetValue(user, value, null);
                }
            }

            if (!user.IsValid())
            {
                Lesson1 lesson1 = new Lesson1();
                lesson1.AddError("Model is invalid!");
                return(lesson1);
            }

            var lessonUser  = CreateUser(user, LessonTypes.HowDoesYourCashFlow.ToString(CultureInfo.InvariantCulture));
            var lesson1User = new Lesson1()
            {
                IndividualId = lessonUser.IndividualId,
                UserId       = lessonUser.UserId,
                User         = lessonUser
            };

            return(lesson1User);
        }
    //GameObject.FindGameObjectWithTag("Pickup").SetActive(false);


    void OnGUI()
    {
        GUI.Label(new Rect(10, 10, 200, 50), "Lessons collected: " + pickCount.ToString() + " /5");
        if (Lesson1.show)
        {
            Lesson1.lesson1_text(imgTexture);
        }
        if (Lesson1.plan)
        {
            Lesson1.LessonOnePlan(eighth, quarter, half, dotted_half, whole);
        }

        if (Lesson2.lesson2_show)
        {
            Lesson2.lesson2_text(imgTexture2);
        }

        if (Lesson2.lesson2_plan)
        {
            Lesson2.LessonTwoPlan(staff, treble, bass);
        }

        if (Lesson3.lesson3_show)
        {
            Lesson3.lesson3_text(imgTexture3);
        }

        if (Lesson3.lesson3_plan)
        {
            Lesson3.LessonThreePlan(A, B, C, D, E, F, G);
        }
        if (Lesson4.lesson4_show)
        {
            Lesson4.lesson4_text(imgTexture4);
        }

        if (Lesson4.lesson4_plan)
        {
            Lesson4.LessonFourPlan(clefA, clefB, clefC, clefD, clefE, clefF, clefG, clefMC);
        }
        if (Lesson5.lesson5_show)
        {
            Lesson5.lesson5_text(imgTexture5);
        }

        if (Lesson5.lesson5_plan)
        {
            Lesson5.LessonFivePlan(isecond, ithird, ifourth, ififth, isixth, iseventh, ioctave);
        }
    }
Beispiel #3
0
        public bool PostLesson1(Lesson1 lesson1)
        {
            if (lesson1.IsValid())
            {
                lock (_lockObject)
                {
                    SaltServiceAgent.PostLesson1(lesson1.ToDataContract());

                    return(true);
                }
            }
            else
            {
                lesson1.AddError("Lesson object is not valid");
                return(false);
            }
        }
 void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Pickup"))
     {
         other.gameObject.SetActive(false);
         pickCount += 1;
         PlayerMovement.MovementBool();
         Lesson1.showInventory();
     }
     else if (other.CompareTag("Pickup2"))
     {
         other.gameObject.SetActive(false);
         pickCount += 1;
         PlayerMovement.MovementBool();
         Lesson2.showInventory();
     }
     if (other.CompareTag("Pickup3"))
     {
         other.gameObject.SetActive(false);
         pickCount += 1;
         PlayerMovement.MovementBool();
         Lesson3.showInventory();
     }
     if (other.CompareTag("Pickup4"))
     {
         other.gameObject.SetActive(false);
         pickCount += 1;
         PlayerMovement.MovementBool();
         Lesson4.showInventory();
     }
     if (other.CompareTag("Pickup5"))
     {
         other.gameObject.SetActive(false);
         pickCount += 1;
         PlayerMovement.MovementBool();
         Lesson5.showInventory();
     }
 }
Beispiel #5
0
        /// <summary>
        /// To the data contract.
        /// </summary>
        /// <param name="lesson1">The lesson1.</param>
        /// <returns></returns>
        public static Lesson1Contract ToDataContract(this Lesson1 lesson1)
        {
            var expenses = new List <ExpenseContract>();
            var incomes  = new List <IncomeContract>();

            if (lesson1.Expenses != null)
            {
                expenses = lesson1.Expenses.Select(expense => expense.ToDataContract()).ToList();
            }

            if (lesson1.Incomes != null)
            {
                incomes = lesson1.Incomes.Select(income => income.ToDataContract()).ToList();
            }

            return(new Lesson1Contract()
            {
                Expenses = expenses.ToArray(),
                Incomes = incomes.ToArray(),
                Goal = lesson1.Goal != null?lesson1.Goal.ToDataContract() : new GoalContract(),
                           User = lesson1.User.ToDataContract(LessonTypes.HowDoesYourCashFlow)
            });
        }