public static void InitPlayer(Proto.EnterServer msg) { // 玩家信息 playerData = msg.info.role; // 背包信息 bagInfo.Clear(); foreach (var one in msg.info.bag) { bagInfo[one.id] = one.num; } // 好友信息 friends.Clear(); foreach (var one in msg.info.friends) { FriendData tmp = new FriendData(); tmp.uid = one.uid; tmp.sid = one.sid; tmp.sex = one.sex; tmp.nickname = one.nickname; tmp.signature = one.signature; friends.Add(one.uid, tmp); } // 邮件信息 mails = msg.info.mails; }
/// <summary> /// 返回到登录场景,重置数据 /// </summary> public static void ResetData() { playerData = null; bagInfo.Clear(); mails.Clear(); friends.Clear(); gameTypes.Clear(); waitPlayers.Clear(); recentPlay = null; }