Refresh() public method

public Refresh ( ) : void
return void
Exemplo n.º 1
0
        //角色摆摊
        //nPtichId 摊位ID
        //play   摆摊对象
        public bool AddPlayPtich(int nPtichId, PlayerObject play)
        {
            if (nPtichId < 0 || nPtichId >= GameBase.Config.Define.PTICH_MAX_COUNT) return false;
            if (PtichHasPlay(nPtichId)) return false;

            if (play.GetTimerSystem().QueryStatus(GameStruct.RoleStatus.STATUS_PTICH) != null) return false; //正在摆摊中
            play.GetTimerSystem().AddStatus(GameStruct.RoleStatus.STATUS_PTICH);

            mListPtichInfo[nPtichId].play = play;

            //设置方向
            play.SetDir(DIR.LEFT_DOWN);

            PacketOut outpack = new PacketOut();

            //网络连接堵塞提示
            //outpack.WriteInt16(16);
            //outpack.WriteInt16(1012);
            //outpack.WriteUInt32(play.GetTypeId());
            //outpack.WriteInt32(0);
            //outpack.WriteInt32(0);
            //play.SendData(outpack.Flush(), true);

            //这个不知道是什么鬼
            //outpack = new PacketOut();
            //outpack.WriteInt16(20);
            //outpack.WriteInt16(1017);
            //outpack.WriteUInt32(play.GetTypeId());
            //outpack.WriteInt32(1);
            //outpack.WriteInt32(4);
            //outpack.WriteInt32(60317); //157, 235, 0, 0
            //play.SendData(outpack.Flush(),true);

            PtichObject obj = new PtichObject(play);
            obj.SetPoint((short)(play.GetCurrentX() + 1), (short)(play.GetCurrentY() + 1));

            play.GetGameMap().AddObject(obj);
            obj.Refresh();
            mListPtichInfo[nPtichId].PtichObj = obj;
            //收到网络协议:长度:28协议号:1010
            outpack = new PacketOut();
            outpack.WriteInt16(28);
            outpack.WriteInt16(1010);
            outpack.WriteInt32(101088);
            outpack.WriteUInt32(play.GetTypeId());
            outpack.WriteInt16(obj.GetCurrentX());
            outpack.WriteInt16(obj.GetCurrentY());
            outpack.WriteInt32(0);
            outpack.WriteUInt32(obj.GetTypeId());
            outpack.WriteInt32(9570);
            play.SendData(outpack.Flush(), true);
            //byte[] data4 = { 28, 0, 242, 3, 224, 138, 1, 0, 174, 66, 15, 0, 91, 1, 27, 2, 0, 0, 0, 0, 28, 162, 1, 0, 98, 37, 0, 0 };
            //this.SendData(data4, true);

            return true;
        }
Exemplo n.º 2
0
        //角色摆摊
        //nPtichId 摊位ID
        //play   摆摊对象
        public bool AddPlayPtich(int nPtichId, PlayerObject play)
        {
            if (nPtichId < 0 || nPtichId >= GameBase.Config.Define.PTICH_MAX_COUNT)
            {
                return(false);
            }
            if (PtichHasPlay(nPtichId))
            {
                return(false);
            }

            if (play.GetTimerSystem().QueryStatus(GameStruct.RoleStatus.STATUS_PTICH) != null)
            {
                return(false);                                                                               //正在摆摊中
            }
            play.GetTimerSystem().AddStatus(GameStruct.RoleStatus.STATUS_PTICH);


            mListPtichInfo[nPtichId].play = play;

            //设置方向
            play.SetDir(DIR.LEFT_DOWN);


            PacketOut outpack = new PacketOut();

            //网络连接堵塞提示
            //outpack.WriteInt16(16);
            //outpack.WriteInt16(1012);
            //outpack.WriteUInt32(play.GetTypeId());
            //outpack.WriteInt32(0);
            //outpack.WriteInt32(0);
            //play.SendData(outpack.Flush(), true);

            //这个不知道是什么鬼
            //outpack = new PacketOut();
            //outpack.WriteInt16(20);
            //outpack.WriteInt16(1017);
            //outpack.WriteUInt32(play.GetTypeId());
            //outpack.WriteInt32(1);
            //outpack.WriteInt32(4);
            //outpack.WriteInt32(60317); //157, 235, 0, 0
            //play.SendData(outpack.Flush(),true);

            PtichObject obj = new PtichObject(play);

            obj.SetPoint((short)(play.GetCurrentX() + 1), (short)(play.GetCurrentY() + 1));

            play.GetGameMap().AddObject(obj);
            obj.Refresh();
            mListPtichInfo[nPtichId].PtichObj = obj;
            //收到网络协议:长度:28协议号:1010
            outpack = new PacketOut();
            outpack.WriteInt16(28);
            outpack.WriteInt16(1010);
            outpack.WriteInt32(101088);
            outpack.WriteUInt32(play.GetTypeId());
            outpack.WriteInt16(obj.GetCurrentX());
            outpack.WriteInt16(obj.GetCurrentY());
            outpack.WriteInt32(0);
            outpack.WriteUInt32(obj.GetTypeId());
            outpack.WriteInt32(9570);
            play.SendData(outpack.Flush(), true);
            //byte[] data4 = { 28, 0, 242, 3, 224, 138, 1, 0, 174, 66, 15, 0, 91, 1, 27, 2, 0, 0, 0, 0, 28, 162, 1, 0, 98, 37, 0, 0 };
            //this.SendData(data4, true);

            return(true);
        }