public override void addToStream(Bundle stream, object v)
 {
     stream.writeUint32(3);
     stream.writeFloat(((Vector3)v).x);
     stream.writeFloat(((Vector3)v).y);
     stream.writeFloat(((Vector3)v).z);
 }
示例#2
0
 public override void addToStream(Bundle stream, object v)
 {
     stream.writeUint32(4);
     stream.writeFloat(((Vector4)v).X);
     stream.writeFloat(((Vector4)v).Y);
     stream.writeFloat(((Vector4)v).Z);
     stream.writeFloat(((Vector4)v).W);
 }
示例#3
0
 public void addToStreamEx(Bundle stream, D_TEAM_INFOS v)
 {
     stream.writeInt32(v.id);
     stream.writeInt32(v.team_id);
     stream.writeFloat(v.position_x);
     stream.writeFloat(v.position_y);
     stream.writeFloat(v.position_z);
     stream.writeFloat(v.direction_x);
     stream.writeFloat(v.direction_y);
     stream.writeFloat(v.direction_z);
 }
示例#4
0
 public void addToStreamEx(Bundle stream, D_ROAD_INFOS v)
 {
     stream.writeInt32(v.id);
     stream.writeInt32(v.group);
     stream.writeFloat(v.position_x);
     stream.writeFloat(v.position_y);
     stream.writeFloat(v.position_z);
     stream.writeFloat(v.eulerAngles_x);
     stream.writeFloat(v.eulerAngles_y);
     stream.writeFloat(v.eulerAngles_z);
     stream.writeInt32(v.born);
 }
 public override void addToStream(Bundle stream, object v)
 {
     stream.writeFloat((float)Convert.ToDouble(v));
 }
        /*
            更新当前玩家的位置与朝向到服务端, 可以通过开关_syncPlayer关闭这个机制
        */
        public void updatePlayerToServer()
        {
            if(!_args.syncPlayer || spaceID == 0)
            {
                return;
            }

            TimeSpan span = DateTime.Now - _lastUpdateToServerTime;

            if(span.Milliseconds < 50)
                return;

            Entity playerEntity = player();
            if(playerEntity == null || playerEntity.inWorld == false)
                return;

            _lastUpdateToServerTime = System.DateTime.Now;

            Vector3 position = playerEntity.position;
            Vector3 direction = playerEntity.direction;

            bool posHasChanged = Vector3.Distance(_entityLastLocalPos, position) > 0.001f;
            bool dirHasChanged = Vector3.Distance(_entityLastLocalDir, direction) > 0.001f;

            if(posHasChanged || dirHasChanged)
            {
                _entityLastLocalPos = position;
                _entityLastLocalDir = direction;

                Bundle bundle = new Bundle();
                bundle.newMessage(Message.messages["Baseapp_onUpdateDataFromClient"]);
                bundle.writeFloat(position.x);
                bundle.writeFloat(position.y);
                bundle.writeFloat(position.z);

                bundle.writeFloat((float)((double)direction.x / 360 * 6.283185307179586));
                bundle.writeFloat((float)((double)direction.y / 360 * 6.283185307179586));
                bundle.writeFloat((float)((double)direction.z / 360 * 6.283185307179586));
                bundle.writeUint8((Byte)(playerEntity.isOnGround == true ? 1 : 0));
                bundle.writeUint32(spaceID);
                bundle.send(_networkInterface);
            }
        }
		public override void addToStream(Bundle stream, object v)
		{
			stream.writeUint32(4);
			stream.writeFloat(((Vector4)v).x);
			stream.writeFloat(((Vector4)v).y);
			stream.writeFloat(((Vector4)v).z);
			stream.writeFloat(((Vector4)v).w);
		}
		public override void addToStream(Bundle stream, object v)
		{
			stream.writeFloat((float)Convert.ToDouble(v));
		}
 public void addToStreamEx(Bundle stream, CITY_TYPE_PRICE_INFO v)
 {
     stream.writeUint32(v.GoodsType);
     stream.writeFloat(v.TypePrice);
 }
示例#10
0
        public void updatePlayerToServer()
        {
            Entity playerEntity = player();
            if(playerEntity == null || playerEntity.inWorld == false)
                return;

            Vector3 position = playerEntity.position;
            Vector3 direction = playerEntity.direction;

            Bundle bundle = new Bundle();
            bundle.newMessage(Message.messages["Baseapp_onUpdateDataFromClient"]);
            bundle.writeFloat(position.x);
            bundle.writeFloat(position.y);
            bundle.writeFloat(position.z);
            bundle.writeFloat(direction.z);
            bundle.writeFloat(direction.y);
            bundle.writeFloat(direction.x);
            bundle.writeUint8((Byte)(playerEntity.isOnGound == true ? 1 : 0));
            bundle.send(networkInterface_);
        }
示例#11
0
 public override void addToStream(Bundle stream, object v)
 {
     stream.writeUint32(4);
     stream.writeFloat(((Vector4)v).X);
     stream.writeFloat(((Vector4)v).Y);
     stream.writeFloat(((Vector4)v).Z);
     stream.writeFloat(((Vector4)v).W);
 }