using System.Collections.Generic; using MoleMole.Config; using UnityEngine; using UnityEngine.UI; using proto; namespace MoleMole { public class PlayerProfilePageContext : BasePageContext { public enum TabType { PlayerTab = 0, AccountTab = 1 } private const string PLAYER_TAB_NAME = "Player"; private const string ACCOUNT_TAB_NAME = "Account"; private const int REDEEM_CODE_LENGTH = 10; private TabManager _tabManager; private MonoAvatarStar _avatarStar; private string _redeemCode; private string _currentTab; public PlayerProfilePageContext(TabType tabType = TabType.PlayerTab) { config = new ContextPattern { contextName = "PlayerProfilePageContext", viewPrefabPath = "UI/Menus/Page/PlayerProfile/PlayerProfilePage" }; _tabManager = new TabManager(); _tabManager.onSetActive += OnTabSetActive; switch (tabType) { case TabType.PlayerTab: _currentTab = "Player"; break; case TabType.AccountTab: _currentTab = "Account"; break; } } public override bool OnPacket(NetPacketV1 pkt) { ushort cmdId = pkt.getCmdId(); switch (cmdId) { case 11: return SetupView(); case 120: SetupAccount(); break; } if (cmdId == 212) { OnGetRedeemCodeInfoRsp(pkt.getData()); } return false; } public override bool OnNotify(Notify ntf) { if (ntf.type == NotifyTypes.MihoyoAccountInfoChanged) { SetupAccount(); } if (ntf.type == NotifyTypes.MissionUpdated) { SetupCollection(); } return false; } protected override void BindViewCallbacks() { BindViewCallback(base.view.transform.Find("ProfilePanel/Buttons/ChangeDescBtn").GetComponent