本文整理汇总了C#中PacketReader.ReadFloat方法的典型用法代码示例。如果您正苦于以下问题:C# PacketReader.ReadFloat方法的具体用法?C# PacketReader.ReadFloat怎么用?C# PacketReader.ReadFloat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PacketReader
的用法示例。
在下文中一共展示了PacketReader.ReadFloat方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Parse
public IEnumerable<PlayerInfo> Parse(byte[] data)
{
var players = new List<PlayerInfo>();
var reader = new PacketReader(data);
var header = reader.ReadByte();
var chard = Convert.ToChar(header);
var numberOfPlayers = reader.ReadByte();
for (byte i = 1; i <= numberOfPlayers; i++)
{
var player = new PlayerInfo();
if (!reader.IsEnd)
{
player.Index = reader.ReadByte(); // always returns 0
player.Index = i;
player.Name = reader.ReadUTFString();
player.Score = reader.ReadLong();
player.Duration = reader.ReadFloat();
}
players.Add(player);
}
return players;
}
示例2: Realm_HandleRegisterRealm
/// <summary>
///
/// </summary>
/// <param name="netState"></param>
/// <param name="packetReader"></param>
public static void Realm_HandleRegisterRealm( NetState netState, PacketReader packetReader )
{
RealmExtendData extendData = netState.GetComponent<RealmExtendData>( RealmExtendData.COMPONENT_ID );
if ( extendData == null )
{
Debug.WriteLine( "Realm_PacketHandlers.Realm_HandleRegisterRealm(...) - extendData == null error!" );
return;
}
if ( extendData.IsLoggedIn == true )
{
Debug.WriteLine( "Realm_PacketHandlers.Realm_HandleRegisterRealm(...) - extendData.IsLoggedIn == true error!" );
return;
}
Realm realm = new Realm();
realm.Name = packetReader.ReadUTF8String();
realm.Address = packetReader.ReadUTF8String();
string strIcon = packetReader.ReadUTF8String();
if ( Insensitive.Equals( strIcon, "PVP" ) )
realm.Icon = (uint)RealmIconType.REALMTYPE_PVP;
else if ( Insensitive.Equals( strIcon, "RP" ) )
realm.Icon = (uint)RealmIconType.REALMTYPE_RP;
else if ( Insensitive.Equals( strIcon, "RPPVP" ) )
realm.Icon = (uint)RealmIconType.REALMTYPE_RPPVP;
else
realm.Icon = (uint)RealmIconType.REALMTYPE_NORMAL;
realm.Colour = packetReader.ReadUInt32();
realm.TimeZone = packetReader.ReadUInt32();
realm.Population = packetReader.ReadFloat();
extendData.RequestSession.Serial = RealmHandler.RealmsExclusiveSerial.GetExclusiveSerial();
// Add to the main realm list
RealmHandler.AddRealm( extendData.RequestSession.Serial, realm );
extendData.IsLoggedIn = true;
// Send back response packet.
netState.Send( new Realm_RegisterRealmResult( extendData.RequestSession.Serial ) );
}
示例3: Read
public static TradeAge.Client.Entity.Character.SceneSprite Read(PacketReader reader)
{
TradeAge.Client.Entity.Character.SceneSprite ret = new TradeAge.Client.Entity.Character.SceneSprite();
ret.Id = reader.ReadInt32();
ret.SpriteType = (TradeAge.Client.Entity.Character.SpriteType)reader.ReadByte();
ret.Name = reader.ReadUTF8String();
ret.Postion = Vector3ReadProxy.Read(reader);
ret.Rotation = QuaternionReadProxy.Read(reader);
ret.Speed = reader.ReadFloat();
return ret;
}
示例4: OnSpriteMove
void OnSpriteMove(NetState netstate, PacketReader reader)
{
var p1 = reader.ReadInt32();
var p2 = new DateTime(reader.ReadLong64());
var p3 = Vector3ReadProxy.Read(reader);
var p4 = QuaternionReadProxy.Read(reader);
var p5 = reader.ReadFloat();
var p6 = reader.ReadFloat();
var p7 = (TradeAge.Client.Entity.Ship.SpeedUpTypes)reader.ReadByte();
module.OnSpriteMove(p1,p2,p3,p4,p5,p6,p7);
}
示例5: Read
public static TradeAge.Client.Entity.Common.Vector2 Read(PacketReader reader)
{
TradeAge.Client.Entity.Common.Vector2 ret = new TradeAge.Client.Entity.Common.Vector2();
ret.X = reader.ReadFloat();
ret.Y = reader.ReadFloat();
return ret;
}
示例6: OnPlayerLook
public void OnPlayerLook(ref PacketReader _pReader, PacketType pt, ref ClientManager _client)
{
_client._player.Yaw = _pReader.ReadFloat();// Yaw
_client._player.Pitch = _pReader.ReadFloat();
_client._player.onGround = _pReader.ReadBool();// On Ground
GridServer.player_list[_client.id].WaitToRead = false;
int i = 0;
for (; i < base.ModuleAddons.Count; i++)
{
base.ModuleAddons.ElementAt(i).Value(pt, ModuleAddons.ElementAt(i).Key, ref _pReader, new PacketHandler(), ref _client);
}
}
示例7: Read
public override void Read(PacketReader reader)
{
Experience = reader.ReadFloat();
Level = reader.ReadShort();
TotExperience = reader.ReadShort();
}
示例8: WorldServerStopChar
/// <summary>
///
/// </summary>
/// <param name="netState"></param>
/// <param name="packetReader"></param>
public static void WorldServerStopChar( NetState netState, PacketReader packetReader )
{
LOGs.WriteLine( LogMessageType.MSG_NONE, " WorldServerStopChar(...)" );
WorldServerExtendData l_ExtendData = netState.ExtendData as WorldServerExtendData;
if ( l_ExtendData == null )
{
Debug.WriteLine( "WorldPacketHandlers.WorldServerStopChar(...) - l_ExtendData == null error!" );
return;
}
if ( l_ExtendData.ROSEMobile.IsLoggedIn == false )
{
Debug.WriteLine( "WorldPacketHandlers.WorldServerStopChar(...) - l_ExtendData.m_bIsLoggedIn == true error!" );
return;
}
if ( packetReader.Size < 16/*( 6 + 4 + 4 + 2)*/ )
{
Debug.WriteLine( "WorldPacketHandlers.WorldServerStopChar(...) - packetReader.Size < 16 error!" );
return;
}
l_ExtendData.ROSEMobile.X = (long)packetReader.ReadFloat() / 100;
l_ExtendData.ROSEMobile.Y = (long)packetReader.ReadFloat() / 100;
ushort Z = packetReader.ReadUInt16();
netState.Send( new StopCharAck( l_ExtendData.ROSEMobile ) );
Debug.WriteLine( string.Format( "WorldServerStopChar {0}, {1}, {2}", l_ExtendData.ROSEMobile.targetid, l_ExtendData.ROSEMobile.X, l_ExtendData.ROSEMobile.Y ) );
IPooledEnumerable pooledEnumerable = netState.Mobile.Map.GetClientsInRange( netState.Mobile.Location );
if ( pooledEnumerable == null )
return;
foreach ( object client in pooledEnumerable )
{
NetState l_NetState = client as NetState;
if ( l_NetState == null )
break;
l_NetState.Send( new StopCharAck( l_ExtendData.ROSEMobile ) );
}
}