ScreenTrophyMain.cs 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using wf;
  5. public class ScreenTrophyMain : WfScreenChildren
  6. {
  7. public override void Awake()
  8. {
  9. base.Awake();
  10. EventDelegate.Add(UTY.GetChildObject(base.root_obj, "MainItems/OK", false).GetComponent<UIButton>().onClick, new EventDelegate.Callback(this.OnClickOK));
  11. this.storage_object_ = UTY.GetChildObject(base.root_obj, "StorageObject", false);
  12. this.panel_dic_.Add("メインカテゴリー", new ScreenTrophyMain.PanesSet());
  13. this.panel_dic_["メインカテゴリー"].grid = UTY.GetChildObject(base.root_obj, "MainItems/MainCategoryViewer/Content/CategoryUnitParent", false).GetComponent<UIGrid>();
  14. this.panel_dic_["メインカテゴリー"].scroll_view = UTY.GetChildObject(base.root_obj, "MainItems/MainCategoryViewer/Content", false).GetComponent<UIScrollView>();
  15. this.panel_dic_["メインカテゴリー"].tab_panel_ = UTY.GetChildObject(base.root_obj, "MainItems/MainCategoryViewer/Content/CategoryUnitParent", false).GetComponent<UIWFTabPanel>();
  16. this.panel_dic_.Add("トロフィーリスト", new ScreenTrophyMain.PanesSet());
  17. this.panel_dic_["トロフィーリスト"].grid = UTY.GetChildObject(base.root_obj, "MainItems/TrophyList/Content/Parent", false).GetComponent<UIGrid>();
  18. this.panel_dic_["トロフィーリスト"].grid.sorting = UIGrid.Sorting.Vertical;
  19. this.panel_dic_["トロフィーリスト"].scroll_view = UTY.GetChildObject(base.root_obj, "MainItems/TrophyList/Content", false).GetComponent<UIScrollView>();
  20. GameObject gameObject = this.panel_dic_["メインカテゴリー"].grid.gameObject;
  21. Func<GameObject, string, UIButton> func = delegate(GameObject parent, string name)
  22. {
  23. GameObject gameObject2 = Utility.CreatePrefab(parent, "SceneShop/Prefab/CategoryButton", true);
  24. gameObject2.name = name;
  25. UTY.GetChildObject(gameObject2, "Label", false).GetComponent<UILabel>().text = gameObject2.name;
  26. return UTY.GetChildObject(gameObject2, "Button", false).GetComponent<UIButton>();
  27. };
  28. List<Trophy.Data> allDatas = Trophy.GetAllDatas(true);
  29. SortedDictionary<int, string> sortedDictionary = new SortedDictionary<int, string>();
  30. foreach (Trophy.Data data in allDatas)
  31. {
  32. int type = (int)data.type;
  33. if (!sortedDictionary.ContainsKey(type))
  34. {
  35. sortedDictionary.Add(type, data.typeDrawText);
  36. }
  37. }
  38. foreach (KeyValuePair<int, string> keyValuePair in sortedDictionary)
  39. {
  40. UIButton uibutton = func(gameObject, keyValuePair.Value);
  41. uibutton.name = ((Trophy.Data.Type)keyValuePair.Key).ToString();
  42. EventDelegate.Add(uibutton.onClick, new EventDelegate.Callback(this.OnClickCategory));
  43. }
  44. Utility.ResetNGUI(this.panel_dic_["メインカテゴリー"].grid);
  45. Utility.ResetNGUI(this.panel_dic_["メインカテゴリー"].scroll_view);
  46. }
  47. protected override void OnCall()
  48. {
  49. this.wait_count_ = 0;
  50. GameMain.Instance.MainLight.Reset();
  51. GameMain.Instance.CharacterMgr.ResetCharaPosAll();
  52. GameMain.Instance.MainCamera.Reset(CameraMain.CameraType.Target, true);
  53. int num = 0;
  54. int[] array = new int[3];
  55. int[] array2 = new int[3];
  56. List<Trophy.Data> allDatas = Trophy.GetAllDatas(true);
  57. foreach (Trophy.Data data in allDatas)
  58. {
  59. GameObject gameObject;
  60. if (data.widthType)
  61. {
  62. gameObject = Utility.CreatePrefab(this.storage_object_, "SceneTrophy/Prefab/TrophyInfoWidth", true);
  63. }
  64. else
  65. {
  66. gameObject = Utility.CreatePrefab(this.storage_object_, "SceneTrophy/Prefab/TrophyInfo", true);
  67. }
  68. gameObject.name = data.name;
  69. TrophyInfo component = gameObject.GetComponent<TrophyInfo>();
  70. component.SetData(data);
  71. component.onClickCardButton = new Action<Trophy.Data, Vector3>(this.OnClickCardButton);
  72. this.trophy_infos_.Add(component);
  73. array[(int)component.trophy_data.type]++;
  74. if (component.have_visible)
  75. {
  76. array2[(int)component.trophy_data.type]++;
  77. num += data.maidPoint;
  78. }
  79. }
  80. this.totalMaidPointLabel.text = num.ToString();
  81. this.heroineTrophyNumLabel.text = array2[0].ToString() + "/" + array[0].ToString();
  82. this.systemTrophyNumLabel.text = array2[1].ToString() + "/" + array[1].ToString();
  83. this.extraTrophyNumLabel.text = array2[2].ToString() + "/" + array[2].ToString();
  84. if (array[2] == 0)
  85. {
  86. this.extraTrophyNumLabel.transform.parent.gameObject.SetActive(false);
  87. Vector3 localPosition = this.totalMaidPointLabel.transform.parent.localPosition;
  88. this.totalMaidPointLabel.transform.parent.localPosition = new Vector3(localPosition.x, localPosition.y + 38f, localPosition.z);
  89. UIWidget component2 = this.totalMaidPointLabel.transform.parent.parent.GetComponent<UIWidget>();
  90. component2.height -= 38;
  91. }
  92. UIWFTabButton componentInChildren = this.panel_dic_["メインカテゴリー"].grid.transform.GetChild(0).GetComponentInChildren<UIWFTabButton>();
  93. this.panel_dic_["メインカテゴリー"].tab_panel_.Select(componentInChildren);
  94. uGUITutorialPanel.OpenTutorial("SceneTrophy", null, false);
  95. }
  96. protected override bool IsCallFadeIn()
  97. {
  98. this.wait_count_++;
  99. return 2 < this.wait_count_;
  100. }
  101. private void OnClickCategory()
  102. {
  103. string name = UIButton.current.name;
  104. Trophy.Data.Type type = (Trophy.Data.Type)Enum.Parse(typeof(Trophy.Data.Type), name);
  105. foreach (TrophyInfo trophyInfo in this.trophy_infos_)
  106. {
  107. trophyInfo.transform.SetParent(this.storage_object_.transform, false);
  108. }
  109. UIGrid grid = this.panel_dic_["トロフィーリスト"].grid;
  110. grid.transform.DetachChildren();
  111. Utility.ResetNGUI(grid);
  112. foreach (TrophyInfo trophyInfo2 in this.trophy_infos_)
  113. {
  114. if (trophyInfo2.trophy_data.type == type)
  115. {
  116. trophyInfo2.transform.SetParent(grid.transform, false);
  117. trophyInfo2.transform.localPosition = new Vector3(0f, (float)(trophyInfo2.trophy_data.id * -1), 0f);
  118. }
  119. }
  120. Utility.ResetNGUI(grid);
  121. Utility.ResetNGUI(this.panel_dic_["トロフィーリスト"].scroll_view);
  122. }
  123. public void OnClickCardButton(Trophy.Data tropheyData, Vector3 cardWorldPos)
  124. {
  125. this.fadeObject.CallCard(tropheyData, cardWorldPos);
  126. }
  127. protected override void OnFinish()
  128. {
  129. base.parent_mgr.CallScreen("Move");
  130. }
  131. public void OnClickOK()
  132. {
  133. this.Finish();
  134. }
  135. [SerializeField]
  136. private UILabel heroineTrophyNumLabel;
  137. [SerializeField]
  138. private UILabel systemTrophyNumLabel;
  139. [SerializeField]
  140. private UILabel extraTrophyNumLabel;
  141. [SerializeField]
  142. private UILabel totalMaidPointLabel;
  143. [SerializeField]
  144. private SceneTrophyCardFade fadeObject;
  145. private GameObject storage_object_;
  146. private Dictionary<string, ScreenTrophyMain.PanesSet> panel_dic_ = new Dictionary<string, ScreenTrophyMain.PanesSet>();
  147. private List<TrophyInfo> trophy_infos_ = new List<TrophyInfo>();
  148. private int wait_count_;
  149. private class PanesSet
  150. {
  151. public UIGrid grid;
  152. public UIScrollView scroll_view;
  153. public UIWFTabPanel tab_panel_;
  154. }
  155. }