GameInShopMain.cs 29 KB

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