PoseEditWindow.cs 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using I2.Loc;
  5. using UnityEngine;
  6. public class PoseEditWindow : BaseMaidPhotoWindow
  7. {
  8. public static IKManager GetMaidIKManager(Maid maid)
  9. {
  10. GameObject gameObject = GameObject.Find("PoseEditWorkParent");
  11. if (gameObject == null)
  12. {
  13. gameObject = new GameObject("PoseEditWorkParent");
  14. }
  15. if (maid == null || maid.boMAN)
  16. {
  17. return null;
  18. }
  19. GameObject gameObject2 = GameObject.Find("PoseEditWorkParent/" + maid.status.guid);
  20. if (gameObject2 != null && gameObject2.GetComponent<IKManager>() != null)
  21. {
  22. return gameObject2.GetComponent<IKManager>();
  23. }
  24. if (gameObject2 == null)
  25. {
  26. gameObject2 = new GameObject(maid.status.guid);
  27. gameObject2.transform.SetParent(gameObject.transform, false);
  28. }
  29. IKManager ikmanager = gameObject2.AddComponent<IKManager>();
  30. ikmanager.SetMaid(maid);
  31. IEnumerator enumerator = Enum.GetValues(typeof(IKManager.BoneSetType)).GetEnumerator();
  32. try
  33. {
  34. while (enumerator.MoveNext())
  35. {
  36. object obj = enumerator.Current;
  37. IKManager.BoneSetType bone_set_type = (IKManager.BoneSetType)obj;
  38. ikmanager.SetRotateVisibleBoneSet(bone_set_type, false);
  39. ikmanager.SetTransAxisVisibleBoneSet(bone_set_type, false);
  40. }
  41. }
  42. finally
  43. {
  44. IDisposable disposable;
  45. if ((disposable = (enumerator as IDisposable)) != null)
  46. {
  47. disposable.Dispose();
  48. }
  49. }
  50. ikmanager.SetTransAxisVisibleRoot(false);
  51. return ikmanager;
  52. }
  53. public override void Awake()
  54. {
  55. base.Awake();
  56. this.noCharaActive = base.GetComponentInChildren<PhotoNoCharaActive>();
  57. EventDelegate.Add(this.BtnSave.onClick, new EventDelegate.Callback(this.OnBtnSave));
  58. if (this.BtnReversal != null)
  59. {
  60. EventDelegate.Add(this.BtnReversal.onClick, new EventDelegate.Callback(this.OnBtnReversal));
  61. }
  62. this.ControlSelectBtnTab.UpdateChildren();
  63. foreach (UIWFTabButton uiwftabButton in this.ControlSelectBtnTab.button_list)
  64. {
  65. EventDelegate.Add(uiwftabButton.onSelect, new EventDelegate.Callback(this.OnSelectControlSelectBtn));
  66. }
  67. for (int i = 0; i < this.FingerBlendArray.Length; i++)
  68. {
  69. this.FingerBlendArray[i].mgr = base.mgr;
  70. this.FingerBlendArray[i].OnClickFingerBlendEnabledEvent = delegate(WindowPartsFingerBlend.Type blend_type, bool blend_enabled)
  71. {
  72. IKManager.BoneSetType boneSetType = IKManager.BoneSetType.Body;
  73. WFCheckBox wfcheckBox = null;
  74. if (blend_type == WindowPartsFingerBlend.Type.RightArm)
  75. {
  76. wfcheckBox = this.ikbox_visible_dic_["ik_box_visible_RightArmFinger"];
  77. boneSetType = IKManager.BoneSetType.RightArmFinger;
  78. }
  79. else if (blend_type == WindowPartsFingerBlend.Type.LeftArm)
  80. {
  81. wfcheckBox = this.ikbox_visible_dic_["ik_box_visible_LeftArmFinger"];
  82. boneSetType = IKManager.BoneSetType.LeftArmFinger;
  83. }
  84. else if (blend_type == WindowPartsFingerBlend.Type.RightLeg)
  85. {
  86. wfcheckBox = this.ikbox_visible_dic_["ik_box_visible_RightLegFinger"];
  87. boneSetType = IKManager.BoneSetType.RightLegFinger;
  88. }
  89. else if (blend_type == WindowPartsFingerBlend.Type.LeftLeg)
  90. {
  91. wfcheckBox = this.ikbox_visible_dic_["ik_box_visible_LeftLegFinger"];
  92. boneSetType = IKManager.BoneSetType.LeftLegFinger;
  93. }
  94. if (!blend_enabled)
  95. {
  96. wfcheckBox.enabled = true;
  97. for (int l = 0; l < this.RotateCheckBoxArray.Length; l++)
  98. {
  99. if (this.RotateCheckBoxArray[l].BoneSetType == boneSetType)
  100. {
  101. this.RotateCheckBoxArray[l].AllCheckBoxEnabled(true);
  102. }
  103. }
  104. return;
  105. }
  106. WFCheckBox wfcheckBox2 = wfcheckBox;
  107. bool flag = false;
  108. wfcheckBox.enabled = flag;
  109. wfcheckBox2.check = flag;
  110. foreach (Action<WFCheckBox> action in wfcheckBox.onClick)
  111. {
  112. action(wfcheckBox);
  113. }
  114. for (int m = 0; m < this.RotateCheckBoxArray.Length; m++)
  115. {
  116. if (this.RotateCheckBoxArray[m].BoneSetType == boneSetType)
  117. {
  118. this.RotateCheckBoxArray[m].AllCheckBoxOFF();
  119. this.RotateCheckBoxArray[m].AllCheckBoxEnabled(false);
  120. }
  121. }
  122. };
  123. }
  124. for (int j = 0; j < this.RotateCheckBoxArray.Length; j++)
  125. {
  126. this.RotateCheckBoxArray[j].mgr = base.mgr;
  127. }
  128. this.GetControlPanelParentObject(PoseEditWindow.ControlType.Body).SetActive(true);
  129. this.GetControlPanelParentObject(PoseEditWindow.ControlType.Hand).SetActive(true);
  130. this.GetControlPanelParentObject(PoseEditWindow.ControlType.Leg).SetActive(true);
  131. List<KeyValuePair<PoseEditWindow.ControlType, KeyValuePair<string, string>>> list = new List<KeyValuePair<PoseEditWindow.ControlType, KeyValuePair<string, string>>>();
  132. list.Add(new KeyValuePair<PoseEditWindow.ControlType, KeyValuePair<string, string>>(PoseEditWindow.ControlType.Body, new KeyValuePair<string, string>("ik_box_visible_Root", "CheckCenterVisible")));
  133. list.Add(new KeyValuePair<PoseEditWindow.ControlType, KeyValuePair<string, string>>(PoseEditWindow.ControlType.Body, new KeyValuePair<string, string>("ik_box_visible_Body", "CheckLimbVisible")));
  134. list.Add(new KeyValuePair<PoseEditWindow.ControlType, KeyValuePair<string, string>>(PoseEditWindow.ControlType.Hand, new KeyValuePair<string, string>("ik_box_visible_RightArmFinger", "RightSet/Parent/CheckIKVisible")));
  135. list.Add(new KeyValuePair<PoseEditWindow.ControlType, KeyValuePair<string, string>>(PoseEditWindow.ControlType.Hand, new KeyValuePair<string, string>("ik_box_visible_LeftArmFinger", "LeftSet/Parent/CheckIKVisible")));
  136. list.Add(new KeyValuePair<PoseEditWindow.ControlType, KeyValuePair<string, string>>(PoseEditWindow.ControlType.Leg, new KeyValuePair<string, string>("ik_box_visible_RightLegFinger", "RightSet/Parent/CheckIKVisible")));
  137. list.Add(new KeyValuePair<PoseEditWindow.ControlType, KeyValuePair<string, string>>(PoseEditWindow.ControlType.Leg, new KeyValuePair<string, string>("ik_box_visible_LeftLegFinger", "LeftSet/Parent/CheckIKVisible")));
  138. for (int k = 0; k < list.Count; k++)
  139. {
  140. WFCheckBox component = UTY.GetChildObject(this.GetControlPanelParentObject(list[k].Key), list[k].Value.Value, false).GetComponent<WFCheckBox>();
  141. component.name = list[k].Value.Key;
  142. component.onClick.Add(new Action<WFCheckBox>(this.OnIKBOXVixibleCheckBox));
  143. this.ikbox_visible_dic_.Add(component.name, component);
  144. }
  145. }
  146. public override void Start()
  147. {
  148. base.Start();
  149. this.UpdateChildren();
  150. this.CheckbtnUse.onClick.Add(new Action<WFCheckBox>(this.OnClickUseCheck));
  151. this.noCharaActive.ChangeMode(true, true);
  152. }
  153. public new void Update()
  154. {
  155. if (base.mgr.select_maid == null || base.mgr.select_maid.boMAN || !this.CheckbtnUse.check)
  156. {
  157. return;
  158. }
  159. bool flag = false;
  160. bool flag2 = false;
  161. if ((Input.GetKey(KeyCode.RightControl) || Input.GetKey(KeyCode.LeftControl)) && Input.GetKeyDown(KeyCode.Z))
  162. {
  163. flag = true;
  164. }
  165. if ((Input.GetKey(KeyCode.RightControl) || Input.GetKey(KeyCode.LeftControl)) && Input.GetKeyDown(KeyCode.Y))
  166. {
  167. flag2 = true;
  168. }
  169. if (flag || flag2)
  170. {
  171. bool flag3 = true;
  172. string draw_text = string.Empty;
  173. for (int i = 0; i < this.FingerBlendArray.Length; i++)
  174. {
  175. if (this.FingerBlendArray[i].CheckBoxEnabled.enabled && this.FingerBlendArray[i].CheckBoxEnabled.check)
  176. {
  177. if (flag)
  178. {
  179. draw_text = "指先ブレンド中はUndoできません";
  180. }
  181. else
  182. {
  183. draw_text = "指先ブレンド中はRedoできません";
  184. }
  185. flag3 = false;
  186. break;
  187. }
  188. }
  189. if (GizmoRender.control_lock || IKDragPoint.IsDrag)
  190. {
  191. if (flag)
  192. {
  193. draw_text = "操作中はUndoできません";
  194. }
  195. else
  196. {
  197. draw_text = "操作中はRedoできません";
  198. }
  199. flag3 = false;
  200. }
  201. MouseExposition @object = MouseExposition.GetObject();
  202. if (flag3)
  203. {
  204. bool flag4 = (!flag) ? this.ik_mgr.HistoryRedo() : this.ik_mgr.HistoryUndo();
  205. if (flag4)
  206. {
  207. @object.SetText((!flag) ? "Redo" : "Undo", 0.5f);
  208. }
  209. }
  210. else
  211. {
  212. @object.SetText(draw_text, 3f);
  213. }
  214. }
  215. }
  216. public override void OnMaidAddEvent(Maid maid, bool is_deserialize_load)
  217. {
  218. base.OnMaidAddEvent(maid, is_deserialize_load);
  219. if (maid.boMAN)
  220. {
  221. return;
  222. }
  223. Dictionary<string, string> maidStoreData = base.GetMaidStoreData(maid);
  224. if (!maidStoreData.ContainsKey("use"))
  225. {
  226. maidStoreData["use"] = false.ToString();
  227. }
  228. if (!maidStoreData.ContainsKey("select_control_type"))
  229. {
  230. maidStoreData["select_control_type"] = PoseEditWindow.ControlType.Body.ToString();
  231. }
  232. if (!maidStoreData.ContainsKey("pose_binary"))
  233. {
  234. maidStoreData["pose_binary"] = string.Empty;
  235. }
  236. if (!maidStoreData.ContainsKey("use_mune_key_l"))
  237. {
  238. Dictionary<string, string> dictionary = maidStoreData;
  239. string key = "use_mune_key_l";
  240. string value = false.ToString();
  241. maidStoreData["use_mune_key_r"] = value;
  242. dictionary[key] = value;
  243. }
  244. foreach (KeyValuePair<string, WFCheckBox> keyValuePair in this.ikbox_visible_dic_)
  245. {
  246. if (!maidStoreData.ContainsKey(keyValuePair.Value.name))
  247. {
  248. maidStoreData[keyValuePair.Value.name] = false.ToString();
  249. }
  250. }
  251. maidStoreData["ik_box_visible_Body"] = true.ToString();
  252. for (int i = 0; i < this.FingerBlendArray.Length; i++)
  253. {
  254. this.FingerBlendArray[i].OnMaidAddEvent(maid, is_deserialize_load);
  255. }
  256. for (int j = 0; j < this.RotateCheckBoxArray.Length; j++)
  257. {
  258. this.RotateCheckBoxArray[j].OnMaidAddEvent(maid, is_deserialize_load);
  259. }
  260. if (is_deserialize_load && !string.IsNullOrEmpty(maidStoreData["pose_binary"]))
  261. {
  262. IKManager maidIKManager = PoseEditWindow.GetMaidIKManager(maid);
  263. KeyValuePair<bool, bool> keyValuePair2 = maidIKManager.cache_bone_data.SetFrameBinary(Convert.FromBase64String(maidStoreData["pose_binary"]));
  264. bool key2 = keyValuePair2.Key;
  265. bool value2 = keyValuePair2.Value;
  266. maid.body0.MuneYureL((float)((!key2) ? 1 : 0));
  267. maid.body0.MuneYureR((float)((!value2) ? 1 : 0));
  268. maid.body0.jbMuneL.enabled = !key2;
  269. maid.body0.jbMuneR.enabled = !value2;
  270. }
  271. }
  272. public void OnMotionUpdate(Maid maid)
  273. {
  274. if (base.mgr.select_maid == null || base.mgr.select_maid != maid || maid.boMAN)
  275. {
  276. return;
  277. }
  278. Dictionary<string, string> maidStoreData = base.GetMaidStoreData(maid);
  279. if (!bool.Parse(maidStoreData["use"]))
  280. {
  281. return;
  282. }
  283. bool flag = maid.body0.GetMuneYureL() == 0f;
  284. bool flag2 = maid.body0.GetMuneYureR() == 0f;
  285. maidStoreData["use_mune_key_l"] = flag.ToString();
  286. maidStoreData["use_mune_key_r"] = flag2.ToString();
  287. maid.body0.jbMuneL.enabled = !flag;
  288. maid.body0.jbMuneR.enabled = !flag2;
  289. for (int i = 0; i < this.RotateCheckBoxArray.Length; i++)
  290. {
  291. this.RotateCheckBoxArray[i].OnMotionUpdate();
  292. }
  293. if (this.ik_mgr_ != null)
  294. {
  295. IKManager.BoneSetType[] array = new IKManager.BoneSetType[0];
  296. if (this.ik_mgr_ != null && this.ctrl_type_ == PoseEditWindow.ControlType.Body)
  297. {
  298. array = new IKManager.BoneSetType[]
  299. {
  300. IKManager.BoneSetType.RightArmFinger,
  301. IKManager.BoneSetType.LeftArmFinger,
  302. IKManager.BoneSetType.RightLegFinger,
  303. IKManager.BoneSetType.LeftLegFinger
  304. };
  305. }
  306. else if (this.ik_mgr_ != null && this.ctrl_type_ == PoseEditWindow.ControlType.Hand)
  307. {
  308. array = new IKManager.BoneSetType[]
  309. {
  310. IKManager.BoneSetType.Body,
  311. IKManager.BoneSetType.RightLegFinger,
  312. IKManager.BoneSetType.LeftLegFinger
  313. };
  314. }
  315. else if (this.ik_mgr_ != null && this.ctrl_type_ == PoseEditWindow.ControlType.Leg)
  316. {
  317. array = new IKManager.BoneSetType[]
  318. {
  319. IKManager.BoneSetType.Body,
  320. IKManager.BoneSetType.RightArmFinger,
  321. IKManager.BoneSetType.LeftArmFinger
  322. };
  323. }
  324. foreach (IKManager.BoneSetType bone_set_type in array)
  325. {
  326. this.ik_mgr_.SetRotateVisibleBoneSet(bone_set_type, false);
  327. }
  328. }
  329. for (int k = 0; k < this.FingerBlendArray.Length; k++)
  330. {
  331. this.FingerBlendArray[k].OnMotionUpdate();
  332. }
  333. if (this.ik_mgr_ != null)
  334. {
  335. this.ik_mgr.HistoryClear();
  336. this.ik_mgr.HistoryNew();
  337. }
  338. }
  339. public void OnSelectControlSelectBtn()
  340. {
  341. if (this.ControlSelectBtnTab.GetSelectButtonObject() == null || base.mgr.select_maid == null || base.mgr.select_maid.boMAN || !UIWFSelectButton.current.isSelected)
  342. {
  343. return;
  344. }
  345. Localize componentInChildren = this.ControlSelectBtnTab.GetSelectButtonObject().GetComponentInChildren<Localize>();
  346. if (componentInChildren == null)
  347. {
  348. return;
  349. }
  350. Dictionary<string, string> maidStoreData = base.GetMaidStoreData(base.mgr.select_maid);
  351. string key = "select_control_type";
  352. if (componentInChildren.Term.IndexOf("胴体") != -1)
  353. {
  354. this.ctrl_type_ = PoseEditWindow.ControlType.Body;
  355. }
  356. else if (componentInChildren.Term.IndexOf("手") != -1)
  357. {
  358. this.ctrl_type_ = PoseEditWindow.ControlType.Hand;
  359. }
  360. else
  361. {
  362. this.ctrl_type_ = PoseEditWindow.ControlType.Leg;
  363. }
  364. maidStoreData[key] = this.ctrl_type_.ToString();
  365. this.SetControlPanel(this.ctrl_type_);
  366. IKManager.BoneSetType[] array = new IKManager.BoneSetType[0];
  367. bool flag = false;
  368. if (this.ik_mgr_ != null && this.ctrl_type_ == PoseEditWindow.ControlType.Body)
  369. {
  370. array = new IKManager.BoneSetType[]
  371. {
  372. IKManager.BoneSetType.RightArmFinger,
  373. IKManager.BoneSetType.LeftArmFinger,
  374. IKManager.BoneSetType.RightLegFinger,
  375. IKManager.BoneSetType.LeftLegFinger
  376. };
  377. flag = true;
  378. }
  379. else if (this.ik_mgr_ != null && this.ctrl_type_ == PoseEditWindow.ControlType.Hand)
  380. {
  381. array = new IKManager.BoneSetType[]
  382. {
  383. IKManager.BoneSetType.Body,
  384. IKManager.BoneSetType.RightLegFinger,
  385. IKManager.BoneSetType.LeftLegFinger
  386. };
  387. }
  388. else if (this.ik_mgr_ != null && this.ctrl_type_ == PoseEditWindow.ControlType.Leg)
  389. {
  390. array = new IKManager.BoneSetType[]
  391. {
  392. IKManager.BoneSetType.Body,
  393. IKManager.BoneSetType.RightArmFinger,
  394. IKManager.BoneSetType.LeftArmFinger
  395. };
  396. }
  397. foreach (KeyValuePair<string, WFCheckBox> keyValuePair in this.ikbox_visible_dic_)
  398. {
  399. keyValuePair.Value.check = bool.Parse(maidStoreData[keyValuePair.Value.name]);
  400. keyValuePair.Value.onClick[0](keyValuePair.Value);
  401. }
  402. foreach (IKManager.BoneSetType bone_set_type in array)
  403. {
  404. this.ik_mgr_.SetRotateVisibleBoneSet(bone_set_type, false);
  405. this.ik_mgr_.SetTransAxisVisibleBoneSet(bone_set_type, false);
  406. }
  407. if (!flag)
  408. {
  409. this.ik_mgr_.SetTransAxisVisibleRoot(false);
  410. }
  411. List<IKManager.BoneSetType> list = new List<IKManager.BoneSetType>(array);
  412. for (int j = 0; j < this.RotateCheckBoxArray.Length; j++)
  413. {
  414. if (0 > list.IndexOf(this.RotateCheckBoxArray[j].BoneSetType))
  415. {
  416. this.RotateCheckBoxArray[j].Apply();
  417. }
  418. }
  419. }
  420. public void OnClickUseCheck(WFCheckBox check_box)
  421. {
  422. if (base.mgr.select_maid == null || base.mgr.select_maid.boMAN)
  423. {
  424. return;
  425. }
  426. if (!check_box.check && GameMain.Instance.SysDlg.IsDecided)
  427. {
  428. GameMain.Instance.SysDlg.ShowFromLanguageTerm("ScenePhotoMode/Pエディット/ダイアログ/セーブしていないデータは失われます。OFFにしますか?", null, SystemDialog.TYPE.YES_NO, delegate
  429. {
  430. check_box.check = false;
  431. this.OnClickUseCheckRun(false);
  432. GameMain.Instance.SysDlg.Close();
  433. }, null);
  434. check_box.check = true;
  435. return;
  436. }
  437. this.OnClickUseCheckRun(true);
  438. }
  439. public void OnClickUseCheckRun(bool check)
  440. {
  441. Dictionary<string, string> maidStoreData = base.GetMaidStoreData(base.mgr.select_maid);
  442. maidStoreData["use"] = check.ToString();
  443. if (!check)
  444. {
  445. maidStoreData["pose_binary"] = string.Empty;
  446. }
  447. this.ChangeEnabeled(check);
  448. this.ik_mgr.HistoryClear();
  449. this.ik_mgr.HistoryNew();
  450. MaidColliderCollect component = base.mgr.select_maid.GetComponent<MaidColliderCollect>();
  451. List<CapsuleCollider> collider = component.GetCollider(MaidColliderCollect.ColliderType.Grab);
  452. foreach (CapsuleCollider capsuleCollider in collider)
  453. {
  454. capsuleCollider.gameObject.SetActive(!check);
  455. }
  456. }
  457. public void OnIKBOXVixibleCheckBox(WFCheckBox check_box)
  458. {
  459. if (base.mgr.select_maid == null || base.mgr.select_maid.boMAN || this.ik_mgr_ == null)
  460. {
  461. return;
  462. }
  463. Dictionary<string, string> maidStoreData = base.GetMaidStoreData(base.mgr.select_maid);
  464. maidStoreData[check_box.name] = check_box.check.ToString();
  465. string text = check_box.name.Replace("ik_box_visible_", string.Empty);
  466. if (text == "Root")
  467. {
  468. this.ik_mgr_.SetTransAxisVisibleRoot(check_box.check);
  469. }
  470. else
  471. {
  472. IKManager.BoneSetType boneSetType = (IKManager.BoneSetType)Enum.Parse(typeof(IKManager.BoneSetType), text);
  473. this.ik_mgr_.SetTransAxisVisibleBoneSet(boneSetType, check_box.check);
  474. if (check_box.check && boneSetType != IKManager.BoneSetType.Body)
  475. {
  476. WindowPartsFingerBlend windowPartsFingerBlend = this.GetWindowPartsFingerBlend(boneSetType);
  477. if (windowPartsFingerBlend != null && windowPartsFingerBlend.CheckBoxEnabled.check)
  478. {
  479. windowPartsFingerBlend.OnClickEnter();
  480. }
  481. }
  482. }
  483. }
  484. public void ChangeEnabeled(bool use)
  485. {
  486. if (use && (base.mgr.select_maid == null || base.mgr.select_maid.boMAN))
  487. {
  488. use = false;
  489. }
  490. if (use)
  491. {
  492. Dictionary<string, string> maidStoreData = base.GetMaidStoreData(base.mgr.select_maid);
  493. this.BtnSave.isEnabled = true;
  494. MotionWindow motionWindow = base.mgr.GetWindow(PhotoWindowManager.WindowType.Motion) as MotionWindow;
  495. if (!motionWindow.CheckbtnStop.check)
  496. {
  497. motionWindow.CheckbtnStop.check = true;
  498. motionWindow.OnClickStopCheck(motionWindow.CheckbtnStop);
  499. }
  500. base.mgr.select_maid.IKTargetToBone("左手", null, "無し", Vector3.zero, IKCtrlData.IKAttachType.Point, false, false, false);
  501. base.mgr.select_maid.IKTargetToBone("右手", null, "無し", Vector3.zero, IKCtrlData.IKAttachType.Point, false, false, false);
  502. this.ControlSelectBtnTab.ResetSelect();
  503. Dictionary<PoseEditWindow.ControlType, UIWFTabButton> dictionary = new Dictionary<PoseEditWindow.ControlType, UIWFTabButton>();
  504. foreach (UIWFTabButton uiwftabButton in this.ControlSelectBtnTab.button_list)
  505. {
  506. uiwftabButton.SetSelect(false);
  507. uiwftabButton.isEnabled = true;
  508. dictionary.Add((PoseEditWindow.ControlType)Enum.Parse(typeof(PoseEditWindow.ControlType), uiwftabButton.transform.parent.name), uiwftabButton);
  509. }
  510. for (int i = 0; i < this.RotateCheckBoxArray.Length; i++)
  511. {
  512. this.RotateCheckBoxArray[i].ChangeEnabeled(use);
  513. }
  514. for (int j = 0; j < this.FingerBlendArray.Length; j++)
  515. {
  516. this.FingerBlendArray[j].ChangeEnabeled(use);
  517. }
  518. this.ControlSelectBtnTab.Select(dictionary[this.ctrl_type_]);
  519. }
  520. else
  521. {
  522. this.ControlSelectBtnTab.ResetSelect();
  523. foreach (UIWFTabButton uiwftabButton2 in this.ControlSelectBtnTab.button_list)
  524. {
  525. uiwftabButton2.SetSelect(false);
  526. uiwftabButton2.isEnabled = false;
  527. }
  528. this.BtnSave.isEnabled = false;
  529. MotionWindow motionWindow2 = base.mgr.GetWindow(PhotoWindowManager.WindowType.Motion) as MotionWindow;
  530. motionWindow2.UpdateAnimationData(base.mgr.select_maid);
  531. this.SetControlPanel(PoseEditWindow.ControlType.Null);
  532. if (this.ik_mgr_ != null)
  533. {
  534. IEnumerator enumerator3 = Enum.GetValues(typeof(IKManager.BoneSetType)).GetEnumerator();
  535. try
  536. {
  537. while (enumerator3.MoveNext())
  538. {
  539. object obj = enumerator3.Current;
  540. IKManager.BoneSetType bone_set_type = (IKManager.BoneSetType)obj;
  541. this.ik_mgr_.SetRotateVisibleBoneSet(bone_set_type, false);
  542. this.ik_mgr_.SetTransAxisVisibleBoneSet(bone_set_type, false);
  543. }
  544. }
  545. finally
  546. {
  547. IDisposable disposable;
  548. if ((disposable = (enumerator3 as IDisposable)) != null)
  549. {
  550. disposable.Dispose();
  551. }
  552. }
  553. this.ik_mgr_.SetTransAxisVisibleRoot(false);
  554. }
  555. if (base.mgr.select_maid != null && base.mgr.select_maid.body0 != null && !base.mgr.select_maid.boMAN)
  556. {
  557. base.mgr.select_maid.body0.MuneYureL(1f);
  558. base.mgr.select_maid.body0.MuneYureR(1f);
  559. base.mgr.select_maid.body0.jbMuneL.enabled = true;
  560. base.mgr.select_maid.body0.jbMuneR.enabled = true;
  561. }
  562. if (this.ik_mgr != null)
  563. {
  564. this.ik_mgr.HistoryClear();
  565. }
  566. for (int k = 0; k < this.RotateCheckBoxArray.Length; k++)
  567. {
  568. this.RotateCheckBoxArray[k].ChangeEnabeled(use);
  569. }
  570. for (int l = 0; l < this.FingerBlendArray.Length; l++)
  571. {
  572. this.FingerBlendArray[l].ChangeEnabeled(use);
  573. }
  574. }
  575. this.Apply();
  576. }
  577. public void Apply()
  578. {
  579. if (base.mgr.select_maid == null || base.mgr.select_maid.boMAN)
  580. {
  581. return;
  582. }
  583. Dictionary<string, string> maidStoreData = base.GetMaidStoreData(base.mgr.select_maid);
  584. if (!bool.Parse(maidStoreData["use"]))
  585. {
  586. return;
  587. }
  588. for (int i = 0; i < this.FingerBlendArray.Length; i++)
  589. {
  590. this.FingerBlendArray[i].Apply();
  591. }
  592. }
  593. public void OnBtnSave()
  594. {
  595. if (this.ik_mgr_ == null || base.mgr.select_maid == null)
  596. {
  597. return;
  598. }
  599. Dictionary<string, string> maidStoreData = base.GetMaidStoreData(base.mgr.select_maid);
  600. this.PanelSave.OpenPoseSaveMode(this.ik_mgr_.cache_bone_data.GetAnmBinary(bool.Parse(maidStoreData["use_mune_key_l"]), bool.Parse(maidStoreData["use_mune_key_r"])));
  601. }
  602. public void OnBtnReversal()
  603. {
  604. this.ik_mgr.Flip();
  605. }
  606. public override void OnMaidRemoveEvent(Maid maid)
  607. {
  608. if (maid != null && maid.boMAN)
  609. {
  610. maid = null;
  611. }
  612. this.DeleteIKManager(maid);
  613. }
  614. public override void OnMaidChangeEvent(Maid maid)
  615. {
  616. base.OnMaidChangeEvent(maid);
  617. if (maid == null)
  618. {
  619. this.ik_mgr_ = null;
  620. }
  621. Dictionary<string, string> dictionary;
  622. if (this.ik_mgr_ != null)
  623. {
  624. dictionary = base.GetMaidStoreData(this.ik_mgr_.maid);
  625. byte[] frameBinary = this.ik_mgr_.cache_bone_data.GetFrameBinary(bool.Parse(dictionary["use_mune_key_l"]), bool.Parse(dictionary["use_mune_key_r"]));
  626. if (bool.Parse(dictionary["use"]))
  627. {
  628. dictionary["pose_binary"] = Convert.ToBase64String(frameBinary);
  629. }
  630. else
  631. {
  632. dictionary["pose_binary"] = string.Empty;
  633. }
  634. IEnumerator enumerator = Enum.GetValues(typeof(IKManager.BoneSetType)).GetEnumerator();
  635. try
  636. {
  637. while (enumerator.MoveNext())
  638. {
  639. object obj = enumerator.Current;
  640. IKManager.BoneSetType bone_set_type = (IKManager.BoneSetType)obj;
  641. this.ik_mgr_.SetRotateVisibleBoneSet(bone_set_type, false);
  642. this.ik_mgr_.SetTransAxisVisibleBoneSet(bone_set_type, false);
  643. }
  644. }
  645. finally
  646. {
  647. IDisposable disposable;
  648. if ((disposable = (enumerator as IDisposable)) != null)
  649. {
  650. disposable.Dispose();
  651. }
  652. }
  653. this.ik_mgr_.SetTransAxisVisibleRoot(false);
  654. }
  655. this.ik_mgr_ = PoseEditWindow.GetMaidIKManager(maid);
  656. dictionary = null;
  657. bool flag = maid != null && !maid.boMAN;
  658. if (flag)
  659. {
  660. dictionary = base.GetMaidStoreData(base.mgr.select_maid);
  661. this.CheckbtnUse.check = bool.Parse(dictionary["use"]);
  662. this.ctrl_type_ = (PoseEditWindow.ControlType)Enum.Parse(typeof(PoseEditWindow.ControlType), dictionary["select_control_type"]);
  663. }
  664. else
  665. {
  666. this.CheckbtnUse.check = false;
  667. this.ctrl_type_ = PoseEditWindow.ControlType.Null;
  668. }
  669. this.CheckbtnUse.enabled = flag;
  670. if (this.ik_mgr_ != null && this.CheckbtnUse.check && dictionary["pose_binary"] != string.Empty)
  671. {
  672. KeyValuePair<bool, bool> keyValuePair = this.ik_mgr_.cache_bone_data.SetFrameBinary(Convert.FromBase64String(dictionary["pose_binary"]));
  673. bool key = keyValuePair.Key;
  674. bool value = keyValuePair.Value;
  675. maid.body0.MuneYureL((float)((!key) ? 1 : 0));
  676. maid.body0.MuneYureR((float)((!value) ? 1 : 0));
  677. maid.body0.jbMuneL.enabled = !key;
  678. maid.body0.jbMuneR.enabled = !value;
  679. }
  680. this.ChangeEnabeled(this.CheckbtnUse.check);
  681. if (this.ik_mgr_ != null && this.CheckbtnUse.check)
  682. {
  683. this.Apply();
  684. this.ik_mgr.HistoryNew();
  685. }
  686. this.noCharaActive.ChangeMode(maid == null, true);
  687. }
  688. public override void OnDeserializeEvent()
  689. {
  690. List<string> maidStoreGuidList = base.mgr.GetMaidStoreGuidList();
  691. for (int i = 0; i < maidStoreGuidList.Count; i++)
  692. {
  693. Dictionary<string, string> maidStoreData = base.GetMaidStoreData(maidStoreGuidList[i]);
  694. }
  695. }
  696. public override void OnSerializeEvent()
  697. {
  698. base.OnSerializeEvent();
  699. if (base.mgr.select_maid == null || base.mgr.select_maid.boMAN)
  700. {
  701. return;
  702. }
  703. Dictionary<string, string> maidStoreData = base.GetMaidStoreData(base.mgr.select_maid);
  704. byte[] frameBinary = this.ik_mgr_.cache_bone_data.GetFrameBinary(bool.Parse(maidStoreData["use_mune_key_l"]), bool.Parse(maidStoreData["use_mune_key_r"]));
  705. maidStoreData = base.GetMaidStoreData(this.ik_mgr_.maid);
  706. if (bool.Parse(maidStoreData["use"]))
  707. {
  708. maidStoreData["pose_binary"] = Convert.ToBase64String(frameBinary);
  709. }
  710. else
  711. {
  712. maidStoreData["pose_binary"] = string.Empty;
  713. }
  714. }
  715. public WindowPartsFingerBlend GetWindowPartsFingerBlend(IKManager.BoneSetType bone_set_type)
  716. {
  717. Dictionary<IKManager.BoneSetType, WindowPartsFingerBlend.Type> dictionary = new Dictionary<IKManager.BoneSetType, WindowPartsFingerBlend.Type>();
  718. dictionary.Add(IKManager.BoneSetType.RightArmFinger, WindowPartsFingerBlend.Type.RightArm);
  719. dictionary.Add(IKManager.BoneSetType.LeftArmFinger, WindowPartsFingerBlend.Type.LeftArm);
  720. dictionary.Add(IKManager.BoneSetType.RightLegFinger, WindowPartsFingerBlend.Type.RightLeg);
  721. dictionary.Add(IKManager.BoneSetType.LeftLegFinger, WindowPartsFingerBlend.Type.LeftLeg);
  722. WindowPartsFingerBlend result = null;
  723. for (int i = 0; i < this.FingerBlendArray.Length; i++)
  724. {
  725. if (dictionary[bone_set_type] == this.FingerBlendArray[i].BlendType)
  726. {
  727. result = this.FingerBlendArray[i];
  728. break;
  729. }
  730. }
  731. return result;
  732. }
  733. private void DeleteIKManager(Maid maid)
  734. {
  735. GameObject x = GameObject.Find("PoseEditWorkParent");
  736. if (x == null)
  737. {
  738. x = new GameObject("PoseEditWorkParent");
  739. }
  740. if (maid == null)
  741. {
  742. return;
  743. }
  744. GameObject gameObject = GameObject.Find("PoseEditWorkParent/" + maid.status.guid);
  745. if (gameObject != null)
  746. {
  747. if (this.ik_mgr_ != null && this.ik_mgr_.maid == maid)
  748. {
  749. this.ik_mgr_ = null;
  750. }
  751. UnityEngine.Object.DestroyImmediate(gameObject);
  752. }
  753. }
  754. private void SetControlPanel(PoseEditWindow.ControlType type)
  755. {
  756. if (type == PoseEditWindow.ControlType.Null)
  757. {
  758. this.WindowSize = new Vector2(480f, 120f);
  759. GameObject[] array = new GameObject[]
  760. {
  761. this.GetControlPanelParentObject(PoseEditWindow.ControlType.Body),
  762. this.GetControlPanelParentObject(PoseEditWindow.ControlType.Hand),
  763. this.GetControlPanelParentObject(PoseEditWindow.ControlType.Leg)
  764. };
  765. foreach (GameObject gameObject in array)
  766. {
  767. gameObject.SetActive(false);
  768. }
  769. }
  770. else if (type == PoseEditWindow.ControlType.Body)
  771. {
  772. this.WindowSize = new Vector2(513f, 850f);
  773. GameObject[] array3 = new GameObject[]
  774. {
  775. this.GetControlPanelParentObject(PoseEditWindow.ControlType.Hand),
  776. this.GetControlPanelParentObject(PoseEditWindow.ControlType.Leg)
  777. };
  778. foreach (GameObject gameObject2 in array3)
  779. {
  780. gameObject2.SetActive(false);
  781. }
  782. this.GetControlPanelParentObject(PoseEditWindow.ControlType.Body).SetActive(true);
  783. }
  784. else if (type == PoseEditWindow.ControlType.Hand)
  785. {
  786. this.WindowSize = new Vector2(765f, 890f);
  787. GameObject[] array5 = new GameObject[]
  788. {
  789. this.GetControlPanelParentObject(PoseEditWindow.ControlType.Body),
  790. this.GetControlPanelParentObject(PoseEditWindow.ControlType.Leg)
  791. };
  792. foreach (GameObject gameObject3 in array5)
  793. {
  794. gameObject3.SetActive(false);
  795. }
  796. this.GetControlPanelParentObject(PoseEditWindow.ControlType.Hand).SetActive(true);
  797. }
  798. else if (type == PoseEditWindow.ControlType.Leg)
  799. {
  800. this.WindowSize = new Vector2(765f, 710f);
  801. GameObject[] array7 = new GameObject[]
  802. {
  803. this.GetControlPanelParentObject(PoseEditWindow.ControlType.Body),
  804. this.GetControlPanelParentObject(PoseEditWindow.ControlType.Hand)
  805. };
  806. foreach (GameObject gameObject4 in array7)
  807. {
  808. gameObject4.SetActive(false);
  809. }
  810. this.GetControlPanelParentObject(PoseEditWindow.ControlType.Leg).SetActive(true);
  811. }
  812. base.ResizeWindow();
  813. }
  814. private GameObject GetControlPanelParentObject(PoseEditWindow.ControlType type)
  815. {
  816. if (type == PoseEditWindow.ControlType.Body)
  817. {
  818. return UTY.GetChildObject(base.gameObject, "Parent/ContentParent/BodyPanel", false);
  819. }
  820. if (type == PoseEditWindow.ControlType.Hand)
  821. {
  822. return UTY.GetChildObject(base.gameObject, "Parent/ContentParent/HandPanel", false);
  823. }
  824. if (type == PoseEditWindow.ControlType.Leg)
  825. {
  826. return UTY.GetChildObject(base.gameObject, "Parent/ContentParent/LegPanel", false);
  827. }
  828. return null;
  829. }
  830. public IKManager ik_mgr
  831. {
  832. get
  833. {
  834. return this.ik_mgr_;
  835. }
  836. }
  837. public UIButton BtnSave;
  838. public PhotoModePoseSave PanelSave;
  839. public WFCheckBox CheckbtnUse;
  840. public UIWFTabPanel ControlSelectBtnTab;
  841. public UIButton BtnReversal;
  842. public WindowPartsBoneCheckBox[] RotateCheckBoxArray;
  843. public WindowPartsFingerBlend[] FingerBlendArray;
  844. private Dictionary<string, WFCheckBox> ikbox_visible_dic_ = new Dictionary<string, WFCheckBox>();
  845. private PhotoNoCharaActive noCharaActive;
  846. private PoseEditWindow.ControlType ctrl_type_;
  847. private IKManager ik_mgr_;
  848. private Dictionary<string, string> store_type_name_map_ = new Dictionary<string, string>();
  849. private enum ControlType
  850. {
  851. Null,
  852. Body,
  853. Hand,
  854. Leg
  855. }
  856. }