123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176 |
- using System;
- using System.Collections.Generic;
- using UnityEngine;
- using wf;
- public class ScreenTrophyMain : WfScreenChildren
- {
- public override void Awake()
- {
- base.Awake();
- EventDelegate.Add(UTY.GetChildObject(base.root_obj, "MainItems/OK", false).GetComponent<UIButton>().onClick, new EventDelegate.Callback(this.OnClickOK));
- this.storage_object_ = UTY.GetChildObject(base.root_obj, "StorageObject", false);
- this.panel_dic_.Add("メインカテゴリー", new ScreenTrophyMain.PanesSet());
- this.panel_dic_["メインカテゴリー"].grid = UTY.GetChildObject(base.root_obj, "MainItems/MainCategoryViewer/Content/CategoryUnitParent", false).GetComponent<UIGrid>();
- this.panel_dic_["メインカテゴリー"].scroll_view = UTY.GetChildObject(base.root_obj, "MainItems/MainCategoryViewer/Content", false).GetComponent<UIScrollView>();
- this.panel_dic_["メインカテゴリー"].tab_panel_ = UTY.GetChildObject(base.root_obj, "MainItems/MainCategoryViewer/Content/CategoryUnitParent", false).GetComponent<UIWFTabPanel>();
- this.panel_dic_.Add("トロフィーリスト", new ScreenTrophyMain.PanesSet());
- this.panel_dic_["トロフィーリスト"].grid = UTY.GetChildObject(base.root_obj, "MainItems/TrophyList/Content/Parent", false).GetComponent<UIGrid>();
- this.panel_dic_["トロフィーリスト"].grid.sorting = UIGrid.Sorting.Vertical;
- this.panel_dic_["トロフィーリスト"].scroll_view = UTY.GetChildObject(base.root_obj, "MainItems/TrophyList/Content", false).GetComponent<UIScrollView>();
- GameObject gameObject = this.panel_dic_["メインカテゴリー"].grid.gameObject;
- Func<GameObject, string, UIButton> func = delegate(GameObject parent, string name)
- {
- GameObject gameObject2 = Utility.CreatePrefab(parent, "SceneShop/Prefab/CategoryButton", true);
- gameObject2.name = name;
- UILabel component = UTY.GetChildObject(gameObject2, "Label", false).GetComponent<UILabel>();
- component.text = gameObject2.name;
- Utility.SetLocalizeTerm(component, "SceneTrophy/タイプ/" + name);
- return UTY.GetChildObject(gameObject2, "Button", false).GetComponent<UIButton>();
- };
- List<Trophy.Data> allDatas = Trophy.GetAllDatas(true);
- SortedDictionary<int, string> sortedDictionary = new SortedDictionary<int, string>();
- foreach (Trophy.Data data in allDatas)
- {
- int type = (int)data.type;
- if (!sortedDictionary.ContainsKey(type))
- {
- sortedDictionary.Add(type, data.typeDrawText);
- }
- }
- foreach (KeyValuePair<int, string> keyValuePair in sortedDictionary)
- {
- UIButton uibutton = func(gameObject, keyValuePair.Value);
- uibutton.name = ((Trophy.Data.Type)keyValuePair.Key).ToString();
- EventDelegate.Add(uibutton.onClick, new EventDelegate.Callback(this.OnClickCategory));
- }
- Utility.ResetNGUI(this.panel_dic_["メインカテゴリー"].grid);
- Utility.ResetNGUI(this.panel_dic_["メインカテゴリー"].scroll_view);
- }
- protected override void OnCall()
- {
- this.wait_count_ = 0;
- GameMain.Instance.MainLight.Reset();
- GameMain.Instance.CharacterMgr.ResetCharaPosAll();
- GameMain.Instance.MainCamera.Reset(CameraMain.CameraType.Target, true);
- int num = 0;
- int[] array = new int[3];
- int[] array2 = new int[3];
- List<Trophy.Data> allDatas = Trophy.GetAllDatas(true);
- foreach (Trophy.Data data in allDatas)
- {
- GameObject gameObject;
- if (data.widthType)
- {
- gameObject = Utility.CreatePrefab(this.storage_object_, "SceneTrophy/Prefab/TrophyInfoWidth", true);
- }
- else
- {
- gameObject = Utility.CreatePrefab(this.storage_object_, "SceneTrophy/Prefab/TrophyInfo", true);
- }
- gameObject.name = data.name;
- TrophyInfo component = gameObject.GetComponent<TrophyInfo>();
- component.SetData(data);
- component.onClickCardButton = new Action<Trophy.Data, Vector3>(this.OnClickCardButton);
- this.trophy_infos_.Add(component);
- array[(int)component.trophy_data.type]++;
- if (component.have_visible)
- {
- array2[(int)component.trophy_data.type]++;
- num += data.maidPoint;
- }
- }
- this.totalMaidPointLabel.text = num.ToString();
- this.heroineTrophyNumLabel.text = array2[0].ToString() + "/" + array[0].ToString();
- this.systemTrophyNumLabel.text = array2[1].ToString() + "/" + array[1].ToString();
- this.extraTrophyNumLabel.text = array2[2].ToString() + "/" + array[2].ToString();
- if (array[2] == 0)
- {
- this.extraTrophyNumLabel.transform.parent.gameObject.SetActive(false);
- Vector3 localPosition = this.totalMaidPointLabel.transform.parent.localPosition;
- this.totalMaidPointLabel.transform.parent.localPosition = new Vector3(localPosition.x, localPosition.y + 38f, localPosition.z);
- UIWidget component2 = this.totalMaidPointLabel.transform.parent.parent.GetComponent<UIWidget>();
- component2.height -= 38;
- }
- UIWFTabButton componentInChildren = this.panel_dic_["メインカテゴリー"].grid.transform.GetChild(0).GetComponentInChildren<UIWFTabButton>();
- this.panel_dic_["メインカテゴリー"].tab_panel_.Select(componentInChildren);
- uGUITutorialPanel.OpenTutorial("SceneTrophy", null, false);
- }
- protected override bool IsCallFadeIn()
- {
- this.wait_count_++;
- return 2 < this.wait_count_;
- }
- private void OnClickCategory()
- {
- string name = UIButton.current.name;
- Trophy.Data.Type type = (Trophy.Data.Type)Enum.Parse(typeof(Trophy.Data.Type), name);
- foreach (TrophyInfo trophyInfo in this.trophy_infos_)
- {
- trophyInfo.transform.SetParent(this.storage_object_.transform, false);
- }
- UIGrid grid = this.panel_dic_["トロフィーリスト"].grid;
- grid.transform.DetachChildren();
- Utility.ResetNGUI(grid);
- foreach (TrophyInfo trophyInfo2 in this.trophy_infos_)
- {
- if (trophyInfo2.trophy_data.type == type)
- {
- trophyInfo2.transform.SetParent(grid.transform, false);
- trophyInfo2.transform.localPosition = new Vector3(0f, (float)(trophyInfo2.trophy_data.id * -1), 0f);
- }
- }
- Utility.ResetNGUI(grid);
- Utility.ResetNGUI(this.panel_dic_["トロフィーリスト"].scroll_view);
- }
- public void OnClickCardButton(Trophy.Data tropheyData, Vector3 cardWorldPos)
- {
- this.fadeObject.CallCard(tropheyData, cardWorldPos);
- }
- protected override void OnFinish()
- {
- base.parent_mgr.CallScreen("Move");
- }
- public void OnClickOK()
- {
- this.Finish();
- }
- [SerializeField]
- private UILabel heroineTrophyNumLabel;
- [SerializeField]
- private UILabel systemTrophyNumLabel;
- [SerializeField]
- private UILabel extraTrophyNumLabel;
- [SerializeField]
- private UILabel totalMaidPointLabel;
- [SerializeField]
- private SceneTrophyCardFade fadeObject;
- private GameObject storage_object_;
- private Dictionary<string, ScreenTrophyMain.PanesSet> panel_dic_ = new Dictionary<string, ScreenTrophyMain.PanesSet>();
- private List<TrophyInfo> trophy_infos_ = new List<TrophyInfo>();
- private int wait_count_;
- private class PanesSet
- {
- public UIGrid grid;
- public UIScrollView scroll_view;
- public UIWFTabPanel tab_panel_;
- }
- }
|