using System; using System.Collections.Generic; using MoleMole.Config; using UnityEngine; using UnityEngine.UI; using proto; namespace MoleMole { public class MainPageContext : BasePageContext { public enum MessageSource { None = 0, System = 1, World = 2, Guild = 3, Friend = 4 } public class PopShowMessage { public string message; public MessageSource source; public uint talkingUid; public PopShowMessage(string msgContent, MessageSource msgSource) { message = msgContent; source = msgSource; } public PopShowMessage(string msgContent, uint uid) { message = msgContent; talkingUid = uid; source = MessageSource.Friend; } } private const string PAGE_FADE_IN_STR = "PageFadeIn"; private const string BTNS_FADE_IN_STR = "MainMenuBtnFadeIn"; private const string BTNS_FADE_OUT_STR = "MainMenuBtnFadeOut"; private int _maxQuenedMessageCount = 10; private bool _optionalBtnsShowed; private Queue _showMessageQueue; private bool _isMessagePlaying; private SequenceDialogManager _firstLoginDialogManager; private bool _waitingForIslandServerData; private MonoFadeImage _fadeImage; public MainPageContext() { config = new ContextPattern { contextName = "MainPageContext", viewPrefabPath = "UI/Menus/Page/MainPage", cacheType = ViewCacheType.AlwaysCached }; showSpaceShip = true; _showMessageQueue = new Queue(); _maxQuenedMessageCount = MiscData.Config.ChatConfig.MaxQuenedPopMessageAmount; _isMessagePlaying = false; } public override bool OnPacket(NetPacketV1 pkt) { ushort cmdId = pkt.getCmdId(); switch (cmdId) { case 25: case 48: return OnGetAvatarReletedInfo(); case 97: return OnRecvSystemChatMsgNotify(pkt.getData()); case 81: return OnGetOfflineFriendsPointNotify(pkt.getData()); case 91: return OnRecvWorldChatMsgNotify(pkt.getData()); case 93: return OnRecvFriendChatMsgNotify(pkt.getData()); case 94: return OnRecvFriendOfflineChatMsgNotify(pkt.getData()); case 65: case 71: return OnRecvFriendRelatedNotify(); case 85: case 87: return OnRecvMailRelatedNotify(); case 113: case 116: return OnRecvMissionNotify(); case 122: return OnGetSignInRewardStatusRsp(pkt.getData()); case 138: return OnRecvBulletinRelatedNotify(); case 157: return OnGetIsLandRsp(pkt.getData()); case 198: return SetupWelfareHint(); default: if (cmdId == 157 || cmdId == 169) { return SetupIslandHint(); } return false; } } public override bool OnNotify(Notify ntf) { if (ntf.type == NotifyTypes.BulletinPopUpUpdate) { return OnRecvBulletinRelatedNotify(); } return false; } public override void SetActive(bool enabled) { if (!enabled) { MonoGalTouchView monoGalTouchView = UnityEngine.Object.FindObjectOfType(); if (monoGalTouchView != null) { monoGalTouchView.gameObject.SetActive(false); } Singleton.Instance.FireNotify(new Notify(NotifyTypes.ExitMainPage)); } else { Singleton.Instance.FireNotify(new Notify(NotifyTypes.EnterMainPage)); } base.SetActive(enabled); } protected override void BindViewCallbacks() { BindViewCallback(base.view.transform.Find("MainBtns/AvatarBtn").GetComponent