GameInShopMain.cs 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.IO;
  5. using System.Text;
  6. using I2.Loc;
  7. using PlayerStatus;
  8. using UnityEngine;
  9. using wf;
  10. public class GameInShopMain : WfScreenChildren
  11. {
  12. public override void Awake()
  13. {
  14. base.Awake();
  15. this.camera_move_support_ = base.gameObject.AddComponent<WfCameraMoveSupport>();
  16. this.trialwear_button_ = UTY.GetChildObject(base.root_obj, "TrialWear", false).GetComponent<UIButton>();
  17. this.trialwear_reset_button_ = UTY.GetChildObject(base.root_obj, "TrialWearReset", false).GetComponent<UIButton>();
  18. this.viwe_reset_button_ = UTY.GetChildObject(base.root_obj, "ViweReset", false).GetComponent<UIButton>();
  19. this.item_info_window_ = UTY.GetChildObject(base.root_obj, "Window-ItemInfo", false).GetComponent<ItemInfoWnd>();
  20. this.item_info_window_.gameObject.SetActive(true);
  21. this.ok_button_ = UTY.GetChildObject(base.root_obj, "OK", false).GetComponent<UIButton>();
  22. this.ok_button_.onClick.Clear();
  23. EventDelegate.Add(this.ok_button_.onClick, new EventDelegate.Callback(this.OnClickOK));
  24. this.panel_dic_.Add("メインカテゴリー", new GameInShopMain.PanesSet());
  25. this.panel_dic_["メインカテゴリー"].grid = UTY.GetChildObject(base.root_obj, "MainCategoryViewer/Content/CategoryUnitParent", false).GetComponent<UIGrid>();
  26. this.panel_dic_["メインカテゴリー"].scroll_view = UTY.GetChildObject(base.root_obj, "MainCategoryViewer/Content", false).GetComponent<UIScrollView>();
  27. this.panel_dic_["メインカテゴリー"].tab_panel_ = UTY.GetChildObject(base.root_obj, "MainCategoryViewer/Content/CategoryUnitParent", false).GetComponent<UIWFTabPanel>();
  28. this.panel_dic_.Add("サブカテゴリー", new GameInShopMain.PanesSet());
  29. this.panel_dic_["サブカテゴリー"].grid = UTY.GetChildObject(base.root_obj, "SubCategoryViewer/Content/CategoryUnitParent", false).GetComponent<UIGrid>();
  30. this.panel_dic_["サブカテゴリー"].scroll_view = UTY.GetChildObject(base.root_obj, "SubCategoryViewer/Content", false).GetComponent<UIScrollView>();
  31. this.panel_dic_["サブカテゴリー"].tab_panel_ = UTY.GetChildObject(base.root_obj, "SubCategoryViewer/Content/CategoryUnitParent", false).GetComponent<UIWFTabPanel>();
  32. this.panel_dic_.Add("アイテムリスト", new GameInShopMain.PanesSet());
  33. this.panel_dic_["アイテムリスト"].grid = UTY.GetChildObject(base.root_obj, "ItemList/Content/Parent", false).GetComponent<UIGrid>();
  34. this.panel_dic_["アイテムリスト"].scroll_view = UTY.GetChildObject(base.root_obj, "ItemList/Content", false).GetComponent<UIScrollView>();
  35. this.panel_dic_["アイテムリスト"].tab_panel_ = null;
  36. EventDelegate.Add(this.trialwear_button_.onClick, new EventDelegate.Callback(this.TrialWear));
  37. EventDelegate.Add(this.trialwear_reset_button_.onClick, new EventDelegate.Callback(this.ResetTrialWear));
  38. this.lineup_list_.Clear();
  39. this.access_lineup_dic_.Clear();
  40. for (int i = 0; i < Shop.category_name_list.Count; i++)
  41. {
  42. List<KeyValuePair<string, List<Shop.ItemDataBase>>> list = new List<KeyValuePair<string, List<Shop.ItemDataBase>>>();
  43. Dictionary<string, List<Shop.ItemDataBase>> dictionary = new Dictionary<string, List<Shop.ItemDataBase>>();
  44. for (int j = 0; j < Shop.category_name_list[i].Value.Count; j++)
  45. {
  46. KeyValuePair<string, List<Shop.ItemDataBase>> item = new KeyValuePair<string, List<Shop.ItemDataBase>>(Shop.category_name_list[i].Value[j], new List<Shop.ItemDataBase>());
  47. list.Add(item);
  48. dictionary.Add(Shop.category_name_list[i].Value[j], item.Value);
  49. }
  50. this.lineup_list_.Add(new KeyValuePair<string, List<KeyValuePair<string, List<Shop.ItemDataBase>>>>(Shop.category_name_list[i].Key, list));
  51. this.access_lineup_dic_.Add(Shop.category_name_list[i].Key, dictionary);
  52. }
  53. GameObject childObject = UTY.GetChildObject(base.root_obj, "MainCategoryViewer/Content/CategoryUnitParent", false);
  54. GameObject childObject2 = UTY.GetChildObject(base.root_obj, "SubCategoryViewer/Content/CategoryUnitParent", false);
  55. Func<GameObject, string, UIButton> func = delegate(GameObject parent, string name)
  56. {
  57. GameObject gameObject = Utility.CreatePrefab(parent, "SceneShop/Prefab/CategoryButton", true);
  58. gameObject.name = name;
  59. UILabel component = UTY.GetChildObject(gameObject, "Label", false).GetComponent<UILabel>();
  60. component.text = gameObject.name;
  61. Localize component2 = component.GetComponent<Localize>();
  62. if (Product.supportMultiLanguage && component2 != null)
  63. {
  64. string[] array = new string[]
  65. {
  66. "SceneShop/メインカテゴリー/",
  67. "SceneShop/サブカテゴリー/",
  68. "SceneEdit/カテゴリー/サブ/"
  69. };
  70. foreach (string str in array)
  71. {
  72. if (LocalizationManager.ContainsTerm(str + gameObject.name))
  73. {
  74. component2.SetTerm(str + gameObject.name);
  75. break;
  76. }
  77. }
  78. }
  79. return UTY.GetChildObject(gameObject, "Button", false).GetComponent<UIButton>();
  80. };
  81. for (int k = 0; k < Shop.category_name_list.Count; k++)
  82. {
  83. string key = Shop.category_name_list[k].Key;
  84. UIButton key2 = func(childObject, key);
  85. Dictionary<string, UIButton> dictionary2 = new Dictionary<string, UIButton>();
  86. for (int l = 0; l < Shop.category_name_list[k].Value.Count; l++)
  87. {
  88. string text = Shop.category_name_list[k].Value[l];
  89. UIButton value = func(childObject2, text);
  90. dictionary2.Add(text, value);
  91. }
  92. this.category_button_dic_.Add(key, new KeyValuePair<UIButton, Dictionary<string, UIButton>>(key2, dictionary2));
  93. }
  94. this.game_in_shop_ = base.transform.parent.gameObject.GetComponent<GameInShop>();
  95. }
  96. protected override void OnCall()
  97. {
  98. Shop.CheckClubGradeShopLineup(GameMain.Instance.CharacterMgr.status.clubGrade);
  99. Shop.CheckBuildingShopLineup();
  100. this.labelMoney.text = GameMain.Instance.CharacterMgr.status.moneyText;
  101. this.item_info_window_.transform.localPosition = new Vector3(7f, -600f, 0f);
  102. this.CheckCardSet();
  103. this.maid_ = GameMain.Instance.CharacterMgr.GetMaid(0);
  104. if (this.maid_ == null || !this.maid_.status.leader)
  105. {
  106. Maid x = null;
  107. for (int i = 0; i < GameMain.Instance.CharacterMgr.GetStockMaidCount(); i++)
  108. {
  109. Maid stockMaid = GameMain.Instance.CharacterMgr.GetStockMaid(i);
  110. if (stockMaid.status.leader)
  111. {
  112. x = stockMaid;
  113. break;
  114. }
  115. }
  116. if (x == null)
  117. {
  118. x = GameMain.Instance.CharacterMgr.GetStockMaid(0);
  119. }
  120. this.maid_ = x;
  121. GameMain.Instance.CharacterMgr.SetActiveMaid(this.maid_, 0);
  122. }
  123. this.maid_.Visible = true;
  124. SceneEdit.AllProcPropSeqStart(this.maid_);
  125. this.player_ = GameMain.Instance.CharacterMgr.status;
  126. foreach (KeyValuePair<string, Dictionary<string, List<Shop.ItemDataBase>>> keyValuePair in this.access_lineup_dic_)
  127. {
  128. foreach (KeyValuePair<string, List<Shop.ItemDataBase>> keyValuePair2 in keyValuePair.Value)
  129. {
  130. keyValuePair2.Value.Clear();
  131. }
  132. }
  133. this.trialwear_data_.Clear();
  134. this.trialwear_button_.isEnabled = false;
  135. this.trialwear_reset_button_.isEnabled = false;
  136. this.select_item_id_ = -1;
  137. this.lineup_list_.Clear();
  138. Shop.CheckGroupItemData();
  139. ReadOnlyDictionary<int, ShopItemStatus> shopLineups = this.player_.shopLineups;
  140. foreach (int key in shopLineups.GetKeyArray())
  141. {
  142. if (Shop.item_data_dic.ContainsKey(key))
  143. {
  144. Shop.ItemDataBase itemDataBase = Shop.item_data_dic[key];
  145. NDebug.Assert(this.access_lineup_dic_.ContainsKey(itemDataBase.main_category), string.Concat(new object[]
  146. {
  147. "ID[",
  148. itemDataBase.id,
  149. "]に設定されているメインカテゴリー[",
  150. itemDataBase.main_category,
  151. "]は定義されていません"
  152. }));
  153. NDebug.Assert(this.access_lineup_dic_[itemDataBase.main_category].ContainsKey(itemDataBase.sub_category), string.Concat(new object[]
  154. {
  155. "ID[",
  156. itemDataBase.id,
  157. "]に設定されているサブカテゴリー[",
  158. itemDataBase.sub_category,
  159. "]は定義されていません"
  160. }));
  161. if (itemDataBase.valid_bg_id_list.Contains(this.game_in_shop_.select_bg_id))
  162. {
  163. this.access_lineup_dic_[itemDataBase.main_category][itemDataBase.sub_category].Add(itemDataBase);
  164. }
  165. }
  166. }
  167. HashSet<string> hashSet = new HashSet<string>();
  168. foreach (KeyValuePair<string, Dictionary<string, List<Shop.ItemDataBase>>> keyValuePair3 in this.access_lineup_dic_)
  169. {
  170. foreach (KeyValuePair<string, List<Shop.ItemDataBase>> keyValuePair4 in keyValuePair3.Value)
  171. {
  172. for (int k = 0; k < keyValuePair4.Value.Count; k++)
  173. {
  174. hashSet.Add(keyValuePair4.Value[k].main_category);
  175. }
  176. }
  177. }
  178. UIWFTabButton uiwftabButton = null;
  179. foreach (KeyValuePair<string, KeyValuePair<UIButton, Dictionary<string, UIButton>>> keyValuePair5 in this.category_button_dic_)
  180. {
  181. keyValuePair5.Value.Key.onClick.Clear();
  182. bool flag = hashSet.Contains(keyValuePair5.Key);
  183. keyValuePair5.Value.Key.transform.parent.gameObject.SetActive(flag);
  184. if (flag)
  185. {
  186. EventDelegate.Add(keyValuePair5.Value.Key.onClick, new EventDelegate.Callback(this.OnClickFromMainCategoryButton));
  187. if (uiwftabButton == null)
  188. {
  189. uiwftabButton = keyValuePair5.Value.Key.gameObject.GetComponent<UIWFTabButton>();
  190. }
  191. }
  192. foreach (KeyValuePair<string, UIButton> keyValuePair6 in keyValuePair5.Value.Value)
  193. {
  194. keyValuePair6.Value.transform.parent.gameObject.SetActive(false);
  195. }
  196. }
  197. this.panel_dic_["メインカテゴリー"].grid.Reposition();
  198. this.panel_dic_["メインカテゴリー"].scroll_view.ResetPosition();
  199. this.panel_dic_["メインカテゴリー"].tab_panel_.UpdateChildren();
  200. if (uiwftabButton != null)
  201. {
  202. this.panel_dic_["メインカテゴリー"].tab_panel_.Select(uiwftabButton);
  203. }
  204. this.wait_check_time_ = -1;
  205. this.InitMaidAndCamera(true);
  206. }
  207. protected void InitMaidAndCamera(bool is_start)
  208. {
  209. GameMain.Instance.MainLight.Reset();
  210. GameMain.Instance.CharacterMgr.ResetCharaPosAll();
  211. GameMain.Instance.MainCamera.Reset(CameraMain.CameraType.Target, true);
  212. if (!is_start)
  213. {
  214. GameMain.Instance.ScriptMgr.StopMotionScript();
  215. this.maid_.EyeToCamera(Maid.EyeMoveType.無し, 0f);
  216. this.maid_.Visible = false;
  217. GameMain.Instance.MainCamera.SetTargetOffset(Vector3.zero, false);
  218. }
  219. }
  220. protected override bool IsCallFadeIn()
  221. {
  222. bool flag = !this.maid_.IsBusy;
  223. if (flag)
  224. {
  225. if (this.wait_check_time_ == -1)
  226. {
  227. this.wait_check_time_ = GameMain.tick_count;
  228. ScriptManager scriptMgr = GameMain.Instance.ScriptMgr;
  229. scriptMgr.LoadMotionScript(0, false, "h_kaiwa_tati_001.ks", "*会話立ち待機", string.Empty, string.Empty, false, true, false);
  230. this.maid_.FaceAnime("通常", 1f, 0);
  231. this.maid_.FaceBlend("無し");
  232. return false;
  233. }
  234. if (this.wait_check_time_ + 500 > GameMain.tick_count)
  235. {
  236. return false;
  237. }
  238. this.maid_.EyeToCamera(Maid.EyeMoveType.目と顔を向ける, 0f);
  239. if (Shop.bg_data_dic[this.game_in_shop_.select_bg_id].use_stage_data != null)
  240. {
  241. Shop.bg_data_dic[this.game_in_shop_.select_bg_id].ChangeBg(this.maid_);
  242. }
  243. else
  244. {
  245. GameMain.Instance.BgMgr.ChangeBg(Shop.bg_data_dic[this.game_in_shop_.select_bg_id].bg_prefab_name);
  246. CameraMain mainCamera = GameMain.Instance.MainCamera;
  247. Transform bone = this.maid_.body0.GetBone("Bip01 Head");
  248. mainCamera.SetTargetPos(bone.position - new Vector3(-0.01597595f, 0.224536926f, -0.043105565f), true);
  249. mainCamera.SetDistance(1.6f, true);
  250. mainCamera.SetAroundAngle(new Vector2(173.7126f, 9.999997f), true);
  251. }
  252. GameMain.Instance.MainCamera.SetTargetOffset(new Vector3((float)Screen.width / 256f * 181f - (float)Screen.width / 2f, 0f, 0f), false);
  253. this.camera_move_support_.SaveCameraPosition();
  254. Shop.bg_data_dic[this.game_in_shop_.select_bg_id].PlayBGM(0.5f);
  255. }
  256. return flag;
  257. }
  258. protected override void OnFinish()
  259. {
  260. if (this.trialwear_reset_button_.isEnabled)
  261. {
  262. this.trialwear_reset_button_.isEnabled = false;
  263. this.ResetTrialWear();
  264. }
  265. }
  266. public override void Update()
  267. {
  268. base.Update();
  269. if (base.fade_status == WfScreenChildren.FadeStatus.FadeEnd && !this.maid_.IsBusy)
  270. {
  271. this.InitMaidAndCamera(false);
  272. base.parent_mgr.CallScreen("Move");
  273. }
  274. }
  275. public void OnClickFromMainCategoryButton()
  276. {
  277. UIButton current = UIButton.current;
  278. this.select_main_category_ = current.transform.parent.name;
  279. GameObject childObject = UTY.GetChildObject(base.root_obj, "MainCategoryViewer/Arrow", false);
  280. HashSet<string> hashSet = new HashSet<string>();
  281. foreach (KeyValuePair<string, List<Shop.ItemDataBase>> keyValuePair in this.access_lineup_dic_[this.select_main_category_])
  282. {
  283. if (0 < keyValuePair.Value.Count)
  284. {
  285. hashSet.Add(keyValuePair.Key);
  286. }
  287. }
  288. foreach (KeyValuePair<string, KeyValuePair<UIButton, Dictionary<string, UIButton>>> keyValuePair2 in this.category_button_dic_)
  289. {
  290. foreach (KeyValuePair<string, UIButton> keyValuePair3 in keyValuePair2.Value.Value)
  291. {
  292. keyValuePair3.Value.onClick.Clear();
  293. keyValuePair3.Value.gameObject.GetComponent<UIWFTabButton>().SetSelect(false);
  294. keyValuePair3.Value.transform.parent.gameObject.SetActive(false);
  295. }
  296. }
  297. UIWFTabButton uiwftabButton = null;
  298. foreach (KeyValuePair<string, UIButton> keyValuePair4 in this.category_button_dic_[this.select_main_category_].Value)
  299. {
  300. bool flag = hashSet.Contains(keyValuePair4.Key);
  301. keyValuePair4.Value.transform.parent.gameObject.SetActive(flag);
  302. if (flag)
  303. {
  304. EventDelegate.Add(keyValuePair4.Value.onClick, new EventDelegate.Callback(this.OnClickFromSubCategoryButton));
  305. if (uiwftabButton == null)
  306. {
  307. uiwftabButton = keyValuePair4.Value.gameObject.GetComponent<UIWFTabButton>();
  308. }
  309. }
  310. }
  311. if (this.last_click_sub_category_button_.ContainsKey(this.select_main_category_))
  312. {
  313. uiwftabButton = this.last_click_sub_category_button_[this.select_main_category_];
  314. }
  315. this.panel_dic_["サブカテゴリー"].grid.Reposition();
  316. this.panel_dic_["サブカテゴリー"].scroll_view.ResetPosition();
  317. this.panel_dic_["サブカテゴリー"].tab_panel_.UpdateChildren();
  318. if (uiwftabButton != null)
  319. {
  320. this.panel_dic_["サブカテゴリー"].tab_panel_.Select(uiwftabButton);
  321. }
  322. Vector3 position = current.transform.TransformPoint(new Vector3(0f, 0f, 0f));
  323. Vector3 local_pos = childObject.transform.parent.InverseTransformPoint(position);
  324. local_pos.x = childObject.transform.localPosition.x;
  325. local_pos.y += 18f;
  326. Hashtable args = TweenHash.EaseOutQuint(TweenHash.Type.Position, local_pos, 0.3f);
  327. iTween.MoveTo(childObject, args);
  328. }
  329. public void OnClickFromSubCategoryButton()
  330. {
  331. UIButton current = UIButton.current;
  332. this.select_sub_category_ = current.transform.parent.name;
  333. if (Shop.sub_category_dressingbutton_enabled.ContainsKey(this.select_sub_category_))
  334. {
  335. bool active = Shop.sub_category_dressingbutton_enabled[this.select_sub_category_];
  336. this.trialwear_button_.gameObject.SetActive(active);
  337. this.trialwear_reset_button_.gameObject.SetActive(active);
  338. this.viwe_reset_button_.gameObject.SetActive(active);
  339. }
  340. if (!this.last_click_sub_category_button_.ContainsKey(this.select_main_category_))
  341. {
  342. this.last_click_sub_category_button_.Add(this.select_main_category_, null);
  343. }
  344. this.last_click_sub_category_button_[this.select_main_category_] = UIWFTabButton.current;
  345. this.SetItemList(this.select_main_category_, this.select_sub_category_);
  346. GameObject childObject = UTY.GetChildObject(base.root_obj, "SubCategoryViewer/Arrow", false);
  347. Vector3 position = current.transform.TransformPoint(new Vector3(0f, 0f, 0f));
  348. Vector3 local_pos = childObject.transform.parent.InverseTransformPoint(position);
  349. local_pos.x = childObject.transform.localPosition.x;
  350. local_pos.y += 18f;
  351. Hashtable args = TweenHash.EaseOutQuint(TweenHash.Type.Position, local_pos, 0.3f);
  352. iTween.MoveTo(childObject, args);
  353. }
  354. public void SetItemList(string main_category, string sub_category)
  355. {
  356. this.select_item_id_ = -1;
  357. this.trialwear_button_.isEnabled = false;
  358. Transform transform = this.panel_dic_["アイテムリスト"].grid.transform;
  359. for (int i = 0; i < transform.childCount; i++)
  360. {
  361. UnityEngine.Object.Destroy(transform.GetChild(i).gameObject);
  362. }
  363. transform.DetachChildren();
  364. this.current_item_list_.Clear();
  365. this.panel_dic_["アイテムリスト"].grid.Reposition();
  366. this.panel_dic_["アイテムリスト"].scroll_view.ResetPosition();
  367. if (!this.access_lineup_dic_.ContainsKey(main_category) || !this.access_lineup_dic_[main_category].ContainsKey(sub_category))
  368. {
  369. return;
  370. }
  371. List<Shop.ItemDataBase> list = this.access_lineup_dic_[main_category][sub_category];
  372. for (int j = 0; j < list.Count; j++)
  373. {
  374. this.current_item_list_.Add(this.CreateShopItem(list[j]));
  375. }
  376. this.panel_dic_["アイテムリスト"].grid.Reposition();
  377. this.panel_dic_["アイテムリスト"].scroll_view.ResetPosition();
  378. }
  379. public ShopItem CreateShopItem(Shop.ItemDataBase add_item)
  380. {
  381. GameObject gameObject = Utility.CreatePrefab(this.panel_dic_["アイテムリスト"].grid.gameObject, "SceneShop/Prefab/ShopItem", true);
  382. ShopItem component = gameObject.GetComponent<ShopItem>();
  383. component.SetData(add_item, this.item_info_window_, new ShopItem.OnClickEvent(this.OnIconClick), new ShopItem.OnClickEvent(this.OnItemClick));
  384. return component;
  385. }
  386. public void TrialWear()
  387. {
  388. if (this.select_item_id_ < 0 || !Shop.item_data_dic.ContainsKey(this.select_item_id_))
  389. {
  390. return;
  391. }
  392. if (this.maid_.IsBusy)
  393. {
  394. return;
  395. }
  396. this.trialwear_data_.Save(this.maid_);
  397. this.trialwear_data_.apply_item_id_list.Add(this.select_item_id_);
  398. Shop.ItemDataBase itemDataBase = Shop.item_data_dic[this.select_item_id_];
  399. string[] trial_wear_item_menu_array = itemDataBase.trial_wear_item_menu_array;
  400. for (int i = 0; i < trial_wear_item_menu_array.Length; i++)
  401. {
  402. byte[] buffer = null;
  403. using (AFileBase afileBase = GameUty.FileSystem.FileOpen(trial_wear_item_menu_array[i]))
  404. {
  405. NDebug.Assert(afileBase.IsValid(), itemDataBase.name + "\nnot file open.");
  406. buffer = afileBase.ReadAll();
  407. }
  408. BinaryReader binaryReader = new BinaryReader(new MemoryStream(buffer), Encoding.UTF8);
  409. string text = binaryReader.ReadString();
  410. NDebug.Assert(text == "CM3D2_MENU", "ProcScriptBin 例外 : ヘッダーファイルが不正です。" + text);
  411. int num = binaryReader.ReadInt32();
  412. string text2 = binaryReader.ReadString();
  413. string text3 = binaryReader.ReadString();
  414. string text4 = binaryReader.ReadString();
  415. binaryReader.Close();
  416. buffer = null;
  417. this.maid_.SetProp(text4, trial_wear_item_menu_array[i], 0, false, false);
  418. if (!itemDataBase.enabled_mask_mode)
  419. {
  420. MPN key = (MPN)Enum.Parse(typeof(MPN), text4);
  421. if (SceneEditInfo.m_dicPartsTypeWearMode.ContainsKey(key))
  422. {
  423. TBody.MaskMode maskMode = SceneEditInfo.m_dicPartsTypeWearMode[key];
  424. this.maid_.body0.SetMaskMode(maskMode);
  425. }
  426. }
  427. }
  428. if (itemDataBase.enabled_mask_mode)
  429. {
  430. this.maid_.body0.SetMaskMode(itemDataBase.mask_mode);
  431. }
  432. SceneEdit.AllProcPropSeqStart(this.maid_);
  433. this.trialwear_reset_button_.isEnabled = true;
  434. }
  435. public void ResetTrialWear()
  436. {
  437. if (this.maid_.IsBusy)
  438. {
  439. return;
  440. }
  441. this.trialwear_reset_button_.isEnabled = false;
  442. this.trialwear_data_.Load(this.maid_);
  443. this.trialwear_data_.Clear();
  444. SceneEdit.AllProcPropSeqStart(this.maid_);
  445. this.maid_.body0.SetMaskMode(TBody.MaskMode.None);
  446. }
  447. private void OnIconClick(ShopItem item)
  448. {
  449. for (int i = 0; i < this.current_item_list_.Count; i++)
  450. {
  451. this.current_item_list_[i].SetFlameVisible(false);
  452. }
  453. if (this.select_item_id_ == item.item_data.id)
  454. {
  455. item.SetFlameVisible(false);
  456. this.select_item_id_ = -1;
  457. this.trialwear_button_.isEnabled = false;
  458. }
  459. else
  460. {
  461. item.SetFlameVisible(true);
  462. this.select_item_id_ = item.item_data.id;
  463. this.trialwear_button_.isEnabled = true;
  464. }
  465. }
  466. private void OnItemClick(ShopItem item)
  467. {
  468. GameMain.Instance.SoundMgr.PlaySystem("SE025.ogg");
  469. this.player_.money += (long)(item.item_data.price * -1);
  470. this.player_.totalPurchasePrice += (long)item.item_data.price;
  471. string[] item_menu_array = item.item_data.item_menu_array;
  472. if (item.item_data.type == Shop.ItemDataBase.Type.Parts)
  473. {
  474. if (Shop.item_data_group_dic.ContainsKey(item.item_data.id))
  475. {
  476. List<int> need_id_list = Shop.item_data_group_dic[item.item_data.id].need_id_list;
  477. for (int i = 0; i < need_id_list.Count; i++)
  478. {
  479. this.player_.SetShopLineupStatus(need_id_list[i], ShopItemStatus.Purchased);
  480. }
  481. }
  482. this.player_.SetShopLineupStatus(item.item_data.id, ShopItemStatus.Purchased);
  483. for (int j = 0; j < item_menu_array.Length; j++)
  484. {
  485. this.player_.AddHavePartsItem(item_menu_array[j]);
  486. }
  487. item.UpdateItemData();
  488. this.CheckCardSet();
  489. }
  490. else
  491. {
  492. Shop.ItemDataEvent itemDataEvent = item.item_data as Shop.ItemDataEvent;
  493. itemDataEvent.ExecBuy();
  494. item.UpdateItemData();
  495. if (2 <= itemDataEvent.free_text.Count && itemDataEvent.free_text[0] == "建物強化素材")
  496. {
  497. GameMain.Instance.FacilityMgr.SetHavePowerUpMaterial(int.Parse(itemDataEvent.free_text[1].Trim()), true);
  498. }
  499. }
  500. Transform transform = this.panel_dic_["アイテムリスト"].grid.transform;
  501. for (int k = 0; k < transform.childCount; k++)
  502. {
  503. ShopItem component = transform.GetChild(k).GetComponent<ShopItem>();
  504. component.UpdateItemData();
  505. }
  506. this.labelMoney.text = GameMain.Instance.CharacterMgr.status.moneyText;
  507. }
  508. private void OnClickOK()
  509. {
  510. if (this.maid_.IsBusy)
  511. {
  512. return;
  513. }
  514. this.Finish();
  515. }
  516. public void OnClickViweReset()
  517. {
  518. this.camera_move_support_.ResetCamera();
  519. }
  520. private void CheckCardSet()
  521. {
  522. Status status = GameMain.Instance.CharacterMgr.status;
  523. List<KeyValuePair<string[], HashSet<int>>> set_card_list = Shop.set_card_list;
  524. for (int i = 0; i < set_card_list.Count; i++)
  525. {
  526. string[] key = set_card_list[i].Key;
  527. bool flag = true;
  528. for (int j = 0; j < key.Length; j++)
  529. {
  530. if (!status.IsHavePartsItem(key[j]))
  531. {
  532. flag = false;
  533. break;
  534. }
  535. }
  536. if (!flag)
  537. {
  538. bool flag2 = true;
  539. foreach (int num in set_card_list[i].Value)
  540. {
  541. if (!status.IsShopLineupItem(num))
  542. {
  543. flag2 = false;
  544. break;
  545. }
  546. ShopItemStatus shopItemStatus = status.shopLineups.Get(num);
  547. if (shopItemStatus != ShopItemStatus.Purchased)
  548. {
  549. flag2 = false;
  550. break;
  551. }
  552. }
  553. if (flag2)
  554. {
  555. for (int k = 0; k < key.Length; k++)
  556. {
  557. status.AddHavePartsItem(key[k]);
  558. }
  559. }
  560. }
  561. }
  562. }
  563. [SerializeField]
  564. public UILabel labelMoney;
  565. private GameInShop game_in_shop_;
  566. private Maid maid_;
  567. private WfCameraMoveSupport camera_move_support_;
  568. private ItemInfoWnd item_info_window_;
  569. private UIButton trialwear_button_;
  570. private UIButton trialwear_reset_button_;
  571. private UIButton viwe_reset_button_;
  572. private int select_item_id_;
  573. private Status player_;
  574. private GameInShopMain.TrialWearData trialwear_data_ = new GameInShopMain.TrialWearData();
  575. private Dictionary<string, GameInShopMain.PanesSet> panel_dic_ = new Dictionary<string, GameInShopMain.PanesSet>();
  576. private UIButton ok_button_;
  577. private int wait_check_time_ = -1;
  578. private List<ShopItem> current_item_list_ = new List<ShopItem>();
  579. private string select_main_category_;
  580. private string select_sub_category_;
  581. private Dictionary<string, KeyValuePair<UIButton, Dictionary<string, UIButton>>> category_button_dic_ = new Dictionary<string, KeyValuePair<UIButton, Dictionary<string, UIButton>>>();
  582. private Dictionary<string, UIWFTabButton> last_click_sub_category_button_ = new Dictionary<string, UIWFTabButton>();
  583. private List<KeyValuePair<string, List<KeyValuePair<string, List<Shop.ItemDataBase>>>>> lineup_list_ = new List<KeyValuePair<string, List<KeyValuePair<string, List<Shop.ItemDataBase>>>>>();
  584. private Dictionary<string, Dictionary<string, List<Shop.ItemDataBase>>> access_lineup_dic_ = new Dictionary<string, Dictionary<string, List<Shop.ItemDataBase>>>();
  585. private class TrialWearData
  586. {
  587. public void Clear()
  588. {
  589. this.apply_item_id_list.Clear();
  590. }
  591. public void Save(Maid maid)
  592. {
  593. if (this.backup_maid_prop_.Count != 0)
  594. {
  595. return;
  596. }
  597. this.backup_maid_prop_.Add(this.CreateData(maid, MPN.hairf));
  598. this.backup_maid_prop_.Add(this.CreateData(maid, MPN.hairr));
  599. this.backup_maid_prop_.Add(this.CreateData(maid, MPN.hairt));
  600. this.backup_maid_prop_.Add(this.CreateData(maid, MPN.hairs));
  601. this.backup_maid_prop_.Add(this.CreateData(maid, MPN.skin));
  602. this.backup_maid_prop_.Add(this.CreateData(maid, MPN.underhair));
  603. this.backup_maid_prop_.Add(this.CreateData(maid, MPN.lip));
  604. this.backup_maid_prop_.Add(this.CreateData(maid, MPN.eye));
  605. this.backup_maid_prop_.Add(this.CreateData(maid, MPN.eye_hi));
  606. this.backup_maid_prop_.Add(this.CreateData(maid, MPN.eye_hi_r));
  607. for (int i = 67; i <= 96; i++)
  608. {
  609. this.backup_maid_prop_.Add(this.CreateData(maid, (MPN)i));
  610. }
  611. MPN[] array = new MPN[]
  612. {
  613. MPN.hairt,
  614. MPN.hairaho
  615. };
  616. this.backup_custom_parts_dic_.Clear();
  617. foreach (MPN mpn in array)
  618. {
  619. List<KeyValuePair<TBody.SlotID, string>> attachPointListFromMPN = maid.body0.GetAttachPointListFromMPN(mpn);
  620. this.backup_custom_parts_dic_.Add(mpn, attachPointListFromMPN);
  621. foreach (KeyValuePair<TBody.SlotID, string> keyValuePair in attachPointListFromMPN)
  622. {
  623. TBody.SlotID key = keyValuePair.Key;
  624. string value = keyValuePair.Value;
  625. maid.body0.CopyAttachPoint(key, value);
  626. }
  627. }
  628. this.hair_length_dic_.Clear();
  629. MPN[] array3 = new MPN[]
  630. {
  631. MPN.hairf,
  632. MPN.hairr,
  633. MPN.hairt,
  634. MPN.hairs,
  635. MPN.hairaho
  636. };
  637. foreach (MPN mpn2 in array3)
  638. {
  639. Dictionary<string, float> dictionary = new Dictionary<string, float>();
  640. Dictionary<string, TBodySkin.HairLengthCtrl.HairLength> hairLengthListFromMPN = maid.body0.GetHairLengthListFromMPN(mpn2);
  641. if (hairLengthListFromMPN != null)
  642. {
  643. foreach (KeyValuePair<string, TBodySkin.HairLengthCtrl.HairLength> keyValuePair2 in hairLengthListFromMPN)
  644. {
  645. string key2 = keyValuePair2.Key;
  646. TBodySkin.HairLengthCtrl.HairLength value2 = keyValuePair2.Value;
  647. dictionary.Add(key2, value2.GetLengthRate());
  648. }
  649. }
  650. if (dictionary.Count != 0)
  651. {
  652. this.hair_length_dic_.Add(mpn2, dictionary);
  653. }
  654. }
  655. }
  656. public void Load(Maid maid)
  657. {
  658. if (this.backup_maid_prop_.Count == 0)
  659. {
  660. return;
  661. }
  662. for (int i = 0; i < this.backup_maid_prop_.Count; i++)
  663. {
  664. maid.SetProp(this.backup_maid_prop_[i].mpn, this.backup_maid_prop_[i].file_name, this.backup_maid_prop_[i].file_name_rid, false, false);
  665. }
  666. this.backup_maid_prop_.Clear();
  667. maid.AllProcProp();
  668. foreach (KeyValuePair<MPN, List<KeyValuePair<TBody.SlotID, string>>> keyValuePair in this.backup_custom_parts_dic_)
  669. {
  670. MPN key = keyValuePair.Key;
  671. List<KeyValuePair<TBody.SlotID, string>> value = keyValuePair.Value;
  672. foreach (KeyValuePair<TBody.SlotID, string> keyValuePair2 in value)
  673. {
  674. TBody.SlotID key2 = keyValuePair2.Key;
  675. string value2 = keyValuePair2.Value;
  676. maid.body0.PasteAttachPoint(key2, value2);
  677. }
  678. }
  679. foreach (KeyValuePair<MPN, Dictionary<string, float>> keyValuePair3 in this.hair_length_dic_)
  680. {
  681. MPN key3 = keyValuePair3.Key;
  682. Dictionary<string, float> value3 = keyValuePair3.Value;
  683. Dictionary<string, TBodySkin.HairLengthCtrl.HairLength> hairLengthListFromMPN = maid.body0.GetHairLengthListFromMPN(key3);
  684. if (hairLengthListFromMPN != null)
  685. {
  686. foreach (KeyValuePair<string, TBodySkin.HairLengthCtrl.HairLength> keyValuePair4 in hairLengthListFromMPN)
  687. {
  688. string key4 = keyValuePair4.Key;
  689. TBodySkin.HairLengthCtrl.HairLength value4 = keyValuePair4.Value;
  690. value4.SetLengthRate(value3[key4]);
  691. }
  692. maid.body0.HairLengthBlend();
  693. }
  694. }
  695. }
  696. private GameInShopMain.TrialWearData.MaidPropData CreateData(Maid maid, MPN mpn_num)
  697. {
  698. MaidProp prop = maid.GetProp(mpn_num);
  699. GameInShopMain.TrialWearData.MaidPropData result;
  700. result.mpn = mpn_num;
  701. result.file_name = prop.strFileName;
  702. result.file_name_rid = prop.nTempFileNameRID;
  703. return result;
  704. }
  705. public HashSet<int> apply_item_id_list = new HashSet<int>();
  706. private List<GameInShopMain.TrialWearData.MaidPropData> backup_maid_prop_ = new List<GameInShopMain.TrialWearData.MaidPropData>();
  707. private Dictionary<MPN, List<KeyValuePair<TBody.SlotID, string>>> backup_custom_parts_dic_ = new Dictionary<MPN, List<KeyValuePair<TBody.SlotID, string>>>();
  708. private Dictionary<MPN, Dictionary<string, float>> hair_length_dic_ = new Dictionary<MPN, Dictionary<string, float>>();
  709. private struct MaidPropData
  710. {
  711. public MPN mpn;
  712. public string file_name;
  713. public int file_name_rid;
  714. }
  715. }
  716. private class PanesSet
  717. {
  718. public UIGrid grid;
  719. public UIScrollView scroll_view;
  720. public UIWFTabPanel tab_panel_;
  721. }
  722. }