GameStartView.cs 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. using System;
  2. using System.Collections.Generic;
  3. using ET;
  4. using FairyGUI;
  5. using UI.MiniGame;
  6. using UnityEngine;
  7. namespace GFGGame
  8. {
  9. public class GameStartView : BaseView
  10. {
  11. private UI_GameStartUI _ui;
  12. //后续这里改成读表内容
  13. private List<string> name = new List<string>() { "翻牌", "2048" };
  14. private List<string> viewName = new List<string>() { "FlipGameView", "TZFEGameView" };
  15. private List<string> CustemsDesc = new List<string>()
  16. {
  17. "首次评价达到卓越奖励:",
  18. "首次评价达到优秀奖励:",
  19. "首次评价达到良好奖励:",
  20. };
  21. private int currentGame = 0;
  22. public override void Dispose()
  23. {
  24. if (_ui != null)
  25. {
  26. _ui.Dispose();
  27. _ui = null;
  28. }
  29. base.Dispose();
  30. }
  31. protected override void OnInit()
  32. {
  33. base.OnInit();
  34. packageName = UI_GameStartUI.PACKAGE_NAME;
  35. _ui = UI_GameStartUI.Create();
  36. this.viewCom = _ui.target;
  37. isfullScreen = true;
  38. _ui.m_game1.onClick.Add(OnClickBtnGameOne);
  39. _ui.m_game2.onClick.Add(OnClickBtnGameTwo);
  40. _ui.m_btnBack.onClick.Add(OnClickBtnBack);
  41. _ui.m_shopBtn.onClick.Add(OnClickBtnShop);
  42. _ui.m_addIcon.onClick.Add(OnClickBtnAdd);
  43. _ui.m_rewardBtn.onClick.Add(OnClickBtnReward);
  44. }
  45. protected override void OnShown()
  46. {
  47. base.OnShown();
  48. }
  49. protected override void OnHide()
  50. {
  51. base.OnHide();
  52. }
  53. private void UpdateView()
  54. {
  55. _ui.m_ticketNum.text = "999";
  56. _ui.m_game1name.text = name[0];
  57. _ui.m_game2name.text = name[1];
  58. }
  59. private void OnClickBtnBack()
  60. {
  61. this.Hide();
  62. }
  63. private void OnClickBtnShop()
  64. {
  65. ViewManager.Show<StoreView>(new object[] { ConstStoreTabId.STORE_EXCHANGE, ConstStoreSubId.STORE_ACTIVITY_EXCHANGE });
  66. }
  67. private void OnClickBtnReward()
  68. {
  69. ViewManager.Show<ChallengeRewardView>(new object[] { new List<int>() { 0,1 } });
  70. }
  71. private void OnClickBtnAdd()
  72. {
  73. }
  74. private void OnClickBtnGameOne()
  75. {
  76. ViewManager.Show($"GFGGame.{viewName[0]}");
  77. this.Hide();
  78. }
  79. private void OnClickBtnGameTwo()
  80. {
  81. ViewManager.Show($"GFGGame.{viewName[1]}");
  82. this.Hide();
  83. }
  84. }
  85. }