//广播 public virtual void BrocatBuffer(byte[] msg) { foreach (RefreshObject refobj in this.GetVisibleList().Values) { BaseObject obj = refobj.obj; if (obj.type == OBJECTTYPE.PLAYER && obj.GetGameSession() != null) { BaseMsg data = new BaseMsg(); data.Create(msg, obj.GetGamePackKeyEx()); obj.SendData(data.GetBuffer()); } } }
//广播移动消息 //public void BroadcastMove(BaseObject obj,byte[] data) //{ // foreach (BaseObject o in obj.mVisibleList.Values) // { // if (o.type == OBJECTTYPE.PLAYER) // { // PlayerObject po = o as PlayerObject; // o.SendData(data); // } // } //} //广播消息 public void BroadcastBuffer(BaseObject obj, byte[] buff) { // obj.RefreshVisibleObject(); foreach (RefreshObject o in obj.GetVisibleList().Values) { BaseObject _obj = o.obj; if (_obj.type == OBJECTTYPE.PLAYER && _obj.GetGameSession() != null) { NetMsg.BaseMsg basemsg = new NetMsg.BaseMsg(); basemsg.Create(buff, _obj.GetGamePackKeyEx()); _obj.SendData(basemsg.GetBuffer()); } } }
public void SendMoveInfo(BaseObject obj, byte runValue) { //if (obj.type != OBJECTTYPE.PLAYER) return; //PlayerObject play = obj as PlayerObject; //if (obj.GetGameSession() == null) return; //已经断线 //if (!play.GetPlayObjectList().ContainsKey(this.GetGameID()) || // !this.GetPlayObjectList().ContainsKey(play.GetGameID())) //{ // this.SendPlayRefreshInfo(play); // play.GetPlayObjectList()[this.GetGameID()] = this; // this.GetPlayObjectList()[play.GetGameID()] = play; // // Log.Instance().WriteLog("发送刷新幻兽信息!!"); // return; //} //存在可视列表就发移动消息 NetMsg.MsgMoveInfo move = new NetMsg.MsgMoveInfo(); move.Create(null, obj.GetGamePackKeyEx()); move.id = this.GetTypeId(); move.x = this.GetCurrentX(); move.y = this.GetCurrentY(); move.dir = this.GetDir(); move.ucMode = runValue; obj.SendData(move.GetBuffer()); }
public void SendRoleMoveInfo(BaseObject obj, byte runValue, RefreshObject _refobj) { if (obj.type != OBJECTTYPE.PLAYER) return; PlayerObject play = obj as PlayerObject; // if (!play.GetPlayObjectList().ContainsKey(this.GetGameID()) || // !this.GetPlayObjectList().ContainsKey(play.GetGameID())) if (_refobj.bRefreshTag == false) { this.SendRoleInfo(play); play.SendRoleInfo(this); _refobj.bRefreshTag = true; //设置为已刷新标记 //NetMsg.MsgRoleInfo role = new NetMsg.MsgRoleInfo(); //role.Create(null, obj.GetGamePackKeyEx()); //role.role_id = this.GetTypeId(); //role.x = this.GetCurrentX(); //role.y = this.GetCurrentY(); //role.armor_id = this.GetItemSystem().GetArmorLook(); //role.wepon_id = this.GetItemSystem().GetWeaponLook(); //role.face_sex = this.GetFace(); //role.dir = this.GetDir(); //role.guanjue = (byte)this.GetGuanJue(); //role.str.Add(this.GetName()); //obj.SendData(role.GetBuffer()); ////这个玩家也刷新给自己--- //role = new NetMsg.MsgRoleInfo(); //role.Create(null, this.GetGamePackKeyEx()); //role.role_id = play.GetTypeId(); //role.x = play.GetCurrentX(); //role.y = play.GetCurrentY(); //role.armor_id = play.GetItemSystem().GetArmorLook(); //role.wepon_id = play.GetItemSystem().GetWeaponLook(); //role.face_sex = play.GetFace(); //role.dir = play.GetDir(); //role.guanjue = (byte)play.GetGuanJue(); //role.str.Add(play.GetName()); //this.SendData(role.GetBuffer()); //play.GetPlayObjectList()[this.GetGameID()] = this; //this.GetPlayObjectList()[play.GetGameID()] = play; return; } //存在可视列表就发移动消息 NetMsg.MsgMoveInfo move = new NetMsg.MsgMoveInfo(); move.id = this.GetTypeId(); move.x = this.GetCurrentX(); move.y = this.GetCurrentY(); move.dir = this.GetDir(); move.ucMode = runValue; obj.SendData(move.GetBuffer(), true); }