Exemplo n.º 1
0
 //添加可视对象
 //
 public void AddVisibleObject(BaseObject obj,bool bRefreshTag = true)
 {
     RefreshObject refobj = null;
     if (this.GetVisibleList().ContainsKey(obj.GetGameID()))
     {
         refobj = mVisibleList[obj.GetGameID()];
         refobj.bRefreshTag = bRefreshTag;
         return;
     }
     refobj = new RefreshObject();
     refobj.bRefreshTag = bRefreshTag;
     refobj.obj = obj;
     mVisibleList[obj.GetGameID()] = refobj;
 }
Exemplo n.º 2
0
        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);
        }