using System; using System.Collections; using System.Collections.Generic; using System.Linq; using com.workman.cm3d2.task; using PlayerStatus; using Schedule; using UnityEngine; public class ResultWorkCtrl : BaseCreateViewerCtrl { public Action ActionToDisplayCommuBonus { get; set; } public void Init(ResultWorkMgr resultWorkMgr, GameObject goPanel) { this.m_mgr = resultWorkMgr; this.m_goPanel = goPanel; foreach (GameObject gameObject in this.disableObjectList) { gameObject.SetActive(false); } } private void InitViewer() { this.m_scrollBar = UTY.GetChildObject(this.m_goPanel, "MaidStatusViewer/BG/Scroll Bar", false).GetComponent(); UIButton component = UTY.GetChildObject(this.m_goPanel, "Ok", false).GetComponent(); EventDelegate.Add(component.onClick, new EventDelegate.Callback(this.m_mgr.CloseResultWorkPanel)); this.m_unitPrefabPath = "SceneDaily/ResultWork/Prefab/MaidStatusUnit"; this.m_goUnitParent = UTY.GetChildObject(this.m_goPanel, "MaidStatusViewer/BG/Contents/SelectedMaidUnitParent", false); this.m_resultWorkIconPrefab = Resources.Load("SceneDaily/ResultWork/Prefab/ResultWorkIcon"); this.m_hasActiveColor = false; this.PlaySe(this.m_mgr.GetAudioClipName(ScheduleData.WorkSuccessLv.Success)); UILabel component2 = UTY.GetChildObject(this.m_goPanel, "MaidStatusViewer/Header/Frame_Time/Label", false).GetComponent(); if (this.m_mgr.GetCurrentResultType() == ResultWorkMgr.ResultType.Daytime) { component2.text = "昼"; } else if (this.m_mgr.GetCurrentResultType() == ResultWorkMgr.ResultType.Night) { component2.text = "夜"; } } public void CreateMaidStatusViewer(Dictionary dicMaidStatusAndTaskInfo, Dictionary dicResultWork) { if (!this.m_bInit) { this.InitViewer(); this.m_bInit = true; } this.m_dicMaidStatusAndTask = dicMaidStatusAndTaskInfo; this.m_dicResultWork = dicResultWork; base.CreateViewerWhenDataNotExist(dicMaidStatusAndTaskInfo); } protected override void SetDataForViewer() { for (int i = 0; i < 40; i++) { ScheduleCtrl.MaidStatusAndTaskUnit maidStatusAndTaskUnit = null; GameObject gameObject = UnityEngine.Object.Instantiate(this.m_goUnitPrefab); if (this.m_dicMaidStatusAndTask.TryGetValue(string.Format("slot_{0}", i), out maidStatusAndTaskUnit)) { ScheduleCtrl.SetMaidStatus(UTY.GetChildObject(gameObject, "MaidStatus", false), maidStatusAndTaskUnit); } else { ScheduleCtrl.SetEmptyMaidStatusResult(gameObject); } gameObject.name = string.Format("slot_{0}", i); base.SetTransformInfo(gameObject); GameObject childObject = UTY.GetChildObject(gameObject, "MaidStatus", false); GameObject childObject2 = UTY.GetChildObject(childObject, "SelectCursor", false); childObject2.SetActive(false); childObject.GetComponent().enabled = false; UIButton component = childObject.GetComponent(); BoxCollider component2 = childObject.GetComponent(); component.enabled = false; component2.enabled = false; childObject.name = string.Format("slot_{0}_" + ScheduleCtrl.SlotColumn.MaidStatus, i); GameObject childObject3 = UTY.GetChildObject(gameObject, "Task", false); if (maidStatusAndTaskUnit != null) { UIButton component3 = childObject3.GetComponent(); maidStatusAndTaskUnit.uiBtnDaytimeTask = component3; UITexture component4 = childObject3.GetComponent(); component4.mainTexture = maidStatusAndTaskUnit.taskIcon; component3.enabled = false; childObject3.GetComponent().enabled = false; } GameObject childObject4 = UTY.GetChildObject(childObject3, "SelectCursor", false); childObject4.SetActive(false); GameObject childObject5 = UTY.GetChildObject(childObject3, "NamePlate", false); childObject5.SetActive(false); childObject3.name = string.Format("slot_{0}_" + ScheduleCtrl.SlotColumn.DaytimeTask, i); GameObject childObject6 = UTY.GetChildObject(gameObject, "Icon_MaidClassMax", false); childObject6.SetActive(false); GameObject childObject7 = UTY.GetChildObject(gameObject, "Icon_YotogiClassMax", false); childObject7.SetActive(false); if (maidStatusAndTaskUnit != null) { ResultWorkCtrl.ResultWork resultWork = null; if (this.m_dicResultWork.TryGetValue(maidStatusAndTaskUnit.slotNo.ToString(), out resultWork)) { resultWork.goTask = childObject3; resultWork.goIconMaidClassMax = childObject6; resultWork.goIconYotogiClassMax = childObject7; bool flag = true; if (resultWork.taskType == ScheduleTaskCtrl.TaskType.Yotogi || resultWork.workId == ScheduleCSVData.faclilityPowerUpWorkId) { flag = false; } GameObject childObject8 = UTY.GetChildObject(gameObject, "CommuNoon", false); if (flag) { UIToggle component5 = childObject8.GetComponent(); component5.value = resultWork.commuFlag; } else { childObject8.SetActive(false); } GameObject childObject9 = UTY.GetChildObject(gameObject, "UpParam", false); ScheduleMaidStatusUnit component6 = childObject9.GetComponent(); component6.Init(this.m_mgr, i); this.ViewUpParam(component6, resultWork); this.ResultIcon(resultWork); } if (!DailyMgr.IsLegacy && maidStatusAndTaskUnit.maidStatus != null && maidStatusAndTaskUnit.maidStatus.maid != null) { GameMain.Instance.CharacterMgr.status.CheckTrophyMaidStatus(maidStatusAndTaskUnit.maidStatus.maid); } } } } private void ViewUpParam(ScheduleMaidStatusUnit upParamUnit, ResultWorkCtrl.ResultWork resultWork) { if (resultWork.taskType == ScheduleTaskCtrl.TaskType.Training) { ScheduleCSVData.Training training = ScheduleCSVData.TrainingData[resultWork.workId]; if (training.trainingType == ScheduleCSVData.TrainingType.Trainee) { upParamUnit.SetViewer(ScheduleMaidStatusUnit.DataType.Trainee); } else if (training.trainingType == ScheduleCSVData.TrainingType.Trainer) { upParamUnit.SetViewer(ScheduleMaidStatusUnit.DataType.Trainer); } else { upParamUnit.SetViewer(ScheduleMaidStatusUnit.DataType.Training); } } else if (resultWork.taskType == ScheduleTaskCtrl.TaskType.Yotogi) { upParamUnit.SetViewer(ScheduleMaidStatusUnit.DataType.Yotogi); } else if (resultWork.taskType == ScheduleTaskCtrl.TaskType.Work) { if (resultWork.workId == ScheduleCSVData.faclilityPowerUpWorkId) { upParamUnit.SetViewer(ScheduleMaidStatusUnit.DataType.Facility); } else { upParamUnit.SetViewer(ScheduleMaidStatusUnit.DataType.Work); } } } private void DisplayResultWorkIconBySlotNo(string slotNo) { ResultWorkCtrl.ResultWork resultWork = null; if (this.m_dicResultWork.TryGetValue(slotNo, out resultWork)) { int num = 34; float value = Mathf.Clamp(float.Parse(slotNo) - 5f, 0f, (float)num) / (float)num; this.m_scrollBar.value = value; this.ResultIcon(resultWork); this.PlaySe(resultWork.audioClipName); } } private void ResultIcon(ResultWorkCtrl.ResultWork resultWork) { GameObject gameObject = UnityEngine.Object.Instantiate(this.m_resultWorkIconPrefab); gameObject.GetComponent().mainTexture = resultWork.resultTaskIcon; GameObject goTask = resultWork.goTask; base.SetTransformInfo(goTask, gameObject); } private void PlaySe(string audioClipName) { GameMain.Instance.SoundMgr.PlaySe(audioClipName, false); } public void SetActiveViewer(ResultWorkMgr.ResultType result) { foreach (KeyValuePair keyValuePair in this.m_dicCanNotDispSimultaneouslyViewer) { if (result == keyValuePair.Key) { keyValuePair.Value.SetActive(true); } else { keyValuePair.Value.SetActive(false); } } } public string GetMaidIdByButtonName(string buttonName) { ScheduleCtrl.Slot slotByButtonName = ScheduleCtrl.GetSlotByButtonName(buttonName); ScheduleCtrl.MaidStatusAndTaskUnit maidStatusAndTaskUnit = null; if (this.m_dicMaidStatusAndTask.TryGetValue(slotByButtonName.slotNo, out maidStatusAndTaskUnit)) { return maidStatusAndTaskUnit.maidStatus.id; } return string.Empty; } public void SetSelectedRowActive(string buttonName) { ScheduleCtrl.Slot slotByButtonName = ScheduleCtrl.GetSlotByButtonName(buttonName); this.SetSelectedRowActiveBySlotNo(slotByButtonName.slotNo); } public void SetSelectedRowActiveByMaidId(string maidId) { string slotNoByMaidId = this.GetSlotNoByMaidId(maidId); this.SetSelectedRowActiveBySlotNo(slotNoByMaidId); } public string GetSlotNoByMaidId(string maidId) { foreach (KeyValuePair keyValuePair in this.m_dicMaidStatusAndTask) { if (keyValuePair.Value.maidStatus.id == maidId) { return keyValuePair.Key; } } return null; } public void SetSelectedRowActiveBySlotNo(string slotNo) { foreach (KeyValuePair keyValuePair in this.m_dicMaidStatusAndTask) { string key = keyValuePair.Key; ScheduleCtrl.MaidStatusAndTaskUnit value = keyValuePair.Value; Color defaultColor; if (slotNo == key) { value.goSelectCursorMaidStatus.SetActive(true); defaultColor = this.activeColor; } else { value.goSelectCursorMaidStatus.SetActive(false); defaultColor = this.inActiveColor; } value.uiBtnMaidStatus.defaultColor = defaultColor; if (value.uiBtnDaytimeTask != null) { value.uiBtnDaytimeTask.defaultColor = defaultColor; } if (value.uiBtnNightTask != null) { value.uiBtnNightTask.defaultColor = defaultColor; } } } public void AdjustParameterViewer(GameObject itemParent, int displayItemCount, int heightOfTitle, UISprite targetBG) { float num = 15f; float num2 = 25f; float num3 = 0f; if (displayItemCount > 0) { num3 += (float)heightOfTitle + num; float y = itemParent.GetComponent().padding.y; IEnumerator enumerator = itemParent.transform.GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; Transform transform = (Transform)obj; if (transform.gameObject.activeSelf) { UILabel component = transform.GetComponent(); num3 += (float)component.height + y * 2f; } } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } num3 += num2; targetBG.height = (int)num3; } } public void StartAnimation(Action onFinished = null) { List list = new List(); Action action = new Action(this.m_mgr.ClickMaidStatusByButtonName); Action action2 = new Action(this.DisplayResultWorkIconBySlotNo); IOrderedEnumerable> orderedEnumerable = from pair in this.m_dicMaidStatusAndTask orderby pair.Value.slotNo select pair; foreach (KeyValuePair keyValuePair in orderedEnumerable) { Task item = new Task(action, string.Format(keyValuePair.Key + "_" + ScheduleCtrl.SlotColumn.MaidStatus, new object[0])); Task item2 = new Task(action2, keyValuePair.Value.slotNo.ToString()); SyncTask item3 = new SyncTask(new List> { item, item2 }); list.Add(item3); } Task item4; if (!string.IsNullOrEmpty(this.m_mgr.SlotNoToAcquiredCommuBonus)) { item4 = new Task(new Action(this.m_mgr.ClickMaidStatusByButtonName), "slot_" + this.m_mgr.SlotNoToAcquiredCommuBonus + "_MaidStatus"); } else { string param = string.Format(this.m_dicMaidStatusAndTask.First>().Key + "_" + ScheduleCtrl.SlotColumn.MaidStatus, new object[0]); item4 = new Task(action, param); } list.Add(item4); this.GetTaskManager().listTask = list; this.m_taskMgr.StartTask(onFinished); } public void SetAllMaidStatusButtonEnable(bool enabled) { foreach (KeyValuePair keyValuePair in this.m_dicMaidStatusAndTask) { keyValuePair.Value.colliderMaidStatus.enabled = enabled; keyValuePair.Value.uiBtnMaidStatus.enabled = enabled; } } public ResultWorkCtrl.ResultWork GetResultWorkBySlotNo(int slotNo) { ResultWorkCtrl.ResultWork result = null; if (!this.m_dicResultWork.TryGetValue(slotNo.ToString(), out result)) { Debug.LogError(string.Format("不適切なスロットNoが選択されました。選択されたスロットNo={0}", slotNo)); return null; } return result; } private TaskMgr GetTaskManager() { if (this.m_taskMgr == null) { GameObject f_goParent = GameObject.Find("/UI Root"); GameObject childObject = UTY.GetChildObject(f_goParent, "Manager/TaskMgr", false); this.m_taskMgr = childObject.GetComponent(); return this.m_taskMgr; } return this.m_taskMgr; } public void StopCoroutineIfRunning() { if (this.m_taskMgr != null) { this.m_taskMgr.Stop(); } } public void OnFinished() { } public const string NOTHING = "0"; private const int CONTENS_DISPLAYMAX = 6; private ResultWorkMgr m_mgr; private TaskMgr m_taskMgr; private GameObject m_goPanel; private GameObject m_resultWorkIconPrefab; private UIScrollBar m_scrollBar; private Dictionary m_dicCanNotDispSimultaneouslyViewer; private Dictionary m_dicMaidStatusAndTask; private Dictionary m_dicResultWork; private Color activeColor; private Color inActiveColor; private bool m_hasActiveColor; private bool m_bInit; private const string UNIT_PARENT_PATH = "MaidStatusViewer/BG/Contents/SelectedMaidUnitParent"; private const string UNIT_PREFAB_PATH = "SceneDaily/ResultWork/Prefab/MaidStatusUnit"; private const string RESULT_WORK_ICON_PREFAB = "SceneDaily/ResultWork/Prefab/ResultWorkIcon"; [SerializeField] private List disableObjectList = new List(); public class ResultWork { public ScheduleTaskCtrl.TaskType taskType; public ScheduleData.WorkSuccessLv successLv = ScheduleData.WorkSuccessLv.Success; public int workId; public int slotNo; public bool hasResult; public string audioClipName; public bool commuFlag; public ResultWorkCtrl.UpperMaidStatus upperMaidStatus; public Texture2D resultTaskIcon; public GameObject goTask; public GameObject goIconMaidClassMax; public GameObject goIconYotogiClassMax; public ScheduleMaidStatusUnit upParamUnit; } public class UpperMaidStatus { public string maidId; public int studyRate; public int likability; public int reception; public int care; public int lovely; public int elegance; public int charm; public int teach; public int maidClassLevel; public int maidClassExp; public int cooking; public int vocal; public int dance; public int appealPoint; public bool maidLvCompletion; public bool givenCommuBonus; public bool givenPerfectSucces; public Texture2D bonusIcon; public Texture2D perfectSuccessIcon; public int inyoku; public int m_value; public int hentai; public int housi; public int evaluation; public long income; public int yotogiClassLevel; public int yotogiClassExp; public int yotogiPlayCount; public int othersPlayCount; public bool yotogiLvCompletion; public long workingFunds; } public class ResultStatus { public int slotNo; public ResultWorkCtrl.UpperMaidStatus maidStatus; } }