PlacementWindow.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Runtime.CompilerServices;
  4. using UnityEngine;
  5. using wf;
  6. public class PlacementWindow : BaseMaidPhotoWindow
  7. {
  8. public override void Awake()
  9. {
  10. base.Awake();
  11. this.PartsTransForm.onChangeAxisVisibleType.Add(new Action(this.OnChangeAxisVisibleType));
  12. EventDelegate.Add(this.CameraFocusButton.onClick, new EventDelegate.Callback(this.OnClickCameraFocus));
  13. EventDelegate.Add(this.DeActiveButton.onClick, new EventDelegate.Callback(this.OnClickDeActive));
  14. this.VisibleCheckButton.onClick.Add(new Action<WFCheckBox>(this.OnClickVisibleCheckButton));
  15. this.camera_move_support_ = base.gameObject.AddComponent<WfCameraMoveSupport>();
  16. EventDelegate.Add(this.CallEditButton.onClick, delegate()
  17. {
  18. base.mgr.CallEditSceneFunction(base.mgr.select_maid);
  19. });
  20. }
  21. public override void Start()
  22. {
  23. base.Start();
  24. this.chara_mgr_ = GameMain.Instance.CharacterMgr;
  25. List<Maid> list = new List<Maid>();
  26. for (int i = 0; i < this.chara_mgr_.GetStockMaidCount(); i++)
  27. {
  28. Maid stockMaid = this.chara_mgr_.GetStockMaid(i);
  29. if (!(stockMaid == null))
  30. {
  31. list.Add(stockMaid);
  32. }
  33. }
  34. List<Maid> list2 = list;
  35. if (PlacementWindow.<>f__mg$cache0 == null)
  36. {
  37. PlacementWindow.<>f__mg$cache0 = new Comparison<Maid>(CharacterSelectManager.SortMaidStandardNoSchedule);
  38. }
  39. list2.Sort(PlacementWindow.<>f__mg$cache0);
  40. for (int j = 0; j < this.chara_mgr_.GetManCount(); j++)
  41. {
  42. Maid man = this.chara_mgr_.GetMan(j);
  43. if (!(man == null) && !man.boNPC)
  44. {
  45. PhotoManEditManager.Controller controller = new PhotoManEditManager.Controller(man);
  46. if (j != 0)
  47. {
  48. man.SetUpModel("_I_man.menu");
  49. controller.color = new Color(0f, 0.09f, 1f);
  50. controller.fat = 0.2f;
  51. man.AllProcProp();
  52. }
  53. PlacementWindow.ManDataBackup value = default(PlacementWindow.ManDataBackup);
  54. value.color = controller.color;
  55. value.fat = controller.fat;
  56. value.parts_visible = true;
  57. value.head_item_rid = controller.head_menu_rid;
  58. this.man_backup_data_dic_.Add(man.status.guid, value);
  59. list.Add(man);
  60. }
  61. }
  62. UIGrid component = UTY.GetChildObject(this.content_game_object, "ListParent/Contents/UnitParent", false).GetComponent<UIGrid>();
  63. UIScrollView component2 = UTY.GetChildObject(this.content_game_object, "ListParent/Contents", false).GetComponent<UIScrollView>();
  64. for (int k = 0; k < list.Count; k++)
  65. {
  66. GameObject f_goParent = Utility.CreatePrefab(component.gameObject, "ScenePhotoMode/SimpleMaidPlatePlacement", true);
  67. PlacementWindow.PlateData plateData = new PlacementWindow.PlateData();
  68. plateData.maid = list[k];
  69. plateData.plate = UTY.GetChildObject(f_goParent, "Plate", false).GetComponent<SimpleMaidPlate>();
  70. plateData.plate.SetMaidData(list[k]);
  71. plateData.btn = UTY.GetChildObject(f_goParent, "Plate/Plate/TopButton", false).GetComponent<UIButton>();
  72. plateData.def_btn_color = new Color(1f, 1f, 1f, 0.7f);
  73. plateData.select_btn = UTY.GetChildObject(f_goParent, "Plate/Button", false).GetComponent<UIWFTabButton>();
  74. plateData.select_btn.isEnabled = false;
  75. EventDelegate.Add(plateData.select_btn.onClick, new EventDelegate.Callback(this.OnClickMaid));
  76. plateData.bg_sprite = UTY.GetChildObject(f_goParent, "Plate/Plate/BG", false).GetComponent<UISprite>();
  77. plateData.select_frame = UTY.GetChildObject(f_goParent, "Plate/Plate/SelectFrame", false).GetComponent<UISprite>();
  78. EventDelegate.Add(plateData.btn.onClick, new EventDelegate.Callback(this.OnClickPlacementBtn));
  79. this.maid_data_list_.Add(plateData);
  80. }
  81. component.Reposition();
  82. component2.ResetPosition();
  83. this.UpdateChildren();
  84. UIButtonColor cameraFocusButton = this.CameraFocusButton;
  85. bool flag = false;
  86. this.VisibleCheckButton.enabled = flag;
  87. flag = flag;
  88. this.DeActiveButton.isEnabled = flag;
  89. flag = flag;
  90. this.CallEditButton.isEnabled = flag;
  91. cameraFocusButton.isEnabled = flag;
  92. this.is_first_ = true;
  93. this.call_deserialize_ = false;
  94. }
  95. public void OnDestroy()
  96. {
  97. if (GameMain.Instance == null || GameMain.Instance.CharacterMgr == null)
  98. {
  99. return;
  100. }
  101. }
  102. public override void Update()
  103. {
  104. if (this.is_first_)
  105. {
  106. this.UpdateList();
  107. this.is_first_ = false;
  108. }
  109. if (Input.GetKeyDown(KeyCode.F1))
  110. {
  111. this.PartsTransForm.NextAxis();
  112. }
  113. if (Input.GetKeyDown(KeyCode.F2) && this.CameraFocusButton.isEnabled)
  114. {
  115. this.OnClickCameraFocus();
  116. }
  117. if (this.new_load_maid_data_list_.Count == 0 || this.chara_mgr_.IsBusy())
  118. {
  119. if (!this.chara_mgr_.IsBusy() && this.maid_casule_collider_hash_.Count != 0)
  120. {
  121. bool flag = false;
  122. using (Dictionary<int, CapsuleCollider>.Enumerator enumerator = this.maid_casule_collider_hash_.GetEnumerator())
  123. {
  124. if (enumerator.MoveNext())
  125. {
  126. KeyValuePair<int, CapsuleCollider> keyValuePair = enumerator.Current;
  127. flag = keyValuePair.Value.enabled;
  128. }
  129. }
  130. if (GameMain.Instance.VRMode)
  131. {
  132. if (!OvrIK.IsVRIKMode && !flag)
  133. {
  134. foreach (KeyValuePair<int, CapsuleCollider> keyValuePair2 in this.maid_casule_collider_hash_)
  135. {
  136. keyValuePair2.Value.enabled = true;
  137. }
  138. }
  139. }
  140. else if (Input.GetKey(KeyCode.Tab) && !flag)
  141. {
  142. foreach (KeyValuePair<int, CapsuleCollider> keyValuePair3 in this.maid_casule_collider_hash_)
  143. {
  144. keyValuePair3.Value.enabled = true;
  145. }
  146. }
  147. else if (!Input.GetKey(KeyCode.Tab) && flag)
  148. {
  149. foreach (KeyValuePair<int, CapsuleCollider> keyValuePair4 in this.maid_casule_collider_hash_)
  150. {
  151. keyValuePair4.Value.enabled = false;
  152. }
  153. }
  154. }
  155. return;
  156. }
  157. for (int i = 0; i < this.new_load_maid_data_list_.Count; i++)
  158. {
  159. PlacementWindow.MaidSlotData maidSlotData = this.new_load_maid_data_list_[i];
  160. Maid maid = maidSlotData.maid;
  161. this.active_maid_list_.Add(maidSlotData);
  162. maid.transform.position = Vector3.zero;
  163. maid.transform.rotation = default(Quaternion);
  164. maid.transform.localScale = Vector3.one;
  165. maid.body0.SetBoneHitHeightY(-1000f);
  166. base.mgr.OnMaidAddEvent(maid, this.call_deserialize_);
  167. }
  168. if (this.call_deserialize_)
  169. {
  170. base.mgr.OnFinishMaidDeserializeLoad();
  171. }
  172. this.call_deserialize_ = false;
  173. this.SetSelectMaid(this.new_load_maid_data_list_[0].maid);
  174. this.new_load_maid_data_list_.Clear();
  175. GameMain.Instance.MainCamera.FadeIn(0.3f, false, null, true, true, default(Color));
  176. }
  177. public int GetActiveMaidCount()
  178. {
  179. return this.active_maid_list_.Count;
  180. }
  181. private void SetSelectMaid(Maid maid)
  182. {
  183. if (maid == null)
  184. {
  185. base.mgr.OnMaidChangeEvent(null);
  186. return;
  187. }
  188. bool flag = false;
  189. for (int i = 0; i < this.GetMaidOrManCount(maid); i++)
  190. {
  191. if (this.GetMaidOrMan(maid, i) == maid)
  192. {
  193. flag = true;
  194. break;
  195. }
  196. }
  197. if (flag && maid.boMAN && !maid.Visible)
  198. {
  199. flag = false;
  200. }
  201. if (!flag)
  202. {
  203. return;
  204. }
  205. base.mgr.OnMaidChangeEvent(maid);
  206. this.UpdateList();
  207. }
  208. public override void OnMaidChangeEvent(Maid maid)
  209. {
  210. base.OnMaidChangeEvent(maid);
  211. UIButtonColor cameraFocusButton = this.CameraFocusButton;
  212. bool flag = maid != null;
  213. this.VisibleCheckButton.enabled = flag;
  214. flag = flag;
  215. this.DeActiveButton.isEnabled = flag;
  216. flag = flag;
  217. this.CallEditButton.isEnabled = flag;
  218. cameraFocusButton.isEnabled = flag;
  219. if (maid != null && maid.boMAN)
  220. {
  221. this.CallEditButton.isEnabled = false;
  222. }
  223. this.VisibleCheckButton.check = (maid != null && maid.transform.GetChild(0).localScale.x != 0f);
  224. if (maid != null)
  225. {
  226. this.PartsTransForm.SetObject(maid.gameObject);
  227. this.PartsTransForm.ScaleInput.SetInitVector(Vector3.one);
  228. }
  229. else
  230. {
  231. this.PartsTransForm.SetObject(null);
  232. }
  233. this.OnChangeAxisVisibleType();
  234. }
  235. public override void OnMaidRemoveEvent(Maid maid)
  236. {
  237. base.OnMaidRemoveEvent(maid);
  238. if (this.transtarget_maid_dic_.ContainsKey(maid))
  239. {
  240. this.transtarget_maid_dic_[maid].Delete();
  241. this.transtarget_maid_dic_.Remove(maid);
  242. }
  243. this.UpdateList();
  244. }
  245. public override void OnMaidAddEvent(Maid maid, bool is_deserialize_load)
  246. {
  247. base.OnMaidAddEvent(maid, is_deserialize_load);
  248. Dictionary<string, string> maidStoreData = base.GetMaidStoreData(maid);
  249. if (!is_deserialize_load)
  250. {
  251. maidStoreData["position"] = Vector3.zero.ToString();
  252. maidStoreData["rotation"] = Quaternion.identity.ToString();
  253. maidStoreData["scale"] = Vector3.one.ToString();
  254. maidStoreData["visible"] = true.ToString();
  255. }
  256. maid.transform.position = Parse.Vector3(maidStoreData["position"]);
  257. maid.transform.rotation = Parse.Quaternion(maidStoreData["rotation"]);
  258. maid.transform.localScale = Parse.Vector3(maidStoreData["scale"]);
  259. if (bool.Parse(maidStoreData["visible"]))
  260. {
  261. maid.transform.GetChild(0).localScale = Vector3.one;
  262. }
  263. else
  264. {
  265. maid.transform.GetChild(0).localScale = Vector3.zero;
  266. }
  267. this.transtarget_maid_dic_.Add(maid, new PhotoTransTargetObject(maid.gameObject, string.Empty, string.Empty, PhotoTransTargetObject.Type.Maid, new Vector2(this.PartsTransForm.ScaleInput.SliderMin, this.PartsTransForm.ScaleInput.SliderMax)));
  268. if (GameMain.Instance.VRMode)
  269. {
  270. MeshRenderer componentInChildren = this.transtarget_maid_dic_[maid].axis_obj.GetComponentInChildren<MeshRenderer>();
  271. if (componentInChildren != null)
  272. {
  273. componentInChildren.enabled = false;
  274. }
  275. BoxCollider[] componentsInChildren = this.transtarget_maid_dic_[maid].axis_obj.GetComponentsInChildren<BoxCollider>();
  276. foreach (BoxCollider boxCollider in componentsInChildren)
  277. {
  278. boxCollider.enabled = false;
  279. }
  280. }
  281. if (maid.boMAN)
  282. {
  283. return;
  284. }
  285. MaidColliderCollect maidColliderCollect = MaidColliderCollect.AddColliderCollect(maid);
  286. List<CapsuleCollider> list = maidColliderCollect.AddCollider(MaidColliderCollect.ColliderType.Grab);
  287. for (int j = 0; j < list.Count; j++)
  288. {
  289. ColliderEvent colliderEvent = list[j].gameObject.AddComponent<ColliderEvent>();
  290. colliderEvent.onMouseUp = new Action(maid.OnMouseUp);
  291. this.maid_casule_collider_hash_.Add(list[j].GetInstanceID(), list[j]);
  292. }
  293. using (Dictionary<int, CapsuleCollider>.Enumerator enumerator = this.maid_casule_collider_hash_.GetEnumerator())
  294. {
  295. if (enumerator.MoveNext())
  296. {
  297. KeyValuePair<int, CapsuleCollider> keyValuePair = enumerator.Current;
  298. keyValuePair.Value.enabled = true;
  299. }
  300. }
  301. maid.onMouseUpEvent = new Action<Maid>(this.OnMouseUpFromMaid);
  302. }
  303. private void OnMouseUpFromMaid(Maid maid)
  304. {
  305. if (Input.GetKey(KeyCode.Tab) && base.mgr.select_maid != maid)
  306. {
  307. this.SetSelectMaid(maid);
  308. MouseExposition @object = MouseExposition.GetObject();
  309. string draw_text = maid.status.firstName + " " + maid.status.lastName + "を選択しました";
  310. @object.SetText(draw_text, 2f);
  311. }
  312. }
  313. private void UpdateList()
  314. {
  315. HashSet<string> hashSet = new HashSet<string>();
  316. for (int i = 0; i < this.chara_mgr_.GetMaidCount(); i++)
  317. {
  318. Maid maid = this.chara_mgr_.GetMaid(i);
  319. if (!(maid == null))
  320. {
  321. if (!hashSet.Contains(maid.status.guid))
  322. {
  323. hashSet.Add(maid.status.guid);
  324. }
  325. }
  326. }
  327. for (int j = 0; j < this.chara_mgr_.GetManCount(); j++)
  328. {
  329. Maid man = this.chara_mgr_.GetMan(j);
  330. if (!(man == null) && man.Visible)
  331. {
  332. if (!hashSet.Contains(man.status.guid))
  333. {
  334. hashSet.Add(man.status.guid);
  335. }
  336. }
  337. }
  338. for (int k = 0; k < this.maid_data_list_.Count; k++)
  339. {
  340. if (hashSet.Contains(this.maid_data_list_[k].maid.status.guid))
  341. {
  342. this.maid_data_list_[k].btn.isEnabled = false;
  343. this.maid_data_list_[k].select_btn.isEnabled = true;
  344. if (base.mgr.select_maid == this.maid_data_list_[k].maid)
  345. {
  346. this.maid_data_list_[k].select_btn.SetSelect(true);
  347. }
  348. else
  349. {
  350. this.maid_data_list_[k].select_btn.SetSelect(false);
  351. }
  352. }
  353. else
  354. {
  355. this.maid_data_list_[k].btn.isEnabled = true;
  356. this.maid_data_list_[k].select_btn.SetSelect(false);
  357. this.maid_data_list_[k].select_btn.isEnabled = false;
  358. }
  359. }
  360. }
  361. public void OnClickMaid()
  362. {
  363. if (this.chara_mgr_.IsBusy())
  364. {
  365. return;
  366. }
  367. PlacementWindow.PlateData plateData = null;
  368. for (int i = 0; i < this.maid_data_list_.Count; i++)
  369. {
  370. if (this.maid_data_list_[i].select_btn == UIButton.current)
  371. {
  372. plateData = this.maid_data_list_[i];
  373. break;
  374. }
  375. }
  376. if (plateData == null)
  377. {
  378. return;
  379. }
  380. this.SetSelectMaid(plateData.maid);
  381. }
  382. private void OnClickPlacementBtn()
  383. {
  384. if (this.chara_mgr_.IsBusy())
  385. {
  386. return;
  387. }
  388. PlacementWindow.PlateData plateData = null;
  389. for (int i = 0; i < this.maid_data_list_.Count; i++)
  390. {
  391. if (!(UIButton.current != this.maid_data_list_[i].btn))
  392. {
  393. plateData = this.maid_data_list_[i];
  394. break;
  395. }
  396. }
  397. bool flag = false;
  398. for (int j = 0; j < this.GetMaidOrManCount(plateData.maid); j++)
  399. {
  400. if (this.GetMaidOrMan(plateData.maid, j) == plateData.maid)
  401. {
  402. flag = true;
  403. break;
  404. }
  405. }
  406. if (flag && plateData.maid.boMAN && !plateData.maid.Visible)
  407. {
  408. flag = false;
  409. }
  410. if (flag)
  411. {
  412. this.DeActiveMaid(plateData.maid, false);
  413. }
  414. else
  415. {
  416. int num = 0;
  417. if (!plateData.maid.boMAN)
  418. {
  419. for (int k = 0; k < this.GetMaidOrManCount(plateData.maid); k++)
  420. {
  421. num += ((!(this.GetMaidOrMan(plateData.maid, k) != null)) ? 0 : 1);
  422. }
  423. }
  424. else
  425. {
  426. for (int l = 0; l < this.GetMaidOrManCount(plateData.maid); l++)
  427. {
  428. if (this.GetMaidOrMan(plateData.maid, l) != null && plateData.maid.Visible)
  429. {
  430. num++;
  431. }
  432. }
  433. }
  434. if (!plateData.maid.boMAN && 12 <= num)
  435. {
  436. GameMain.Instance.SysDlg.ShowFromLanguageTerm("ScenePhotoMode/キャラ選択/ダイアログ/これ以上メイドを配置する事はできません", null, SystemDialog.TYPE.OK, null, null);
  437. }
  438. else if (plateData.maid.boMAN && 5 <= num)
  439. {
  440. GameMain.Instance.SysDlg.ShowFromLanguageTerm("ScenePhotoMode/キャラ選択/ダイアログ/これ以上男を配置する事はできません", null, SystemDialog.TYPE.OK, null, null);
  441. }
  442. else
  443. {
  444. this.ActiveMaid(plateData.maid);
  445. }
  446. }
  447. }
  448. private void ActiveMaid(Maid maid)
  449. {
  450. if (maid == null)
  451. {
  452. return;
  453. }
  454. List<PlacementWindow.MaidSlotData> list = new List<PlacementWindow.MaidSlotData>();
  455. uint num = 0u;
  456. for (int i = 0; i < this.active_maid_list_.Count; i++)
  457. {
  458. if (this.active_maid_list_[i].maid == maid)
  459. {
  460. list.Add(this.active_maid_list_[i]);
  461. }
  462. if (num < this.active_maid_list_[i].sort_no)
  463. {
  464. num = this.active_maid_list_[i].sort_no;
  465. }
  466. }
  467. for (int j = 0; j < list.Count; j++)
  468. {
  469. this.active_maid_list_.Remove(list[j]);
  470. }
  471. this.active_maid_list_.Sort();
  472. int k = 0;
  473. while (k < this.GetMaidOrManCount(maid))
  474. {
  475. if (!maid.boMAN)
  476. {
  477. if (!(this.GetMaidOrMan(maid, k) != null))
  478. {
  479. goto IL_107;
  480. }
  481. }
  482. else if (!(this.GetMaidOrMan(maid, k) != maid))
  483. {
  484. goto IL_107;
  485. }
  486. k++;
  487. continue;
  488. IL_107:
  489. this.SetActiveMaidOrMan(maid, k);
  490. maid.Visible = true;
  491. maid.AllProcPropSeqStart();
  492. PlacementWindow.MaidSlotData maidSlotData = new PlacementWindow.MaidSlotData();
  493. maidSlotData.maid = maid;
  494. maidSlotData.sort_no = num + 1u;
  495. maidSlotData.slot_no = k;
  496. this.new_load_maid_data_list_.Add(maidSlotData);
  497. break;
  498. }
  499. if (this.chara_mgr_.IsBusy())
  500. {
  501. GameMain.Instance.MainCamera.FadeOut(0f, false, null, true, default(Color));
  502. }
  503. }
  504. public void DeActiveMaid(Maid maid, bool on_reset_call = false)
  505. {
  506. if (this.chara_mgr_.IsBusy() || maid == null)
  507. {
  508. return;
  509. }
  510. List<PlacementWindow.MaidSlotData> list = new List<PlacementWindow.MaidSlotData>();
  511. for (int i = 0; i < this.active_maid_list_.Count; i++)
  512. {
  513. if (this.active_maid_list_[i].maid == maid)
  514. {
  515. list.Add(this.active_maid_list_[i]);
  516. }
  517. }
  518. bool flag = false;
  519. for (int j = 0; j < list.Count; j++)
  520. {
  521. if (list[j].maid == base.mgr.select_maid)
  522. {
  523. flag = true;
  524. }
  525. this.active_maid_list_.Remove(list[j]);
  526. }
  527. this.active_maid_list_.Sort();
  528. if (flag)
  529. {
  530. if (0 < this.active_maid_list_.Count && !on_reset_call)
  531. {
  532. this.SetSelectMaid(this.active_maid_list_[0].maid);
  533. }
  534. else
  535. {
  536. this.SetSelectMaid(null);
  537. }
  538. }
  539. for (int k = 0; k < this.GetMaidOrManCount(maid); k++)
  540. {
  541. Maid maidOrMan = this.GetMaidOrMan(maid, k);
  542. if (maidOrMan == maid)
  543. {
  544. maidOrMan.transform.position = Vector3.zero;
  545. maidOrMan.transform.rotation = Quaternion.identity;
  546. maidOrMan.transform.localScale = Vector3.one;
  547. maidOrMan.transform.GetChild(0).localScale = Vector3.one;
  548. maidOrMan.ResetAll();
  549. CapsuleCollider[] componentsInChildren = maid.GetComponentsInChildren<CapsuleCollider>();
  550. if (componentsInChildren.Length == 0)
  551. {
  552. this.maid_casule_collider_hash_.Clear();
  553. }
  554. for (int l = 0; l < componentsInChildren.Length; l++)
  555. {
  556. this.maid_casule_collider_hash_.Remove(componentsInChildren[l].GetInstanceID());
  557. ColliderEvent component = componentsInChildren[l].GetComponent<ColliderEvent>();
  558. if (component != null)
  559. {
  560. UnityEngine.Object.Destroy(component);
  561. }
  562. UnityEngine.Object.Destroy(componentsInChildren[l]);
  563. }
  564. maid.onMouseUpEvent = null;
  565. base.mgr.OnMaidRemoveEventPrev(maid);
  566. if (!maid.boMAN)
  567. {
  568. this.DeactivateMaidOrMan(maid);
  569. }
  570. else
  571. {
  572. int m;
  573. for (m = 0; m < this.chara_mgr_.GetManCount(); m++)
  574. {
  575. if (this.chara_mgr_.GetMan(m) == maid)
  576. {
  577. break;
  578. }
  579. }
  580. this.chara_mgr_.CharaVisible(m, false, true);
  581. }
  582. base.mgr.OnMaidRemoveEvent(maid);
  583. break;
  584. }
  585. }
  586. }
  587. protected void OnChangeAxisVisibleType()
  588. {
  589. WindowPartsTransform.AxisVisibleType axis_visible_type = this.PartsTransForm.axis_visible_type;
  590. PhotoTransTargetObject photoTransTargetObject = null;
  591. foreach (KeyValuePair<Maid, PhotoTransTargetObject> keyValuePair in this.transtarget_maid_dic_)
  592. {
  593. if (keyValuePair.Value.axis_obj != null)
  594. {
  595. keyValuePair.Value.axis_obj.Visible = false;
  596. }
  597. if (keyValuePair.Value.rotate_obj != null)
  598. {
  599. keyValuePair.Value.rotate_obj.Visible = false;
  600. }
  601. }
  602. if (base.mgr.select_maid != null)
  603. {
  604. photoTransTargetObject = this.transtarget_maid_dic_[base.mgr.select_maid];
  605. }
  606. if (photoTransTargetObject == null || photoTransTargetObject.obj == null || photoTransTargetObject.axis_obj == null)
  607. {
  608. return;
  609. }
  610. if (axis_visible_type == WindowPartsTransform.AxisVisibleType.UnVisible)
  611. {
  612. photoTransTargetObject.axis_obj.Visible = false;
  613. photoTransTargetObject.rotate_obj.Visible = false;
  614. }
  615. else if (axis_visible_type == WindowPartsTransform.AxisVisibleType.Position)
  616. {
  617. photoTransTargetObject.axis_obj.Visible = true;
  618. photoTransTargetObject.rotate_obj.Visible = false;
  619. }
  620. else if (axis_visible_type == WindowPartsTransform.AxisVisibleType.Rotate)
  621. {
  622. photoTransTargetObject.axis_obj.Visible = false;
  623. photoTransTargetObject.rotate_obj.Visible = true;
  624. }
  625. }
  626. public void OnClickVisibleCheckButton(WFCheckBox check_box)
  627. {
  628. if (base.mgr.select_maid == null)
  629. {
  630. return;
  631. }
  632. if (check_box.check)
  633. {
  634. base.mgr.select_maid.gameObject.transform.GetChild(0).localScale = Vector3.one;
  635. }
  636. else
  637. {
  638. base.mgr.select_maid.gameObject.transform.GetChild(0).localScale = Vector3.zero;
  639. }
  640. }
  641. public void OnClickCameraFocus()
  642. {
  643. if (base.mgr.select_maid == null || base.mgr.select_maid.body0 == null)
  644. {
  645. return;
  646. }
  647. Transform bone;
  648. if (!base.mgr.select_maid.boMAN)
  649. {
  650. bone = base.mgr.select_maid.body0.GetBone("Bip01 Head");
  651. }
  652. else
  653. {
  654. bone = base.mgr.select_maid.body0.GetBone("ManBip Head");
  655. }
  656. Vector3 position = bone.position;
  657. float distance = 1.6f;
  658. Vector2 aroundAngle = new Vector2(-180f, 4.7f);
  659. this.camera_move_support_.StartCameraPosition(position, distance, aroundAngle);
  660. }
  661. public void OnClickDeActive()
  662. {
  663. this.DeActiveMaid(base.mgr.select_maid, false);
  664. }
  665. public override void OnReset()
  666. {
  667. for (int i = 0; i < this.chara_mgr_.GetMaidCount(); i++)
  668. {
  669. if (this.chara_mgr_.GetMaid(i) != null)
  670. {
  671. this.DeActiveMaid(this.chara_mgr_.GetMaid(i), true);
  672. }
  673. }
  674. for (int j = 0; j < this.chara_mgr_.GetManCount(); j++)
  675. {
  676. if (this.chara_mgr_.GetMan(j) != null && this.chara_mgr_.GetMan(j).Visible)
  677. {
  678. this.DeActiveMaid(this.chara_mgr_.GetMan(j), true);
  679. }
  680. }
  681. }
  682. public override void OnDeserializeEvent()
  683. {
  684. List<string> maidStoreGuidList = base.mgr.GetMaidStoreGuidList();
  685. for (int i = 0; i < maidStoreGuidList.Count; i++)
  686. {
  687. this.call_deserialize_ = true;
  688. Maid maid = GameMain.Instance.CharacterMgr.GetStockMaid(maidStoreGuidList[i]);
  689. if (maid == null)
  690. {
  691. maid = GameMain.Instance.CharacterMgr.GetStockMan(maidStoreGuidList[i]);
  692. }
  693. maid.transform.position = Vector3.zero;
  694. maid.transform.rotation = Quaternion.identity;
  695. maid.transform.localScale = Vector3.one;
  696. maid.transform.GetChild(0).localScale = Vector3.one;
  697. this.ActiveMaid(maid);
  698. }
  699. }
  700. private int GetMaidOrManCount(Maid maid)
  701. {
  702. return maid.boMAN ? this.chara_mgr_.GetManCount() : this.chara_mgr_.GetMaidCount();
  703. }
  704. private Maid GetMaidOrMan(Maid maid, int slot_no)
  705. {
  706. return maid.boMAN ? this.chara_mgr_.GetMan(slot_no) : this.chara_mgr_.GetMaid(slot_no);
  707. }
  708. private void SetActiveMaidOrMan(Maid maid, int slot_no)
  709. {
  710. if (!maid.boMAN)
  711. {
  712. this.chara_mgr_.SetActiveMaid(maid, slot_no);
  713. }
  714. else
  715. {
  716. this.chara_mgr_.SetActiveMan(maid, slot_no);
  717. }
  718. }
  719. private void DeactivateMaidOrMan(Maid maid)
  720. {
  721. if (!maid.boMAN)
  722. {
  723. this.chara_mgr_.DeactivateMaid(maid);
  724. }
  725. else
  726. {
  727. this.chara_mgr_.DeactivateMan(maid);
  728. }
  729. }
  730. public Dictionary<string, PlacementWindow.ManDataBackup> man_backup_data_dic
  731. {
  732. get
  733. {
  734. return this.man_backup_data_dic_;
  735. }
  736. }
  737. public List<Maid> maid_list
  738. {
  739. get
  740. {
  741. List<Maid> list = new List<Maid>();
  742. foreach (PlacementWindow.PlateData plateData in this.maid_data_list_)
  743. {
  744. list.Add(plateData.maid);
  745. }
  746. return list;
  747. }
  748. }
  749. public WindowPartsTransform PartsTransForm;
  750. public UIButton CameraFocusButton;
  751. public WFCheckBox VisibleCheckButton;
  752. public UIButton DeActiveButton;
  753. public UIButton CallEditButton;
  754. private bool is_first_;
  755. private WfCameraMoveSupport camera_move_support_;
  756. private CharacterMgr chara_mgr_;
  757. private List<PlacementWindow.PlateData> maid_data_list_ = new List<PlacementWindow.PlateData>();
  758. private List<PlacementWindow.MaidSlotData> active_maid_list_ = new List<PlacementWindow.MaidSlotData>();
  759. private Dictionary<Maid, PhotoTransTargetObject> transtarget_maid_dic_ = new Dictionary<Maid, PhotoTransTargetObject>();
  760. private Dictionary<int, CapsuleCollider> maid_casule_collider_hash_ = new Dictionary<int, CapsuleCollider>();
  761. private bool call_deserialize_;
  762. private List<PlacementWindow.MaidSlotData> new_load_maid_data_list_ = new List<PlacementWindow.MaidSlotData>();
  763. private Dictionary<string, PlacementWindow.ManDataBackup> man_backup_data_dic_ = new Dictionary<string, PlacementWindow.ManDataBackup>();
  764. [CompilerGenerated]
  765. private static Comparison<Maid> <>f__mg$cache0;
  766. public struct ManDataBackup
  767. {
  768. public Color color;
  769. public float fat;
  770. public bool parts_visible;
  771. public int head_item_rid;
  772. }
  773. private class PlateData
  774. {
  775. public Maid maid;
  776. public Color def_btn_color;
  777. public SimpleMaidPlate plate;
  778. public UIButton btn;
  779. public UIWFTabButton select_btn;
  780. public UISprite bg_sprite;
  781. public UISprite select_frame;
  782. }
  783. private class MaidSlotData : IComparable
  784. {
  785. public int CompareTo(object obj)
  786. {
  787. if (obj == null)
  788. {
  789. return 1;
  790. }
  791. if (base.GetType() != obj.GetType())
  792. {
  793. NDebug.Assert("error", false);
  794. }
  795. return this.sort_no.CompareTo(((PlacementWindow.MaidSlotData)obj).sort_no);
  796. }
  797. public Maid maid;
  798. public uint sort_no;
  799. public int slot_no;
  800. }
  801. }