Пример #1
0
	//Completes a course view, returns its index
	//Returns -2 if already completed
	public int CompleteCourseView(Course _course, string _cvID)
	{
		CourseProgressData _pData = GetCourseProgressData(_course.ID);
		List<CourseViewStateData> _stateDataList = _pData.GetStateDataList();
		for (int i = 0; i < _stateDataList.Count; i++)
		{
			if (_stateDataList[i].ID == _cvID)
			{
				//If already completed return -2
				if (_stateDataList[i].isCompleted)
					return -2;

				// Match found: Complete it
				_stateDataList[i].isCompleted = true;
				
				int _completeIndex = _course.GetCourseViewIndexByID(_cvID);

				_pData.SetStateDataList(_stateDataList);
				SetCourseProgressData(_pData);
				return _completeIndex;
			}
		}

		Debug.LogError("CompleteCourseView: Course View not found! Returning -1");
		return -1;
	}