public void Serialize(NetBitReader reader) { byte sourceNum = reader.ReadByte(); bool bHasAdditiveSources = reader.ReadBit(); bool bHasOverrideSources = reader.ReadBit(); FVector lastPreAdditiveVelocity = reader.SerializePropertyVector10(); bool bIsAdditiveVelocityApplied = reader.ReadBit(); byte lastAccumulatedSettingsFlags = reader.ReadByte(); //Off by about 130 bits for (int i = 0; i < sourceNum; i++) { uint guid = reader.SerializePropertyObject(); ushort priority = reader.ReadUInt16(); ushort localId = reader.ReadUInt16(); byte accumulatedModeSerialize = reader.ReadByte(); string instanceName = reader.SerializePropertyName(); float currentTime = reader.SerializePropertyFloat(); float duration = reader.SerializePropertyFloat(); byte statusFlags = reader.ReadByte(); bool bInLocalSpace = reader.ReadBit(); } }
private FVector AsVector(VectorType type) { _reader.Reset(); FVector tVector = null; switch (type) { case VectorType.Normal: tVector = _reader.SerializePropertyVectorNormal(); break; case VectorType.Vector10: tVector = _reader.SerializePropertyVector10(); break; case VectorType.Vector100: tVector = _reader.SerializePropertyVector100(); break; case VectorType.Quantize: tVector = _reader.SerializePropertyQuantizedVector(); break; } if (_reader.IsError || !_reader.AtEnd()) { return(null); } return(tVector); }
private FVector AsVector(VectorType type) { _reader.Reset(); FVector tVector = type switch { VectorType.Normal => _reader.SerializePropertyVectorNormal(), VectorType.Vector10 => _reader.SerializePropertyVector10(), VectorType.Vector100 => _reader.SerializePropertyVector100(), VectorType.Quantize => _reader.SerializePropertyQuantizedVector(), _ => null }; if (_reader.IsError || !_reader.AtEnd()) { return(null); } return(tVector); }
/// <summary> /// see https://github.com/EpicGames/UnrealEngine/blob/6c20d9831a968ad3cb156442bebb41a883e62152/Engine/Plugins/Runtime/GameplayAbilities/Source/GameplayAbilities/Private/GameplayEffectTypes.cpp#L789 /// </summary> /// <param name="reader"></param> public void Serialize(NetBitReader reader) { const byte NUM_LEVEL_BITS = 5; // need to bump this up to support 20 levels for AbilityLevel // const byte MAX_LEVEL = (1 << NUM_LEVEL_BITS) - 1; var RepBits = reader.ReadBitsToInt((int)RepFlag.REP_MAX); // Tag containers serialize empty containers with 1 bit, so no need to serialize this in the RepBits field. AggregatedSourceTags.Serialize(reader); AggregatedTargetTags.Serialize(reader); if ((RepBits & (1 << (int)RepFlag.REP_NormalizedMagnitude)) > 0) { NormalizedMagnitude = reader.ReadSingle(); } if ((RepBits & (1 << (int)RepFlag.REP_RawMagnitude)) > 0) { RawMagnitude = reader.ReadSingle(); } if ((RepBits & (1 << (int)RepFlag.REP_EffectContext)) > 0) { // FGameplayEffectContextHandle if (reader.ReadBit()) { var handle = new FGameplayEffectContextHandle(); handle.Serialize(reader); } } if ((RepBits & (1 << (int)RepFlag.REP_Location)) > 0) { Location = reader.SerializePropertyVector10(); } if ((RepBits & (1 << (int)RepFlag.REP_Normal)) > 0) { Normal = reader.SerializePropertyVectorNormal(); } if ((RepBits & (1 << (int)RepFlag.REP_Instigator)) > 0) { Instigator = reader.ReadIntPacked(); } if ((RepBits & (1 << (int)RepFlag.REP_EffectCauser)) > 0) { EffectCauser = reader.ReadIntPacked(); } if ((RepBits & (1 << (int)RepFlag.REP_SourceObject)) > 0) { SourceObject = reader.ReadIntPacked(); } if ((RepBits & (1 << (int)RepFlag.REP_TargetAttachComponent)) > 0) { TargetAttachComponent = reader.ReadIntPacked(); } if ((RepBits & (1 << (int)RepFlag.REP_PhysMaterial)) > 0) { PhysicalMaterial = reader.ReadIntPacked(); } if ((RepBits & (1 << (int)RepFlag.REP_GELevel)) > 0) { GameplayEffectLevel = reader.ReadBitsToInt(NUM_LEVEL_BITS); } if ((RepBits & (1 << (int)RepFlag.REP_AbilityLevel)) > 0) { AbilityLevel = reader.ReadBitsToInt(NUM_LEVEL_BITS); } }