PlacementWindow.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867
  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 = new List<CapsuleCollider>();
  287. if (maid.body0.IsCrcBody)
  288. {
  289. list = maidColliderCollect.AddCollider(MaidColliderCollect.ColliderType.Crc);
  290. }
  291. else
  292. {
  293. list = maidColliderCollect.AddCollider(MaidColliderCollect.ColliderType.Grab);
  294. }
  295. for (int j = 0; j < list.Count; j++)
  296. {
  297. ColliderEvent colliderEvent = list[j].gameObject.AddComponent<ColliderEvent>();
  298. colliderEvent.onMouseUp = new Action(maid.OnMouseUp);
  299. this.maid_casule_collider_hash_.Add(list[j].GetInstanceID(), list[j]);
  300. }
  301. using (Dictionary<int, CapsuleCollider>.Enumerator enumerator = this.maid_casule_collider_hash_.GetEnumerator())
  302. {
  303. if (enumerator.MoveNext())
  304. {
  305. KeyValuePair<int, CapsuleCollider> keyValuePair = enumerator.Current;
  306. keyValuePair.Value.enabled = true;
  307. }
  308. }
  309. maid.onMouseUpEvent = new Action<Maid>(this.OnMouseUpFromMaid);
  310. }
  311. private void OnMouseUpFromMaid(Maid maid)
  312. {
  313. if (Input.GetKey(KeyCode.Tab) && base.mgr.select_maid != maid)
  314. {
  315. this.SetSelectMaid(maid);
  316. MouseExposition @object = MouseExposition.GetObject();
  317. string draw_text = maid.status.firstName + " " + maid.status.lastName + "を選択しました";
  318. @object.SetText(draw_text, 2f);
  319. }
  320. }
  321. private void UpdateList()
  322. {
  323. HashSet<string> hashSet = new HashSet<string>();
  324. for (int i = 0; i < this.chara_mgr_.GetMaidCount(); i++)
  325. {
  326. Maid maid = this.chara_mgr_.GetMaid(i);
  327. if (!(maid == null))
  328. {
  329. if (!hashSet.Contains(maid.status.guid))
  330. {
  331. hashSet.Add(maid.status.guid);
  332. }
  333. }
  334. }
  335. for (int j = 0; j < this.chara_mgr_.GetManCount(); j++)
  336. {
  337. Maid man = this.chara_mgr_.GetMan(j);
  338. if (!(man == null) && man.Visible)
  339. {
  340. if (!hashSet.Contains(man.status.guid))
  341. {
  342. hashSet.Add(man.status.guid);
  343. }
  344. }
  345. }
  346. for (int k = 0; k < this.maid_data_list_.Count; k++)
  347. {
  348. if (hashSet.Contains(this.maid_data_list_[k].maid.status.guid))
  349. {
  350. this.maid_data_list_[k].btn.isEnabled = false;
  351. this.maid_data_list_[k].select_btn.isEnabled = true;
  352. if (base.mgr.select_maid == this.maid_data_list_[k].maid)
  353. {
  354. this.maid_data_list_[k].select_btn.SetSelect(true);
  355. }
  356. else
  357. {
  358. this.maid_data_list_[k].select_btn.SetSelect(false);
  359. }
  360. }
  361. else
  362. {
  363. this.maid_data_list_[k].btn.isEnabled = true;
  364. this.maid_data_list_[k].select_btn.SetSelect(false);
  365. this.maid_data_list_[k].select_btn.isEnabled = false;
  366. }
  367. }
  368. }
  369. public void OnClickMaid()
  370. {
  371. if (this.chara_mgr_.IsBusy())
  372. {
  373. return;
  374. }
  375. PlacementWindow.PlateData plateData = null;
  376. for (int i = 0; i < this.maid_data_list_.Count; i++)
  377. {
  378. if (this.maid_data_list_[i].select_btn == UIButton.current)
  379. {
  380. plateData = this.maid_data_list_[i];
  381. break;
  382. }
  383. }
  384. if (plateData == null)
  385. {
  386. return;
  387. }
  388. this.SetSelectMaid(plateData.maid);
  389. }
  390. private void OnClickPlacementBtn()
  391. {
  392. if (this.chara_mgr_.IsBusy())
  393. {
  394. return;
  395. }
  396. PlacementWindow.PlateData plateData = null;
  397. for (int i = 0; i < this.maid_data_list_.Count; i++)
  398. {
  399. if (!(UIButton.current != this.maid_data_list_[i].btn))
  400. {
  401. plateData = this.maid_data_list_[i];
  402. break;
  403. }
  404. }
  405. bool flag = false;
  406. for (int j = 0; j < this.GetMaidOrManCount(plateData.maid); j++)
  407. {
  408. if (this.GetMaidOrMan(plateData.maid, j) == plateData.maid)
  409. {
  410. flag = true;
  411. break;
  412. }
  413. }
  414. if (flag && plateData.maid.boMAN && !plateData.maid.Visible)
  415. {
  416. flag = false;
  417. }
  418. if (flag)
  419. {
  420. this.DeActiveMaid(plateData.maid, false);
  421. }
  422. else
  423. {
  424. int num = 0;
  425. if (!plateData.maid.boMAN)
  426. {
  427. for (int k = 0; k < this.GetMaidOrManCount(plateData.maid); k++)
  428. {
  429. num += ((!(this.GetMaidOrMan(plateData.maid, k) != null)) ? 0 : 1);
  430. }
  431. }
  432. else
  433. {
  434. for (int l = 0; l < this.GetMaidOrManCount(plateData.maid); l++)
  435. {
  436. if (this.GetMaidOrMan(plateData.maid, l) != null && plateData.maid.Visible)
  437. {
  438. num++;
  439. }
  440. }
  441. }
  442. if (!plateData.maid.boMAN && 12 <= num)
  443. {
  444. GameMain.Instance.SysDlg.ShowFromLanguageTerm("ScenePhotoMode/キャラ選択/ダイアログ/これ以上メイドを配置する事はできません", null, SystemDialog.TYPE.OK, null, null);
  445. }
  446. else if (plateData.maid.boMAN && 5 <= num)
  447. {
  448. GameMain.Instance.SysDlg.ShowFromLanguageTerm("ScenePhotoMode/キャラ選択/ダイアログ/これ以上男を配置する事はできません", null, SystemDialog.TYPE.OK, null, null);
  449. }
  450. else
  451. {
  452. this.ActiveMaid(plateData.maid);
  453. }
  454. }
  455. }
  456. private void ActiveMaid(Maid maid)
  457. {
  458. if (maid == null)
  459. {
  460. return;
  461. }
  462. List<PlacementWindow.MaidSlotData> list = new List<PlacementWindow.MaidSlotData>();
  463. uint num = 0U;
  464. for (int i = 0; i < this.active_maid_list_.Count; i++)
  465. {
  466. if (this.active_maid_list_[i].maid == maid)
  467. {
  468. list.Add(this.active_maid_list_[i]);
  469. }
  470. if (num < this.active_maid_list_[i].sort_no)
  471. {
  472. num = this.active_maid_list_[i].sort_no;
  473. }
  474. }
  475. for (int j = 0; j < list.Count; j++)
  476. {
  477. this.active_maid_list_.Remove(list[j]);
  478. }
  479. this.active_maid_list_.Sort();
  480. int k = 0;
  481. while (k < this.GetMaidOrManCount(maid))
  482. {
  483. if (!maid.boMAN)
  484. {
  485. if (!(this.GetMaidOrMan(maid, k) != null))
  486. {
  487. goto IL_107;
  488. }
  489. }
  490. else if (!(this.GetMaidOrMan(maid, k) != maid))
  491. {
  492. goto IL_107;
  493. }
  494. k++;
  495. continue;
  496. IL_107:
  497. this.SetActiveMaidOrMan(maid, k);
  498. maid.Visible = true;
  499. maid.AllProcPropSeqStart();
  500. PlacementWindow.MaidSlotData maidSlotData = new PlacementWindow.MaidSlotData();
  501. maidSlotData.maid = maid;
  502. maidSlotData.sort_no = num + 1U;
  503. maidSlotData.slot_no = k;
  504. this.new_load_maid_data_list_.Add(maidSlotData);
  505. break;
  506. }
  507. if (this.chara_mgr_.IsBusy())
  508. {
  509. GameMain.Instance.MainCamera.FadeOut(0f, false, null, true, default(Color));
  510. }
  511. }
  512. public void DeActiveMaid(Maid maid, bool on_reset_call = false)
  513. {
  514. if (this.chara_mgr_.IsBusy() || maid == null)
  515. {
  516. return;
  517. }
  518. List<PlacementWindow.MaidSlotData> list = new List<PlacementWindow.MaidSlotData>();
  519. for (int i = 0; i < this.active_maid_list_.Count; i++)
  520. {
  521. if (this.active_maid_list_[i].maid == maid)
  522. {
  523. list.Add(this.active_maid_list_[i]);
  524. }
  525. }
  526. bool flag = false;
  527. for (int j = 0; j < list.Count; j++)
  528. {
  529. if (list[j].maid == base.mgr.select_maid)
  530. {
  531. flag = true;
  532. }
  533. this.active_maid_list_.Remove(list[j]);
  534. }
  535. this.active_maid_list_.Sort();
  536. if (flag)
  537. {
  538. if (0 < this.active_maid_list_.Count && !on_reset_call)
  539. {
  540. this.SetSelectMaid(this.active_maid_list_[0].maid);
  541. }
  542. else
  543. {
  544. this.SetSelectMaid(null);
  545. }
  546. }
  547. for (int k = 0; k < this.GetMaidOrManCount(maid); k++)
  548. {
  549. Maid maidOrMan = this.GetMaidOrMan(maid, k);
  550. if (maidOrMan == maid)
  551. {
  552. maidOrMan.transform.position = Vector3.zero;
  553. maidOrMan.transform.rotation = Quaternion.identity;
  554. maidOrMan.transform.localScale = Vector3.one;
  555. maidOrMan.transform.GetChild(0).localScale = Vector3.one;
  556. maidOrMan.ResetAll();
  557. CapsuleCollider[] componentsInChildren = maid.GetComponentsInChildren<CapsuleCollider>();
  558. if (componentsInChildren.Length == 0)
  559. {
  560. this.maid_casule_collider_hash_.Clear();
  561. }
  562. for (int l = 0; l < componentsInChildren.Length; l++)
  563. {
  564. this.maid_casule_collider_hash_.Remove(componentsInChildren[l].GetInstanceID());
  565. ColliderEvent component = componentsInChildren[l].GetComponent<ColliderEvent>();
  566. if (component != null)
  567. {
  568. UnityEngine.Object.Destroy(component);
  569. }
  570. UnityEngine.Object.Destroy(componentsInChildren[l]);
  571. }
  572. maid.onMouseUpEvent = null;
  573. base.mgr.OnMaidRemoveEventPrev(maid);
  574. if (!maid.boMAN)
  575. {
  576. this.DeactivateMaidOrMan(maid);
  577. }
  578. else
  579. {
  580. int m;
  581. for (m = 0; m < this.chara_mgr_.GetManCount(); m++)
  582. {
  583. if (this.chara_mgr_.GetMan(m) == maid)
  584. {
  585. break;
  586. }
  587. }
  588. this.chara_mgr_.CharaVisible(m, false, true);
  589. }
  590. base.mgr.OnMaidRemoveEvent(maid);
  591. break;
  592. }
  593. }
  594. }
  595. protected void OnChangeAxisVisibleType()
  596. {
  597. WindowPartsTransform.AxisVisibleType axis_visible_type = this.PartsTransForm.axis_visible_type;
  598. PhotoTransTargetObject photoTransTargetObject = null;
  599. foreach (KeyValuePair<Maid, PhotoTransTargetObject> keyValuePair in this.transtarget_maid_dic_)
  600. {
  601. if (keyValuePair.Value.axis_obj != null)
  602. {
  603. keyValuePair.Value.axis_obj.Visible = false;
  604. }
  605. if (keyValuePair.Value.rotate_obj != null)
  606. {
  607. keyValuePair.Value.rotate_obj.Visible = false;
  608. }
  609. }
  610. if (base.mgr.select_maid != null)
  611. {
  612. photoTransTargetObject = this.transtarget_maid_dic_[base.mgr.select_maid];
  613. }
  614. if (photoTransTargetObject == null || photoTransTargetObject.obj == null || photoTransTargetObject.axis_obj == null)
  615. {
  616. return;
  617. }
  618. if (axis_visible_type == WindowPartsTransform.AxisVisibleType.UnVisible)
  619. {
  620. photoTransTargetObject.axis_obj.Visible = false;
  621. photoTransTargetObject.rotate_obj.Visible = false;
  622. }
  623. else if (axis_visible_type == WindowPartsTransform.AxisVisibleType.Position)
  624. {
  625. photoTransTargetObject.axis_obj.Visible = true;
  626. photoTransTargetObject.rotate_obj.Visible = false;
  627. }
  628. else if (axis_visible_type == WindowPartsTransform.AxisVisibleType.Rotate)
  629. {
  630. photoTransTargetObject.axis_obj.Visible = false;
  631. photoTransTargetObject.rotate_obj.Visible = true;
  632. }
  633. }
  634. public void OnClickVisibleCheckButton(WFCheckBox check_box)
  635. {
  636. if (base.mgr.select_maid == null)
  637. {
  638. return;
  639. }
  640. if (check_box.check)
  641. {
  642. base.mgr.select_maid.gameObject.transform.GetChild(0).localScale = Vector3.one;
  643. }
  644. else
  645. {
  646. base.mgr.select_maid.gameObject.transform.GetChild(0).localScale = Vector3.zero;
  647. }
  648. }
  649. public void OnClickCameraFocus()
  650. {
  651. if (base.mgr.select_maid == null || base.mgr.select_maid.body0 == null)
  652. {
  653. return;
  654. }
  655. Transform bone;
  656. if (!base.mgr.select_maid.boMAN)
  657. {
  658. bone = base.mgr.select_maid.body0.GetBone("Bip01 Head");
  659. }
  660. else
  661. {
  662. bone = base.mgr.select_maid.body0.GetBone("ManBip Head");
  663. }
  664. Vector3 position = bone.position;
  665. float distance = 1.6f;
  666. Vector2 aroundAngle = new Vector2(-180f, 4.7f);
  667. this.camera_move_support_.StartCameraPosition(position, distance, aroundAngle);
  668. }
  669. public void OnClickDeActive()
  670. {
  671. this.DeActiveMaid(base.mgr.select_maid, false);
  672. }
  673. public override void OnReset()
  674. {
  675. for (int i = 0; i < this.chara_mgr_.GetMaidCount(); i++)
  676. {
  677. if (this.chara_mgr_.GetMaid(i) != null)
  678. {
  679. this.DeActiveMaid(this.chara_mgr_.GetMaid(i), true);
  680. }
  681. }
  682. for (int j = 0; j < this.chara_mgr_.GetManCount(); j++)
  683. {
  684. if (this.chara_mgr_.GetMan(j) != null && this.chara_mgr_.GetMan(j).Visible)
  685. {
  686. this.DeActiveMaid(this.chara_mgr_.GetMan(j), true);
  687. }
  688. }
  689. }
  690. public override void OnDeserializeEvent()
  691. {
  692. List<string> maidStoreGuidList = base.mgr.GetMaidStoreGuidList();
  693. for (int i = 0; i < maidStoreGuidList.Count; i++)
  694. {
  695. this.call_deserialize_ = true;
  696. Maid maid = GameMain.Instance.CharacterMgr.GetStockMaid(maidStoreGuidList[i]);
  697. if (maid == null)
  698. {
  699. maid = GameMain.Instance.CharacterMgr.GetStockMan(maidStoreGuidList[i]);
  700. }
  701. maid.transform.position = Vector3.zero;
  702. maid.transform.rotation = Quaternion.identity;
  703. maid.transform.localScale = Vector3.one;
  704. maid.transform.GetChild(0).localScale = Vector3.one;
  705. this.ActiveMaid(maid);
  706. }
  707. }
  708. private int GetMaidOrManCount(Maid maid)
  709. {
  710. return maid.boMAN ? this.chara_mgr_.GetManCount() : this.chara_mgr_.GetMaidCount();
  711. }
  712. private Maid GetMaidOrMan(Maid maid, int slot_no)
  713. {
  714. return maid.boMAN ? this.chara_mgr_.GetMan(slot_no) : this.chara_mgr_.GetMaid(slot_no);
  715. }
  716. private void SetActiveMaidOrMan(Maid maid, int slot_no)
  717. {
  718. if (!maid.boMAN)
  719. {
  720. this.chara_mgr_.SetActiveMaid(maid, slot_no);
  721. }
  722. else
  723. {
  724. this.chara_mgr_.SetActiveMan(maid, slot_no);
  725. }
  726. }
  727. private void DeactivateMaidOrMan(Maid maid)
  728. {
  729. if (!maid.boMAN)
  730. {
  731. this.chara_mgr_.DeactivateMaid(maid);
  732. }
  733. else
  734. {
  735. this.chara_mgr_.DeactivateMan(maid);
  736. }
  737. }
  738. public Dictionary<string, PlacementWindow.ManDataBackup> man_backup_data_dic
  739. {
  740. get
  741. {
  742. return this.man_backup_data_dic_;
  743. }
  744. }
  745. public List<Maid> maid_list
  746. {
  747. get
  748. {
  749. List<Maid> list = new List<Maid>();
  750. foreach (PlacementWindow.PlateData plateData in this.maid_data_list_)
  751. {
  752. list.Add(plateData.maid);
  753. }
  754. return list;
  755. }
  756. }
  757. public WindowPartsTransform PartsTransForm;
  758. public UIButton CameraFocusButton;
  759. public WFCheckBox VisibleCheckButton;
  760. public UIButton DeActiveButton;
  761. public UIButton CallEditButton;
  762. private bool is_first_;
  763. private WfCameraMoveSupport camera_move_support_;
  764. private CharacterMgr chara_mgr_;
  765. private List<PlacementWindow.PlateData> maid_data_list_ = new List<PlacementWindow.PlateData>();
  766. private List<PlacementWindow.MaidSlotData> active_maid_list_ = new List<PlacementWindow.MaidSlotData>();
  767. private Dictionary<Maid, PhotoTransTargetObject> transtarget_maid_dic_ = new Dictionary<Maid, PhotoTransTargetObject>();
  768. private Dictionary<int, CapsuleCollider> maid_casule_collider_hash_ = new Dictionary<int, CapsuleCollider>();
  769. private bool call_deserialize_;
  770. private List<PlacementWindow.MaidSlotData> new_load_maid_data_list_ = new List<PlacementWindow.MaidSlotData>();
  771. private Dictionary<string, PlacementWindow.ManDataBackup> man_backup_data_dic_ = new Dictionary<string, PlacementWindow.ManDataBackup>();
  772. [CompilerGenerated]
  773. private static Comparison<Maid> <>f__mg$cache0;
  774. public struct ManDataBackup
  775. {
  776. public Color color;
  777. public float fat;
  778. public bool parts_visible;
  779. public int head_item_rid;
  780. }
  781. private class PlateData
  782. {
  783. public Maid maid;
  784. public Color def_btn_color;
  785. public SimpleMaidPlate plate;
  786. public UIButton btn;
  787. public UIWFTabButton select_btn;
  788. public UISprite bg_sprite;
  789. public UISprite select_frame;
  790. }
  791. private class MaidSlotData : IComparable
  792. {
  793. public int CompareTo(object obj)
  794. {
  795. if (obj == null)
  796. {
  797. return 1;
  798. }
  799. if (base.GetType() != obj.GetType())
  800. {
  801. NDebug.Assert("error", false);
  802. }
  803. return this.sort_no.CompareTo(((PlacementWindow.MaidSlotData)obj).sort_no);
  804. }
  805. public Maid maid;
  806. public uint sort_no;
  807. public int slot_no;
  808. }
  809. }