ScheduleTaskCtrl.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using MaidStatus;
  5. using Schedule;
  6. using UnityEngine;
  7. public class ScheduleTaskCtrl : BaseCreateViewerCtrl
  8. {
  9. public ScheduleScene ScheduleApi
  10. {
  11. get
  12. {
  13. return this.m_scheduleApi;
  14. }
  15. }
  16. public ScheduleMgr ScheduleMgr
  17. {
  18. get
  19. {
  20. return this.m_scheduleMgr;
  21. }
  22. }
  23. public ScheduleCtrl ScheduleCtrl
  24. {
  25. get
  26. {
  27. return this.m_scheduleCtrl;
  28. }
  29. }
  30. public ScheduleTaskViewer TaskViewer
  31. {
  32. get
  33. {
  34. return this.m_taskViewer;
  35. }
  36. }
  37. public List<ScheduleBase> GetWorksData(ScheduleTaskCtrl.TaskType type)
  38. {
  39. return this.m_listWorksData[type];
  40. }
  41. public int CurrentActiveSlotNo
  42. {
  43. get
  44. {
  45. return this.m_currentActiveSlotNo;
  46. }
  47. }
  48. public void Init(ScheduleMgr scheduleMgr, ScheduleCtrl scheduleCtrl, GameObject goPanel)
  49. {
  50. this.m_scheduleMgr = scheduleMgr;
  51. this.m_scheduleCtrl = scheduleCtrl;
  52. this.m_goScheduleTaskViewer = UTY.GetChildObject(goPanel, "ScheduleTaskViewer", false);
  53. this.m_taskViewer = UTY.GetChildObject(goPanel, "ScheduleTaskViewer", false).GetComponent<ScheduleTaskViewer>();
  54. this.m_taskViewer.taskCtrl = this;
  55. }
  56. private void InitViewer()
  57. {
  58. this.m_unitPrefabPath = "SceneDaily/Schedule/Prefab/NightTaskUnit";
  59. GameObject childObject = UTY.GetChildObject(this.m_goScheduleTaskViewer, "TaskViewer", false);
  60. this.m_goUnitParent = UTY.GetChildObject(childObject, "Contents/TaskUnitParent", false);
  61. this.m_content = UTY.GetChildObject(childObject, "Contents", false);
  62. this.m_contentPosY = this.m_content.transform.localPosition.y;
  63. this.m_taskScrollView = UTY.GetChildObject(childObject, "Contents", false).GetComponent<UIScrollView>();
  64. GameObject childObject2 = UTY.GetChildObject(this.m_goScheduleTaskViewer, "DescScheduleYotogi", false);
  65. this.m_lDescription = UTY.GetChildObject(childObject2, "Description/Message", false).GetComponent<UILabel>();
  66. this.m_goConditionParent = UTY.GetChildObject(childObject2, "Condition/ConditionParent", false);
  67. this.m_goTitleOfConditiont = UTY.GetChildObject(childObject2, "Condition/Title", false);
  68. this.m_goConditionUnit = (Resources.Load("SceneDaily/Schedule/Prefab/ConditionUnit") as GameObject);
  69. this.m_taskScrollBar = UTY.GetChildObject(childObject, "Scroll Bar", false).GetComponent<UIScrollBar>();
  70. this.m_spBGOfDescriptionViewer = UTY.GetChildObject(childObject2, "BG", false).GetComponent<UISprite>();
  71. this.m_heightOfconditionTitle = this.m_goTitleOfConditiont.GetComponent<UISprite>().height;
  72. childObject2.SetActive(false);
  73. childObject.SetActive(false);
  74. }
  75. public void CreateTaskViewer(string buttonName)
  76. {
  77. this.CreateTaskViewer(buttonName, ScheduleTaskViewer.ScheduleTime);
  78. }
  79. public void CreateTaskViewer(string buttonName, ScheduleMgr.ScheduleTime scheduleTime)
  80. {
  81. if (!this.m_bInit)
  82. {
  83. this.InitViewer();
  84. this.m_bInit = true;
  85. }
  86. ScheduleTaskViewer.ScheduleTime = scheduleTime;
  87. this.m_scheduleCtrl.SetMaidIdByButtonName(buttonName);
  88. this.m_scheduleCtrl.SetViewerActive(ScheduleCtrl.ExclusiveViewer.Task);
  89. this.m_scheduleCtrl.SetSelectedRowActive(buttonName);
  90. this.m_currentActiveSlotNo = ScheduleCtrl.GetSlotNoByButtonName(buttonName);
  91. this.m_listTaskButton = new Dictionary<ScheduleTaskCtrl.TaskType, List<ScheduleTaskCtrl.TaskButton>>();
  92. this.m_listWorksData = new Dictionary<ScheduleTaskCtrl.TaskType, List<ScheduleBase>>();
  93. if (!DailyMgr.IsLegacy)
  94. {
  95. GameMain.Instance.FacilityMgr.UpdateFacilityAssignedMaidData();
  96. }
  97. this.m_scheduleMgr.GetScheduleApi().Update(this.CurrentActiveSlotNo);
  98. List<ScheduleTaskCtrl.TaskButton> list = this.LoadYotogiData(this.m_currentActiveSlotNo);
  99. this.m_listTaskButton.Add(ScheduleTaskCtrl.TaskType.Yotogi, list);
  100. List<ScheduleTaskViewer.ViewData> list2 = new List<ScheduleTaskViewer.ViewData>();
  101. for (int i = 0; i < list.Count; i++)
  102. {
  103. ScheduleTaskViewer.ViewData item = default(ScheduleTaskViewer.ViewData);
  104. ScheduleTaskCtrl.YotogiTaskButton yotogiTaskButton = (ScheduleTaskCtrl.YotogiTaskButton)list[i];
  105. item.taskButton = yotogiTaskButton;
  106. item.schedule = ScheduleCSVData.AllData[yotogiTaskButton.data.id];
  107. item.is_enabled = list[i].enableTask;
  108. if (!GameMain.Instance.CharacterMgr.status.lockNTRPlay || !ScheduleCSVData.NetorareFlag.Contains(item.schedule.id))
  109. {
  110. list2.Add(item);
  111. }
  112. }
  113. List<ScheduleTaskCtrl.TaskButton> list3 = this.LoadTrainingData(this.m_currentActiveSlotNo);
  114. this.m_listTaskButton.Add(ScheduleTaskCtrl.TaskType.Training, list3);
  115. List<ScheduleTaskViewer.ViewData> list4 = new List<ScheduleTaskViewer.ViewData>();
  116. for (int j = 0; j < list3.Count; j++)
  117. {
  118. ScheduleTaskViewer.ViewData item2 = default(ScheduleTaskViewer.ViewData);
  119. ScheduleTaskCtrl.TrainingTaskButton trainingTaskButton = (ScheduleTaskCtrl.TrainingTaskButton)list3[j];
  120. item2.taskButton = trainingTaskButton;
  121. item2.schedule = ScheduleCSVData.AllData[int.Parse(trainingTaskButton.id)];
  122. item2.is_enabled = list3[j].enableTask;
  123. list4.Add(item2);
  124. }
  125. List<ScheduleTaskCtrl.TaskButton> list5 = this.LoadWorkData(this.m_currentActiveSlotNo);
  126. this.m_listTaskButton.Add(ScheduleTaskCtrl.TaskType.Work, list5);
  127. List<ScheduleTaskViewer.ViewData> list6 = new List<ScheduleTaskViewer.ViewData>();
  128. for (int k = 0; k < list5.Count; k++)
  129. {
  130. ScheduleTaskViewer.ViewData item3 = default(ScheduleTaskViewer.ViewData);
  131. ScheduleTaskCtrl.WorkTaskButton workTaskButton = (ScheduleTaskCtrl.WorkTaskButton)list5[k];
  132. item3.taskButton = workTaskButton;
  133. item3.schedule = ScheduleCSVData.AllData[int.Parse(workTaskButton.id)];
  134. item3.is_enabled = list5[k].enableTask;
  135. list6.Add(item3);
  136. }
  137. Dictionary<ScheduleTaskCtrl.TaskType, List<ScheduleTaskViewer.ViewData>> dictionary = new Dictionary<ScheduleTaskCtrl.TaskType, List<ScheduleTaskViewer.ViewData>>();
  138. dictionary.Add(ScheduleTaskCtrl.TaskType.Yotogi, list2);
  139. dictionary.Add(ScheduleTaskCtrl.TaskType.Training, list4);
  140. dictionary.Add(ScheduleTaskCtrl.TaskType.Work, list6);
  141. Dictionary<ScheduleMgr.ScheduleTime, ScheduleCSVData.ScheduleBase> dictionary2 = new Dictionary<ScheduleMgr.ScheduleTime, ScheduleCSVData.ScheduleBase>();
  142. dictionary2.Add(ScheduleMgr.ScheduleTime.Night, ScheduleCSVData.AllData[int.Parse(this.GetTaskId(ScheduleMgr.ScheduleTime.Night))]);
  143. dictionary2.Add(ScheduleMgr.ScheduleTime.DayTime, ScheduleCSVData.AllData[int.Parse(this.GetTaskId(ScheduleMgr.ScheduleTime.DayTime))]);
  144. this.m_taskViewer.Call(this.m_scheduleCtrl.SelectedMaid, scheduleTime, dictionary, dictionary2);
  145. Action<ScheduleCSVData.ScheduleBase> onClickWorkUnitEvent = delegate(ScheduleCSVData.ScheduleBase click_unit)
  146. {
  147. this.SetWorkId(ScheduleTaskViewer.ScheduleTime, click_unit.id);
  148. string currentActiveButton = this.m_scheduleMgr.CurrentActiveButton;
  149. this.m_scheduleMgr.UpdateMaidStatus();
  150. this.m_scheduleCtrl.SetViewerActive(ScheduleCtrl.ExclusiveViewer.Task);
  151. this.m_scheduleCtrl.SetMaidIdByButtonName(currentActiveButton);
  152. this.m_scheduleCtrl.SetSelectedRowActive(currentActiveButton);
  153. this.m_scheduleMgr.CurrentActiveButton = currentActiveButton;
  154. };
  155. this.m_taskViewer.onClickWorkUnitEvent = onClickWorkUnitEvent;
  156. }
  157. private void ResetPosition()
  158. {
  159. this.m_taskScrollView.ResetPosition();
  160. this.m_content.transform.localPosition = new Vector2(this.m_content.transform.localPosition.x, this.m_contentPosY);
  161. }
  162. protected override void SetDataForViewer()
  163. {
  164. this.m_dicTask = new Dictionary<ScheduleTaskCtrl.TaskType, Dictionary<string, ScheduleTaskCtrl.TaskButton>>();
  165. this.m_dicTask.Add(ScheduleTaskCtrl.TaskType.Yotogi, this.AddYotogiTaskButton(ScheduleTaskCtrl.TaskType.Yotogi));
  166. this.m_dicTask.Add(ScheduleTaskCtrl.TaskType.Training, this.AddTrainingTaskButton(ScheduleTaskCtrl.TaskType.Training));
  167. }
  168. private Dictionary<string, ScheduleTaskCtrl.TaskButton> AddTrainingTaskButton(ScheduleTaskCtrl.TaskType taskType)
  169. {
  170. Dictionary<string, ScheduleTaskCtrl.TaskButton> dictionary = new Dictionary<string, ScheduleTaskCtrl.TaskButton>();
  171. int num = 0;
  172. foreach (ScheduleTaskCtrl.TaskButton taskButton in this.m_listTaskButton[taskType])
  173. {
  174. ScheduleTaskCtrl.TrainingTaskButton trainingTaskButton = (ScheduleTaskCtrl.TrainingTaskButton)taskButton;
  175. GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(this.m_goUnitPrefab);
  176. gameObject.name = trainingTaskButton.id;
  177. GameObject childObject = UTY.GetChildObject(gameObject, "Main", false);
  178. childObject.name = trainingTaskButton.id;
  179. base.SetTransformInfo(gameObject);
  180. UILabel component = UTY.GetChildObject(gameObject, "Title", false).GetComponent<UILabel>();
  181. component.text = trainingTaskButton.name;
  182. UITexture component2 = childObject.GetComponent<UITexture>();
  183. component2.mainTexture = trainingTaskButton.txtTaskIcon;
  184. this.SetDaytimeTaskRank(gameObject, trainingTaskButton.rank);
  185. this.SetExpRatio(gameObject, trainingTaskButton.expRatio);
  186. if (trainingTaskButton.type == ScheduleCSVData.TrainingType.Travel)
  187. {
  188. UTY.GetChildObject(gameObject, "Stars", false).SetActive(false);
  189. UTY.GetChildObject(gameObject, "ExpRatio", false).SetActive(false);
  190. Transform transform = UTY.GetChildObject(gameObject, "Title", false).transform;
  191. Vector3 localPosition = transform.localPosition;
  192. localPosition.y = -55f;
  193. transform.localPosition = localPosition;
  194. }
  195. GameObject childObject2 = UTY.GetChildObject(childObject, "SelectCursor", false);
  196. childObject2.SetActive(false);
  197. trainingTaskButton.selectCursor = childObject2;
  198. trainingTaskButton.order = num;
  199. UIButton component3 = childObject.GetComponent<UIButton>();
  200. trainingTaskButton.btnTask = component3;
  201. EventDelegate eventDelegate = new EventDelegate(this.m_scheduleMgr, "ClickTask");
  202. eventDelegate.parameters[0].value = ScheduleMgr.ScheduleTime.DayTime;
  203. EventDelegate.Add(component3.onClick, eventDelegate);
  204. if (!trainingTaskButton.enableTask)
  205. {
  206. Debug.Log(string.Format("選択できないタスクです。タスクID={0}, タスク名={1}", trainingTaskButton.id, trainingTaskButton.name));
  207. }
  208. dictionary.Add(trainingTaskButton.id, trainingTaskButton);
  209. num++;
  210. }
  211. return dictionary;
  212. }
  213. private void SetDaytimeTaskRank(GameObject go, int rank)
  214. {
  215. List<GameObject> list = new List<GameObject>();
  216. GameObject childObject = UTY.GetChildObject(go, "Stars/Icon", false);
  217. IEnumerator enumerator = childObject.transform.GetEnumerator();
  218. try
  219. {
  220. while (enumerator.MoveNext())
  221. {
  222. object obj = enumerator.Current;
  223. Transform transform = (Transform)obj;
  224. list.Add(transform.gameObject);
  225. }
  226. }
  227. finally
  228. {
  229. IDisposable disposable;
  230. if ((disposable = (enumerator as IDisposable)) != null)
  231. {
  232. disposable.Dispose();
  233. }
  234. }
  235. int count = list.Count;
  236. for (int i = 0; i < count; i++)
  237. {
  238. if (rank > i)
  239. {
  240. list[i].SetActive(true);
  241. }
  242. else
  243. {
  244. list[i].SetActive(false);
  245. }
  246. }
  247. }
  248. private void SetExpRatio(GameObject go, int expRatio)
  249. {
  250. List<GameObject> list = new List<GameObject>();
  251. GameObject childObject = UTY.GetChildObject(go, "ExpRatio/ValueGroup", false);
  252. IEnumerator enumerator = childObject.transform.GetEnumerator();
  253. try
  254. {
  255. while (enumerator.MoveNext())
  256. {
  257. object obj = enumerator.Current;
  258. Transform transform = (Transform)obj;
  259. list.Add(transform.gameObject);
  260. }
  261. }
  262. finally
  263. {
  264. IDisposable disposable;
  265. if ((disposable = (enumerator as IDisposable)) != null)
  266. {
  267. disposable.Dispose();
  268. }
  269. }
  270. int count = list.Count;
  271. for (int i = 0; i < count; i++)
  272. {
  273. if (expRatio > i)
  274. {
  275. list[i].SetActive(true);
  276. }
  277. else
  278. {
  279. list[i].SetActive(false);
  280. }
  281. }
  282. }
  283. private Dictionary<string, ScheduleTaskCtrl.TaskButton> AddYotogiTaskButton(ScheduleTaskCtrl.TaskType taskType)
  284. {
  285. Dictionary<string, ScheduleTaskCtrl.TaskButton> dictionary = new Dictionary<string, ScheduleTaskCtrl.TaskButton>();
  286. int num = 0;
  287. foreach (ScheduleTaskCtrl.TaskButton taskButton in this.m_listTaskButton[taskType])
  288. {
  289. GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(this.m_goUnitPrefab);
  290. gameObject.name = taskButton.id;
  291. GameObject childObject = UTY.GetChildObject(gameObject, "Main", false);
  292. childObject.name = taskButton.id;
  293. base.SetTransformInfo(gameObject);
  294. UILabel component = UTY.GetChildObject(gameObject, "Title", false).GetComponent<UILabel>();
  295. component.text = taskButton.name;
  296. UITexture component2 = childObject.GetComponent<UITexture>();
  297. component2.mainTexture = taskButton.txtTaskIcon;
  298. GameObject childObject2 = UTY.GetChildObject(childObject, "SelectCursor", false);
  299. childObject2.SetActive(false);
  300. taskButton.selectCursor = childObject2;
  301. taskButton.order = num;
  302. UIButton component3 = childObject.GetComponent<UIButton>();
  303. taskButton.btnTask = component3;
  304. EventDelegate eventDelegate = new EventDelegate(this.m_scheduleMgr, "ClickTask");
  305. eventDelegate.parameters[0].value = ScheduleMgr.ScheduleTime.Night;
  306. EventDelegate.Add(component3.onClick, eventDelegate);
  307. if (!taskButton.enableTask)
  308. {
  309. Debug.Log(string.Format("選択できないタスクです。タスクID={0}, タスク名={1}", taskButton.id, taskButton.name));
  310. }
  311. dictionary.Add(taskButton.id, taskButton);
  312. num++;
  313. }
  314. return dictionary;
  315. }
  316. public void UpdateTaskViewer(string taskId)
  317. {
  318. this.LoadYotogiTaskData(taskId);
  319. this.SetTaskButtonActive(ScheduleTaskCtrl.TaskType.Yotogi, taskId);
  320. }
  321. private string GetTaskId(ScheduleMgr.ScheduleTime workTime)
  322. {
  323. ScheduleCtrl.MaidStatusAndTaskUnit maidStatusAndTaskUnit = null;
  324. Dictionary<string, ScheduleCtrl.MaidStatusAndTaskUnit> dicMaidStatusAndTask = this.m_scheduleCtrl.GetDicMaidStatusAndTask();
  325. if (dicMaidStatusAndTask.TryGetValue(this.m_scheduleCtrl.GetActiveSlotNo(), out maidStatusAndTaskUnit))
  326. {
  327. if (workTime == ScheduleMgr.ScheduleTime.Night)
  328. {
  329. return maidStatusAndTaskUnit.nightTaskId;
  330. }
  331. if (workTime == ScheduleMgr.ScheduleTime.DayTime)
  332. {
  333. return maidStatusAndTaskUnit.daytimeTaskId;
  334. }
  335. }
  336. return null;
  337. }
  338. private void LoadYotogiTaskData(string taskId)
  339. {
  340. int num = int.Parse(taskId);
  341. this.m_listCondition = new List<ScheduleCtrl.VariableItem>();
  342. foreach (ScheduleBase scheduleBase in this.m_listWorksData[ScheduleTaskCtrl.TaskType.Yotogi])
  343. {
  344. if (scheduleBase.id == num)
  345. {
  346. ScheduleYotogi scheduleYotogi = (ScheduleYotogi)scheduleBase;
  347. this.m_lDescription.text = scheduleYotogi.info;
  348. base.DelChildGameObject(this.m_goConditionParent);
  349. int num2 = 1;
  350. if (scheduleYotogi.condInfo != null && scheduleYotogi.condInfo.Count > 0)
  351. {
  352. foreach (string text in scheduleYotogi.condInfo)
  353. {
  354. GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(this.m_goConditionUnit);
  355. gameObject.name = "condition_" + num2;
  356. base.SetTransformInfo(this.m_goConditionParent, gameObject);
  357. UILabel component = UTY.GetChildObject(gameObject, "No", false).GetComponent<UILabel>();
  358. component.text = num2.ToString();
  359. UILabel component2 = UTY.GetChildObject(gameObject, "Message", false).GetComponent<UILabel>();
  360. component2.text = text;
  361. ScheduleCtrl.VariableItem item = new ScheduleCtrl.VariableItem(gameObject, component2);
  362. this.m_listCondition.Add(item);
  363. num2++;
  364. }
  365. }
  366. }
  367. }
  368. this.ExamineDisplayItem();
  369. }
  370. private void ExamineDisplayItem()
  371. {
  372. int num = ScheduleCtrl.SetActiveExceptForNothing(this.m_listCondition, this.NOTHING);
  373. bool active = num > 0;
  374. this.m_goTitleOfConditiont.SetActive(active);
  375. BaseCreateViewerCtrl.Reposition(this.m_goConditionParent);
  376. this.AdjustConditon(num);
  377. }
  378. private void AdjustConditon(int displayConditionCount)
  379. {
  380. float num = 260f;
  381. float num2 = 10f;
  382. float num3 = 25f;
  383. float num4 = 4f;
  384. float num5 = 0f;
  385. if (displayConditionCount > 0)
  386. {
  387. num5 += (float)this.m_heightOfconditionTitle + num2;
  388. float y = this.m_goConditionParent.GetComponent<UITable>().padding.y;
  389. IEnumerator enumerator = this.m_goConditionParent.transform.GetEnumerator();
  390. try
  391. {
  392. while (enumerator.MoveNext())
  393. {
  394. object obj = enumerator.Current;
  395. Transform transform = (Transform)obj;
  396. if (transform.gameObject.activeSelf)
  397. {
  398. UILabel component = transform.Find("Message").GetComponent<UILabel>();
  399. num5 += (float)component.height + y * 2f + num4;
  400. }
  401. }
  402. }
  403. finally
  404. {
  405. IDisposable disposable;
  406. if ((disposable = (enumerator as IDisposable)) != null)
  407. {
  408. disposable.Dispose();
  409. }
  410. }
  411. num5 += num3;
  412. }
  413. this.m_spBGOfDescriptionViewer.height = (int)(num + num5);
  414. }
  415. public void SetTaskButtonActive(ScheduleTaskCtrl.TaskType type, string taskId)
  416. {
  417. foreach (KeyValuePair<string, ScheduleTaskCtrl.TaskButton> keyValuePair in this.m_dicTask[type])
  418. {
  419. string key = keyValuePair.Key;
  420. ScheduleTaskCtrl.TaskButton value = keyValuePair.Value;
  421. if (key == taskId)
  422. {
  423. if (value.enableTask)
  424. {
  425. value.btnTask.defaultColor = this.m_scheduleCtrl.GetActiveColor();
  426. }
  427. else
  428. {
  429. value.btnTask.defaultColor = this.m_scheduleCtrl.GetDisableColor();
  430. }
  431. value.selectCursor.SetActive(true);
  432. }
  433. else
  434. {
  435. value.selectCursor.SetActive(false);
  436. value.btnTask.defaultColor = this.m_scheduleCtrl.GetInActiveColor();
  437. }
  438. }
  439. }
  440. public void UpdateSelectedMaidTask(string taskId)
  441. {
  442. this.SetWorkId(ScheduleTaskViewer.ScheduleTime, int.Parse(taskId));
  443. string currentActiveButton = this.m_scheduleMgr.CurrentActiveButton;
  444. this.m_scheduleMgr.UpdateMaidStatus();
  445. this.CreateTaskViewer(currentActiveButton);
  446. this.m_scheduleMgr.CurrentActiveButton = currentActiveButton;
  447. }
  448. public void SetCommu(ScheduleMgr.ScheduleTime workTime, string guid, bool value)
  449. {
  450. CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
  451. for (int i = 0; i < characterMgr.GetStockMaidCount(); i++)
  452. {
  453. Maid stockMaid = characterMgr.GetStockMaid(i);
  454. bool flag = false;
  455. if (stockMaid.status.guid == guid)
  456. {
  457. flag = value;
  458. }
  459. if (stockMaid.status.guid == guid || flag)
  460. {
  461. if (workTime == ScheduleMgr.ScheduleTime.DayTime)
  462. {
  463. stockMaid.status.noonCommu = flag;
  464. }
  465. else if (workTime == ScheduleMgr.ScheduleTime.Night)
  466. {
  467. stockMaid.status.nightCommu = flag;
  468. }
  469. }
  470. }
  471. }
  472. private void SetWorkId(ScheduleMgr.ScheduleTime workTime, int taskId)
  473. {
  474. if (ScheduleCSVData.AllData.ContainsKey(taskId))
  475. {
  476. ScheduleCSVData.ScheduleBase scheduleBase = ScheduleCSVData.AllData[taskId];
  477. int slotId = 0;
  478. for (int i = 0; i < 40; i++)
  479. {
  480. Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
  481. if (scheduleSlot != null && scheduleSlot == this.m_scheduleCtrl.SelectedMaid)
  482. {
  483. slotId = i;
  484. }
  485. }
  486. ScheduleTaskCtrl.TaskType type = scheduleBase.type;
  487. if (type != ScheduleTaskCtrl.TaskType.Training && type != ScheduleTaskCtrl.TaskType.Work)
  488. {
  489. if (type == ScheduleTaskCtrl.TaskType.Yotogi)
  490. {
  491. this.m_scheduleApi.SetNightWorkSlot_Safe(workTime, slotId, taskId);
  492. }
  493. }
  494. else
  495. {
  496. this.m_scheduleApi.SetNoonWorkSlot_Safe(workTime, slotId, taskId);
  497. }
  498. }
  499. if (!DailyMgr.IsLegacy)
  500. {
  501. GameMain.Instance.FacilityMgr.UpdateFacilityAssignedMaidData();
  502. }
  503. ScheduleAPI.MaidWorkIdErrorCheck(true);
  504. }
  505. private List<ScheduleTaskCtrl.TaskButton> LoadYotogiData(int slotNo)
  506. {
  507. this.m_scheduleApi = this.m_scheduleMgr.GetScheduleApi();
  508. List<ScheduleBase> scheduleData = this.m_scheduleApi.slot[slotNo].scheduleData;
  509. List<ScheduleBase> list = new List<ScheduleBase>();
  510. Maid maid = this.m_scheduleApi.slot[slotNo].maid;
  511. this.m_listWorksData.Add(ScheduleTaskCtrl.TaskType.Yotogi, list);
  512. List<ScheduleTaskCtrl.TaskButton> list2 = new List<ScheduleTaskCtrl.TaskButton>();
  513. foreach (ScheduleBase scheduleBase in scheduleData)
  514. {
  515. list.Add(scheduleBase);
  516. if (scheduleBase.workType == ScheduleType.Yotogi)
  517. {
  518. ScheduleYotogi scheduleYotogi = (ScheduleYotogi)scheduleBase;
  519. bool flag = scheduleYotogi.visible;
  520. if (flag && maid != null)
  521. {
  522. flag = PersonalEventBlocker.IsEnabledScheduleTask(maid.status.personal, scheduleBase.id);
  523. }
  524. if (flag)
  525. {
  526. list2.Add(new ScheduleTaskCtrl.YotogiTaskButton
  527. {
  528. id = scheduleYotogi.id.ToString(),
  529. name = scheduleYotogi.name,
  530. txtTaskIcon = scheduleYotogi.icon,
  531. enableTask = scheduleYotogi.enabled,
  532. data = scheduleYotogi
  533. });
  534. }
  535. }
  536. }
  537. return list2;
  538. }
  539. private List<ScheduleTaskCtrl.TaskButton> LoadTrainingData(int slotNo)
  540. {
  541. this.m_scheduleApi = this.m_scheduleMgr.GetScheduleApi();
  542. List<ScheduleBase> scheduleData = this.m_scheduleApi.slot[slotNo].scheduleData;
  543. List<ScheduleBase> list = new List<ScheduleBase>();
  544. Maid maid = this.m_scheduleApi.slot[slotNo].maid;
  545. this.m_listWorksData.Add(ScheduleTaskCtrl.TaskType.Training, list);
  546. this.m_currentSlotInfo = this.m_scheduleApi.slot[slotNo];
  547. List<ScheduleTaskCtrl.TaskButton> list2 = new List<ScheduleTaskCtrl.TaskButton>();
  548. foreach (ScheduleBase scheduleBase in scheduleData)
  549. {
  550. list.Add(scheduleBase);
  551. if (scheduleBase.workType == ScheduleType.Training)
  552. {
  553. ScheduleTraining scheduleTraining = (ScheduleTraining)scheduleBase;
  554. bool flag = scheduleTraining.visible;
  555. if (flag && maid != null)
  556. {
  557. flag = PersonalEventBlocker.IsEnabledScheduleTask(maid.status.personal, scheduleBase.id);
  558. }
  559. if (flag)
  560. {
  561. list2.Add(new ScheduleTaskCtrl.TrainingTaskButton
  562. {
  563. id = scheduleTraining.id.ToString(),
  564. name = scheduleTraining.name,
  565. rank = scheduleTraining.lv,
  566. expRatio = scheduleTraining.expRatioFrom0To10,
  567. txtTaskIcon = scheduleTraining.icon,
  568. enableTask = scheduleTraining.enabled,
  569. type = scheduleTraining.type
  570. });
  571. }
  572. }
  573. }
  574. return list2;
  575. }
  576. private List<ScheduleTaskCtrl.TaskButton> LoadWorkData(int slotNo)
  577. {
  578. this.m_scheduleApi = this.m_scheduleMgr.GetScheduleApi();
  579. List<ScheduleBase> scheduleData = this.m_scheduleApi.slot[slotNo].scheduleData;
  580. List<ScheduleBase> list = new List<ScheduleBase>();
  581. Maid maid = this.m_scheduleApi.slot[slotNo].maid;
  582. this.m_listWorksData.Add(ScheduleTaskCtrl.TaskType.Work, list);
  583. this.m_currentSlotInfo = this.m_scheduleApi.slot[slotNo];
  584. List<ScheduleTaskCtrl.TaskButton> list2 = new List<ScheduleTaskCtrl.TaskButton>();
  585. foreach (ScheduleBase scheduleBase in scheduleData)
  586. {
  587. list.Add(scheduleBase);
  588. if (scheduleBase.workType == ScheduleType.Work)
  589. {
  590. ScheduleWork scheduleWork = (ScheduleWork)scheduleBase;
  591. bool flag = scheduleWork.visible;
  592. if (flag && maid != null)
  593. {
  594. flag = PersonalEventBlocker.IsEnabledScheduleTask(maid.status.personal, scheduleBase.id);
  595. }
  596. if (flag)
  597. {
  598. list2.Add(new ScheduleTaskCtrl.WorkTaskButton
  599. {
  600. id = scheduleWork.id.ToString(),
  601. name = scheduleWork.name,
  602. rank = scheduleWork.lv,
  603. expRatio = scheduleWork.expRatioFrom0To10,
  604. txtTaskIcon = scheduleWork.icon,
  605. enableTask = scheduleWork.enabled,
  606. type = scheduleWork.type
  607. });
  608. }
  609. }
  610. }
  611. return list2;
  612. }
  613. private string Sign(int input, string format = null)
  614. {
  615. if (input <= 0)
  616. {
  617. return input.ToString();
  618. }
  619. if (format != null)
  620. {
  621. return "+" + input.ToString(format);
  622. }
  623. return "+" + input.ToString();
  624. }
  625. public bool CanSetTask(ScheduleTaskCtrl.TaskType type, int taskId)
  626. {
  627. foreach (ScheduleBase scheduleBase in this.m_listWorksData[type])
  628. {
  629. if (scheduleBase.id == taskId)
  630. {
  631. return scheduleBase.enabled;
  632. }
  633. }
  634. return false;
  635. }
  636. private ScheduleMgr m_scheduleMgr;
  637. private ScheduleCtrl m_scheduleCtrl;
  638. private ScheduleScene m_scheduleApi;
  639. private ScheduleTaskViewer m_taskViewer;
  640. private ScheduleRoomCtrl m_roomViewer;
  641. private Dictionary<ScheduleTaskCtrl.TaskType, Dictionary<string, ScheduleTaskCtrl.TaskButton>> m_dicTask;
  642. private Dictionary<ScheduleTaskCtrl.TaskType, List<ScheduleTaskCtrl.TaskButton>> m_listTaskButton;
  643. private Dictionary<ScheduleTaskCtrl.TaskType, List<ScheduleBase>> m_listWorksData;
  644. private List<ScheduleCtrl.VariableItem> m_listCondition;
  645. private GameObject m_goScheduleTaskViewer;
  646. private GameObject m_goTitleOfConditiont;
  647. private GameObject m_goConditionParent;
  648. private GameObject m_goConditionUnit;
  649. private GameObject m_content;
  650. private UISprite m_spBGOfParameterViewer;
  651. private UILabel m_lStudyRate;
  652. private UILabel m_lReception;
  653. private UILabel m_lCare;
  654. private UILabel m_lLovely;
  655. private UILabel m_lElegance;
  656. private UILabel m_lCharm;
  657. private UILabel m_lTeachRate;
  658. private UILabel m_lMaidClassExp;
  659. private UILabel m_lCleanliness;
  660. private UILabel m_lBrilliant;
  661. private UILabel m_lIncome;
  662. private UILabel m_lCurrentStudyRate;
  663. private UILabel m_lCurrentReception;
  664. private UILabel m_lCurrentCare;
  665. private UILabel m_lCurrentLovely;
  666. private UILabel m_lCurrentElegance;
  667. private UILabel m_lCurrentCharm;
  668. private UILabel m_lCurrentTeachRate;
  669. private UILabel m_lCurrentMaidClassExp;
  670. private UILabel m_lRoomName;
  671. private Slot m_currentSlotInfo;
  672. private UIScrollView m_taskScrollView;
  673. private UIScrollBar m_taskScrollBar;
  674. private UISprite m_spBGOfDescriptionViewer;
  675. private UILabel m_lDescription;
  676. private bool m_bInit;
  677. private float m_contentPosY;
  678. private string NOTHING = string.Empty;
  679. private int m_heightOfconditionTitle;
  680. [SerializeField]
  681. private int m_currentActiveSlotNo;
  682. private const string NIGHT_TASK_UNIT_PATH = "SceneDaily/Schedule/Prefab/NightTaskUnit";
  683. private const string CONDITION_UNIT_PATH = "SceneDaily/Schedule/Prefab/ConditionUnit";
  684. private const string PREFIX_BUTTON_NAME = "NightTask";
  685. private const int MAX_CONDITION_COUNT = 9;
  686. public class TaskButton
  687. {
  688. public ScheduleBase data;
  689. public string id;
  690. public string name;
  691. public int order;
  692. public bool enableTask;
  693. public UIButton btnTask;
  694. public Texture2D txtTaskIcon;
  695. public GameObject selectCursor;
  696. }
  697. public class YotogiTaskButton : ScheduleTaskCtrl.TaskButton
  698. {
  699. }
  700. public class TrainingTaskButton : ScheduleTaskCtrl.TaskButton
  701. {
  702. public int rank;
  703. public int expRatio;
  704. public List<GameObject> listRank;
  705. public ScheduleCSVData.TrainingType type;
  706. }
  707. public class WorkTaskButton : ScheduleTaskCtrl.TrainingTaskButton
  708. {
  709. }
  710. public enum TaskType
  711. {
  712. Yotogi,
  713. Training,
  714. Work,
  715. Max
  716. }
  717. }