using System;

namespace Schedule
{
	public class WorkResultSlot : SlotBase
	{
		public WorkResultSlot(WorkResultScene rs, int slotId)
		{
			this.wrs = rs;
			this._slotId = slotId;
			this.textureBank = rs.textureBank;
			this.Update();
		}

		public override void Update()
		{
			base.Update();
		}

		public void InitResultWork(WorkResultSceneMode mode)
		{
			if (mode == WorkResultSceneMode.Noon)
			{
				if (this.noonWorksData == null)
				{
					this.noonWorksData = this.InitResultWork(base.noonWorkId, ResultWorkMgr.ResultType.Daytime);
				}
			}
			else if (mode == WorkResultSceneMode.Night && this.nightWorksData == null)
			{
				this.nightWorksData = this.InitResultWork(base.nightWorkId, ResultWorkMgr.ResultType.Night);
			}
		}

		private ResultBaseTask InitResultWork(int workId, ResultWorkMgr.ResultType resultType)
		{
			ResultBaseTask result = null;
			if (ScheduleCSVData.AllData.ContainsKey(workId))
			{
				ScheduleCSVData.ScheduleBase scheduleBase = ScheduleCSVData.AllData[workId];
				ScheduleTaskCtrl.TaskType type = scheduleBase.type;
				if (type != ScheduleTaskCtrl.TaskType.Training)
				{
					if (type != ScheduleTaskCtrl.TaskType.Yotogi)
					{
						if (type == ScheduleTaskCtrl.TaskType.Work)
						{
							result = new ResultWorkTask(this, workId, resultType);
						}
					}
					else
					{
						result = new ResultYotogiTask(this, workId, resultType);
					}
				}
				else
				{
					result = new ResultTrainingTask(this, workId, resultType);
				}
			}
			return result;
		}

		protected WorkResultScene wrs;

		public ResultBaseTask noonWorksData;

		public ResultBaseTask nightWorksData;
	}
}
