本文整理汇总了C#中Server.GenericReader.ReadUShort方法的典型用法代码示例。如果您正苦于以下问题:C# GenericReader.ReadUShort方法的具体用法?C# GenericReader.ReadUShort怎么用?C# GenericReader.ReadUShort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.GenericReader
的用法示例。
在下文中一共展示了GenericReader.ReadUShort方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DesignState
public DesignState( HouseFoundation foundation, GenericReader reader )
{
m_Foundation = foundation;
int version = reader.ReadInt();
switch( version )
{
case 0:
{
m_Components = new MultiComponentList( reader );
int length = reader.ReadInt();
m_Fixtures = new MultiTileEntry[length];
for( int i = 0; i < length; ++i )
{
m_Fixtures[i].m_ItemID = reader.ReadUShort();
m_Fixtures[i].m_OffsetX = reader.ReadShort();
m_Fixtures[i].m_OffsetY = reader.ReadShort();
m_Fixtures[i].m_OffsetZ = reader.ReadShort();
m_Fixtures[i].m_Flags = reader.ReadInt();
}
m_Revision = reader.ReadInt();
break;
}
}
}
示例2: Skill
public Skill( Skills owner, SkillInfo info, GenericReader reader )
{
m_Owner = owner;
m_Info = info;
int version = reader.ReadByte();
switch ( version )
{
case 0:
{
m_Base = reader.ReadUShort();
m_Cap = reader.ReadUShort();
m_Lock = (SkillLock)reader.ReadByte();
break;
}
case 0xFF:
{
m_Base = 0;
m_Cap = 1000;
m_Lock = SkillLock.Up;
break;
}
default:
{
if ( (version & 0xC0) == 0x00 )
{
if ( (version & 0x1) != 0 )
m_Base = reader.ReadUShort();
if ( (version & 0x2) != 0 )
m_Cap = reader.ReadUShort();
else
m_Cap = 1000;
if ( (version & 0x4) != 0 )
m_Lock = (SkillLock)reader.ReadByte();
}
break;
}
}
if ( m_Lock < SkillLock.Up || m_Lock > SkillLock.Locked )
{
Console.WriteLine( "Bad skill lock -> {0}.{1}", owner.Owner, m_Lock );
m_Lock = SkillLock.Up;
}
}
示例3: Deserialize
public static Skill Deserialize( Skills owner, SkillInfo info, GenericReader reader )
{
int version = reader.ReadByte();
ushort m_Base = 0;
ushort m_Cap = 0;
SkillLock m_Lock = SkillLock.Up;
switch ( version )
{
case 0:
{
m_Base = reader.ReadUShort();
m_Cap = reader.ReadUShort();
m_Lock = (SkillLock)reader.ReadByte();
break;
}
case 0xFF:
return null;
default:
{
if ( (version & 0xC0) == 0x00 )
{
if ( (version & 0x1) != 0 )
m_Base = reader.ReadUShort();
if ( (version & 0x2) != 0 )
m_Cap = reader.ReadUShort();
else
m_Cap = 1000;
if ( (version & 0x4) != 0 )
m_Lock = (SkillLock)reader.ReadByte();
}
break;
}
}
return new Skill(owner, info, m_Base, m_Cap, m_Lock);
}
示例4: MultiComponentList
public MultiComponentList( GenericReader reader )
{
int version = reader.ReadInt();
m_Min = reader.ReadPoint2D();
m_Max = reader.ReadPoint2D();
m_Center = reader.ReadPoint2D();
m_Width = reader.ReadInt();
m_Height = reader.ReadInt();
int length = reader.ReadInt();
MultiTileEntry[] allTiles = m_List = new MultiTileEntry[length];
if ( version == 0 ) {
for ( int i = 0; i < length; ++i )
{
int id = reader.ReadShort();
if ( id >= 0x4000 )
id -= 0x4000;
allTiles[i].m_ItemID = (ushort)id;
allTiles[i].m_OffsetX = reader.ReadShort();
allTiles[i].m_OffsetY = reader.ReadShort();
allTiles[i].m_OffsetZ = reader.ReadShort();
allTiles[i].m_Flags = reader.ReadInt();
}
} else {
for ( int i = 0; i < length; ++i )
{
allTiles[i].m_ItemID = reader.ReadUShort();
allTiles[i].m_OffsetX = reader.ReadShort();
allTiles[i].m_OffsetY = reader.ReadShort();
allTiles[i].m_OffsetZ = reader.ReadShort();
allTiles[i].m_Flags = reader.ReadInt();
}
}
TileList[][] tiles = new TileList[m_Width][];
m_Tiles = new StaticTile[m_Width][][];
for ( int x = 0; x < m_Width; ++x )
{
tiles[x] = new TileList[m_Height];
m_Tiles[x] = new StaticTile[m_Height][];
for ( int y = 0; y < m_Height; ++y )
tiles[x][y] = new TileList();
}
for ( int i = 0; i < allTiles.Length; ++i )
{
if ( i == 0 || allTiles[i].m_Flags != 0 )
{
int xOffset = allTiles[i].m_OffsetX + m_Center.m_X;
int yOffset = allTiles[i].m_OffsetY + m_Center.m_Y;
tiles[xOffset][yOffset].Add( (ushort)allTiles[i].m_ItemID, (sbyte)allTiles[i].m_OffsetZ );
}
}
for ( int x = 0; x < m_Width; ++x )
for ( int y = 0; y < m_Height; ++y )
m_Tiles[x][y] = tiles[x][y].ToArray();
}
示例5: MultiComponentList
public MultiComponentList(GenericReader reader)
{
int version = reader.ReadInt();
m_Min = reader.ReadPoint2D();
m_Max = reader.ReadPoint2D();
m_Center = reader.ReadPoint2D();
m_Width = reader.ReadInt();
m_Height = reader.ReadInt();
int length = reader.ReadInt();
var allTiles = m_List = new MultiTileEntry[length];
if (version == 0)
{
for (int i = 0; i < length; ++i)
{
int id = reader.ReadShort();
if (id >= 0x4000)
{
id -= 0x4000;
}
allTiles[i].m_ItemID = (ushort)id;
allTiles[i].m_OffsetX = reader.ReadShort();
allTiles[i].m_OffsetY = reader.ReadShort();
allTiles[i].m_OffsetZ = reader.ReadShort();
allTiles[i].m_Flags = reader.ReadInt();
}
}
else
{
for (int i = 0; i < length; ++i)
{
allTiles[i].m_ItemID = reader.ReadUShort();
allTiles[i].m_OffsetX = reader.ReadShort();
allTiles[i].m_OffsetY = reader.ReadShort();
allTiles[i].m_OffsetZ = reader.ReadShort();
allTiles[i].m_Flags = reader.ReadInt();
}
}
var tiles = new TileList[m_Width][];
m_Tiles = new StaticTile[m_Width][][];
for (int x = 0; x < m_Width; ++x)
{
tiles[x] = new TileList[m_Height];
m_Tiles[x] = new StaticTile[m_Height][];
for (int y = 0; y < m_Height; ++y)
{
tiles[x][y] = new TileList();
}
}
for (int i = 0; i < allTiles.Length; ++i)
{
if (i == 0 || allTiles[i].m_Flags != 0)
{
int xOffset = allTiles[i].m_OffsetX + m_Center.m_X;
int yOffset = allTiles[i].m_OffsetY + m_Center.m_Y;
#region Stygian Abyss
//tiles[xOffset][yOffset].Add( (ushort)allTiles[i].m_ItemID, (sbyte)allTiles[i].m_OffsetZ );
tiles[xOffset][yOffset].Add(
(ushort)((allTiles[i].m_ItemID & TileData.MaxItemValue) | 0x10000), (sbyte)allTiles[i].m_OffsetZ);
#endregion
}
}
for (int x = 0; x < m_Width; ++x)
{
for (int y = 0; y < m_Height; ++y)
{
m_Tiles[x][y] = tiles[x][y].ToArray();
}
}
}
示例6: Skill
public Skill( Skills owner, SkillInfo info, GenericReader reader )
{
m_Owner = owner;
m_Info = info;
int version = reader.ReadByte();
switch ( version )
{
case 0:
{
m_Base = reader.ReadUShort();
m_Cap = reader.ReadUShort();
m_Lock = (SkillLock)reader.ReadByte();
break;
}
case 0xFF:
{
m_Base = 0;
m_Cap = 1000;
m_Lock = SkillLock.Up;
break;
}
default:
{
if ( (version & 0xC0) == 0x00 )
{
if ( (version & 0x1) != 0 )
m_Base = reader.ReadUShort();
if ( (version & 0x2) != 0 )
m_Cap = reader.ReadUShort();
else
m_Cap = 1000;
if ( (version & 0x4) != 0 )
m_Lock = (SkillLock)reader.ReadByte();
}
break;
}
}
}
示例7: Deserialize
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
m_Code = reader.ReadUShort();
m_Controller = reader.ReadItem() as LeverPuzzleController;
}