本文整理汇总了C#中Server.GenericWriter.WriteInt32方法的典型用法代码示例。如果您正苦于以下问题:C# GenericWriter.WriteInt32方法的具体用法?C# GenericWriter.WriteInt32怎么用?C# GenericWriter.WriteInt32使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.GenericWriter
的用法示例。
在下文中一共展示了GenericWriter.WriteInt32方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Serialize
public virtual void Serialize(GenericWriter writer)
{
writer.Write(10); // version
SaveFlag flags = SaveFlag.None;
int x = m_Location.m_X, y = m_Location.m_Y, z = m_Location.m_Z;
if (x != 0 || y != 0 || z != 0)
{
if (x >= short.MinValue && x <= short.MaxValue && y >= short.MinValue && y <= short.MaxValue && z >= sbyte.MinValue && z <= sbyte.MaxValue)
{
if (x != 0 || y != 0)
{
if (x >= byte.MinValue && x <= byte.MaxValue && y >= byte.MinValue && y <= byte.MaxValue)
flags |= SaveFlag.LocationByteXY;
else
flags |= SaveFlag.LocationShortXY;
}
if (z != 0)
flags |= SaveFlag.LocationSByteZ;
}
else
{
flags |= SaveFlag.LocationFull;
}
}
if (m_Direction != Direction.North) flags |= SaveFlag.Direction;
if (m_Bounce != null) flags |= SaveFlag.Bounce;
if (m_LootType != LootType.Regular) flags |= SaveFlag.LootType;
if (m_ItemID != 0) flags |= SaveFlag.ItemID;
if (m_Hue != 0) flags |= SaveFlag.Hue;
if (m_Amount != 1) flags |= SaveFlag.Amount;
if (m_Layer != Layer.Invalid) flags |= SaveFlag.Layer;
if (m_Name != null) flags |= SaveFlag.Name;
if (m_Parent != null) flags |= SaveFlag.Parent;
if (m_Items != null && m_Items.Count > 0) flags |= SaveFlag.Items;
if (m_Map != Map.Internal) flags |= SaveFlag.Map;
//if ( m_InsuredFor != null && !m_InsuredFor.Deleted ) flags |= SaveFlag.InsuredFor;
if (m_BlessedFor != null && !m_BlessedFor.Deleted) flags |= SaveFlag.BlessedFor;
if (m_HeldBy != null && !m_HeldBy.Deleted) flags |= SaveFlag.HeldBy;
if (m_SavedFlags != 0) flags |= SaveFlag.SavedFlags;
if (m_RareData != 0) flags |= SaveFlag.RareData; //wea: 13/Mar/2007 Rare Factory
if (m_DropRate != 1.0) flags |= SaveFlag.DropRate; //Adam: Spawner Loot Packs
if (m_Weight == 0.0)
{
flags |= SaveFlag.WeightIs0;
}
else if (m_Weight != 1.0)
{
if (m_Weight == (int)m_Weight)
flags |= SaveFlag.IntWeight;
else
flags |= SaveFlag.WeightNot1or0;
}
// see if anything here is set
ImplFlag implFlags = (m_Flags & (ImplFlag.Visible | ImplFlag.Movable | ImplFlag.Stackable | ImplFlag.PlayerCrafted | ImplFlag.IsIntMapStorage | ImplFlag.FreezeDried | ImplFlag.Debug | ImplFlag.IsTemplate | ImplFlag.ToDelete | ImplFlag.PlayerQuest | ImplFlag.HideAttributes | ImplFlag.Audited));
if (implFlags != (ImplFlag.Visible | ImplFlag.Movable))
flags |= SaveFlag.ImplFlags;
if (IsFreezeDried)
flags |= SaveFlag.FreezeDried;
// must be the first thing written
writer.WriteInt32((int)flags);
// version 10: Adam
// Spawner Loot Packs
if (GetSaveFlag(flags, SaveFlag.DropRate))
writer.Write(m_DropRate);
//
// older versions follow
//
/* begin last moved time optimization */
long ticks = m_LastMovedTime.Ticks;
long now = DateTime.Now.Ticks;
TimeSpan d;
try { d = new TimeSpan(ticks - now); }
catch { if (ticks < now) d = TimeSpan.MaxValue; else d = TimeSpan.MaxValue; }
double minutes = -d.TotalMinutes;
if (minutes < int.MinValue)
minutes = int.MinValue;
else if (minutes > int.MaxValue)
minutes = int.MaxValue;
writer.WriteEncodedInt((int)minutes);
/* end */
if (GetSaveFlag(flags, SaveFlag.Direction))
//.........这里部分代码省略.........
示例2: Serialize
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 2 ); // version
// version 2
writer.WriteInt32(m_spawners.Count);
for (int i = 0; i < m_spawners.Count; ++i)
writer.Write((Item)m_spawners[i]);
// version 1
writer.Write( m_KinRansomChest );
writer.Write( m_RegStone );
writer.Write( m_OldGuardMode );
writer.Write( m_OldCountMode );
writer.Write( m_RegionName );
writer.Write( (int)m_IOBAlignment );
writer.Write( m_ChestOpenTime );
writer.Write( m_bChestOpenInit );
writer.Write( m_PreEventTime );
writer.Write( m_bPreEventInit );
}
示例3: Serialize
public virtual void Serialize(GenericWriter writer)
{
writer.Write((int)31); // version
writer.Write(m_STRBonusCap);
//write flytile array
writer.WriteInt32(FlyIDs.Length);
for (int i = 0; i < FlyIDs.Length; i++)
{
writer.Write(FlyIDs[i]);
}
writer.Write(m_CanFly);
writer.WriteDeltaTime(m_LastStatGain);
writer.WriteInt32((int)m_Flags);
writer.Write(m_Corpse);
writer.Write(m_CreationTime);
writer.WriteMobileList(m_Stabled, true);
writer.Write(m_CantWalk);
VirtueInfo.Serialize(writer, m_Virtues);
writer.WriteInt32(m_Thirst);
writer.WriteInt32(m_BAC);
writer.WriteInt32(m_ShortTermMurders);
//writer.Write( m_ShortTermElapse );
//writer.Write( m_LongTermElapse );
//writer.Write( m_Followers );
writer.WriteInt32(m_FollowersMax);
writer.WriteInt32(m_MagicDamageAbsorb);
writer.Write(m_GuildFealty);
writer.Write(m_Guild);
writer.Write(m_DisplayGuildTitle);
writer.Write(m_CanSwim);
writer.Write(m_Squelched);
writer.Write(m_Holding);
writer.WriteInt32(m_VirtualArmor);
writer.WriteInt32(m_BaseSoundID);
writer.Write(m_DisarmReady);
writer.Write(m_StunReady);
//Poison.Serialize( m_Poison, writer );
writer.WriteInt32(m_StatCap);
writer.WriteInt32(m_NameHue);
writer.WriteInt32(m_Hunger);
writer.Write(m_Location);
writer.WriteInt32((int)m_Body);
writer.Write(m_Name);
writer.Write(m_GuildTitle);
writer.Write(m_Criminal);
writer.WriteInt32(m_Kills);
writer.WriteInt32(m_SpeechHue);
writer.WriteInt32(m_EmoteHue);
writer.WriteInt32(m_WhisperHue);
writer.WriteInt32(m_YellHue);
writer.Write(m_Language);
writer.Write(m_Female);
writer.Write(m_Warmode);
writer.Write(m_Hidden);
writer.Write((byte)m_Direction);
writer.WriteInt32(m_Hue);
writer.WriteInt32(m_Str);
writer.WriteInt32(m_Dex);
writer.WriteInt32(m_Int);
writer.WriteInt32(m_Hits);
writer.WriteInt32(m_Stam);
writer.WriteInt32(m_Mana);
writer.Write(m_Map);
writer.Write(m_Blessed);
writer.WriteInt32(m_Fame);
writer.WriteInt32(m_Karma);
writer.Write((byte)m_AccessLevel);
m_Skills.Serialize(writer);
//.........这里部分代码省略.........
示例4: Serialize
public override void Serialize(GenericWriter writer)
{
int version = 6;
writer.Write(version); // version
// set the save flags.
// clear
m_flags &= ~SaveFlags.DesignState_Design;
m_flags &= ~SaveFlags.DesignState_Backup;
// set
if (m_Design != null) m_flags |= SaveFlags.DesignState_Design;
if (m_Backup != null) m_flags |= SaveFlags.DesignState_Backup;
// version 6
writer.WriteInt32((int)m_flags);
writer.Write(m_Signpost);
writer.Write((int)m_SignpostGraphic);
writer.Write((int)m_Type);
writer.Write(m_SignHanger);
writer.Write((int)m_LastRevision);
writer.WriteItemList(m_Fixtures, true);
CurrentState.Serialize(writer);
if ((m_flags & SaveFlags.DesignState_Design) != 0)
DesignState.Serialize(writer);
if ((m_flags & SaveFlags.DesignState_Backup) != 0)
BackupState.Serialize(writer);
base.Serialize(writer);
}