PoseEditWindow.cs 28 KB

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