GameInShopMain.cs 28 KB

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