using System; using System.Collections.Generic; using BackupParamAccessor; using PlayerStatus; using Schedule; using UnityEngine; public class ResultWorkMgr : BaseCreatePanel { public ResultWorkMgr.ResultType GetCurrentResultType() { return this.currentResultType; } public WorkResultScene GetWorkResultSceneApi() { return this.m_workResultSceneApi; } public string SlotNoToAcquiredCommuBonus { get { return this.m_SlotNoToAcquiredCommuBonus; } } public ResultWorkCtrl Ctrl { get { return this.m_ctrl; } } public void SetCurrentActiveButton(string buttonName) { this.currentActiveButton = buttonName; } public override void Init() { this.m_goPanel = base.GetPanel("ResultWorkPanel"); this.m_ctrl = base.GetCtrl(); this.m_ctrl.Init(this, this.m_goPanel); this.m_api = new ResultWorkAPI(); this.m_descTraining = UTY.GetChildObject(this.m_goPanel, "ResultViewer/DescResultTraining", false).GetComponent(); this.m_descTraining.Init(this, this.m_ctrl, this.m_goPanel); this.m_descYotogi = UTY.GetChildObject(this.m_goPanel, "ResultViewer/DescResultYotogi", false).GetComponent(); this.m_descYotogi.Init(this, this.m_ctrl, this.m_goPanel); this.m_descWork = UTY.GetChildObject(this.m_goPanel, "ResultViewer/DescResultWork", false).GetComponent(); this.m_descWork.Init(this, this.m_ctrl, this.m_goPanel); } public void OpenResultDaytimePanel() { Debug.Log("昼仕事リザルトをオープンしました。"); this.m_api.SceneStart(true, this, new ResultWorkAPI.dgOnSceneStartCallBack(this.OpenResultDaytimeCallBack)); } public void OpenResultDaytimeCallBack() { base.BaseOpenPanel(ResultWorkMgr.ResultType.Daytime.ToString()); } public void OpenResultNightPanel() { Debug.Log("夜仕事リザルトをオープンしました。"); this.m_api.SceneStart(false, this, new ResultWorkAPI.dgOnSceneStartCallBack(this.OpenResultNightCallBack)); } public void OpenResultNightCallBack() { base.BaseOpenPanel(ResultWorkMgr.ResultType.Night.ToString()); } protected override void OpenPanel(string openType) { ResultWorkMgr.ResultType resultType = (ResultWorkMgr.ResultType)Enum.Parse(typeof(ResultWorkMgr.ResultType), openType); this.currentResultType = resultType; Dictionary dictionary = this.LoadMaidStatusData(); if (!this.m_ctrl.HasDicData(dictionary)) { Debug.LogWarning("スケジュールにメイドが設定されていないため、表示する仕事の結果がありません。"); return; } this.currentActiveButton = string.Empty; Dictionary dictionary2 = this.LoadResultData(this.currentResultType); this.m_ctrl.CreateMaidStatusViewer(dictionary, dictionary2); this.SetDescResultWorkDic(dictionary2); this.ExecuteDaytimeRelatedAPI(); this.ExecuteNightRelatedAPI(); } private void OnFinished() { this.m_ctrl.OnFinished(); this.ActiveDescAnimation(false); } private void ActiveDescAnimation(bool acitve) { this.m_descTraining.m_playedAnimation = acitve; this.m_descYotogi.m_playedAnimation = acitve; this.m_descWork.m_playedAnimation = acitve; } private void SetDescResultWorkDic(Dictionary dicResultWork) { this.m_descTraining.SetResultWorkDic(dicResultWork); this.m_descYotogi.SetResultWorkDic(dicResultWork); this.m_descWork.SetResultWorkDic(dicResultWork); } private void ExecuteDaytimeRelatedAPI() { GameMain.Instance.CharacterMgr.status.CheckTrophyDayResultAndNightResult(); } private void ExecuteNightRelatedAPI() { GameMain.Instance.CharacterMgr.status.CheckTrophyDayResultAndNightResult(); } public void CloseResultWorkPanel() { base.BaseClosePanel(); } protected override void ClosePanel() { this.AfterTreatment(); } private void AfterTreatment() { this.currentActiveButton = string.Empty; this.currentResultType = ResultWorkMgr.ResultType.None; this.m_ctrl.StopCoroutineIfRunning(); } public void ClickMaidStatus() { string name = UIButton.current.name; this.ClickMaidStatusByButtonName(name); } public void ClickMaidStatusByButtonName(string buttonName) { } public Dictionary LoadMaidStatusData() { this.m_workResultSceneApi = this.GetWorkResultSceneApi(this.currentResultType); Dictionary dictionary = new Dictionary(); if (this.m_workResultSceneApi.slot == null || this.m_workResultSceneApi.slot.Length <= 0) { return dictionary; } foreach (WorkResultSlot workResultSlot in this.m_workResultSceneApi.slot) { ScheduleCtrl.MaidStatusAndTaskUnit maidStatusAndTaskUnit = new ScheduleCtrl.MaidStatusAndTaskUnit(); if (!(workResultSlot.maid == null)) { maidStatusAndTaskUnit.slotNo = workResultSlot.slotId; if (this.currentResultType == ResultWorkMgr.ResultType.Daytime) { maidStatusAndTaskUnit.daytimeTaskId = workResultSlot.noonWorkId.ToString(); maidStatusAndTaskUnit.taskIcon = workResultSlot.noon_icon; } else if (this.currentResultType == ResultWorkMgr.ResultType.Night) { maidStatusAndTaskUnit.daytimeTaskId = workResultSlot.nightWorkId.ToString(); maidStatusAndTaskUnit.taskIcon = workResultSlot.night_icon; } maidStatusAndTaskUnit.maidStatus = new MaidStatusListCtrl.MaidStatusButton { maid = workResultSlot.maid, id = workResultSlot.maid.status.guid, isReader = workResultSlot.leader, maidIcon = workResultSlot.icon, firstName = workResultSlot.first_name, lastName = workResultSlot.last_name, Rranking = workResultSlot.popular_rank, crownIcon = workResultSlot.popular_rank_icon, contractTypeName = workResultSlot.contract_type_name }; dictionary.Add(string.Format("slot_{0}", maidStatusAndTaskUnit.slotNo), maidStatusAndTaskUnit); } } return dictionary; } private WorkResultScene GetWorkResultSceneApi(ResultWorkMgr.ResultType currentResultType) { if (this.m_workResultSceneApi == null) { this.m_workResultSceneApi = new WorkResultScene(); } if (currentResultType != ResultWorkMgr.ResultType.Daytime) { if (currentResultType == ResultWorkMgr.ResultType.Night) { this.InitDayTimeAPI(); this.InitNightAPI(); } } else { this.InitDayTimeAPI(); } return this.m_workResultSceneApi; } private void InitDayTimeAPI() { if (!this.m_initResultDaytime) { this.m_workResultSceneApi.Calc(WorkResultSceneMode.Noon, true); this.m_initResultDaytime = true; } } private void InitNightAPI() { if (!this.m_initResultNight) { this.m_workResultSceneApi.Calc(WorkResultSceneMode.Night, true); this.m_initResultNight = true; } } private Dictionary LoadResultData(ResultWorkMgr.ResultType resultType) { Dictionary dictionary = new Dictionary(); this.m_SlotNoToAcquiredCommuBonus = string.Empty; if (this.m_workResultSceneApi.slot == null || this.m_workResultSceneApi.slot.Length <= 0) { return dictionary; } foreach (WorkResultSlot workResultSlot in this.m_workResultSceneApi.slot) { if (!(workResultSlot.maid == null)) { ResultWorkCtrl.ResultWork resultWork = new ResultWorkCtrl.ResultWork(); resultWork.slotNo = workResultSlot.slotId; ResultBaseTask resultBaseTask; if (resultType == ResultWorkMgr.ResultType.Daytime) { resultWork.resultTaskIcon = workResultSlot.noonWorksData.successLv_icon; resultBaseTask = workResultSlot.noonWorksData; resultWork.workId = workResultSlot.noonWorkId; } else { resultWork.resultTaskIcon = workResultSlot.nightWorksData.successLv_icon; resultBaseTask = workResultSlot.nightWorksData; resultWork.workId = workResultSlot.nightWorkId; } if (resultBaseTask == null) { Debug.Log(string.Format("スロットNo={0}に仕事の結果が設定されておりません。", workResultSlot.slotId)); resultWork.hasResult = false; dictionary.Add(resultWork.slotNo.ToString(), resultWork); } else { ScheduleTaskCtrl.TaskType type = ScheduleCSVData.AllData[resultBaseTask.id].type; resultWork.taskType = type; resultWork.successLv = resultBaseTask.commonSuccessLv; if (type != ScheduleTaskCtrl.TaskType.Training) { if (type != ScheduleTaskCtrl.TaskType.Yotogi) { if (type == ScheduleTaskCtrl.TaskType.Work) { this.TrainingResultData(resultType, ref resultWork, resultBaseTask, workResultSlot); } } else { this.YotogiResultData(ref resultWork, resultBaseTask, workResultSlot); } } else { this.TrainingResultData(resultType, ref resultWork, resultBaseTask, workResultSlot); } dictionary.Add(resultWork.slotNo.ToString(), resultWork); } } } return dictionary; } private ResultWorkCtrl.ResultWork TrainingResultData(ResultWorkMgr.ResultType type, ref ResultWorkCtrl.ResultWork rw, ResultBaseTask workData, WorkResultSlot slotInfo) { rw.hasResult = true; ResultTrainingTask resultTrainingTask = (ResultTrainingTask)workData; rw.audioClipName = this.GetAudioClipName(resultTrainingTask.successLv); ResultWorkCtrl.UpperMaidStatus upperMaidStatus = new ResultWorkCtrl.UpperMaidStatus(); upperMaidStatus.maidId = slotInfo.maid.status.guid; upperMaidStatus.maidLvCompletion = resultTrainingTask.maidLvCompletion; if (resultTrainingTask.successLv == ScheduleData.WorkSuccessLv.Perfect) { upperMaidStatus.perfectSuccessIcon = resultTrainingTask.bonus_icon; upperMaidStatus.givenPerfectSucces = true; } upperMaidStatus.givenCommuBonus = resultTrainingTask.communicationBonus; if (upperMaidStatus.givenCommuBonus) { this.SetUpperMaidStatus(ref upperMaidStatus, resultTrainingTask.uppedParams); upperMaidStatus.bonusIcon = resultTrainingTask.bonus_icon; this.m_SlotNoToAcquiredCommuBonus = rw.slotNo.ToString(); } else { this.SetUpperMaidStatus(ref upperMaidStatus, resultTrainingTask.uppedParamsWithoutCommunicationBonus); } rw.commuFlag = upperMaidStatus.givenCommuBonus; rw.upperMaidStatus = upperMaidStatus; return rw; } private ResultWorkCtrl.ResultWork YotogiResultData(ref ResultWorkCtrl.ResultWork rw, ResultBaseTask workData, WorkResultSlot slotInfo) { rw.hasResult = true; ResultYotogiTask resultYotogiTask = (ResultYotogiTask)workData; rw.audioClipName = this.GetAudioClipName(resultYotogiTask.successLv); ResultWorkCtrl.UpperMaidStatus upperMaidStatus = new ResultWorkCtrl.UpperMaidStatus(); this.SetUpperMaidStatus(ref upperMaidStatus, resultYotogiTask.uppedParams); upperMaidStatus.yotogiLvCompletion = resultYotogiTask.yotogiLvCompletion; rw.upperMaidStatus = upperMaidStatus; return rw; } private void SetUpperMaidStatus(ref ResultWorkCtrl.UpperMaidStatus upperMaidStatus, Params param) { upperMaidStatus.studyRate = StatusCtrl.ToPercent(param.study_rate, 10); upperMaidStatus.likability = param.likability; upperMaidStatus.reception = param.reception; upperMaidStatus.care = param.care; upperMaidStatus.lovely = param.lovely; upperMaidStatus.elegance = param.elegance; upperMaidStatus.charm = param.charm; upperMaidStatus.cooking = param.cooking; upperMaidStatus.vocal = param.vocal; upperMaidStatus.dance = param.dance; upperMaidStatus.appealPoint = param.appealPoint; upperMaidStatus.teach = StatusCtrl.ToPercent(param.teach_rate, 10); upperMaidStatus.maidClassLevel = param.maidClassLv; upperMaidStatus.maidClassExp = param.maidClassExp; upperMaidStatus.inyoku = param.inyoku; upperMaidStatus.hentai = param.hentai; upperMaidStatus.housi = param.housi; upperMaidStatus.m_value = param.m_value; upperMaidStatus.evaluation = param.evaluation; upperMaidStatus.income = param.sales; upperMaidStatus.yotogiClassExp = param.yotogiClassExp; upperMaidStatus.yotogiClassLevel = param.yotogiClassLv; upperMaidStatus.yotogiPlayCount = param.yotogi_play_count; upperMaidStatus.othersPlayCount = param.others_play_count; upperMaidStatus.workingFunds = param.sales; } public string GetAudioClipName(ScheduleData.WorkSuccessLv workSuccessLv) { string result = string.Empty; switch (workSuccessLv) { case ScheduleData.WorkSuccessLv.Miss: case ScheduleData.WorkSuccessLv.Unexecuted: result = "SE021.ogg"; break; case ScheduleData.WorkSuccessLv.Success: result = "SE002.ogg"; break; case ScheduleData.WorkSuccessLv.Perfect: result = "SE008.ogg"; break; } return result; } protected override void AfterClose() { if (this.sceneMgr != null) { this.m_api.EndNextScene(new ResultWorkAPI.dgOnSceneFinalCallBack(this.sceneMgr.CloseScene)); } } public void OnDestroy() { if (this.m_workResultSceneApi != null) { this.m_workResultSceneApi.Dispace(); } } protected override void SetFadeTargetPanel() { this.fadeTargetPanel = this.m_goPanel; } private WorkResultScene m_workResultSceneApi; private ResultWorkMgr.ResultType currentResultType; private ResultWorkCtrl m_ctrl; private ResultWorkAPI m_api; private DescResultTraining m_descTraining; private DescResultYotogi m_descYotogi; private DescResultWork m_descWork; private string m_SlotNoToAcquiredCommuBonus; private string currentActiveButton; private bool m_initResultDaytime; private bool m_initResultNight; private const string SE_PERFECT = "SE008.ogg"; private const string SE_SUCCESS = "SE002.ogg"; private const string SE_MISS = "SE021.ogg"; private const string uiRootPath = "/UI Root"; private const string BUTTON_NAME_TEMPLATE = "slot_{0}"; private const int DENOMINATOR_10 = 10; public enum ResultType { None, Daytime, Night } }