GameshopDialog.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763
  1. using Client.MirControls;
  2. using Client.MirGraphics;
  3. using Client.MirSounds;
  4. namespace Client.MirScenes.Dialogs
  5. {
  6. public sealed class GameShopDialog : MirImageControl
  7. {
  8. public GameShopViewer Viewer;
  9. public MirLabel PageNumberLabel, totalGold, totalCredits;
  10. public MirButton ALL, War, Sin, Tao, Wiz, Arch;
  11. public MirButton allItems, topItems, Deals, New;
  12. public MirButton CloseButton, PreviousButton, NextButton;
  13. public MirButton UpButton, DownButton, PositionBar;
  14. public MirCheckBox PaymentTypeGold, PaymentTypeCredit;
  15. public GameShopCell[] Grid;
  16. public MirLabel[] Filters = new MirLabel[22];
  17. List<String> CategoryList = new List<String>();
  18. List<GameShopItem> filteredShop = new List<GameShopItem>();
  19. List<GameShopItem> SearchResult = new List<GameShopItem>();
  20. public MirTextBox Search;
  21. public MirImageControl TitleLabel, FilterBackground;
  22. public string ClassFilter = "Show All";
  23. public string TypeFilter = "Show All";
  24. public string SectionFilter = "Show All";
  25. public int StartIndex = 0;
  26. public int Page = 0;
  27. public int CStartIndex = 0;
  28. public decimal maxPage;
  29. public GameShopDialog()
  30. {
  31. GameScene.GameShopInfoList.Clear();
  32. Index = 749;
  33. Library = Libraries.Title;
  34. Movable = true;
  35. Location = Center;
  36. Sort = true;
  37. TitleLabel = new MirImageControl
  38. {
  39. Index = 26,
  40. Library = Libraries.Title,
  41. Location = new Point(18, 9),
  42. Parent = this
  43. };
  44. Grid = new GameShopCell[4 * 2];
  45. for (int x = 0; x < 4; x++)
  46. {
  47. for (int y = 0; y < 2; y++)
  48. {
  49. int idx = 4 * y + x;
  50. Grid[idx] = new GameShopCell
  51. {
  52. Size = new Size(125, 146),
  53. Visible = true,
  54. Parent = this,
  55. };
  56. }
  57. }
  58. CloseButton = new MirButton
  59. {
  60. HoverIndex = 361,
  61. Index = 360,
  62. Location = new Point(671, 4),
  63. Library = Libraries.Prguse2,
  64. Parent = this,
  65. PressedIndex = 362,
  66. Sound = SoundList.ButtonA,
  67. };
  68. CloseButton.Click += (o, e) => Hide();
  69. totalGold = new MirLabel
  70. {
  71. Size = new Size(100, 20),
  72. DrawFormat = TextFormatFlags.RightToLeft | TextFormatFlags.Right,
  73. Location = new Point(123, 449),
  74. Parent = this,
  75. NotControl = true,
  76. Font = new Font(Settings.FontName, 8F),
  77. };
  78. totalCredits = new MirLabel
  79. {
  80. Size = new Size(100, 20),
  81. DrawFormat = TextFormatFlags.RightToLeft | TextFormatFlags.Right,
  82. Location = new Point(5, 449),
  83. Parent = this,
  84. NotControl = true,
  85. Font = new Font(Settings.FontName, 8F)
  86. };
  87. UpButton = new MirButton
  88. {
  89. Index = 197,
  90. HoverIndex = 198,
  91. PressedIndex = 199,
  92. Library = Libraries.Prguse2,
  93. Parent = this,
  94. Size = new Size(16, 14),
  95. Location = new Point(120, 103),
  96. Sound = SoundList.ButtonA,
  97. Visible = true
  98. };
  99. UpButton.Click += (o, e) =>
  100. {
  101. if (CStartIndex <= 0) return;
  102. CStartIndex--;
  103. SetCategories();
  104. UpdatePositionBar();
  105. };
  106. DownButton = new MirButton
  107. {
  108. Index = 207,
  109. HoverIndex = 208,
  110. Library = Libraries.Prguse2,
  111. PressedIndex = 209,
  112. Parent = this,
  113. Size = new Size(16, 14),
  114. Location = new Point(120, 421),
  115. Sound = SoundList.ButtonA,
  116. Visible = true
  117. };
  118. DownButton.Click += (o, e) =>
  119. {
  120. if (CStartIndex + 22 >= CategoryList.Count) return;
  121. CStartIndex++;
  122. SetCategories();
  123. UpdatePositionBar();
  124. };
  125. PositionBar = new MirButton
  126. {
  127. Index = 205,
  128. HoverIndex = 206,
  129. PressedIndex = 206,
  130. Library = Libraries.Prguse2,
  131. Location = new Point(120, 117),
  132. Parent = this,
  133. Movable = true,
  134. Sound = SoundList.None,
  135. Visible = true
  136. };
  137. PositionBar.OnMoving += PositionBar_OnMoving;
  138. FilterBackground = new MirImageControl
  139. {
  140. Index = 769,
  141. Library = Libraries.Title,
  142. Location = new Point(11, 102),
  143. Parent = this,
  144. };
  145. FilterBackground.MouseWheel += FilterScrolling;
  146. Search = new MirTextBox
  147. {
  148. BackColour = Color.FromArgb(4, 4, 4),
  149. ForeColour = Color.White,
  150. Parent = this,
  151. Size = new Size(140, 16),
  152. Location = new Point(540, 69),
  153. Font = new Font(Settings.FontName, 9F),
  154. MaxLength = 23,
  155. CanLoseFocus = true,
  156. };
  157. Search.TextBox.KeyUp += (o, e) =>
  158. {
  159. GetCategories();
  160. };
  161. PaymentTypeGold = new MirCheckBox
  162. {
  163. LabelText = GameLanguage.ClientTextMap.GetLocalization(ClientTextKeys.BuyWithGold),
  164. Location = new Point(250, 449),
  165. Parent = this,
  166. Hint = GameLanguage.ClientTextMap.GetLocalization(ClientTextKeys.BuyItemsWithGold),
  167. Index = 2086,
  168. UnTickedIndex = 2086,
  169. TickedIndex = 2087,
  170. Library = Libraries.Prguse,
  171. Checked = true
  172. };
  173. PaymentTypeGold.Click += PType_Clicked;
  174. PaymentTypeCredit = new MirCheckBox
  175. {
  176. LabelText = GameLanguage.ClientTextMap.GetLocalization(ClientTextKeys.BuyWithCredits),
  177. Location = new Point(340, 449),
  178. Parent = this,
  179. Hint = GameLanguage.ClientTextMap.GetLocalization(ClientTextKeys.BuyItemsWithCredits),
  180. Index = 2086,
  181. UnTickedIndex = 2086,
  182. TickedIndex = 2087,
  183. Library = Libraries.Prguse
  184. };
  185. PaymentTypeCredit.Click += PType_Clicked;
  186. allItems = new MirButton
  187. {
  188. Index = 770,
  189. Library = Libraries.Title,
  190. Location = new Point(138, 68),
  191. Visible = true,
  192. Parent = this,
  193. Sound = SoundList.ButtonA,
  194. };
  195. allItems.Click += (o, e) =>
  196. {
  197. SectionFilter = "Show All";
  198. ResetTabs();
  199. GetCategories();
  200. };
  201. topItems = new MirButton
  202. {
  203. Index = 776,
  204. Library = Libraries.Title,
  205. Location = new Point(209, 68),
  206. Visible = true,
  207. Parent = this,
  208. Sound = SoundList.ButtonA,
  209. };
  210. topItems.Click += (o, e) =>
  211. {
  212. SectionFilter = "TopItems";
  213. ResetTabs();
  214. GetCategories();
  215. };
  216. Deals = new MirButton
  217. {
  218. Index = 772,
  219. Library = Libraries.Title,
  220. Location = new Point(280, 68),
  221. Visible = true,
  222. Parent = this,
  223. Sound = SoundList.ButtonA,
  224. };
  225. Deals.Click += (o, e) =>
  226. {
  227. SectionFilter = "DealItems";
  228. ResetTabs();
  229. GetCategories();
  230. };
  231. New = new MirButton
  232. {
  233. Index = 774,
  234. Library = Libraries.Title,
  235. Location = new Point(351, 68),
  236. Visible = false,
  237. Parent = this,
  238. Sound = SoundList.ButtonA,
  239. };
  240. New.Click += (o, e) =>
  241. {
  242. SectionFilter = "NewItems";
  243. ResetTabs();
  244. New.Index = 775;
  245. GetCategories();
  246. };
  247. ALL = new MirButton
  248. {
  249. Index = 751,
  250. HoverIndex = 752,
  251. PressedIndex = 753,
  252. Library = Libraries.Title,
  253. Location = new Point(539, 37),
  254. Visible = true,
  255. Parent = this,
  256. };
  257. ALL.Click += (o, e) =>
  258. {
  259. ClassFilter = "Show All";
  260. TypeFilter = "Show All";
  261. GetCategories();
  262. ResetClass();
  263. };
  264. War = new MirButton
  265. {
  266. Index = 754,
  267. HoverIndex = 755,
  268. PressedIndex = 756,
  269. Library = Libraries.Title,
  270. Location = new Point(568, 38),
  271. Visible = true,
  272. Parent = this,
  273. };
  274. War.Click += (o, e) =>
  275. {
  276. ClassFilter = "Warrior";
  277. TypeFilter = "Show All";
  278. GetCategories();
  279. ResetClass();
  280. };
  281. Sin = new MirButton
  282. {
  283. Index = 757,
  284. HoverIndex = 758,
  285. PressedIndex = 759,
  286. Library = Libraries.Title,
  287. Location = new Point(591, 38),
  288. Visible = true,
  289. Parent = this,
  290. };
  291. Sin.Click += (o, e) =>
  292. {
  293. ClassFilter = "Assassin";
  294. TypeFilter = "Show All";
  295. GetCategories();
  296. ResetClass();
  297. };
  298. Tao = new MirButton
  299. {
  300. Index = 760,
  301. HoverIndex = 761,
  302. PressedIndex = 762,
  303. Library = Libraries.Title,
  304. Location = new Point(614, 38),
  305. Visible = true,
  306. Parent = this,
  307. };
  308. Tao.Click += (o, e) =>
  309. {
  310. ClassFilter = "Taoist";
  311. TypeFilter = "Show All";
  312. GetCategories();
  313. ResetClass();
  314. };
  315. Wiz = new MirButton
  316. {
  317. Index = 763,
  318. HoverIndex = 764,
  319. PressedIndex = 765,
  320. Library = Libraries.Title,
  321. Location = new Point(637, 38),
  322. Visible = true,
  323. Parent = this,
  324. };
  325. Wiz.Click += (o, e) =>
  326. {
  327. ClassFilter = "Wizard";
  328. TypeFilter = "Show All";
  329. GetCategories();
  330. ResetClass();
  331. };
  332. Arch = new MirButton
  333. {
  334. Index = 766,
  335. HoverIndex = 767,
  336. PressedIndex = 768,
  337. Library = Libraries.Title,
  338. Location = new Point(660, 38),
  339. Visible = true,
  340. Parent = this,
  341. };
  342. Arch.Click += (o, e) =>
  343. {
  344. ClassFilter = "Archer";
  345. TypeFilter = "Show All";
  346. GetCategories();
  347. ResetClass();
  348. };
  349. PageNumberLabel = new MirLabel
  350. {
  351. Text = "",
  352. Parent = this,
  353. Size = new Size(83, 17),
  354. Location = new Point(597, 446),
  355. DrawFormat = TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter,
  356. Font = new Font(Settings.FontName, 7F),
  357. };
  358. PreviousButton = new MirButton
  359. {
  360. Index = 240,
  361. HoverIndex = 241,
  362. PressedIndex = 242,
  363. Library = Libraries.Prguse2,
  364. Parent = this,
  365. Location = new Point(600, 448),
  366. Sound = SoundList.ButtonA,
  367. };
  368. PreviousButton.Click += (o, e) =>
  369. {
  370. Page--;
  371. if (Page < 0) Page = 0;
  372. StartIndex = Grid.Length * Page;
  373. UpdateShop();
  374. };
  375. NextButton = new MirButton
  376. {
  377. Index = 243,
  378. HoverIndex = 244,
  379. PressedIndex = 245,
  380. Library = Libraries.Prguse2,
  381. Parent = this,
  382. Location = new Point(660, 448),
  383. Sound = SoundList.ButtonA,
  384. };
  385. NextButton.Click += (o, e) =>
  386. {
  387. Page++;
  388. if ((Page + 1) > maxPage) Page--;
  389. StartIndex = Grid.Length * Page;
  390. UpdateShop();
  391. };
  392. for (int i = 0; i < Filters.Length; i++)
  393. {
  394. Filters[i] = new MirLabel
  395. {
  396. Parent = this,
  397. Size = new Size(90, 20),
  398. Location = new Point(15, 103 + (15 * i)),
  399. Text = "Testing - " + i.ToString(),
  400. ForeColour = Color.Gray,
  401. Font = new Font(Settings.FontName, 7F),
  402. };
  403. Filters[i].Click += (o, e) =>
  404. {
  405. MirLabel lab = (MirLabel)o;
  406. TypeFilter = lab.Text;
  407. Page = 0;
  408. StartIndex = 0;
  409. UpdateShop();
  410. for (int p = 0; p < Filters.Length; p++)
  411. {
  412. if (Filters[p].Text == lab.Text) Filters[p].ForeColour = Color.FromArgb(230, 200, 160);
  413. else Filters[p].ForeColour = Color.Gray;
  414. }
  415. };
  416. Filters[i].MouseEnter += (o, e) =>
  417. {
  418. MirLabel lab = (MirLabel)o;
  419. for (int p = 0; p < Filters.Length; p++)
  420. {
  421. if (Filters[p].Text == lab.Text && Filters[p].ForeColour != Color.FromArgb(230, 200, 160)) Filters[p].ForeColour = Color.FromArgb(160, 140, 110);
  422. }
  423. };
  424. Filters[i].MouseLeave += (o, e) =>
  425. {
  426. MirLabel lab = (MirLabel)o;
  427. for (int p = 0; p < Filters.Length; p++)
  428. {
  429. if (Filters[p].Text == lab.Text && Filters[p].ForeColour != Color.FromArgb(230, 200, 160)) Filters[p].ForeColour = Color.Gray;
  430. }
  431. };
  432. Filters[i].MouseWheel += FilterScrolling;
  433. }
  434. Viewer = new GameShopViewer();
  435. }
  436. private void PType_Clicked(object sender, EventArgs e)
  437. {
  438. if (sender == PaymentTypeCredit)
  439. RefreshPayType(0);
  440. else if (sender == PaymentTypeGold)
  441. RefreshPayType(1);
  442. }
  443. private void RefreshPayType(int idx)
  444. {
  445. switch (idx)
  446. {
  447. case 0: // Credits
  448. PaymentTypeCredit.Checked = true;
  449. PaymentTypeGold.Checked = false;
  450. break;
  451. case 1: // Gold
  452. PaymentTypeGold.Checked = true;
  453. PaymentTypeCredit.Checked = false;
  454. break;
  455. }
  456. }
  457. public override void Hide()
  458. {
  459. if (!Visible) return;
  460. Viewer.Visible = false;
  461. Visible = false;
  462. }
  463. public override void Show()
  464. {
  465. if (Visible) return;
  466. Visible = true;
  467. ClassFilter = GameScene.User.Class.ToString();
  468. SectionFilter = "Show All";
  469. ResetTabs();
  470. ResetClass();
  471. GetCategories();
  472. }
  473. protected override void Dispose(bool disposing)
  474. {
  475. base.Dispose(disposing);
  476. Search.Dispose();
  477. Search = null;
  478. PageNumberLabel = null;
  479. totalGold = null;
  480. totalCredits = null;
  481. ALL = null;
  482. War = null;
  483. Sin = null;
  484. Tao = null;
  485. Wiz = null;
  486. Arch = null;
  487. allItems = null;
  488. topItems = null;
  489. Deals = null;
  490. New = null;
  491. CloseButton = null;
  492. PreviousButton = null;
  493. NextButton = null;
  494. UpButton = null;
  495. DownButton = null;
  496. PositionBar = null;
  497. Grid = null;
  498. Filters = null;
  499. FilterBackground = null;
  500. Viewer.Dispose();
  501. CategoryList.Clear();
  502. filteredShop.Clear();
  503. SearchResult.Clear();
  504. }
  505. public void Process()
  506. {
  507. totalCredits.Text = GameScene.Credit.ToString("###,###,##0");
  508. totalGold.Text = GameScene.Gold.ToString("###,###,##0");
  509. }
  510. public void FilterScrolling(object sender, MouseEventArgs e)
  511. {
  512. int count = e.Delta / SystemInformation.MouseWheelScrollDelta;
  513. if (CStartIndex == 0 && count >= 0) return;
  514. if (CStartIndex == CategoryList.Count - 1 && count <= 0) return;
  515. if (CategoryList.Count <= 22) return;
  516. CStartIndex -= count;
  517. if (CStartIndex < 0) CStartIndex = 0;
  518. if (CStartIndex + 22 > CategoryList.Count - 1) CStartIndex = CategoryList.Count - 22;
  519. SetCategories();
  520. UpdatePositionBar();
  521. }
  522. private void UpdatePositionBar()
  523. {
  524. if (CategoryList.Count <= 22) return;
  525. int interval = 290 / (CategoryList.Count - 22);
  526. int x = 120;
  527. int y = 117 + (CStartIndex * interval);
  528. if (y >= 401) y = 401;
  529. if (y <= 117) y = 117;
  530. PositionBar.Location = new Point(x, y);
  531. }
  532. void PositionBar_OnMoving(object sender, MouseEventArgs e)
  533. {
  534. int x = 120;
  535. int y = PositionBar.Location.Y;
  536. if (y >= 401) y = 401;
  537. if (y <= 117) y = 117;
  538. if (CategoryList.Count > 22)
  539. {
  540. int location = y - 117;
  541. int interval = 284 / (CategoryList.Count - 22);
  542. double yPoint = location / interval;
  543. CStartIndex = Convert.ToInt16(Math.Floor(yPoint));
  544. SetCategories();
  545. }
  546. PositionBar.Location = new Point(x, y);
  547. }
  548. public void ResetTabs()
  549. {
  550. allItems.Index = 770;
  551. topItems.Index = 776;
  552. Deals.Index = 772;
  553. New.Index = 774;
  554. if (SectionFilter == "Show All") allItems.Index = 771;
  555. if (SectionFilter == "TopItems") topItems.Index = 777;
  556. if (SectionFilter == "DealItems") Deals.Index = 773;
  557. if (SectionFilter == "NewItems") New.Index = 775;
  558. }
  559. public void ResetClass()
  560. {
  561. ALL.Index = 751;
  562. War.Index = 754;
  563. Sin.Index = 757;
  564. Tao.Index = 760;
  565. Wiz.Index = 763;
  566. Arch.Index = 766;
  567. if (ClassFilter == "Show All") ALL.Index = 752;
  568. if (ClassFilter == "Warrior") War.Index = 755;
  569. if (ClassFilter == "Assassin") Sin.Index = 758;
  570. if (ClassFilter == "Taoist") Tao.Index = 761;
  571. if (ClassFilter == "Wizard") Wiz.Index = 764;
  572. if (ClassFilter == "Archer") Arch.Index = 767;
  573. }
  574. public void GetCategories()
  575. {
  576. TypeFilter = "Show All";
  577. Page = 0;
  578. StartIndex = 0;
  579. List<GameShopItem> shopList;
  580. if (Search.TextBox.Text != "")
  581. shopList = GameScene.GameShopInfoList.Where(f => f.Info.FriendlyName.ToLower().Contains(Search.TextBox.Text.ToLower())).ToList();
  582. else
  583. shopList = GameScene.GameShopInfoList;
  584. CategoryList.Clear();
  585. PositionBar.Location = new Point(120, 117);
  586. CategoryList.Add("Show All");
  587. for (int i = 0; i < shopList.Count; i++)
  588. {
  589. if (!CategoryList.Contains(shopList[i].Category) && shopList[i].Category != "")
  590. {
  591. if (shopList[i].Class == ClassFilter || shopList[i].Class == "All" || ClassFilter == "Show All")
  592. {
  593. if (SectionFilter == "Show All" || SectionFilter == "TopItems" && shopList[i].TopItem || SectionFilter == "DealItems" && shopList[i].Deal || SectionFilter == "NewItems" && shopList[i].Date > CMain.Now.AddDays(-7))
  594. CategoryList.Add(shopList[i].Category);
  595. }
  596. }
  597. }
  598. Filters[0].ForeColour = Color.FromArgb(230, 200, 160);
  599. CStartIndex = 0;
  600. SetCategories();
  601. UpdateShop();
  602. }
  603. public void SetCategories()
  604. {
  605. for (int i = 0; i < Filters.Length; i++)
  606. {
  607. if (i < CategoryList.Count)
  608. {
  609. Filters[i].Text = CategoryList[i + CStartIndex];
  610. Filters[i].ForeColour = Filters[i].Text == TypeFilter ? Color.FromArgb(230, 200, 160) : Color.Gray;
  611. Filters[i].NotControl = false;
  612. }
  613. else
  614. {
  615. Filters[i].Text = "";
  616. Filters[i].NotControl = true;
  617. }
  618. }
  619. }
  620. public void UpdateShop()
  621. {
  622. List<GameShopItem> ShopList;
  623. if (Search.TextBox.Text != "")
  624. ShopList = GameScene.GameShopInfoList.Where(f => f.Info.FriendlyName.ToLower().Contains(Search.TextBox.Text.ToLower())).ToList();
  625. else
  626. ShopList = GameScene.GameShopInfoList;
  627. for (int i = 0; i < Grid.Length; i++)
  628. {
  629. if (Grid[i] != null) Grid[i].Dispose();
  630. Grid[i].Item = null;
  631. };
  632. filteredShop.Clear();
  633. for (int i = 0; i < ShopList.Count; i++)
  634. {
  635. if (ShopList[i].Class == ClassFilter || ShopList[i].Class == "All" || ClassFilter == "Show All")
  636. if (ShopList[i].Category == TypeFilter || TypeFilter == "Show All")
  637. {
  638. if (SectionFilter == "Show All" || SectionFilter == "TopItems" && ShopList[i].TopItem || SectionFilter == "DealItems" && ShopList[i].Deal || SectionFilter == "NewItems" && ShopList[i].Date > CMain.Now.AddDays(-7))
  639. filteredShop.Add(ShopList[i]);
  640. }
  641. }
  642. maxPage = ((decimal)filteredShop.Count / 8);
  643. maxPage = Math.Ceiling(maxPage);
  644. if (maxPage < 1) maxPage = 1;
  645. PageNumberLabel.Text = (Page + 1) + " / " + maxPage;
  646. int maxIndex = filteredShop.Count - 1;
  647. if (StartIndex > maxIndex) StartIndex = maxIndex;
  648. if (StartIndex < 0) StartIndex = 0;
  649. filteredShop = filteredShop.OrderBy(e => e.Info.FriendlyName).ToList();
  650. for (int i = 0; i < Grid.Length; i++)
  651. {
  652. if (i + StartIndex >= filteredShop.Count) break;
  653. if (Grid[i] != null) Grid[i].Dispose();
  654. Grid[i] = new GameShopCell
  655. {
  656. Visible = true,
  657. Item = filteredShop[i + StartIndex],
  658. Size = new Size(125, 146),
  659. Location = i < 4 ? new Point(152 + (i * 132), 115) : new Point(152 + ((i - 4) * 132), 275),
  660. Parent = this,
  661. };
  662. }
  663. GameScene.Scene.GameShopDialog.Viewer.Visible = false;
  664. }
  665. }
  666. }