Example #1
0
	public void LoadCourseProgressData(Course _course)
	{
		CourseProgressData _pData;
		if (CourseProgressDataExists(_course.ID))
		{
			_pData = GetCourseProgressData(_course.ID);
			//Debug.Log("Course Progress Data exists, let's check that it's valid and updated.");

			if (_pData.GetStateDataCount() > _course.courseViews.Count)
			{
				Debug.LogError("Progress Data has more CV states than there are CV's. TODO: Delete them.");
			}
			else if (_pData.GetStateDataCount() < _course.courseViews.Count)
			{
				Debug.LogError("Progress Data has less CV states than there are CV's. TODO: Add them.");
			}

			if (!_course.CourseViewExists(_pData.GetCurrentCourseViewID()))
			{
				Debug.Log("Current course view doesn't exist. Setting to first one.");
				_pData.SetCurrentCourseViewID( _course.GetCourseViewIDByIndex(0) );
			}
		}
		else
		{
			Debug.Log("NO Course Progress Data exists: Let's set the default");
			_pData = SetDefaultCourseProgressData(_course);
		}

		//Debug.Log("Now let's load it in!");
		SetCurCourseView(_pData.GetCurrentCourseViewID());
	}