Example #1
0
 public void ClearThis(PlayerObject play)
 {
     NetMsg.MsgClearObjectInfo info = new NetMsg.MsgClearObjectInfo();
     info.Create(null, play.GetGamePackKeyEx());
     info.id = GetTypeId();
     play.SendData(info.GetBuffer());
 }
 public void ClearThis(PlayerObject play)
 {
     NetMsg.MsgClearObjectInfo info = new NetMsg.MsgClearObjectInfo();
     info.Create(null, play.GetGamePackKeyEx());
     info.id = GetTypeId();
     play.SendData(info.GetBuffer());
 }
Example #3
0
        public override void ClearThis()
        {
            NetMsg.MsgClearObjectInfo info = new NetMsg.MsgClearObjectInfo();
            info.id = GetTypeId();
            byte[] msg = info.GetBuffer();

            foreach (RefreshObject refobj in this.GetVisibleList().Values)
            {
                BaseObject obj = refobj.obj;
                if (obj.type == OBJECTTYPE.PLAYER && obj.GetGameSession() != null)
                {
                    if (obj.GetGameID() == play.GetGameID()) continue; //不发给宿主玩家
                    NetMsg.BaseMsg data = new NetMsg.BaseMsg();
                    data.Create(msg, obj.GetGamePackKeyEx());
                    obj.SendData(data.GetBuffer());

                }
            }

            //移除范围内的对象..以便下次刷新怪物的时候刷新出来2015.10.16
            foreach (RefreshObject refobj in this.GetVisibleList().Values)
            {
                BaseObject obj = refobj.obj;
                if (obj.type != OBJECTTYPE.PLAYER) continue;
                if (obj.GetVisibleList().ContainsKey(this.GetGameID()))
                {
                    obj.GetVisibleList().Remove(this.GetGameID());
                }
            }
            this.GetVisibleList().Clear();
            //base.ClearThis();
        }
Example #4
0
        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();
            //}
        }
Example #5
0
        public void ClearThis(PlayerObject play)
        {
            NetMsg.MsgClearObjectInfo info = new NetMsg.MsgClearObjectInfo();
             info.Create(null, play.GetGamePackKeyEx());
             info.id = this.GetTypeId();
             play.SendData(info.GetBuffer());

             this.GetVisibleList().Remove(play.GetGameID());
        }
Example #6
0
        public override bool Run()
        {
            //意外断开处理
            if (GetGameSession() == null)
            {
                //广播出去,清除该玩家
                if (GetVisibleList().Count > 0)
                {
                    NetMsg.MsgClearObjectInfo clear = new NetMsg.MsgClearObjectInfo();
                    clear.id = this.GetTypeId();
                    GetGameMap().BroadcastBuffer(this, clear.GetBuffer());
                }

                return false;
            }
            base.Run();
            //连招解锁
            if (this.IsLock())
            {
                if (!this.CheckLockTime())
                {
                    this.UnLock();
                }
            }
            this.GetTimerSystem().Run();
            //战斗系统
            this.GetFightSystem().Run();
            this.GetPKSystem().Run();
            //角色死亡变为鬼魂状态,
            if (this.IsDie() && m_bGhost && mnGhostTick != -1)
            {
                if (System.Environment.TickCount - mnGhostTick >= 3000)
                {
                    this.ChangeAttribute(UserAttribute.STATUS, 6);
                    this.ChangeAttribute(UserAttribute.LOOKFACE, GetLookFace(), true);

                    mnGhostTick = -1;

                }
            }

            //死亡--因为会被连击锁定-- 所以放到run方法
            if (IsDie() && !this.IsLock() && mTarget != null && m_bGhost == false)
            {
                GameStruct.Action action;
                //死亡
                action = new GameStruct.Action(GameStruct.Action.DIE, null);
                action.AddObject(mTarget);

                this.PushAction(action);
            }

            //定时保存玩家数据
            if (mSaveTime.ToNextTime())
            {
                UserEngine.Instance().AddSaveRole(this);
            }

            //传送状态
            if (mbTransmit && mTransmitTimeOut.ToNextTime())
            {
                //幻兽出征
                this.GetEudemonSystem().Eudemon_BattleAll();
                //发送天气信息
                this.GetGameMap().SendWeatherInfo(this);
                this.SetTransmitIng(false);
            }
            return true;
        }