123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 |
- using System;
- using System.Collections.Generic;
- using System.Runtime.CompilerServices;
- using MaidStatus;
- using UnityEngine;
- using UnityEngine.UI;
- using wf;
- public class uGUICharacterSelectManager : MonoBehaviour
- {
- public static void DefaultMaidList(List<Maid> drawList)
- {
- CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
- for (int i = 0; i < characterMgr.GetStockMaidCount(); i++)
- {
- drawList.Add(characterMgr.GetStockMaid(i));
- }
- }
- public static void PrivateMaidList(List<Maid> drawList)
- {
- CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
- for (int i = 0; i < characterMgr.GetStockMaidCount(); i++)
- {
- Maid stockMaid = characterMgr.GetStockMaid(i);
- Status status = stockMaid.status;
- if (status.specialRelation == SpecialRelation.Married && !stockMaid.IsCrcBody)
- {
- drawList.Add(stockMaid);
- }
- }
- }
- public void Awake()
- {
- NDebug.AssertNull(this.MaidPlateParentGrid != null);
- this.tabPanel = this.MaidPlateParentGrid.gameObject.GetComponent<uGUITabPanel>();
- }
- public void Create(uGUICharacterSelectManager.Type type)
- {
- if (this.callBackMaidList == null)
- {
- if (uGUICharacterSelectManager.<>f__mg$cache0 == null)
- {
- uGUICharacterSelectManager.<>f__mg$cache0 = new uGUICharacterSelectManager.CallBackMaidList(uGUICharacterSelectManager.DefaultMaidList);
- }
- this.callBackMaidList = uGUICharacterSelectManager.<>f__mg$cache0;
- }
- this.m_type = type;
- Transform transform = this.MaidPlateParentGrid.transform;
- for (int i = 0; i < transform.childCount; i++)
- {
- UnityEngine.Object.Destroy(transform.GetChild(i).gameObject);
- }
- transform.DetachChildren();
- this.maidList = new List<Maid>();
- this.callBackMaidList(this.maidList);
- this.buttonList = new List<uGUITabButton>();
- if (type == uGUICharacterSelectManager.Type.Private)
- {
- GameObject f_goParent = Utility.CreatePrefab(this.MaidPlateParentGrid.gameObject, "ScenePrivate/NoSelect", true);
- uGUITabButton component = UTY.GetChildObject(f_goParent, "Plate", false).GetComponent<uGUITabButton>();
- this.buttonList.Add(component);
- if (this.maidList.Count > 0)
- {
- GameObject f_goParent2 = Utility.CreatePrefab(this.MaidPlateParentGrid.gameObject, "ScenePrivate/RandomButton", true);
- uGUITabButton component2 = UTY.GetChildObject(f_goParent2, "Plate", false).GetComponent<uGUITabButton>();
- this.buttonList.Add(component2);
- }
- }
- for (int j = 0; j < this.maidList.Count; j++)
- {
- GameObject gameObject = Utility.CreatePrefab(this.MaidPlateParentGrid.gameObject, "ScenePrivate/MaidStatus", true);
- gameObject.GetComponent<uGUIMaidPlate>().SetMaidData(this.maidList[j]);
- uGUITabButton component3 = UTY.GetChildObject(gameObject, "Plate", false).GetComponent<uGUITabButton>();
- EventDelegate.Add(component3.onSelectEvent, new EventDelegate.Callback(this.OnSelect));
- this.buttonList.Add(component3);
- }
- if (this.tabPanel == null)
- {
- this.tabPanel = this.MaidPlateParentGrid.gameObject.AddComponent<uGUITabPanel>();
- }
- this.tabPanel.UpdateChildren();
- uGUITabButton component4 = UTY.GetChildObject(this.MaidPlateParentGrid.transform.GetChild(0).gameObject, "Plate", false).GetComponent<uGUITabButton>();
- this.tabPanel.Select(component4);
- }
- public void SelectMaid(Maid maid)
- {
- if (maid == null)
- {
- return;
- }
- Transform transform = this.MaidPlateParentGrid.transform;
- for (int i = 0; i < transform.childCount; i++)
- {
- uGUIMaidPlate component = transform.GetChild(i).GetComponent<uGUIMaidPlate>();
- if (component != null && component.maid == maid)
- {
- uGUITabButton component2 = UTY.GetChildObject(component.gameObject, "Plate", false).GetComponent<uGUITabButton>();
- this.tabPanel.Select(component2);
- return;
- }
- }
- }
- public void UpdateMaidPlate(Maid maid)
- {
- Transform transform = this.MaidPlateParentGrid.transform;
- for (int i = 0; i < transform.childCount; i++)
- {
- uGUIMaidPlate component = transform.GetChild(i).GetComponent<uGUIMaidPlate>();
- if (component != null && component.maid == maid)
- {
- component.SetMaidData(maid);
- return;
- }
- }
- }
- private void OnSelect()
- {
- GameObject gameObject = uGUITabButton.current.transform.parent.gameObject;
- uGUIMaidPlate component = gameObject.GetComponent<uGUIMaidPlate>();
- bool selected = uGUITabButton.selected;
- if (selected && this.callBackOnSelect != null)
- {
- this.callBackOnSelect(component.maid);
- }
- }
- public List<uGUITabButton> GetButtonList()
- {
- if (this.buttonList != null)
- {
- return this.buttonList;
- }
- return null;
- }
- public List<Maid> GetMaidList()
- {
- if (this.maidList != null)
- {
- return this.maidList;
- }
- return null;
- }
- public void SetCallBackMaidList(uGUICharacterSelectManager.CallBackMaidList callBack)
- {
- this.callBackMaidList = callBack;
- }
- public void SetCallBackOnSelect(uGUICharacterSelectManager.CallBackOnSelect callBack)
- {
- this.callBackOnSelect = callBack;
- }
- public GridLayoutGroup MaidPlateParentGrid;
- private uGUICharacterSelectManager.CallBackMaidList callBackMaidList;
- private uGUICharacterSelectManager.CallBackOnSelect callBackOnSelect;
- private uGUICharacterSelectManager.Type m_type;
- private uGUITabPanel tabPanel;
- private uGUIMaidPlate[] selectList;
- private List<uGUITabButton> buttonList;
- private List<Maid> maidList;
- [CompilerGenerated]
- private static uGUICharacterSelectManager.CallBackMaidList <>f__mg$cache0;
- public delegate void CallBackMaidList(List<Maid> drawList);
- public delegate void CallBackOnSelect(Maid selectMaid);
- public delegate void CallBackOnSelectNoSelect();
- public enum Type
- {
- Default,
- Private
- }
- }
|