FaceWindow.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using I2.Loc;
  5. using UnityEngine;
  6. using wf;
  7. public class FaceWindow : BaseMaidPhotoWindow
  8. {
  9. public override void Awake()
  10. {
  11. base.Awake();
  12. PhotoFaceData.Create();
  13. this.noCharaActive = base.GetComponentInChildren<PhotoNoCharaActive>();
  14. Dictionary<string, List<string>> dictionary = new Dictionary<string, List<string>>();
  15. Dictionary<string, List<KeyValuePair<string, object>>> dictionary2 = new Dictionary<string, List<KeyValuePair<string, object>>>();
  16. foreach (KeyValuePair<string, List<PhotoFaceData>> keyValuePair in PhotoFaceData.category_list)
  17. {
  18. if (!dictionary2.ContainsKey(keyValuePair.Key))
  19. {
  20. dictionary2.Add(keyValuePair.Key, new List<KeyValuePair<string, object>>());
  21. dictionary.Add(keyValuePair.Key, new List<string>());
  22. }
  23. for (int i = 0; i < keyValuePair.Value.Count; i++)
  24. {
  25. dictionary2[keyValuePair.Key].Add(new KeyValuePair<string, object>(keyValuePair.Value[i].name, keyValuePair.Value[i]));
  26. dictionary[keyValuePair.Key].Add(keyValuePair.Value[i].termName);
  27. }
  28. }
  29. if (!Product.supportMultiLanguage)
  30. {
  31. dictionary = null;
  32. }
  33. this.PopupAndTabList.SetData(dictionary2, dictionary, false);
  34. this.PopupAndTabList.onChangePopUpListValue.Add(new Action<KeyValuePair<string, UnityEngine.Object>>(this.OnChangePopUpList));
  35. this.PopupAndTabList.onSelect.Add(new Action<object>(this.OnSelectItem));
  36. this.SliderFaceToX.onChangeValue.Add(new Action<WindowPartsInputSliderSet.SliderAndInputSet, float>(this.OnChangeSliderXValue));
  37. this.SliderFaceToY.onChangeValue.Add(new Action<WindowPartsInputSliderSet.SliderAndInputSet, float>(this.OnChangeSliderYValue));
  38. this.CheckBoxEyeToCamera.onClick.Add(new Action<WFCheckBox>(this.OnClickCheckBox));
  39. this.CheckBoxFaceToCamera.onClick.Add(new Action<WFCheckBox>(this.OnClickCheckBox));
  40. this.CheckOpenMouse.onClick.Add(new Action<WFCheckBox>(this.OnClickCheckBox));
  41. this.CheckMorphWindowVisible.onClick.Add(delegate(WFCheckBox check_box)
  42. {
  43. this.MorphSubWindow.visible = check_box.check;
  44. });
  45. UTY.GetChildObject(this.content_game_object, "ContentParent/ListParent/DragMat", false).GetComponent<BoxCollider>().enabled = false;
  46. }
  47. public override void Start()
  48. {
  49. base.Start();
  50. GameMain.Instance.StartCoroutine(this.Setup());
  51. }
  52. private IEnumerator Setup()
  53. {
  54. do
  55. {
  56. yield return null;
  57. }
  58. while (!GameMain.Instance.MenuDataBase.JobFinished());
  59. if (Product.isPublic)
  60. {
  61. this.PartVisibleCheckBox.gameObject.SetActive(false);
  62. }
  63. this.placement_window_ = (base.mgr.GetWindow(PhotoWindowManager.WindowType.Placement) as PlacementWindow);
  64. this.motion_window_ = (base.mgr.GetWindow(PhotoWindowManager.WindowType.Motion) as MotionWindow);
  65. this.man_edit_mgr_ = new PhotoManEditManager();
  66. List<SceneEdit.SMenuItem>[] itemLists = new List<SceneEdit.SMenuItem>[]
  67. {
  68. this.man_edit_mgr_.man_head_menu_list,
  69. this.man_edit_mgr_.man_body_menu_list
  70. };
  71. UIWFTabPanel[] tagetPanels = new UIWFTabPanel[]
  72. {
  73. this.HeadItemTabPanel,
  74. this.BodyItemTabPanel
  75. };
  76. EventDelegate.Callback[] callBackFunctions = new EventDelegate.Callback[]
  77. {
  78. new EventDelegate.Callback(this.OnSelectManHeadItem),
  79. new EventDelegate.Callback(this.OnSelectManHeadItem)
  80. };
  81. for (int i = 0; i < itemLists.Length; i++)
  82. {
  83. UIWFTabPanel uiwftabPanel = tagetPanels[i];
  84. EventDelegate.Callback callback = callBackFunctions[i];
  85. foreach (SceneEdit.SMenuItem smenuItem in itemLists[i])
  86. {
  87. GameObject gameObject = Utility.CreatePrefab(uiwftabPanel.gameObject, "ScenePhotoMode/EditItemIcon", true);
  88. if (smenuItem.m_texIconRef != null)
  89. {
  90. Sprite sprite2D = Sprite.Create(smenuItem.m_texIconRef, new Rect(0f, 0f, (float)smenuItem.m_texIconRef.width, (float)smenuItem.m_texIconRef.height), default(Vector2));
  91. UI2DSprite componentInChildren = gameObject.GetComponentInChildren<UI2DSprite>();
  92. componentInChildren.sprite2D = sprite2D;
  93. componentInChildren.SetDimensions(60, 60);
  94. }
  95. UIWFTabButton component = gameObject.GetComponent<UIWFTabButton>();
  96. component.name = smenuItem.m_nMenuFileRID.ToString();
  97. EventDelegate.Add(component.onSelect, callback);
  98. }
  99. Utility.ResetNGUI(uiwftabPanel.GetComponent<UIGrid>());
  100. Utility.ResetNGUI(uiwftabPanel.transform.parent.GetComponent<UIScrollView>());
  101. uiwftabPanel.UpdateChildren();
  102. }
  103. this.UpdateChildren();
  104. WFCheckBox checkBoxEyeToCamera = this.CheckBoxEyeToCamera;
  105. bool flag = false;
  106. this.SliderFaceToY.enabled = flag;
  107. flag = flag;
  108. this.SliderFaceToX.enabled = flag;
  109. flag = flag;
  110. this.CheckOpenMouse.enabled = flag;
  111. flag = flag;
  112. this.CheckBoxFaceToCamera.enabled = flag;
  113. checkBoxEyeToCamera.enabled = flag;
  114. this.add_option_dic_ = new Dictionary<string, WFCheckBox>();
  115. Transform add_option_parent = UTY.GetChildObject(this.content_game_object.gameObject, "ContentParent/AddOption/Btns", false).transform;
  116. for (int j = 0; j < add_option_parent.childCount; j++)
  117. {
  118. WFCheckBox component2 = add_option_parent.GetChild(j).GetComponent<WFCheckBox>();
  119. component2.check = false;
  120. component2.enabled = false;
  121. if (!Product.supportMultiLanguage)
  122. {
  123. this.add_option_dic_.Add(component2.GetComponentInChildren<UILabel>().text, component2);
  124. }
  125. else
  126. {
  127. string term = component2.GetComponentInChildren<UILabel>().GetComponent<Localize>().Term;
  128. string translation = LocalizationManager.GetTranslation(term, true, 0, true, false, null, Product.EnumConvert.ToI2LocalizeLanguageName(Product.Language.Japanese));
  129. this.add_option_dic_.Add(translation, component2);
  130. }
  131. component2.onClick.Add(new Action<WFCheckBox>(this.OnClickCheckBoxAddOption));
  132. }
  133. this.CheckOpenMouse.check = false;
  134. WFCheckBox checkMorphWindowVisible = this.CheckMorphWindowVisible;
  135. flag = false;
  136. this.CheckMorphWindowVisible.enabled = flag;
  137. checkMorphWindowVisible.check = flag;
  138. this.MorphSubWindow.gameObject.SetActive(true);
  139. this.MorphSubWindow.SetButtonEnabled(BasePhotoSubWindow.BtnType.End, true, false);
  140. this.MorphSubWindow.GetButtonOnClickEventList(BasePhotoSubWindow.BtnType.End).Add(delegate
  141. {
  142. this.CheckMorphWindowVisible.check = false;
  143. foreach (Action<WFCheckBox> action in this.CheckMorphWindowVisible.onClick)
  144. {
  145. action(this.CheckMorphWindowVisible);
  146. }
  147. });
  148. this.ContentParentMan.SetActive(false);
  149. this.FaceMorphInput.SetFaceWindow(this);
  150. this.noCharaActive.ChangeMode(true, true);
  151. yield break;
  152. }
  153. public void OnDestroy()
  154. {
  155. if (this.man_edit_mgr_ != null)
  156. {
  157. this.man_edit_mgr_.Destroy();
  158. }
  159. this.man_edit_mgr_ = null;
  160. }
  161. public void OnClickCheckBoxAddOption(WFCheckBox check_box)
  162. {
  163. Dictionary<string, string> maidStoreData = base.GetMaidStoreData(base.mgr.select_maid);
  164. string[] array = new string[]
  165. {
  166. "頬染め1",
  167. "頬染め2",
  168. "頬染め3"
  169. };
  170. string[] array2 = new string[]
  171. {
  172. "涙1",
  173. "涙2",
  174. "涙3"
  175. };
  176. string[][] array3 = new string[][]
  177. {
  178. array,
  179. array2
  180. };
  181. foreach (KeyValuePair<string, WFCheckBox> keyValuePair in this.add_option_dic_)
  182. {
  183. if (keyValuePair.Value == check_box)
  184. {
  185. maidStoreData[keyValuePair.Key] = check_box.check.ToString();
  186. foreach (string[] array4 in array3)
  187. {
  188. if (0 <= Array.IndexOf<string>(array4, keyValuePair.Key))
  189. {
  190. for (int j = 0; j < array4.Length; j++)
  191. {
  192. if (!(array4[j] == keyValuePair.Key))
  193. {
  194. if (this.add_option_dic_[array4[j]].check)
  195. {
  196. this.add_option_dic_[array4[j]].check = false;
  197. }
  198. maidStoreData[array4[j]] = false.ToString();
  199. }
  200. }
  201. }
  202. }
  203. }
  204. }
  205. this.UpdateMaidAddOption();
  206. }
  207. public void OnClickCheckBox(WFCheckBox check_box)
  208. {
  209. if (base.mgr.select_maid == null)
  210. {
  211. return;
  212. }
  213. Dictionary<string, string> maidStoreData = base.GetMaidStoreData(base.mgr.select_maid);
  214. if (check_box == this.CheckBoxEyeToCamera)
  215. {
  216. maidStoreData["eye_to_camera"] = check_box.check.ToString();
  217. }
  218. else if (check_box == this.CheckBoxFaceToCamera)
  219. {
  220. maidStoreData["face_to_camera"] = check_box.check.ToString();
  221. }
  222. else if (check_box == this.CheckOpenMouse)
  223. {
  224. maidStoreData["open_mouse"] = check_box.check.ToString();
  225. }
  226. WindowPartsInputSliderSet sliderFaceToX = this.SliderFaceToX;
  227. bool enabled = !this.CheckBoxFaceToCamera.check;
  228. this.SliderFaceToY.enabled = enabled;
  229. sliderFaceToX.enabled = enabled;
  230. this.Apply(base.mgr.select_maid);
  231. }
  232. public void UpdateMaidAddOption()
  233. {
  234. if (base.mgr.select_maid == null)
  235. {
  236. return;
  237. }
  238. this.Apply(base.mgr.select_maid);
  239. }
  240. public void OnChangeSliderXValue(WindowPartsInputSliderSet.SliderAndInputSet obj, float val)
  241. {
  242. if (base.mgr.select_maid == null)
  243. {
  244. return;
  245. }
  246. Dictionary<string, string> maidStoreData = base.GetMaidStoreData(base.mgr.select_maid);
  247. maidStoreData["face_to_x"] = val.ToString("G9");
  248. WindowPartsInputSliderSet sliderFaceToX = this.SliderFaceToX;
  249. bool enabled = !this.CheckBoxFaceToCamera.check;
  250. this.SliderFaceToY.enabled = enabled;
  251. sliderFaceToX.enabled = enabled;
  252. this.Apply(base.mgr.select_maid);
  253. }
  254. public void OnChangeSliderYValue(WindowPartsInputSliderSet.SliderAndInputSet obj, float val)
  255. {
  256. if (base.mgr.select_maid == null)
  257. {
  258. return;
  259. }
  260. Dictionary<string, string> maidStoreData = base.GetMaidStoreData(base.mgr.select_maid);
  261. maidStoreData["face_to_y"] = val.ToString("G9");
  262. WindowPartsInputSliderSet sliderFaceToX = this.SliderFaceToX;
  263. bool enabled = !this.CheckBoxFaceToCamera.check;
  264. this.SliderFaceToY.enabled = enabled;
  265. sliderFaceToX.enabled = enabled;
  266. this.Apply(base.mgr.select_maid);
  267. }
  268. public override void OnMaidAddEvent(Maid maid, bool is_deserialize_load)
  269. {
  270. base.OnMaidAddEvent(maid, is_deserialize_load);
  271. Dictionary<string, string> maidStoreData = base.GetMaidStoreData(maid);
  272. if (maid.boMAN)
  273. {
  274. this.man_controller_ = new PhotoManEditManager.Controller(maid);
  275. if (!is_deserialize_load)
  276. {
  277. maidStoreData.Add("color", this.man_controller_.color.ToString());
  278. maidStoreData.Add("fat", this.man_controller_.fat.ToString("G9"));
  279. maidStoreData.Add("parts_visible", true.ToString());
  280. maidStoreData.Add("head_menu_rid", this.man_controller_.head_menu_rid.ToString());
  281. maidStoreData.Add("body_menu_rid", this.man_controller_.body_menu_rid.ToString());
  282. }
  283. else
  284. {
  285. this.man_controller_.color = Parse.Color(maidStoreData["color"]);
  286. this.man_controller_.fat = float.Parse(maidStoreData["fat"]);
  287. this.man_controller_.parts_visible = bool.Parse(maidStoreData["parts_visible"]);
  288. int num = int.Parse(maidStoreData["head_menu_rid"]);
  289. foreach (SceneEdit.SMenuItem smenuItem in this.man_edit_mgr_.man_head_menu_list)
  290. {
  291. if (num == smenuItem.m_nMenuFileRID)
  292. {
  293. this.man_controller_.SetMenu(smenuItem);
  294. break;
  295. }
  296. }
  297. int num2 = int.Parse(maidStoreData["body_menu_rid"]);
  298. foreach (SceneEdit.SMenuItem smenuItem2 in this.man_edit_mgr_.man_head_menu_list)
  299. {
  300. if (num2 == smenuItem2.m_nMenuFileRID)
  301. {
  302. this.man_controller_.SetMenu(smenuItem2);
  303. this.motion_window_.UpdateAnimationData(this.man_controller_.man);
  304. break;
  305. }
  306. }
  307. }
  308. this.man_controller_ = null;
  309. return;
  310. }
  311. maid.FaceBlend("オリジナル");
  312. if (!is_deserialize_load)
  313. {
  314. maidStoreData.Clear();
  315. maidStoreData.Add("id", PhotoFaceData.init_data.id.ToString());
  316. maidStoreData.Add("eye_to_camera", true.ToString());
  317. maidStoreData.Add("face_to_camera", true.ToString());
  318. maidStoreData.Add("face_to_x", 0.ToString());
  319. maidStoreData.Add("face_to_y", 0.ToString());
  320. maidStoreData.Add("open_mouse", false.ToString());
  321. foreach (KeyValuePair<string, WFCheckBox> keyValuePair in this.add_option_dic_)
  322. {
  323. maidStoreData.Add(keyValuePair.Key, false.ToString());
  324. }
  325. }
  326. else
  327. {
  328. if (!maidStoreData.ContainsKey("open_mouse"))
  329. {
  330. maidStoreData.Add("open_mouse", false.ToString());
  331. }
  332. if (maid.IsCrcBody && !maidStoreData.ContainsKey("morph_val_tanga"))
  333. {
  334. maidStoreData.Add("morph_val_tanga", "0");
  335. }
  336. }
  337. this.FaceMorphInput.OnMaidAddEvent(maid, is_deserialize_load, maidStoreData);
  338. maid.EyeToCamera(Maid.EyeMoveType.目と顔を向ける, 0f);
  339. this.Apply(maid);
  340. }
  341. public override void OnMaidChangeEvent(Maid maid)
  342. {
  343. base.OnMaidChangeEvent(maid);
  344. this.PopupAndTabList.ResetSelect();
  345. this.PopupAndTabList.gameObject.SetActive(true);
  346. this.ContentParentMan.SetActive(false);
  347. if (maid == null || maid.boMAN)
  348. {
  349. if (maid == null)
  350. {
  351. this.noCharaActive.ChangeMode(true, true);
  352. }
  353. else
  354. {
  355. this.noCharaActive.ChangeMode(false, true);
  356. }
  357. this.MorphSubWindow.gameObject.SetActive(false);
  358. WFCheckBox checkMorphWindowVisible = this.CheckMorphWindowVisible;
  359. bool flag = false;
  360. this.CheckMorphWindowVisible.check = flag;
  361. checkMorphWindowVisible.enabled = flag;
  362. UTY.GetChildObject(this.content_game_object, "ContentParent/ListParent/DragMat", false).GetComponent<BoxCollider>().enabled = false;
  363. this.head_transform_ = null;
  364. this.PopupAndTabList.popup_value_list = null;
  365. this.PopupAndTabList.SetPopupValue(this.PopupAndTabList.popup_value_list[0].Key);
  366. WFCheckBox checkBoxEyeToCamera = this.CheckBoxEyeToCamera;
  367. flag = false;
  368. this.SliderFaceToY.enabled = flag;
  369. flag = flag;
  370. this.SliderFaceToX.enabled = flag;
  371. flag = flag;
  372. this.CheckOpenMouse.enabled = flag;
  373. flag = flag;
  374. this.CheckBoxFaceToCamera.enabled = flag;
  375. checkBoxEyeToCamera.enabled = flag;
  376. foreach (KeyValuePair<string, WFCheckBox> keyValuePair in this.add_option_dic_)
  377. {
  378. WFCheckBox value2 = keyValuePair.Value;
  379. flag = false;
  380. keyValuePair.Value.enabled = flag;
  381. value2.check = flag;
  382. }
  383. this.CheckOpenMouse.check = false;
  384. if (maid != null && maid.boMAN)
  385. {
  386. this.PopupAndTabList.gameObject.SetActive(false);
  387. this.ContentParentMan.SetActive(true);
  388. PlacementWindow.ManDataBackup manDataBackup = this.placement_window_.man_backup_data_dic[maid.status.guid];
  389. Dictionary<string, string> store_data = base.GetMaidStoreData(maid);
  390. this.man_controller_ = new PhotoManEditManager.Controller(maid);
  391. this.ManColor.onChangeValue.Clear();
  392. this.ManColor.ResetNum = manDataBackup.color;
  393. this.ManColor.ColorPalette.SetColor(Parse.Color(store_data["color"]));
  394. Action<WindowPartsInputColorrPalette, Color> item = delegate(WindowPartsInputColorrPalette parent, Color color)
  395. {
  396. if (this.man_controller_ != null)
  397. {
  398. this.man_controller_.color = color;
  399. }
  400. store_data["color"] = color.ToString();
  401. };
  402. this.ManColor.onChangeValue.Add(item);
  403. PhotoSliderAndInput sliderAndInput = this.ManFat.GetSliderAndInput("fat");
  404. sliderAndInput.onChangeValue.Clear();
  405. sliderAndInput.ResetNum = manDataBackup.fat;
  406. sliderAndInput.value = float.Parse(store_data["fat"]);
  407. Action<float> item2 = delegate(float value)
  408. {
  409. if (this.man_controller_ != null)
  410. {
  411. this.man_controller_.fat = value;
  412. }
  413. store_data["fat"] = value.ToString("G9");
  414. };
  415. sliderAndInput.onChangeValue.Add(item2);
  416. this.PartVisibleCheckBox.onClick.Clear();
  417. this.PartVisibleCheckBox.check = bool.Parse(store_data["parts_visible"]);
  418. Action<WFCheckBox> item3 = delegate(WFCheckBox check_box)
  419. {
  420. bool check = check_box.check;
  421. if (this.man_controller_ != null)
  422. {
  423. this.man_controller_.parts_visible = check;
  424. }
  425. store_data["parts_visible"] = check.ToString();
  426. };
  427. this.PartVisibleCheckBox.onClick.Add(item3);
  428. UIWFTabButton[] componentsInChildren = this.HeadItemTabPanel.GetComponentsInChildren<UIWFTabButton>();
  429. foreach (UIWFTabButton uiwftabButton in componentsInChildren)
  430. {
  431. if (uiwftabButton.name == store_data["head_menu_rid"])
  432. {
  433. this.HeadItemTabPanel.Select(uiwftabButton);
  434. break;
  435. }
  436. }
  437. UIWFTabButton[] componentsInChildren2 = this.BodyItemTabPanel.GetComponentsInChildren<UIWFTabButton>();
  438. foreach (UIWFTabButton uiwftabButton2 in componentsInChildren2)
  439. {
  440. if (uiwftabButton2.name == store_data["body_menu_rid"])
  441. {
  442. this.BodyItemTabPanel.Select(uiwftabButton2);
  443. break;
  444. }
  445. }
  446. }
  447. }
  448. else
  449. {
  450. this.noCharaActive.ChangeMode(false, true);
  451. this.MorphSubWindow.gameObject.SetActive(true);
  452. this.CheckMorphWindowVisible.enabled = true;
  453. this.CheckMorphWindowVisible.check = this.MorphSubWindow.visible;
  454. UTY.GetChildObject(this.content_game_object, "ContentParent/ListParent/DragMat", false).GetComponent<BoxCollider>().enabled = true;
  455. this.head_transform_ = base.mgr.select_maid.body0.GetBone("Bip01 Head");
  456. WFCheckBox checkBoxEyeToCamera2 = this.CheckBoxEyeToCamera;
  457. bool flag = true;
  458. this.SliderFaceToY.enabled = flag;
  459. flag = flag;
  460. this.SliderFaceToX.enabled = flag;
  461. flag = flag;
  462. this.CheckOpenMouse.enabled = flag;
  463. flag = flag;
  464. this.CheckBoxFaceToCamera.enabled = flag;
  465. checkBoxEyeToCamera2.enabled = flag;
  466. Transform transform = UTY.GetChildObject(this.content_game_object.gameObject, "ContentParent/AddOption/Btns", false).transform;
  467. for (int k = 0; k < transform.childCount; k++)
  468. {
  469. transform.GetChild(k).GetComponent<WFCheckBox>().enabled = true;
  470. }
  471. Dictionary<string, string> maidStoreData = base.GetMaidStoreData(maid);
  472. PhotoFaceData photoFaceData = PhotoFaceData.Get(long.Parse(maidStoreData["id"]));
  473. this.PopupAndTabList.popup_term_list = ((!Product.supportMultiLanguage) ? null : PhotoFaceData.popup_category_term_list);
  474. this.PopupAndTabList.popup_value_list = PhotoFaceData.popup_category_list;
  475. this.PopupAndTabList.SetPopupValue(photoFaceData.category);
  476. this.PopupAndTabList.SetSelectButton(photoFaceData, false);
  477. this.CheckBoxEyeToCamera.check = bool.Parse(maidStoreData["eye_to_camera"]);
  478. this.CheckBoxFaceToCamera.check = bool.Parse(maidStoreData["face_to_camera"]);
  479. this.SliderFaceToX.SetValue("x", float.Parse(maidStoreData["face_to_x"]));
  480. this.SliderFaceToY.enabled = true;
  481. this.SliderFaceToY.SetValue("y", float.Parse(maidStoreData["face_to_y"]));
  482. this.CheckOpenMouse.check = bool.Parse(maidStoreData["open_mouse"]);
  483. foreach (KeyValuePair<string, WFCheckBox> keyValuePair2 in this.add_option_dic_)
  484. {
  485. keyValuePair2.Value.check = bool.Parse(maidStoreData[keyValuePair2.Key]);
  486. }
  487. if (this.CheckBoxFaceToCamera.check)
  488. {
  489. WindowPartsInputSliderSet sliderFaceToX = this.SliderFaceToX;
  490. flag = false;
  491. this.SliderFaceToY.enabled = flag;
  492. sliderFaceToX.enabled = flag;
  493. }
  494. this.Apply(base.mgr.select_maid);
  495. if (maid.IsCrcBody)
  496. {
  497. if (!this.tangaSlider.enabled)
  498. {
  499. this.tangaSlider.enabled = true;
  500. }
  501. }
  502. else if (this.tangaSlider.enabled)
  503. {
  504. this.tangaSlider.enabled = false;
  505. }
  506. }
  507. }
  508. public override void OnMaidRemoveEventPrev(Maid maid)
  509. {
  510. if (!maid.boMAN)
  511. {
  512. return;
  513. }
  514. PlacementWindow.ManDataBackup manDataBackup = this.placement_window_.man_backup_data_dic[maid.status.guid];
  515. PhotoManEditManager.Controller controller = new PhotoManEditManager.Controller(maid);
  516. controller.color = manDataBackup.color;
  517. controller.fat = manDataBackup.fat;
  518. controller.parts_visible = true;
  519. foreach (SceneEdit.SMenuItem smenuItem in this.man_edit_mgr_.man_head_menu_list)
  520. {
  521. if (manDataBackup.head_item_rid == smenuItem.m_nMenuFileRID)
  522. {
  523. controller.SetMenu(smenuItem);
  524. break;
  525. }
  526. }
  527. }
  528. public void OnSelectManHeadItem()
  529. {
  530. UIWFSelectButton current = UIWFSelectButton.current;
  531. if (this.man_controller_ == null || !current.isSelected)
  532. {
  533. return;
  534. }
  535. int num = int.Parse(current.name);
  536. foreach (SceneEdit.SMenuItem smenuItem in this.man_edit_mgr_.man_head_menu_list)
  537. {
  538. if (num == smenuItem.m_nMenuFileRID)
  539. {
  540. this.man_controller_.SetMenu(smenuItem);
  541. Dictionary<string, string> maidStoreData = base.GetMaidStoreData(this.man_controller_.man);
  542. maidStoreData["head_menu_rid"] = smenuItem.m_nMenuFileRID.ToString();
  543. break;
  544. }
  545. }
  546. foreach (SceneEdit.SMenuItem smenuItem2 in this.man_edit_mgr_.man_body_menu_list)
  547. {
  548. if (num == smenuItem2.m_nMenuFileRID)
  549. {
  550. bool flag = this.man_controller_.SetMenu(smenuItem2);
  551. if (flag)
  552. {
  553. Dictionary<string, string> maidStoreData2 = this.motion_window_.GetMaidStoreData(this.man_controller_.man);
  554. PhotoMotionData motion_data = PhotoMotionData.Get(long.Parse(maidStoreData2["id"]));
  555. this.motion_window_.Apply(motion_data, this.man_controller_.man);
  556. }
  557. Dictionary<string, string> maidStoreData3 = base.GetMaidStoreData(this.man_controller_.man);
  558. maidStoreData3["body_menu_rid"] = smenuItem2.m_nMenuFileRID.ToString();
  559. break;
  560. }
  561. }
  562. }
  563. protected void OnChangePopUpList(KeyValuePair<string, UnityEngine.Object> popup_val)
  564. {
  565. }
  566. private void OnSelectItem(object select_data_obj)
  567. {
  568. if (base.mgr.select_maid == null || select_data_obj == null)
  569. {
  570. return;
  571. }
  572. PhotoFaceData photoFaceData = select_data_obj as PhotoFaceData;
  573. Dictionary<string, string> maidStoreData = base.GetMaidStoreData(base.mgr.select_maid);
  574. maidStoreData["id"] = photoFaceData.id.ToString();
  575. this.FaceMorphInput.ApplyBackupData(base.mgr.select_maid);
  576. photoFaceData.Apply(base.mgr.select_maid);
  577. this.Apply(base.mgr.select_maid);
  578. }
  579. private void Apply(Maid maid)
  580. {
  581. if (maid == null || maid.boMAN)
  582. {
  583. return;
  584. }
  585. Dictionary<string, string> maidStoreData = base.GetMaidStoreData(maid);
  586. PhotoFaceData photoFaceData = PhotoFaceData.Get(long.Parse(maidStoreData["id"]));
  587. photoFaceData.Apply(maid);
  588. TMorph.AddBlendType addBlendType = TMorph.AddBlendType.None;
  589. Dictionary<string, TMorph.AddBlendType> dictionary = new Dictionary<string, TMorph.AddBlendType>
  590. {
  591. {
  592. "頬染め1",
  593. TMorph.AddBlendType.Cheek1
  594. },
  595. {
  596. "頬染め2",
  597. TMorph.AddBlendType.Cheek2
  598. },
  599. {
  600. "頬染め3",
  601. TMorph.AddBlendType.Cheek3
  602. },
  603. {
  604. "涙1",
  605. TMorph.AddBlendType.Tear1
  606. },
  607. {
  608. "涙2",
  609. TMorph.AddBlendType.Tear2
  610. },
  611. {
  612. "涙3",
  613. TMorph.AddBlendType.Tear3
  614. },
  615. {
  616. "涙(玉)",
  617. TMorph.AddBlendType.TearBig
  618. },
  619. {
  620. "涎",
  621. TMorph.AddBlendType.Yodare
  622. },
  623. {
  624. "赤面",
  625. TMorph.AddBlendType.Blush
  626. },
  627. {
  628. "ショック",
  629. TMorph.AddBlendType.Shock
  630. }
  631. };
  632. foreach (KeyValuePair<string, TMorph.AddBlendType> keyValuePair in dictionary)
  633. {
  634. if (maidStoreData.ContainsKey(keyValuePair.Key) && bool.Parse(maidStoreData[keyValuePair.Key]))
  635. {
  636. addBlendType |= keyValuePair.Value;
  637. }
  638. }
  639. maid.body0.Face.morph.SetValueOriginalBlendSet(addBlendType);
  640. if (bool.Parse(maidStoreData["face_to_camera"]))
  641. {
  642. maid.EyeToCamera(Maid.EyeMoveType.目と顔を向ける, 0f);
  643. }
  644. else
  645. {
  646. Transform bone = maid.body0.GetBone("Bip01 Head");
  647. if (bone.Find("face_to_object") == null)
  648. {
  649. GameObject gameObject = new GameObject();
  650. gameObject.name = "face_to_object";
  651. gameObject.transform.SetParent(bone);
  652. gameObject.transform.localPosition = Vector3.zero;
  653. gameObject.transform.localRotation = Quaternion.identity;
  654. gameObject.transform.localScale = Vector3.one;
  655. }
  656. Transform transform = bone.Find("face_to_object");
  657. Vector3 localPosition = new Vector3(float.Parse(maidStoreData["face_to_y"]) * -1f * 0.2f, 0.2f, float.Parse(maidStoreData["face_to_x"]) * 0.2f);
  658. transform.localPosition = localPosition;
  659. maid.EyeToTargetObject(transform, 0f);
  660. }
  661. maid.OpenMouth(bool.Parse(maidStoreData["open_mouse"]));
  662. maid.body0.boEyeToCam = bool.Parse(maidStoreData["eye_to_camera"]);
  663. this.FaceMorphInput.SetPhotoFaceData(photoFaceData);
  664. this.FaceMorphInput.UpdateGui(maid);
  665. }
  666. public override void OnDeserializeEvent()
  667. {
  668. List<string> maidStoreGuidList = base.mgr.GetMaidStoreGuidList();
  669. for (int i = 0; i < maidStoreGuidList.Count; i++)
  670. {
  671. Dictionary<string, string> maidStoreData = base.GetMaidStoreData(maidStoreGuidList[i]);
  672. if (maidStoreData.Count > 0)
  673. {
  674. if (maidStoreData.ContainsKey("id"))
  675. {
  676. PhotoFaceData photoFaceData = PhotoFaceData.Get(long.Parse(maidStoreData["id"]));
  677. if (photoFaceData == null)
  678. {
  679. photoFaceData = PhotoFaceData.init_data;
  680. }
  681. maidStoreData["id"] = photoFaceData.id.ToString();
  682. }
  683. }
  684. }
  685. }
  686. public PopupAndTabList PopupAndTabList;
  687. public WFCheckBox CheckBoxEyeToCamera;
  688. public WFCheckBox CheckBoxFaceToCamera;
  689. public WindowPartsInputSliderSet SliderFaceToX;
  690. public WindowPartsInputSliderSet SliderFaceToY;
  691. public WFCheckBox CheckOpenMouse;
  692. [SerializeField]
  693. [Header("モーフオプション")]
  694. public BasePhotoSubWindow MorphSubWindow;
  695. public WindowPartsFaceMorph FaceMorphInput;
  696. public WFCheckBox CheckMorphWindowVisible;
  697. [SerializeField]
  698. [Header("男オプション")]
  699. public GameObject ContentParentMan;
  700. public WindowPartsInputColorrPalette ManColor;
  701. public WindowPartsInputSliderSet ManFat;
  702. public WFCheckBox PartVisibleCheckBox;
  703. public UIWFTabPanel HeadItemTabPanel;
  704. public UIWFTabPanel BodyItemTabPanel;
  705. [SerializeField]
  706. private PhotoSliderAndInput tangaSlider;
  707. private PhotoNoCharaActive noCharaActive;
  708. private PlacementWindow placement_window_;
  709. private MotionWindow motion_window_;
  710. private Dictionary<string, WFCheckBox> add_option_dic_;
  711. private Transform head_transform_;
  712. private PhotoManEditManager man_edit_mgr_;
  713. private PhotoManEditManager.Controller man_controller_;
  714. }