當前位置: 首頁>>代碼示例>>C#>>正文


C# GenericReader.ReadSByte方法代碼示例

本文整理匯總了C#中Server.GenericReader.ReadSByte方法的典型用法代碼示例。如果您正苦於以下問題:C# GenericReader.ReadSByte方法的具體用法?C# GenericReader.ReadSByte怎麽用?C# GenericReader.ReadSByte使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Server.GenericReader的用法示例。


在下文中一共展示了GenericReader.ReadSByte方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Deserialize

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

            SetLastMoved();

            switch ( version )
            {
                case 7:
                case 6:
                {
                    SaveFlag flags = (SaveFlag)reader.ReadInt();

                    if ( version < 7 )
                    {
                        LastMoved = reader.ReadDeltaTime();
                    }
                    else
                    {
                        int minutes = reader.ReadEncodedInt();

                        try{ LastMoved = Core.Now - TimeSpan.FromMinutes( minutes ); }
                        catch{ LastMoved = Core.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 = string.Intern(reader.ReadString());

                    if ( GetSaveFlag( flags, SaveFlag.Parent ) )
                    {
                        Serial parent = reader.ReadInt();

                        if ( parent.IsMobile )
                            m_Parent = World.FindMobile( parent );
                        else if ( parent.IsItem )
                            m_Parent = World.FindItem( parent );
                        else
                            m_Parent = null;

                        if ( m_Parent == null && (parent.IsMobile || parent.IsItem) )
                            Delete();
                    }

                    if ( GetSaveFlag( flags, SaveFlag.Items ) )
                        m_Items = reader.ReadItemList();
                    //else
                    //	m_Items = new ArrayList( 1 );

                    if ( GetSaveFlag( flags, SaveFlag.IntWeight ) )
                        m_Weight = reader.ReadEncodedInt();
//.........這裏部分代碼省略.........
開發者ID:BackupTheBerlios,項目名稱:sunuo-svn,代碼行數:101,代碼來源:Item.cs

示例2: 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
//.........這裏部分代碼省略.........
開發者ID:Ravenwolfe,項目名稱:xrunuo,代碼行數:101,代碼來源:Item.cs

示例3: Deserialize

        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch ( version )
            {
                case 0:
                    _Rect = reader.ReadRect2D();
                    _Items = reader.ReadStrongItemList();
                    _Battle = reader.ReadItem<BattleController>();
                    _Owner = reader.ReadInt();
                    _ScoreFactor = reader.ReadSByte();
                    break;
            }

            Timer.DelayCall(TimeSpan.Zero, new TimerCallback(UpdateRect));

            _CheckTimer = Timer.DelayCall(TimeSpan.Zero, TimeSpan.FromSeconds(1.0), new TimerCallback(CheckOwner));
        }
開發者ID:greeduomacro,項目名稱:divinity,代碼行數:21,代碼來源:BattleBuilding.cs

示例4: 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


注:本文中的Server.GenericReader.ReadSByte方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。