ScheduleTaskCtrl.cs 25 KB

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