本文整理匯總了C#中Server.GenericReader.ReadShort方法的典型用法代碼示例。如果您正苦於以下問題:C# GenericReader.ReadShort方法的具體用法?C# GenericReader.ReadShort怎麽用?C# GenericReader.ReadShort使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Server.GenericReader
的用法示例。
在下文中一共展示了GenericReader.ReadShort方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: 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();
}
示例2: Deserialize
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
var version = reader.GetVersion();
if (version < 4)
{
WebServer = true;
DirectoryIndex = true;
}
if (version < 3)
{
MaxSendBufferSize = 32;
MaxReceiveBufferSize = 32;
}
if (version < 2)
{
Whitelist = new List<string>();
Blacklist = new List<string>();
}
switch (version)
{
case 4:
{
WebServer = reader.ReadBool();
DirectoryIndex = reader.ReadBool();
}
goto case 3;
case 3:
case 2:
{
MaxSendBufferSize = reader.ReadInt();
MaxReceiveBufferSize = reader.ReadInt();
}
goto case 1;
case 1:
{
Whitelist = reader.ReadList(r => r.ReadString(), Whitelist);
Blacklist = reader.ReadList(r => r.ReadString(), Blacklist);
UseWhitelist = reader.ReadBool();
}
goto case 0;
case 0:
{
Port = reader.ReadShort();
MaxConnections = reader.ReadInt();
}
break;
}
}
示例3: Deserialize
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
switch (version)
{
case 0:
{
m_Job = (JobFragment)reader.ReadShort();
m_Mood = (Attitude)reader.ReadByte();
m_Soph = (Sophistication)reader.ReadByte();
break;
}
}
}
示例4: Deserialize
public virtual void Deserialize( GenericReader reader )
{
int version = reader.ReadInt();
SetLastMoved();
switch ( version )
{
case 14:
{
m_InstanceID = reader.ReadInt();
SaveFlag flags = (SaveFlag) reader.ReadInt();
int minutes = reader.ReadEncodedInt();
try { LastMoved = DateTime.Now - TimeSpan.FromMinutes( minutes ); }
catch { LastMoved = DateTime.Now; }
if ( GetSaveFlag( flags, SaveFlag.Direction ) )
m_Direction = (Direction) reader.ReadByte();
if ( GetSaveFlag( flags, SaveFlag.LightType ) )
m_LightType = (LightType) reader.ReadByte();
if ( GetSaveFlag( flags, SaveFlag.Bounce ) )
m_Bounce = BounceInfo.Deserialize( reader );
if ( GetSaveFlag( flags, SaveFlag.LootType ) )
m_LootType = (LootType) reader.ReadByte();
int x = 0, y = 0, z = 0;
if ( GetSaveFlag( flags, SaveFlag.LocationFull ) )
{
x = reader.ReadEncodedInt();
y = reader.ReadEncodedInt();
z = reader.ReadEncodedInt();
}
else
{
if ( GetSaveFlag( flags, SaveFlag.LocationByteXY ) )
{
x = reader.ReadByte();
y = reader.ReadByte();
}
else if ( GetSaveFlag( flags, SaveFlag.LocationShortXY ) )
{
x = reader.ReadShort();
y = reader.ReadShort();
}
if ( GetSaveFlag( flags, SaveFlag.LocationSByteZ ) )
z = reader.ReadSByte();
}
m_Location = new Point3D( x, y, z );
if ( GetSaveFlag( flags, SaveFlag.ItemID ) )
m_ItemID = reader.ReadEncodedInt();
if ( GetSaveFlag( flags, SaveFlag.Hue ) )
m_Hue = reader.ReadEncodedInt();
if ( GetSaveFlag( flags, SaveFlag.Amount ) )
m_Amount = reader.ReadEncodedInt();
else
m_Amount = 1;
if ( GetSaveFlag( flags, SaveFlag.Layer ) )
m_Layer = (Layer) reader.ReadByte();
if ( GetSaveFlag( flags, SaveFlag.Name ) )
m_Name = string.Intern( reader.ReadString() );
if ( GetSaveFlag( flags, SaveFlag.Parent ) )
{
Serial parent = reader.ReadInt();
if ( parent.IsMobile )
m_Parent = World.Instance.FindMobile( parent );
else if ( parent.IsItem )
m_Parent = World.Instance.FindItem( parent );
else
m_Parent = null;
if ( m_Parent == null && ( parent.IsMobile || parent.IsItem ) )
Delete();
}
if ( GetSaveFlag( flags, SaveFlag.Items ) )
m_Items = reader.ReadStrongItemList();
if ( GetSaveFlag( flags, SaveFlag.IntWeight ) )
m_Weight = reader.ReadEncodedInt();
else if ( GetSaveFlag( flags, SaveFlag.WeightNot1or0 ) )
m_Weight = reader.ReadDouble();
else if ( GetSaveFlag( flags, SaveFlag.WeightIs0 ) )
m_Weight = 0.0;
else
//.........這裏部分代碼省略.........
示例5: Deserialize
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.GetVersion();
switch (version)
{
case 0:
{
Port = reader.ReadShort();
MaxConnections = reader.ReadInt();
UpdateInterval = reader.ReadTimeSpan();
RequestFlags = reader.ReadFlag<WebStatsRequestFlags>();
}
break;
}
}
示例6: Deserialize
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
var version = reader.GetVersion();
switch (version)
{
case 1:
{
Mode = reader.ReadFlag<SkillCodexMode>();
Flags = reader.ReadFlag<SkillCodexFlags>();
Count = reader.ReadInt();
Value = reader.ReadDouble();
DeleteWhenEmpty = reader.ReadBool();
IgnoredSkills = reader.ReadList(r => r.ReadFlag<SkillName>());
}
break;
case 0:
{
Mode = (SkillCodexMode)reader.ReadByte();
Flags = (SkillCodexFlags)reader.ReadByte();
Count = reader.ReadInt();
Value = reader.ReadDouble();
DeleteWhenEmpty = reader.ReadBool();
IgnoredSkills = reader.ReadList(() => (SkillName)reader.ReadShort());
}
break;
}
}
示例7: Deserialize
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
var version = reader.GetVersion();
switch (version)
{
case 1:
case 0:
{
if (version < 1)
{
reader.ReadShort();
reader.ReadInt();
}
UpdateInterval = reader.ReadTimeSpan();
RequestFlags = reader.ReadFlag<ReqFlags>();
}
break;
}
}
示例8: Deserialize
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
switch ( version )
{
case 5:
{
// erl: New "crafted by" and quality properties
m_Crafter = reader.ReadMobile();
m_Quality = (JewelQuality)reader.ReadShort();
goto case 4;
}
case 4:
{
// remove AOS crap
// see case 1 below
goto case 3;
}
case 3:
{
m_MagicType = (JewelMagicEffect) reader.ReadInt();
m_MagicCharges = reader.ReadInt();
m_Identified = reader.ReadBool();
goto case 2;
}
case 2:
{
m_Resource = (CraftResource)reader.ReadEncodedInt();
m_GemType = (GemType)reader.ReadEncodedInt();
goto case 1;
}
case 1:
{
// pack these out of furture versions.
if (version < 4)
{
AosAttributes dmy_AosAttributes;
AosElementAttributes dmy_AosResistances;
AosSkillBonuses dmy_AosSkillBonuses;
dmy_AosAttributes = new AosAttributes( this, reader );
dmy_AosResistances = new AosElementAttributes( this, reader );
dmy_AosSkillBonuses = new AosSkillBonuses( this, reader );
if ( Core.AOS && Parent is Mobile )
dmy_AosSkillBonuses.AddTo( (Mobile)Parent );
int strBonus = dmy_AosAttributes.BonusStr;
int dexBonus = dmy_AosAttributes.BonusDex;
int intBonus = dmy_AosAttributes.BonusInt;
if ( Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0) )
{
Mobile m = (Mobile)Parent;
string modName = Serial.ToString();
if ( strBonus != 0 )
m.AddStatMod( new StatMod( StatType.Str, modName + "Str", strBonus, TimeSpan.Zero ) );
if ( dexBonus != 0 )
m.AddStatMod( new StatMod( StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero ) );
if ( intBonus != 0 )
m.AddStatMod( new StatMod( StatType.Int, modName + "Int", intBonus, TimeSpan.Zero ) );
}
}
if ( Parent is Mobile )
((Mobile)Parent).CheckStatTimers();
break;
}
case 0:
{
// pack these out of furture versions.
if (version < 4)
{
AosAttributes dmy_AosAttributes;
AosElementAttributes dmy_AosResistances;
AosSkillBonuses dmy_AosSkillBonuses;
dmy_AosAttributes = new AosAttributes( this );
dmy_AosResistances = new AosElementAttributes( this );
dmy_AosSkillBonuses = new AosSkillBonuses( this );
}
break;
}
}
if ( version < 2 )
{
m_Resource = CraftResource.Iron;
m_GemType = GemType.None;
}
//.........這裏部分代碼省略.........
示例9: Deserialize
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
m_TreasureLevel = (TreasureLevel)reader.ReadByte();
m_MinSpawnTime = reader.ReadShort();
m_MaxSpawnTime = reader.ReadShort();
if( !Locked )
StartResetTimer();
}
示例10: Deserialize
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
switch ( version )
{
case 1:
{
m_IsTrapable = reader.ReadBool();
m_TrapChance = reader.ReadInt();
goto case 0;
}
case 0:
{
m_TreasureLevel = (TreasureLevel)reader.ReadByte();
m_MinSpawnTime = reader.ReadShort();
m_MaxSpawnTime = reader.ReadShort();
break;
}
}
StartResetTimer();
}
示例11: MultiComponentList
public MultiComponentList( GenericReader reader )
{
int version = reader.ReadInt();
switch ( version )
{
case 0:
{
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];
for ( int i = 0; i < length; ++i )
{
allTiles[i].m_ItemID = reader.ReadShort();
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 Tile[m_Width][][];
for ( int x = 0; x < m_Width; ++x )
{
tiles[x] = new TileList[m_Height];
m_Tiles[x] = new Tile[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 SA
// Note #1 | 0x8000 produces problems, namely the server doesn't increase your Z when climbing stairs thus the itemid isn't reconized properly.
tiles[xOffset][yOffset].Add( (short)((allTiles[i].m_ItemID & 0x7FFF) | 0x4000), (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();
break;
}
}
}
示例12: Deserialize
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
LootType = LootType.Blessed;
if ( Weight == 0.0 )
Weight = 3.0;
int version = reader.ReadInt();
switch ( version )
{
case 2:
{
m_Crafter = reader.ReadMobile();
m_Quality = (RunebookQuality)reader.ReadShort();
goto case 1;
}
case 1:
{
m_Level = (SecureLevel)reader.ReadInt();
goto case 0;
}
case 0:
{
int count = reader.ReadInt();
m_Entries = new ArrayList( count );
for ( int i = 0; i < count; ++i )
m_Entries.Add( new RunebookEntry( reader ) );
m_Description = reader.ReadString();
m_CurCharges = reader.ReadInt();
m_MaxCharges = reader.ReadInt();
m_DefaultIndex = reader.ReadInt();
break;
}
}
}
示例13: Deserialize
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
switch ( version )
{
case 0:
{
m_Poster = reader.ReadMobile();
m_Subject = reader.ReadString();
m_Time = reader.ReadDateTime();
bool hasThread = reader.ReadBool();
if ( hasThread )
m_Thread = reader.ReadItem() as BulletinMessage;
m_PostedName = reader.ReadString();
m_PostedBody = reader.ReadShort();
m_PostedHue = reader.ReadShort();
m_PostedEquip = new BulletinEquip[reader.ReadByte()];
for ( int i = 0; i < m_PostedEquip.Length; ++i )
{
m_PostedEquip[i].itemID = reader.ReadShort();
m_PostedEquip[i].hue = reader.ReadShort();
}
m_Lines = new string[reader.ReadByte()];
for ( int i = 0; i < m_Lines.Length; ++i )
m_Lines[i] = reader.ReadString();
if ( hasThread && m_Thread == null )
Delete();
break;
}
}
}
示例14: Deserialize
public virtual void Deserialize(GenericReader reader)
{
int version = reader.ReadInt();
SetLastMoved();
// must always read this first
SaveFlag flags = 0;
if (version >= 5)
flags = (SaveFlag)reader.ReadInt32();
switch (version)
{
case 10:
{ // get the per item custom drop rate
if (GetSaveFlag(flags, SaveFlag.DropRate))
m_DropRate = reader.ReadDouble();
}
goto case 9;
case 9:
goto case 8;
case 8:
goto case 7;// change is at bottom of file after ImplFlags are read
case 7:
goto case 6;
case 6:
{
if (version < 7)
{
LastMoved = reader.ReadDeltaTime();
}
else
{
int minutes = reader.ReadEncodedInt();
try { LastMoved = DateTime.Now - TimeSpan.FromMinutes(minutes); }
catch { LastMoved = DateTime.Now; }
}
if (GetSaveFlag(flags, SaveFlag.Direction))
m_Direction = (Direction)reader.ReadByte();
if (GetSaveFlag(flags, SaveFlag.Bounce))
m_Bounce = BounceInfo.Deserialize(reader);
if (GetSaveFlag(flags, SaveFlag.LootType))
m_LootType = (LootType)reader.ReadByte();
int x = 0, y = 0, z = 0;
if (GetSaveFlag(flags, SaveFlag.LocationFull))
{
x = reader.ReadEncodedInt();
y = reader.ReadEncodedInt();
z = reader.ReadEncodedInt();
}
else
{
if (GetSaveFlag(flags, SaveFlag.LocationByteXY))
{
x = reader.ReadByte();
y = reader.ReadByte();
}
else if (GetSaveFlag(flags, SaveFlag.LocationShortXY))
{
x = reader.ReadShort();
y = reader.ReadShort();
}
if (GetSaveFlag(flags, SaveFlag.LocationSByteZ))
z = reader.ReadSByte();
}
m_Location = new Point3D(x, y, z);
if (GetSaveFlag(flags, SaveFlag.ItemID))
m_ItemID = reader.ReadEncodedInt();
if (GetSaveFlag(flags, SaveFlag.Hue))
m_Hue = reader.ReadEncodedInt();
if (GetSaveFlag(flags, SaveFlag.Amount))
m_Amount = reader.ReadEncodedInt();
else
m_Amount = 1;
if (GetSaveFlag(flags, SaveFlag.Layer))
m_Layer = (Layer)reader.ReadByte();
if (GetSaveFlag(flags, SaveFlag.Name))
m_Name = reader.ReadString();
if (GetSaveFlag(flags, SaveFlag.Parent))
{
Serial parent = reader.ReadInt32();
if (parent.IsMobile)
m_Parent = World.FindMobile(parent);
else if (parent.IsItem)
m_Parent = World.FindItem(parent);
//.........這裏部分代碼省略.........
示例15: Deserialize
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
m_Active = reader.ReadBool();
m_Casino = (Casino)reader.ReadInt();
m_CasinoName = reader.ReadString();
m_TotalPlays = reader.ReadULong();
m_TotalCollected = reader.ReadULong();
m_TotalWon = reader.ReadULong();
m_ErrorCode = reader.ReadInt();
m_OrigHue = reader.ReadInt();
m_InUseBy = reader.ReadMobile();
m_OnCredit = reader.ReadInt();
m_Escrow = reader.ReadInt();
m_SecurityCamMobile = reader.ReadMobile();
m_SecurityChatter = (VerboseType)reader.ReadInt();
m_Bet = reader.ReadInt();
m_TestMode = reader.ReadBool();
m_DealerDelay = reader.ReadBool();
m_DoubleAfterSplit = reader.ReadBool();
m_DealerHitsSoft17 = reader.ReadBool();
m_DealerTakesPush = reader.ReadBool();
m_Resplits = reader.ReadBool();
m_SplitAces = (SplitAces)reader.ReadInt();
m_BJSplitAces21 = reader.ReadBool();
m_BJSplitAcesPaysEven = reader.ReadBool();
m_DoubleDown = (DoubleDown)reader.ReadInt();
m_PlayerCardsFaceUp = reader.ReadBool();
m_DealerCardsFaceUp = reader.ReadBool();
m_NumberOfDecks = reader.ReadShort();
m_ContinuousShuffle = reader.ReadBool();
m_MinBet = (BetValues)reader.ReadInt();
m_MaxBet = (BetValues)reader.ReadInt();
m_BlackJackPays = (BlackJackPays)reader.ReadInt();
m_CardSounds = reader.ReadBool();
carddeck = new CardDeck(m_NumberOfDecks,0);
m_BJInfo.HandInfo = new HandStruct[5];
for (int h = 0; h < 5; h++)
{
m_BJInfo.HandInfo[h].bet = 0;
m_BJInfo.HandInfo[h].totalcards = 0;
m_BJInfo.HandInfo[h].card = new short[12];
for (int c = 0; c < 12; c++)
m_BJInfo.HandInfo[h].card[c] = -1;
m_BJInfo.HandInfo[h].bestscore = 0;
m_BJInfo.HandInfo[h].altscore = 0;
}
}