本文整理汇总了C#中fCraft.Packet类的典型用法代码示例。如果您正苦于以下问题:C# Packet类的具体用法?C# Packet怎么用?C# Packet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Packet类属于fCraft命名空间,在下文中一共展示了Packet类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: MakeSetBlock
/// <summary> Creates a new SetBlockServer (0x06) packet. </summary>
/// <param name="coords"> Coordinates of the block. </param>
/// <param name="type"> Block type to set at given coordinates. </param>
/// <param name="player"> Player packet is being sent to, used to get fallback block </param>
public static Packet MakeSetBlock( Vector3I coords, Block type, Player player ) {
Packet packet = new Packet( OpCode.SetBlockServer );
//Logger.Log(LogType.Debug, "Send: MakeSetBlock({0})({1})", coords, type);
ToNetOrder( (short)coords.X, packet.Bytes, 1 );
ToNetOrder( (short)coords.Z, packet.Bytes, 3 );
ToNetOrder( (short)coords.Y, packet.Bytes, 5 );
packet.Bytes[7] = (byte)player.getFallback(type);
return packet;
}
开发者ID:Magi1053,项目名称:ProCraft,代码行数:13,代码来源:Packet.cs
示例2: MakeCustomBlockSupportLevel
public static Packet MakeCustomBlockSupportLevel(byte level)
{
Logger.Log(LogType.Debug, "Send: CustomBlockSupportLevel({0})", level);
Packet packet = new Packet(OpCode.CustomBlocks);
packet.Data[1] = level;
return packet;
}
开发者ID:EricKilla,项目名称:LegendCraft,代码行数:7,代码来源:CPE.cs
示例3: MakeChangeModel
public static Packet MakeChangeModel(byte EntityID, string modelName)
{
Packet packet = new Packet(OpCode.ChangeModel);
packet.Data[1] = EntityID;
Encoding.ASCII.GetBytes(modelName.PadRight(64), 0, 64, packet.Data, 2);
return packet;
}
开发者ID:Rhinovex,项目名称:LegendCraft,代码行数:7,代码来源:PacketWriter.cs
示例4: MakeSetBlock
public static Packet MakeSetBlock( short x, short y, short z, Block type ) {
Packet packet = new Packet( OpCode.SetBlockServer );
ToNetOrder( x, packet.Bytes, 1 );
ToNetOrder( z, packet.Bytes, 3 );
ToNetOrder( y, packet.Bytes, 5 );
packet.Bytes[7] = (byte)type;
return packet;
}
开发者ID:fragmer,项目名称:fCraft,代码行数:8,代码来源:Packet.cs
示例5: MakeSetBlockPermission
public static Packet MakeSetBlockPermission(Block block, bool canPlace, bool canDelete)
{
Packet packet = new Packet(OpCode.SetBlockPermissions);
packet.Data[1] = (byte)block;
packet.Data[2] = (byte)(canPlace ? 1 : 0);
packet.Data[3] = (byte)(canDelete ? 1 : 0);
return packet;
}
开发者ID:EricKilla,项目名称:LegendCraft,代码行数:8,代码来源:CPE.cs
示例6: MakeExtEntry
public static Packet MakeExtEntry(string name, int version)
{
Logger.Log(LogType.Debug, "Send: ExtEntry({0},{1})", name, version);
Packet packet = new Packet(OpCode.ExtEntry);
Encoding.ASCII.GetBytes(name.PadRight(64), 0, 64, packet.Data, 1);
ToNetOrder(version, packet.Data, 65);
return packet;
}
开发者ID:EricKilla,项目名称:LegendCraft,代码行数:8,代码来源:CPE.cs
示例7: MakeExtAddEntity
public static Packet MakeExtAddEntity(byte EntityID, string entityName, string skinName)
{
Packet packet = new Packet(OpCode.ExtAddEntity);
packet.Data[1] = EntityID;
Encoding.ASCII.GetBytes(entityName.PadRight(64), 0, 64, packet.Data, 2);
Encoding.ASCII.GetBytes(skinName.PadRight(64), 0, 64, packet.Data, 66);
return packet;
}
开发者ID:Rhinovex,项目名称:LegendCraft,代码行数:8,代码来源:PacketWriter.cs
示例8: MakeDisconnect
internal static Packet MakeDisconnect( string reason )
{
if ( reason == null )
throw new ArgumentNullException( "reason" );
Packet packet = new Packet( OpCode.Kick );
Encoding.ASCII.GetBytes( reason.PadRight( 64 ), 0, 64, packet.Data, 1 );
return packet;
}
开发者ID:Jonty800,项目名称:Guilds,代码行数:9,代码来源:Packets.cs
示例9: MakeSetBlock
public static Packet MakeSetBlock( int x, int y, int z, Block type )
{
Packet packet = new Packet( OpCode.SetBlockServer );
ToNetOrder( x, packet.Data, 1 );
ToNetOrder( z, packet.Data, 3 );
ToNetOrder( y, packet.Data, 5 );
packet.Data[7] = (byte)type;
return packet;
}
开发者ID:zINaPalm,项目名称:LegendCraftSource,代码行数:9,代码来源:PacketWriter.cs
示例10: MakeEnvSetMapAppearance
public static Packet MakeEnvSetMapAppearance(string textureURL, byte sideBlock, byte edgeBlock, short sideLevel)
{
Packet packet = new Packet(OpCode.EnvSetMapAppearance);
Encoding.ASCII.GetBytes(textureURL.PadRight(64), 0, 64, packet.Data, 1);
packet.Data[65] = sideBlock;
packet.Data[66] = edgeBlock;
ToNetOrder((short)sideLevel, packet.Data, 67);
return packet;
}
开发者ID:Rhinovex,项目名称:LegendCraft,代码行数:9,代码来源:PacketWriter.cs
示例11: MakeMove
internal static Packet MakeMove( int id, Position pos )
{
Packet packet = new Packet( OpCode.Move );
packet.Data[1] = ( byte )id;
packet.Data[2] = ( byte )pos.X;
packet.Data[3] = ( byte )pos.Z;
packet.Data[4] = ( byte )pos.Y;
return packet;
}
开发者ID:Jonty800,项目名称:Guilds,代码行数:9,代码来源:Packets.cs
示例12: MakeExtInfo
public static Packet MakeExtInfo(short extCount)
{
String VersionString = "LegendCraft " + Updater.LatestStable;
Logger.Log(LogType.Debug, "Send: ExtInfo({0},{1})", VersionString, extCount);
Packet packet = new Packet(OpCode.ExtInfo);
Encoding.ASCII.GetBytes(VersionString.PadRight(64), 0, 64, packet.Data, 1);
ToNetOrder(extCount, packet.Data, 65);
return packet;
}
开发者ID:EricKilla,项目名称:LegendCraft,代码行数:10,代码来源:CPE.cs
示例13: MakeExtAddPlayerName
/// <summary> Packet used to change players names/group in TabList as well as their autocomplete name. Color code friendly. </summary>
/// <param name="NameID"> Name ID number from 0-255 </param>
/// <param name="PlayerName"> Name used for autocompletion (can be null) </param>
/// <param name="ListName"> Name displayed in Tab List </param>
/// <param name="GroupName"> Name of group in Tab List </param>
/// <param name="GroupRank"> Rank of group in Tab list (0 is highest) </param>
public static Packet MakeExtAddPlayerName(short NameID, [CanBeNull]string PlayerName, string ListName, string GroupName, byte GroupRank)
{
Packet packet = new Packet(OpCode.ExtAddPlayerName); //0
ToNetOrder((short)NameID, packet.Data, 1); //1
Encoding.ASCII.GetBytes(PlayerName.PadRight(64), 0, 64, packet.Data, 3); //2
Encoding.ASCII.GetBytes(ListName.PadRight(64), 0, 64, packet.Data, 67); //67
Encoding.ASCII.GetBytes(GroupName.PadRight(64), 0, 64, packet.Data, 131); //131
packet.Data[195] = (byte)GroupRank;
return packet;
}
开发者ID:Rhinovex,项目名称:LegendCraft,代码行数:16,代码来源:PacketWriter.cs
示例14: MakeEnvSetColor
public static Packet MakeEnvSetColor(byte selection, string colorcode)
{
System.Drawing.Color col = System.Drawing.ColorTranslator.FromHtml(colorcode.ToUpper());
Packet packet = new Packet(OpCode.EnvSetColor);
packet.Data[1] = selection;
ToNetOrder((short)(col.R), packet.Data, 2);
ToNetOrder((short)(col.G), packet.Data, 4);
ToNetOrder((short)(col.B), packet.Data, 6);
return packet;
}
开发者ID:Rhinovex,项目名称:LegendCraft,代码行数:10,代码来源:PacketWriter.cs
示例15: MakeMessage
internal static Packet MakeMessage( string message )
{
if ( message == null )
throw new ArgumentNullException( "message" );
Packet packet = new Packet( OpCode.Message );
packet.Data[1] = 0; // unused
Encoding.ASCII.GetBytes( message.PadRight( 64 ), 0, 64, packet.Data, 2 );
return packet;
}
开发者ID:Jonty800,项目名称:Guilds,代码行数:10,代码来源:Packets.cs
示例16: MakeExtInfo
public static Packet MakeExtInfo( short extCount )
{
String VersionString = "800Craft " + Updater.CurrentRelease.VersionString;
Logger.Log( LogType.SystemActivity, "Send: ExtInfo({0},{1})", VersionString, extCount );
Packet packet = new Packet( OpCode.ExtInfo );
Encoding.ASCII.GetBytes( VersionString.PadRight( 64 ), 0, 64, packet.Data, 1 );
ToNetOrder( extCount, packet.Data, 65 );
return packet;
}
开发者ID:GlennMR,项目名称:800craft,代码行数:10,代码来源:CPE.cs
示例17: MakeTeleport
public static Packet MakeTeleport( sbyte id, Position pos ) {
Packet packet = new Packet( OpCode.Teleport );
packet.Bytes[1] = (byte)id;
ToNetOrder( pos.X, packet.Bytes, 2 );
ToNetOrder( pos.Z, packet.Bytes, 4 );
ToNetOrder( pos.Y, packet.Bytes, 6 );
packet.Bytes[8] = pos.R;
packet.Bytes[9] = pos.L;
return packet;
}
开发者ID:fragmer,项目名称:fCraft,代码行数:10,代码来源:Packet.cs
示例18: MakeHandshake
/// <summary> Creates a new Handshake (0x00) packet. </summary>
/// <param name="serverName"> Server name, to be shown on recipient's loading screen. May not be null. </param>
/// <param name="player"> Player to whom this packet is being sent.
/// Used to determine DeleteAdmincrete permission, for client-side checks. May not be null. </param>
/// <param name="motd"> Message-of-the-day (text displayed below the server name). May not be null. </param>
/// <exception cref="ArgumentNullException"> player, serverName, or motd is null </exception>
public static Packet MakeHandshake([NotNull] Player player, [NotNull] string serverName, [NotNull] string motd) {
if (serverName == null) throw new ArgumentNullException("serverName");
if (motd == null) throw new ArgumentNullException("motd");
Packet packet = new Packet(OpCode.Handshake);
packet.Bytes[1] = Config.ProtocolVersion;
Encoding.ASCII.GetBytes(serverName.PadRight(64), 0, 64, packet.Bytes, 2);
Encoding.ASCII.GetBytes(motd.PadRight(64), 0, 64, packet.Bytes, 66);
packet.Bytes[130] = (byte)(player.Can(Permission.DeleteAdmincrete) ? 100 : 0);
return packet;
}
开发者ID:fragmer,项目名称:fCraft,代码行数:17,代码来源:Packet.cs
示例19: MakeAddEntity
public static Packet MakeAddEntity( sbyte id, [NotNull] string name, Position pos ) {
if( name == null ) throw new ArgumentNullException( "name" );
Packet packet = new Packet( OpCode.AddEntity );
packet.Bytes[1] = (byte)id;
Encoding.ASCII.GetBytes( name.PadRight( 64 ), 0, 64, packet.Bytes, 2 );
ToNetOrder( pos.X, packet.Bytes, 66 );
ToNetOrder( pos.Z, packet.Bytes, 68 );
ToNetOrder( pos.Y, packet.Bytes, 70 );
packet.Bytes[72] = pos.R;
packet.Bytes[73] = pos.L;
return packet;
}
开发者ID:fragmer,项目名称:fCraft,代码行数:13,代码来源:Packet.cs
示例20: MakeAddEntity
/// <summary> Creates a new AddEntity (0x07) packet. </summary>
/// <param name="id"> Entity ID. Negative values refer to "self". </param>
/// <param name="name"> Entity name. May not be null. </param>
/// <param name="spawnPosition"> Spawning position for the player. </param>
/// <exception cref="ArgumentNullException"> name is null </exception>
public static Packet MakeAddEntity( sbyte id, [NotNull] string name, Position spawnPosition ) {
if (name == null) throw new ArgumentNullException("name");
Packet packet = new Packet( OpCode.AddEntity );
//Logger.Log(LogType.Debug, "Send: MakeAddEntity({0}, {1}, {2})", id, name, spawnPosition);
packet.Bytes[1] = (byte)id;
Encoding.ASCII.GetBytes( name.PadRight( 64 ), 0, 64, packet.Bytes, 2 );
ToNetOrder( spawnPosition.X, packet.Bytes, 66 );
ToNetOrder( spawnPosition.Z, packet.Bytes, 68 );
ToNetOrder( spawnPosition.Y, packet.Bytes, 70 );
packet.Bytes[72] = spawnPosition.R;
packet.Bytes[73] = spawnPosition.L;
return packet;
}
开发者ID:Magi1053,项目名称:ProCraft,代码行数:19,代码来源:Packet.cs
注:本文中的fCraft.Packet类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论