void OnPlayerLogin(object parameters) { RpPlayerLogin playerLogin = parameters as RpPlayerLogin; if (null == playerLogin) { return; } PlayerId = playerLogin.PlayerId; PlayerName = playerLogin.PlayerName; GameMain.Instance.EventMgr.PostObjectEvent(EventId.PlayerLogin, null); }
public void PlayerLogin(int playerId, string playerName, int connectionId) { LBPlayer curPlayer = GetPlayerByPlayerId(playerId); if (null != curPlayer) { LBLogger.Error(LogTag, "当前玩家已经登录,不能再次登录 " + playerId + " " + playerName); return; } curPlayer = mCacheManager.GetObject(); curPlayer.Login(playerId, playerName, connectionId); mPlayerDic[playerId] = curPlayer; mPlayerConnectionDic[connectionId] = curPlayer; LBPeerManager.Instance.SendMessage(connectionId, RpId.PlayerLogin, RpPlayerLogin.Serialization(playerId, playerName)); }