protected override void ProcessAction_Move(GameStruct.Action act) { byte runvalue = 1; if (act.GetObjectCount() > 0) { runvalue = (byte)act.GetObject(0); } //取现有列表- 不在范围内的就通知客户端了 foreach (RefreshObject refobj in this.GetVisibleList().Values) { BaseObject obj = refobj.obj; if (obj.type == OBJECTTYPE.PLAYER) { // Console.WriteLine("距离:x"+Math.Abs(this.GetCurrentX() - obj.GetCurrentX()).ToString()+" y:"+Math.Abs(this.GetCurrentY() - obj.GetCurrentY()).ToString()); if (!obj.GetPoint().CheckVisualDistance(this.GetCurrentX(), this.GetCurrentY(), GameBase.Config.Define.MAX_EUDEMON_OTHER_PLAY_DISTANCE)) { NetMsg.MsgClearObjectInfo info = new NetMsg.MsgClearObjectInfo(); info.id = this.GetTypeId(); (obj as PlayerObject).SendData(info.GetBuffer(),true); obj.GetVisibleList().Remove(this.GetGameID()); } } } this.RefreshVisibleObject(); foreach(RefreshObject refobj in this.GetVisibleList().Values) { BaseObject obj = refobj.obj; if (obj.type == OBJECTTYPE.PLAYER) { if (!obj.GetVisibleList().ContainsKey(this.GetGameID())) { obj.AddVisibleObject(this, true); this.SendEudemonInfo(); } //if (this.GetVisibleList().ContainsKey(obj.GetGameID())) //{ // this.AddVisibleObject(obj, true); // this.SendEudemonInfo(); //} } } 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; this.BrocatBuffer(move.GetBuffer()); //if (mRefreshList.Count > 0) //{ // foreach (BaseObject o in mRefreshList.Values) // { // switch (o.type) // { // case OBJECTTYPE.PLAYER: // { // // if (o.GetGameID() == play.GetGameID()) continue; // this.SendMoveInfo(o, runvalue); // break; // } // } // } // mRefreshList.Clear(); //} }
protected override void ProcessAction_Move(GameStruct.Action act) { byte runvalue = 1; if (act.GetObjectCount() > 0) { runvalue = (byte)act.GetObject(0); } RefreshVisibleObject(); if (mVisibleList.Count > 0) { foreach (RefreshObject obj in mVisibleList.Values) { BaseObject o = obj.obj; switch (o.type) { case OBJECTTYPE.NPC: { if (obj.bRefreshTag) break; this.SendNpcInfo(o); obj.bRefreshTag = true; break; } case OBJECTTYPE.MONSTER: case OBJECTTYPE.CALLOBJECT: { if (obj.bRefreshTag) break; this.SendMonsterInfo(o); obj.bRefreshTag = true; break; } case OBJECTTYPE.PLAYER: { this.SendRoleMoveInfo(o, runvalue, obj); break; } case OBJECTTYPE.DROPITEM: { if (obj.bRefreshTag) break; this.SendDropItemInfo(o); obj.bRefreshTag = true; break; } case OBJECTTYPE.EUDEMON: { if (obj.bRefreshTag) break; (o as EudemonObject).SendEudemonInfo(this); obj.bRefreshTag = true; break; } case OBJECTTYPE.ROBOT: { if (obj.bRefreshTag) break; (o as RobotObject).SendRobotInfo(this); obj.bRefreshTag = true; break; } case OBJECTTYPE.GUARDKNIGHT: { if (obj.bRefreshTag) break; (o as GuardKnightObject).SendInfo(this); obj.bRefreshTag = true; break; } case OBJECTTYPE.EFFECT: { if (obj.bRefreshTag) break; (o as EffectObject).SendInfo(this); obj.bRefreshTag = true; break; } case OBJECTTYPE.PTICH: //摊位 { if (obj.bRefreshTag) break; (o as PtichObject).SendInfo(this); obj.bRefreshTag = true; break; } } //加入到对方视野中- o.AddVisibleObject(this); } // mRefreshList.Clear(); } }