protected override void OnDisconnect(DisconnectReason _reasoncode, string _reasondetail) { if (!isjoinedroom) { if (playerdata == null) { log.Info(_reasoncode + ":" + _reasoncode + "|" + defaultdata.defaultid + "-" + defaultdata.defaultname + "has been disconnected."); //释放默认信息 defaultdata.defaultid = null; defaultdata.defaultname = null; defaultdata = null; return; } log.Info(_reasoncode + ":" + _reasoncode + "|" + playerdata.playerid + "-" + playerdata.playername + "has been disconnected."); if (FIGHTserverapplication.Getfightserverapplication().clientpeers.ContainsKey(playerdata.playername)) { FIGHTserverapplication.Getfightserverapplication().clientpeers.Remove(playerdata.playername); } //释放玩家信息 playerdata.playername = null; playerdata.playerid = 0; playerdata = null; //释放默认信息 defaultdata.defaultid = null; defaultdata.defaultname = null; defaultdata = null; return; } joinedroom.Exitintheroom(this); if (FIGHTserverapplication.Getfightserverapplication().clientpeers.ContainsKey(playerdata.playername)) { FIGHTserverapplication.Getfightserverapplication().clientpeers.Remove(playerdata.playername); } playerdata = null; }
public Clientpeer(IRpcProtocol _protocol, IPhotonPeer _unmanagedPeer) : base(_protocol, _unmanagedPeer) { defaultdata = new Defaultdata(); defaultdata.defaultid = this.GetHashCode().ToString(); defaultdata.defaultname = "connected use|" + _unmanagedPeer.GetRemoteIP() + " "; }