using UnityEngine; namespace Wizard; public class GatheringJoining : MonoBehaviour { [SerializeField] private GameObject _categorySelectPrefab; [SerializeField] private GameObject _chatPrefab; [SerializeField] private GameObject _infoPrefab; [SerializeField] private GameObject _memberListPrefab; [SerializeField] private GameObject _rankingPrefab; [SerializeField] private GameObject _invitePrefab; [SerializeField] private GameObject _tournamentPrefab; private GatheringChat _chat; private GatheringJoiningCategorySelect _categorySelect; private GatheringMemberList _memberList; private GatheringInvite _invite; private GatheringRanking _ranking; private GatheringTournament _tournament; private GatheringJoiningInfo _info; private GatheringJoiningCategorySelect.Category _currentCategory; private GatheringInfo _gatheringInfo; public void InitializeUI() { _categorySelect = NGUITools.AddChild(base.gameObject, _categorySelectPrefab).GetComponent(); _categorySelect.OnSelect = OnSelectCategory; _info = NGUITools.AddChild(base.gameObject, _infoPrefab).GetComponent(); _memberList = NGUITools.AddChild(base.gameObject, _memberListPrefab).GetComponent(); } public void Initialize() { OnSelectCategory(GatheringJoiningCategorySelect.Category.CHAT); } public void OnReceiveSelfInfo(GatheringInfo info) { _gatheringInfo = info; _categorySelect.OnReceiveSelfInfo(info); } public bool CheckChangeStatus(GatheringInfo currentInfo) { if (_gatheringInfo.State == currentInfo.State) { return false; } SystemText systemText = Data.SystemText; DialogBase dialogBase = null; dialogBase = ((currentInfo.State != GatheringInfo.eState.ACTIVE_BATTLE) ? UIManager.GetInstance().CreateConfirmationDialog(systemText.Get("Gathering_Chat_0010")) : UIManager.GetInstance().CreateConfirmationDialog(systemText.Get("Gathering_Chat_0009"))); dialogBase.OnClose = delegate { UIManager.ChangeViewSceneParam param = new UIManager.ChangeViewSceneParam { MyPageMenuIndex = 3, OnFinishChangeView = delegate { MyPageMenu.Instance.GoToGatheringActionMenu(); } }; UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.MyPage, param); }; dialogBase.SetPanelDepth(4000); return true; } private void OnSelectCategory(GatheringJoiningCategorySelect.Category category) { _currentCategory = category; if (_chat != null) { _chat.ReadyCloseCategory(); _chat.CloseCategory(); Object.Destroy(_chat.gameObject); } if (_memberList != null) { Object.Destroy(_memberList.gameObject); } if (_invite != null) { Object.Destroy(_invite.gameObject); } if (_ranking != null) { Object.Destroy(_ranking.gameObject); } if (_tournament != null) { Object.Destroy(_tournament.gameObject); } _info.gameObject.SetActive(category == GatheringJoiningCategorySelect.Category.INFO); switch (category) { case GatheringJoiningCategorySelect.Category.CHAT: _chat = NGUITools.AddChild(base.gameObject, _chatPrefab).GetComponent(); _chat.OpenCategory(); break; case GatheringJoiningCategorySelect.Category.INFO: _info.Show(this); break; case GatheringJoiningCategorySelect.Category.MEMBER_LIST: _memberList = NGUITools.AddChild(base.gameObject, _memberListPrefab).GetComponent(); _memberList.Show(this); break; case GatheringJoiningCategorySelect.Category.INVITE: _invite = NGUITools.AddChild(base.gameObject, _invitePrefab).GetComponent(); _invite.Show(this); break; case GatheringJoiningCategorySelect.Category.RANKING: _ranking = NGUITools.AddChild(base.gameObject, _rankingPrefab).GetComponent(); _ranking.Show(_gatheringInfo, this); break; case GatheringJoiningCategorySelect.Category.TOURNAMENT: _tournament = NGUITools.AddChild(base.gameObject, _tournamentPrefab).GetComponent(); _tournament.Show(_gatheringInfo, this); break; } } public void ReOpenCurrentCategory() { OnSelectCategory(_currentCategory); } }