ScheduleTaskViewer.cs 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using I2.Loc;
  5. using MaidStatus;
  6. using Schedule;
  7. using UnityEngine;
  8. using UnityEngine.UI;
  9. using wf;
  10. public class ScheduleTaskViewer : MonoBehaviour
  11. {
  12. private void Awake()
  13. {
  14. Func<GameObject, string, UIButton> func = delegate(GameObject parent, string name)
  15. {
  16. GameObject gameObject = Utility.CreatePrefab(parent, "SceneShop/Prefab/CategoryButton", true);
  17. UICenterOnClick2 componentInChildren = gameObject.GetComponentInChildren<UICenterOnClick2>();
  18. if (componentInChildren != null)
  19. {
  20. UnityEngine.Object.Destroy(componentInChildren);
  21. }
  22. gameObject.name = name;
  23. GameObject childObject = UTY.GetChildObject(gameObject, "Label", false);
  24. UILabel component = childObject.GetComponent<UILabel>();
  25. component.text = gameObject.name.Replace("<改行>", "\n");
  26. Localize component2 = childObject.GetComponent<Localize>();
  27. component2.SetTerm("SceneDaily/スケジュール/カテゴリー/" + name);
  28. return UTY.GetChildObject(gameObject, "Button", false).GetComponent<UIButton>();
  29. };
  30. foreach (KeyValuePair<int, string> keyValuePair in ScheduleCSVData.TaskCategoryNameMap)
  31. {
  32. string value = keyValuePair.Value;
  33. UIButton uibutton = func(this.CategoryGrid.gameObject, value);
  34. uibutton.name = keyValuePair.Key.ToString();
  35. this.category_button_dic_.Add(keyValuePair.Key, uibutton);
  36. }
  37. Dictionary<int, int> dictionary = new Dictionary<int, int>();
  38. foreach (KeyValuePair<int, ScheduleCSVData.ScheduleBase> keyValuePair2 in ScheduleCSVData.AllData)
  39. {
  40. int categoryID = keyValuePair2.Value.categoryID;
  41. if (!dictionary.ContainsKey(categoryID))
  42. {
  43. dictionary.Add(categoryID, 0);
  44. }
  45. dictionary[categoryID]++;
  46. }
  47. int num = 0;
  48. foreach (KeyValuePair<int, int> keyValuePair3 in dictionary)
  49. {
  50. num = System.Math.Max(num, keyValuePair3.Value);
  51. }
  52. for (int i = 0; i < 3; i++)
  53. {
  54. ScheduleTaskCtrl.TaskType key = (ScheduleTaskCtrl.TaskType)i;
  55. this.tmpData.Add(key, new ScheduleTaskViewer.TemporaryData());
  56. this.tmpData[key].place = new GameObject();
  57. this.tmpData[key].place.transform.SetParent(base.transform, false);
  58. this.tmpData[key].place.name = "tmp_" + key.ToString();
  59. this.tmpData[key].place.SetActive(false);
  60. }
  61. for (int j = 0; j < num; j++)
  62. {
  63. NightTaskUnit nightTaskUnit = Utility.CreatePrefab(this.tmpData[ScheduleTaskCtrl.TaskType.Yotogi].place, "SceneDaily/Schedule/Prefab/NightTaskUnit", true).AddComponent<NightTaskUnit>();
  64. nightTaskUnit.Init(this);
  65. nightTaskUnit.removePrarent = this.tmpData[ScheduleTaskCtrl.TaskType.Yotogi].place;
  66. }
  67. for (int k = 0; k < num; k++)
  68. {
  69. TrainingTaskUnit trainingTaskUnit = Utility.CreatePrefab(this.tmpData[ScheduleTaskCtrl.TaskType.Training].place, "SceneDaily/Schedule/Prefab/DaytimeTaskUnit", true).AddComponent<TrainingTaskUnit>();
  70. trainingTaskUnit.Init(this);
  71. trainingTaskUnit.removePrarent = this.tmpData[ScheduleTaskCtrl.TaskType.Training].place;
  72. }
  73. for (int l = 0; l < num; l++)
  74. {
  75. WorkTaskUnit workTaskUnit = Utility.CreatePrefab(this.tmpData[ScheduleTaskCtrl.TaskType.Work].place, "SceneDaily/Schedule/Prefab/WorkTaskUnit", true).AddComponent<WorkTaskUnit>();
  76. workTaskUnit.Init(this);
  77. workTaskUnit.removePrarent = this.tmpData[ScheduleTaskCtrl.TaskType.Work].place;
  78. }
  79. }
  80. private void OnDestroy()
  81. {
  82. foreach (KeyValuePair<ScheduleTaskCtrl.TaskType, ScheduleTaskViewer.TemporaryData> keyValuePair in this.tmpData)
  83. {
  84. UnityEngine.Object.Destroy(keyValuePair.Value.place);
  85. foreach (KeyValuePair<string, Texture2D> keyValuePair2 in keyValuePair.Value.icons)
  86. {
  87. UnityEngine.Object.DestroyImmediate(keyValuePair2.Value);
  88. }
  89. keyValuePair.Value.icons.Clear();
  90. }
  91. }
  92. public void Call(Maid maid, ScheduleMgr.ScheduleTime scheduleTime, Dictionary<ScheduleTaskCtrl.TaskType, List<ScheduleTaskViewer.ViewData>> viewDic, Dictionary<ScheduleMgr.ScheduleTime, ScheduleCSVData.ScheduleBase> currentSetWorkDic)
  93. {
  94. if (this.category_button_dic_ == null)
  95. {
  96. this.Awake();
  97. }
  98. ScheduleTaskViewer.scheduleTime = scheduleTime;
  99. HashSet<int> hashSet = new HashSet<int>();
  100. int maxValue = int.MaxValue;
  101. UIWFTabButton uiwftabButton = null;
  102. UIWFTabButton uiwftabButton2 = null;
  103. foreach (KeyValuePair<ScheduleTaskCtrl.TaskType, List<ScheduleTaskViewer.ViewData>> keyValuePair in viewDic)
  104. {
  105. this.CallEnableButton(maid, keyValuePair.Key, keyValuePair.Value, ref hashSet, ref maxValue);
  106. }
  107. this.currentWorkDic = currentSetWorkDic;
  108. int num = maxValue;
  109. ScheduleCSVData.ScheduleBase work_data = null;
  110. foreach (KeyValuePair<int, UIButton> keyValuePair2 in this.category_button_dic_)
  111. {
  112. keyValuePair2.Value.onClick.Clear();
  113. bool flag = hashSet.Contains(keyValuePair2.Key);
  114. keyValuePair2.Value.transform.parent.gameObject.SetActive(flag);
  115. if (flag)
  116. {
  117. EventDelegate.Add(keyValuePair2.Value.onClick, new EventDelegate.Callback(this.OnClickFromMainCategoryButton));
  118. if (uiwftabButton2 == null && num == keyValuePair2.Key)
  119. {
  120. uiwftabButton2 = keyValuePair2.Value.gameObject.GetComponent<UIWFTabButton>();
  121. }
  122. ScheduleCSVData.ScheduleBase scheduleBase = currentSetWorkDic[scheduleTime];
  123. if (uiwftabButton == null && scheduleBase != null && scheduleBase.categoryID == keyValuePair2.Key)
  124. {
  125. work_data = scheduleBase;
  126. uiwftabButton = keyValuePair2.Value.gameObject.GetComponent<UIWFTabButton>();
  127. }
  128. }
  129. }
  130. if (uiwftabButton == null)
  131. {
  132. uiwftabButton = uiwftabButton2;
  133. }
  134. Utility.ResetNGUI(this.CategoryGrid);
  135. Utility.ResetNGUI(this.CategoryScrollView);
  136. UIWFTabPanel componentInChildren = this.CategoryGrid.GetComponentInChildren<UIWFTabPanel>();
  137. componentInChildren.ResetSelect();
  138. componentInChildren.UpdateChildren();
  139. if (uiwftabButton != null)
  140. {
  141. componentInChildren.Select(uiwftabButton);
  142. }
  143. if (this.descDic == null)
  144. {
  145. DescScheduleYotogi component = UTY.GetChildObject(base.gameObject, "DescScheduleYotogi", false).GetComponent<DescScheduleYotogi>();
  146. component.Init(this.taskCtrl);
  147. DescScheduleTraining component2 = UTY.GetChildObject(base.gameObject, "DescScheduleTraining", false).GetComponent<DescScheduleTraining>();
  148. component2.Init(this.taskCtrl);
  149. DescScheduleWork component3 = UTY.GetChildObject(base.gameObject, "DescScheduleWork", false).GetComponent<DescScheduleWork>();
  150. component3.Init(this.taskCtrl);
  151. this.descDic = new Dictionary<ScheduleTaskCtrl.TaskType, DescScheduleBase>();
  152. this.descDic.Add(ScheduleTaskCtrl.TaskType.Yotogi, component);
  153. this.descDic.Add(ScheduleTaskCtrl.TaskType.Training, component2);
  154. this.descDic.Add(ScheduleTaskCtrl.TaskType.Work, component3);
  155. }
  156. this.UpdateForDescriptionViewer(work_data);
  157. }
  158. private void CallEnableButton(Maid maid, ScheduleTaskCtrl.TaskType type, List<ScheduleTaskViewer.ViewData> viewList, ref HashSet<int> enabled_category, ref int min_category_id)
  159. {
  160. this.tmpData[type].views = new List<ScheduleTaskViewer.ViewData>(viewList);
  161. for (int i = 0; i < this.tmpData[type].views.Count; i++)
  162. {
  163. if (!enabled_category.Contains(this.tmpData[type].views[i].schedule.categoryID))
  164. {
  165. ScheduleCSVData.ScheduleBase schedule = this.tmpData[type].views[i].schedule;
  166. int categoryID = schedule.categoryID;
  167. if (DailyMgr.IsLegacy || schedule.mode != ScheduleCSVData.ScheduleBase.Mode.CM3D2)
  168. {
  169. if (!DailyMgr.IsLegacy || schedule.mode != ScheduleCSVData.ScheduleBase.Mode.COM3D)
  170. {
  171. if (DailyMgr.IsLegacy)
  172. {
  173. if (ScheduleTaskViewer.scheduleTime == ScheduleMgr.ScheduleTime.DayTime)
  174. {
  175. if (categoryID != 51)
  176. {
  177. goto IL_135;
  178. }
  179. }
  180. else if (ScheduleTaskViewer.scheduleTime == ScheduleMgr.ScheduleTime.Night && (categoryID == 51 || categoryID == 52))
  181. {
  182. goto IL_135;
  183. }
  184. }
  185. if (maid.status.heroineType != HeroineType.Sub || (categoryID != 51 && categoryID != 100))
  186. {
  187. enabled_category.Add(categoryID);
  188. min_category_id = System.Math.Min(min_category_id, categoryID);
  189. }
  190. }
  191. }
  192. }
  193. IL_135:;
  194. }
  195. }
  196. private void AddButtonEvent(Button button, int num)
  197. {
  198. button.onClick.AddListener(delegate()
  199. {
  200. this.DoSomething(num);
  201. });
  202. }
  203. private void DoSomething(int num)
  204. {
  205. MonoBehaviour.print(num);
  206. }
  207. public void onHoverOverEvent(ScheduleCSVData.ScheduleBase data)
  208. {
  209. this.UpdateForDescriptionViewer(data);
  210. }
  211. public void onHoverOutEvent(ScheduleCSVData.ScheduleBase data)
  212. {
  213. if (this.currentWorkDic[ScheduleTaskViewer.scheduleTime] != null && data != null && this.currentWorkDic[ScheduleTaskViewer.scheduleTime].categoryID == data.categoryID)
  214. {
  215. this.UpdateForDescriptionViewer(this.currentWorkDic[ScheduleTaskViewer.scheduleTime]);
  216. }
  217. else
  218. {
  219. this.UpdateForDescriptionViewer(null);
  220. }
  221. }
  222. public void OnClickTaskUnit(TaskUnit select_unit)
  223. {
  224. ScheduleTaskCtrl.TaskType taskType = select_unit.taskType;
  225. for (int i = 0; i < this.UnitGrid.transform.childCount; i++)
  226. {
  227. TaskUnit component = this.UnitGrid.transform.GetChild(i).GetComponent<TaskUnit>();
  228. bool flag = component == select_unit;
  229. component.SetSelect(flag);
  230. if (flag)
  231. {
  232. this.currentWorkDic[ScheduleTaskViewer.scheduleTime] = component.schedule;
  233. if (component.schedule.type == ScheduleTaskCtrl.TaskType.Training)
  234. {
  235. ScheduleAPI.AddTrainingFacility(this.taskCtrl.ScheduleCtrl.SelectedMaid, component.schedule.id, ScheduleTaskViewer.scheduleTime);
  236. }
  237. }
  238. }
  239. this.description_viewer_out_draw_ = true;
  240. this.UpdateForDescriptionViewer(this.currentWorkDic[ScheduleTaskViewer.scheduleTime]);
  241. if (this.onClickWorkUnitEvent != null)
  242. {
  243. this.onClickWorkUnitEvent(select_unit.schedule);
  244. }
  245. }
  246. public TaskUnit GetSelectedTaskUnit()
  247. {
  248. for (int i = 0; i < this.UnitGrid.transform.childCount; i++)
  249. {
  250. TaskUnit component = this.UnitGrid.transform.GetChild(i).GetComponent<TaskUnit>();
  251. if (component.isSelected)
  252. {
  253. return component;
  254. }
  255. }
  256. return null;
  257. }
  258. public void OnClickTaskUnit_Work(TaskUnit select_unit)
  259. {
  260. WorkTaskUnit workTaskUnit = (WorkTaskUnit)select_unit;
  261. if (workTaskUnit.work.workTyp == ScheduleCSVData.WorkType.Basic)
  262. {
  263. DescScheduleWork descScheduleWork = (DescScheduleWork)this.descDic[ScheduleTaskCtrl.TaskType.Work];
  264. descScheduleWork.TaskUnit = workTaskUnit;
  265. descScheduleWork.EnableFacillityPanel();
  266. }
  267. else
  268. {
  269. this.OnClickTaskUnit(select_unit);
  270. }
  271. }
  272. private void OnClickFromMainCategoryButton()
  273. {
  274. UIButton current = UIButton.current;
  275. int num = int.Parse(current.name);
  276. this.selectedCategoryID = num;
  277. ScheduleTaskCtrl.TaskType type = ScheduleTaskCtrl.TaskType.Yotogi;
  278. if (num == 51)
  279. {
  280. type = ScheduleTaskCtrl.TaskType.Training;
  281. }
  282. else if (num == 52)
  283. {
  284. type = ScheduleTaskCtrl.TaskType.Work;
  285. }
  286. this.CreateTaskUnit(type, current, num);
  287. }
  288. private void CreateTaskUnit(ScheduleTaskCtrl.TaskType type, UIButton current, int select_category_id)
  289. {
  290. if (type == ScheduleTaskCtrl.TaskType.Yotogi)
  291. {
  292. this.description_viewer_out_draw_ = (this.currentWorkDic[ScheduleTaskViewer.scheduleTime] != null && this.currentWorkDic[ScheduleTaskViewer.scheduleTime].categoryID == select_category_id);
  293. if (this.description_viewer_out_draw_ || this.AlwaysDrawDescriptionViewer)
  294. {
  295. this.UpdateForDescriptionViewer(this.currentWorkDic[ScheduleTaskViewer.scheduleTime]);
  296. }
  297. else
  298. {
  299. this.UpdateForDescriptionViewer(null);
  300. }
  301. }
  302. else if (type == ScheduleTaskCtrl.TaskType.Training)
  303. {
  304. if (this.currentWorkDic[ScheduleTaskViewer.scheduleTime].type == ScheduleTaskCtrl.TaskType.Training)
  305. {
  306. this.UpdateForDescriptionViewer(this.currentWorkDic[ScheduleTaskViewer.scheduleTime]);
  307. }
  308. else
  309. {
  310. this.UpdateForDescriptionViewer(null);
  311. }
  312. }
  313. else if (type == ScheduleTaskCtrl.TaskType.Work)
  314. {
  315. if (this.currentWorkDic[ScheduleTaskViewer.scheduleTime].type == ScheduleTaskCtrl.TaskType.Work)
  316. {
  317. this.UpdateForDescriptionViewer(this.currentWorkDic[ScheduleTaskViewer.scheduleTime]);
  318. }
  319. else
  320. {
  321. this.UpdateForDescriptionViewer(null);
  322. }
  323. }
  324. this.RemoveTaskUnitAll();
  325. for (int i = 0; i < this.tmpData[type].views.Count; i++)
  326. {
  327. ScheduleTaskViewer.ViewData view_data = this.tmpData[type].views[i];
  328. if (view_data.schedule.categoryID == this.selectedCategoryID)
  329. {
  330. if (view_data.schedule.IsCommon || !view_data.schedule.IsLegacy != DailyMgr.IsLegacy)
  331. {
  332. if (type == ScheduleTaskCtrl.TaskType.Training)
  333. {
  334. if (this.AddTaskUnitCheck(ScheduleTaskCtrl.TaskType.Training, view_data))
  335. {
  336. this.AddTrainingTaskUnit(view_data);
  337. }
  338. }
  339. else if (type == ScheduleTaskCtrl.TaskType.Yotogi)
  340. {
  341. if (this.AddTaskUnitCheck(ScheduleTaskCtrl.TaskType.Yotogi, view_data))
  342. {
  343. this.AddYotogiTaskUnit(view_data);
  344. }
  345. }
  346. else if (type == ScheduleTaskCtrl.TaskType.Work && this.AddTaskUnitCheck(ScheduleTaskCtrl.TaskType.Work, view_data))
  347. {
  348. this.AddWorkTaskUnit(view_data);
  349. }
  350. }
  351. }
  352. }
  353. Utility.ResetNGUI(this.UnitGrid);
  354. Utility.ResetNGUI(this.UnitScrollView);
  355. GameObject childObject = UTY.GetChildObject(this.CategoryScrollView.transform.parent.gameObject, "Arrow", true);
  356. if (childObject != null)
  357. {
  358. Vector3 position = current.transform.TransformPoint(new Vector3(0f, 0f, 0f));
  359. Vector3 local_pos = childObject.transform.parent.InverseTransformPoint(position);
  360. local_pos.x = childObject.transform.localPosition.x;
  361. local_pos.y += 18f;
  362. Hashtable args = TweenHash.EaseOutQuint(TweenHash.Type.Position, local_pos, 0.3f);
  363. iTween.MoveTo(childObject, args);
  364. }
  365. }
  366. private bool AddTaskUnitCheck(ScheduleTaskCtrl.TaskType type, ScheduleTaskViewer.ViewData view_data)
  367. {
  368. if (this.tmpData[type].place.transform.childCount <= 0)
  369. {
  370. return false;
  371. }
  372. ScheduleCSVData.ScheduleBase schedule = view_data.schedule;
  373. if (!this.tmpData[type].icons.ContainsKey(schedule.icon))
  374. {
  375. string text = schedule.icon;
  376. if (!text.Contains(".tex"))
  377. {
  378. text += ".tex";
  379. }
  380. if (!GameUty.FileSystem.IsExistentFile(text))
  381. {
  382. Debug.LogError("スケジュール" + type.ToString() + "のアイコン画像が見つかりませんでした\n" + text);
  383. this.tmpData[type].icons.Add(schedule.icon, null);
  384. }
  385. else
  386. {
  387. Texture2D value = ImportCM.CreateTexture(text);
  388. this.tmpData[type].icons.Add(schedule.icon, value);
  389. }
  390. }
  391. return true;
  392. }
  393. private void AddTrainingTaskUnit(ScheduleTaskViewer.ViewData view_data)
  394. {
  395. ScheduleCSVData.Training training = (ScheduleCSVData.Training)view_data.schedule;
  396. if (training.trainingType == ScheduleCSVData.TrainingType.Trainee && !ScheduleAPI.CanTrainee(this.taskCtrl.ScheduleCtrl.SelectedMaid))
  397. {
  398. return;
  399. }
  400. TrainingTaskUnit component = this.tmpData[ScheduleTaskCtrl.TaskType.Training].place.transform.GetChild(0).gameObject.GetComponent<TrainingTaskUnit>();
  401. component.SetData(this, view_data);
  402. component.transform.SetParent(this.UnitGrid.transform, false);
  403. component.transform.localPosition = new Vector3(0f, (float)(this.UnitGrid.transform.childCount * 10), 0f);
  404. component.SetSelect(component.schedule == this.currentWorkDic[ScheduleTaskViewer.scheduleTime]);
  405. component.isEnabled = view_data.is_enabled;
  406. }
  407. private void AddYotogiTaskUnit(ScheduleTaskViewer.ViewData view_data)
  408. {
  409. if (GameMain.Instance.CharacterMgr.status.lockNTRPlay)
  410. {
  411. ScheduleCSVData.ScheduleBase schedule = view_data.schedule;
  412. ScheduleCSVData.Yotogi yotogi = (ScheduleCSVData.Yotogi)schedule;
  413. if (ScheduleCSVData.NetorareFlag.Contains(yotogi.id))
  414. {
  415. return;
  416. }
  417. }
  418. NightTaskUnit component = this.tmpData[ScheduleTaskCtrl.TaskType.Yotogi].place.transform.GetChild(0).gameObject.GetComponent<NightTaskUnit>();
  419. component.SetData(this, view_data);
  420. component.transform.SetParent(this.UnitGrid.transform, false);
  421. component.transform.localPosition = new Vector3(0f, (float)(this.UnitGrid.transform.childCount * 10), 0f);
  422. component.SetSelect(component.schedule == this.currentWorkDic[ScheduleTaskViewer.scheduleTime]);
  423. component.isEnabled = view_data.is_enabled;
  424. }
  425. private void AddWorkTaskUnit(ScheduleTaskViewer.ViewData view_data)
  426. {
  427. ScheduleCSVData.Work work = (ScheduleCSVData.Work)view_data.schedule;
  428. if (!work.facility.isBusiness && work.workTyp != ScheduleCSVData.WorkType.PowerUp)
  429. {
  430. return;
  431. }
  432. if (work.workTyp == ScheduleCSVData.WorkType.Basic)
  433. {
  434. Facility[] facilityArray = GameMain.Instance.FacilityMgr.GetFacilityArray();
  435. bool flag = false;
  436. foreach (Facility facility in facilityArray)
  437. {
  438. if (!(facility == null))
  439. {
  440. if (facility.defaultData.ID == work.facility.ID)
  441. {
  442. flag = true;
  443. break;
  444. }
  445. }
  446. }
  447. if (!flag)
  448. {
  449. return;
  450. }
  451. }
  452. WorkTaskUnit component = this.tmpData[ScheduleTaskCtrl.TaskType.Work].place.transform.GetChild(0).gameObject.GetComponent<WorkTaskUnit>();
  453. component.SetData(this, view_data);
  454. component.transform.SetParent(this.UnitGrid.transform, false);
  455. component.transform.localPosition = new Vector3(0f, (float)(this.UnitGrid.transform.childCount * 10), 0f);
  456. component.SetSelect(component.schedule == this.currentWorkDic[ScheduleTaskViewer.scheduleTime]);
  457. component.isEnabled = view_data.is_enabled;
  458. }
  459. private void RemoveTaskUnitAll()
  460. {
  461. Transform transform = this.UnitGrid.transform;
  462. List<Transform> list = new List<Transform>();
  463. for (int i = 0; i < transform.childCount; i++)
  464. {
  465. list.Add(transform.GetChild(i));
  466. }
  467. for (int j = 0; j < list.Count; j++)
  468. {
  469. TaskUnit component = list[j].GetComponent<TaskUnit>();
  470. component.isEnabled = true;
  471. component.SetSelect(false);
  472. list[j].SetParent(component.removePrarent.transform, false);
  473. }
  474. }
  475. private void UpdateForDescriptionViewer(ScheduleCSVData.ScheduleBase work_data)
  476. {
  477. if (this.descDic == null)
  478. {
  479. return;
  480. }
  481. foreach (KeyValuePair<ScheduleTaskCtrl.TaskType, DescScheduleBase> keyValuePair in this.descDic)
  482. {
  483. if (work_data != null && work_data.type == keyValuePair.Key)
  484. {
  485. keyValuePair.Value.UpdateViewCommon(work_data);
  486. }
  487. else
  488. {
  489. keyValuePair.Value.UpdateViewCommon(null);
  490. }
  491. }
  492. }
  493. public ScheduleTaskViewer.TemporaryData TmpData(ScheduleTaskCtrl.TaskType type)
  494. {
  495. return this.tmpData[type];
  496. }
  497. public static ScheduleMgr.ScheduleTime ScheduleTime
  498. {
  499. get
  500. {
  501. return ScheduleTaskViewer.scheduleTime;
  502. }
  503. set
  504. {
  505. ScheduleTaskViewer.scheduleTime = value;
  506. }
  507. }
  508. public ScheduleTaskCtrl taskCtrl;
  509. public UIGrid CategoryGrid;
  510. public UIScrollView CategoryScrollView;
  511. public UIGrid UnitGrid;
  512. public UIScrollView UnitScrollView;
  513. public GameObject ParameterViewer;
  514. public Dictionary<ScheduleTaskCtrl.TaskType, DescScheduleBase> descDic;
  515. [SerializeField]
  516. private int selectedCategoryID;
  517. public bool AlwaysDrawDescriptionViewer;
  518. public Action<ScheduleCSVData.ScheduleBase> onClickWorkUnitEvent;
  519. private Dictionary<int, UIButton> category_button_dic_ = new Dictionary<int, UIButton>();
  520. private Dictionary<ScheduleTaskCtrl.TaskType, ScheduleTaskViewer.TemporaryData> tmpData = new Dictionary<ScheduleTaskCtrl.TaskType, ScheduleTaskViewer.TemporaryData>();
  521. private Dictionary<ScheduleMgr.ScheduleTime, ScheduleCSVData.ScheduleBase> currentWorkDic = new Dictionary<ScheduleMgr.ScheduleTime, ScheduleCSVData.ScheduleBase>();
  522. private static ScheduleMgr.ScheduleTime scheduleTime;
  523. private bool description_viewer_out_draw_;
  524. public struct ViewData
  525. {
  526. public ScheduleTaskCtrl.TaskButton taskButton;
  527. public ScheduleCSVData.ScheduleBase schedule;
  528. public bool is_enabled;
  529. }
  530. public class TemporaryData
  531. {
  532. public GameObject place;
  533. public List<ScheduleTaskViewer.ViewData> views;
  534. public Dictionary<string, Texture2D> icons = new Dictionary<string, Texture2D>();
  535. }
  536. }