ScreenTrophyMain.cs 6.8 KB

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