using System;
using BackupParamAccessor;
using PlayerStatus;

namespace Schedule
{
	public class ResultYotogiTask : ResultBaseTask
	{
		public ResultYotogiTask(WorkResultSlot slot, int workId, ResultWorkMgr.ResultType resultType)
		{
			base.Init(slot, workId, resultType);
			this.CalcParam();
			this.UpdateIcon();
		}

		protected void CalcParam()
		{
			if (base.slot.textureBank != null)
			{
				this._icon = base.slot.textureBank.GetTexture(ScheduleCSVData.AllData[base.id].icon);
			}
			if (base.maid != null && base.maid.status.selectedYotogiClass != null && base.maid.status.selectedYotogiClass.level == base.maid.status.selectedYotogiClass.expSystem.GetMaxLevel())
			{
				this.yotogiLvMax = true;
				if (this.uppedParams.yotogiClassLv > 0)
				{
					this.yotogiLvCompletion = true;
				}
			}
		}

		protected override void CalcParam(SCENE_ID baseId)
		{
			Params backupParams = BackupParamAccessor.GetBackupParams(base.slot.slotId, baseId - 1);
			Params backupParams2 = BackupParamAccessor.GetBackupParams(base.slot.slotId, baseId + 1);
			this.uppedParams = backupParams2 - backupParams;
		}

		protected void UpdateIcon()
		{
			this.successLv_icon = null;
			if (base.maid != null && base.slot.textureBank != null)
			{
				switch (this.successLv)
				{
				case ScheduleData.WorkSuccessLv.Miss:
				case ScheduleData.WorkSuccessLv.Unexecuted:
					this.successLvName = "CM3D2_work_result_mark_sippai";
					break;
				case ScheduleData.WorkSuccessLv.Success:
					this.successLvName = "CM3D2_work_result_mark_seikou";
					break;
				case ScheduleData.WorkSuccessLv.Perfect:
					this.successLvName = "CM3D2_work_result_mark_daiseikou";
					break;
				}
				if (ScheduleCSVData.YotogiData[base.id].yotogiType == ScheduleCSVData.YotogiType.HaveSex && this.uppedParams.yotogi_play_count == 0)
				{
					this.successLvName = "CM3D2_work_result_mark_sippai";
					this.successLv = ScheduleData.WorkSuccessLv.Miss;
					this.commonSuccessLv = this.successLv;
				}
				this.successLv_icon = base.slot.textureBank.GetTexture(this.successLvName);
				this.commonSuccessLv = this.successLv;
			}
		}

		public ScheduleData.WorkSuccessLv successLv = ScheduleData.WorkSuccessLv.Success;

		public bool yotogiLvCompletion;

		public bool yotogiLvMax;
	}
}
