本文整理汇总了C#中BitStream.ReadCompressed方法的典型用法代码示例。如果您正苦于以下问题:C# BitStream.ReadCompressed方法的具体用法?C# BitStream.ReadCompressed怎么用?C# BitStream.ReadCompressed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitStream
的用法示例。
在下文中一共展示了BitStream.ReadCompressed方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: clientRPC
public static void clientRPC(RPCParameters rpcParameters)
{
BitStream b = new BitStream(rpcParameters, false);
string name;
if (!b.Read(out name))
{
Console.Write("Too-short bitstreams.\n");
return;
}
Console.Write("In clientRPC:\n");
Console.Write("Name is {0}\n", name);
uint age;
if (!b.ReadCompressed(out age))
{
return;
}
Console.Write("Age is {0}\n", age);
Console.Out.Flush();
bool wroteEmploymentStruct;
if (!b.Read(out wroteEmploymentStruct))
{
return;
}
if (wroteEmploymentStruct)
{
Console.Write("We are employed.\n");
EmploymentStruct employmentStruct;
if (!b.Read(out employmentStruct.salary)) return;
if (!b.Read(out employmentStruct.yearsEmployed)) return;
Console.Write("Salary is {0}. Years employed is {1}\n", employmentStruct.salary, employmentStruct.yearsEmployed);
}
else
Console.Write("We are between jobs :)\n");
quit = true;
}
示例2: ProcessReplication
internal void ProcessReplication(BitStream bs)
{
bool success;
int typeID;
success = bs.ReadCompressed(out typeID);
Debug.Assert(success, "Failed to read replication type ID");
Debug.Assert(typeID < m_idToType.Count, "Invalid replication type ID");
Type type = m_idToType[typeID];
long tmpLong;
success = bs.Read(out tmpLong);
Debug.Assert(success, "Failed to read entityID");
ulong entityID = (ulong)tmpLong;
object obj = Activator.CreateInstance(type);
MySyncedClass sync = GetSyncedClass(obj);
sync.TypeID = typeID;
sync.EntityId = entityID;
sync.Deserialize(bs);
// TODO:SK should init here
RegisterSynced(sync);
var handle = OnEntityCreated;
if (handle != null)
{
handle(obj, entityID);
}
}