Esempio n. 1
0
        public static void Deserialize(IGenericReader reader, int version, BaseObjectiveInstance objInstance)
        {
            if (reader.ReadBool())
            {
                DateTime endTime = reader.ReadDeltaTime();

                if (objInstance != null)
                {
                    objInstance.EndTime = endTime;
                }
            }

            DataType extraDataType = (DataType)reader.ReadByte();

            switch (extraDataType)
            {
            case DataType.EscortObjective:
            {
                bool completed = reader.ReadBool();

                if (objInstance is EscortObjectiveInstance instance)
                {
                    instance.HasCompleted = completed;
                }

                break;
            }

            case DataType.KillObjective:
            {
                int slain = reader.ReadInt();

                if (objInstance is KillObjectiveInstance instance)
                {
                    instance.Slain = slain;
                }

                break;
            }

            case DataType.DeliverObjective:
            {
                bool completed = reader.ReadBool();

                if (objInstance is DeliverObjectiveInstance instance)
                {
                    instance.HasCompleted = completed;
                }

                break;
            }
            }
        }
Esempio n. 2
0
		public static void Deserialize( GenericReader reader, int version, BaseObjectiveInstance objInstance )
		{
			if ( reader.ReadBool() )
			{
				DateTime endTime = reader.ReadDeltaTime();

				if ( objInstance != null )
					objInstance.EndTime = endTime;
			}

			DataType extraDataType = (DataType)reader.ReadByte();

			switch ( extraDataType )
			{
				case DataType.EscortObjective:
				{
					bool completed = reader.ReadBool();

					if ( objInstance is EscortObjectiveInstance )
						( (EscortObjectiveInstance)objInstance ).HasCompleted = completed;

					break;
				}
				case DataType.KillObjective:
				{
					int slain = reader.ReadInt();

					if ( objInstance is KillObjectiveInstance )
						( (KillObjectiveInstance)objInstance ).Slain = slain;

					break;
				}
				case DataType.DeliverObjective:
				{
					bool completed = reader.ReadBool();

					if ( objInstance is DeliverObjectiveInstance )
						( (DeliverObjectiveInstance)objInstance ).HasCompleted = completed;

					break;
				}
			}
		}