当前位置: 首页>>代码示例>>C#>>正文


C# GenericReader.ReadInt32方法代码示例

本文整理汇总了C#中Server.GenericReader.ReadInt32方法的典型用法代码示例。如果您正苦于以下问题:C# GenericReader.ReadInt32方法的具体用法?C# GenericReader.ReadInt32怎么用?C# GenericReader.ReadInt32使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Server.GenericReader的用法示例。


在下文中一共展示了GenericReader.ReadInt32方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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);
//.........这里部分代码省略.........
开发者ID:zerodowned,项目名称:angelisland,代码行数:101,代码来源:Item.cs

示例2: Deserialize

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
			int version = reader.ReadInt();

			switch (version)
			{
				case 2:
				{
					int itemCount = reader.ReadInt32();

					m_spawners = new ArrayList(itemCount);

					for (int i = 0; i < itemCount; ++i)
					{
						Item item = reader.ReadItem();

						if (item != null)
							m_spawners.Add(item);
					}

					goto case 1;
				}

				case 1:
				{
					m_KinRansomChest = reader.ReadItem() as KinRansomChest;
					m_RegStone = reader.ReadItem() as RegionControl;
					m_OldGuardMode = reader.ReadBool();
					m_OldCountMode = reader.ReadBool();
					m_RegionName = reader.ReadString();
					m_IOBAlignment = (IOBAlignment)reader.ReadInt();
					m_ChestOpenTime = reader.ReadDateTime();
					m_bChestOpenInit = reader.ReadBool();
					m_PreEventTime = reader.ReadDateTime();
					m_bPreEventInit = reader.ReadBool();
					goto case 0;
				}

				case 0:
				{	// all done
					break;
				}
			}
		}
开发者ID:zerodowned,项目名称:angelisland,代码行数:45,代码来源:AutomatedEventSystem.cs

示例3: Deserialize

		public virtual void Deserialize(GenericReader reader)
		{
			int version = reader.ReadInt();

			switch (version)
			{
				case 31:
					{
						m_STRBonusCap = reader.ReadInt();
						goto case 30;
					}
				case 30:
					{
						int size = reader.ReadInt32();
						FlyIDs = new int[size];

						for (int i = 0; i < size; i++)
						{
							FlyIDs[i] = reader.ReadInt();
						}
						goto case 29;
					}
				case 29:
					{
						m_CanFly = reader.ReadBool();
						goto case 28;
					}

				case 28:
					{
						m_LastStatGain = reader.ReadDeltaTime();

						goto case 27;
					}
				case 27:
					{
						m_Flags = (MobileFlags)reader.ReadInt32();

						goto case 26;
					}
				case 26:
				case 25:
				case 24:
					{
						m_Corpse = reader.ReadItem() as Container;

						goto case 23;
					}
				case 23:
					{
						m_CreationTime = reader.ReadDateTime();

						goto case 22;
					}
				case 22: // Just removed followers
				case 21:
					{
						m_Stabled = reader.ReadMobileList();

						goto case 20;
					}
				case 20:
					{
						m_CantWalk = reader.ReadBool();

						goto case 19;
					}
				case 19: // Just removed variables
				case 18:
					{
						m_Virtues = new VirtueInfo(reader);

						goto case 17;
					}
				case 17:
					{
						m_Thirst = reader.ReadInt32();
						m_BAC = reader.ReadInt32();

						goto case 16;
					}
				case 16:
					{
						m_ShortTermMurders = reader.ReadInt32();

						if (version <= 24)
						{
							reader.ReadDateTime();
							reader.ReadDateTime();
						}

						goto case 15;
					}
				case 15:
					{
						if (version < 22)
							reader.ReadInt(); // followers

						m_FollowersMax = reader.ReadInt32();

//.........这里部分代码省略.........
开发者ID:zerodowned,项目名称:angelisland,代码行数:101,代码来源:Mobile.cs

示例4: Deserialize

        public override void Deserialize(GenericReader reader)
        {
            int version = reader.ReadInt();

            switch (version)
            {
                case 6:
                    {
                        m_flags = (SaveFlags)reader.ReadInt32();
                        goto case 5;
                    }
                case 5:
                    {
                        // versions < 6 always read Design & Backup
                        if (version < 6)
                        {
                            m_flags |= SaveFlags.DesignState_Design;
                            m_flags |= SaveFlags.DesignState_Backup;
                        }
                        goto case 4;
                    }
                case 4:
                    {
                        m_Signpost = reader.ReadItem();
                        m_SignpostGraphic = reader.ReadInt();
                        goto case 3;
                    }
                case 3:
                    {
                        m_Type = (FoundationType)reader.ReadInt();
                        goto case 2;
                    }
                case 2:
                    {
                        m_SignHanger = reader.ReadItem();
                        goto case 1;
                    }
                case 1:
                    {
                        if (version < 5)
                            m_DefaultPrice = reader.ReadInt();

                        goto case 0;
                    }
                case 0:
                    {
                        if (version < 3)
                            m_Type = FoundationType.Stone;

                        if (version < 4)
                            m_SignpostGraphic = 9;

                        m_LastRevision = reader.ReadInt();
                        m_Fixtures = reader.ReadItemList();

                        m_Current = new DesignState(this, reader);

                        if ((m_flags & SaveFlags.DesignState_Design) != 0)
                            m_Design = new DesignState(this, reader);

                        if ((m_flags & SaveFlags.DesignState_Backup) != 0)
                            m_Backup = new DesignState(this, reader);

                        break;
                    }
            }

            base.Deserialize(reader);
        }
开发者ID:zerodowned,项目名称:angelisland,代码行数:69,代码来源:HouseFoundation.cs


注:本文中的Server.GenericReader.ReadInt32方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。