ScheduleTaskViewer.cs 19 KB

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