/// <summary> /// see https://github.com/EpicGames/UnrealEngine/blob/6c20d9831a968ad3cb156442bebb41a883e62152/Engine/Plugins/Runtime/GameplayAbilities/Source/GameplayAbilities/Private/GameplayEffectTypes.cpp#L311 /// see https://github.com/EpicGames/UnrealEngine/blob/6c20d9831a968ad3cb156442bebb41a883e62152/Engine/Plugins/Runtime/GameplayAbilities/Source/GameplayAbilities/Private/GameplayEffectTypes.cpp#L177 /// </summary> /// <param name="reader"></param> public void Serialize(NetBitReader reader) { var validData = reader.ReadBit(); if (validData) { var RepBits = reader.ReadBitsToInt(7); if ((RepBits & (1 << 0)) > 0) { Instigator = reader.ReadIntPacked(); } if ((RepBits & (1 << 1)) > 0) { EffectCauser = reader.ReadIntPacked(); } if ((RepBits & (1 << 2)) > 0) { AbilityCDO = reader.ReadIntPacked(); } if ((RepBits & (1 << 3)) > 0) { SourceObject = reader.ReadIntPacked(); } if ((RepBits & (1 << 4)) > 0) { // SafeNetSerializeTArray_HeaderOnly var bitCount = (int)Math.Ceiling(Math.Log2(31)); var arrayNum = reader.ReadBitsToInt(bitCount); // SafeNetSerializeTArray_Default Actors = new ActorGuid[arrayNum]; for (var i = 0; i < arrayNum; i++) { Actors[i] = new ActorGuid() { Value = reader.ReadIntPacked() }; } } if ((RepBits & (1 << 5)) > 0) { HitResult = new FHitResult(reader); } if ((RepBits & (1 << 6)) > 0) { WorldOrigin = reader.SerializePropertyVector100(); bHasWorldOrigin = true; } else { bHasWorldOrigin = false; } } }
public void Serialize(NetBitReader reader) { var isHardcoded = reader.ReadBoolean(); if (isHardcoded) { uint nameIndex; if (reader.EngineNetworkVersion < EngineNetworkVersionHistory.HISTORY_CHANNEL_NAMES) { nameIndex = reader.ReadUInt32(); } else { nameIndex = reader.ReadIntPacked(); } Value = ((UnrealNames)nameIndex).ToString(); return; } var inString = reader.ReadFString(); var inNumber = reader.ReadInt32(); Value = inString; }
public void Serialize(NetBitReader reader) { uint total = reader.ReadIntPacked(); if (total == 0) { RemoveAll = true; } else { uint id = reader.ReadIntPacked(); if (id == 0) { RemoveId = (total); } else { Ids = new string[total]; Ids[id - 1] = ParseId(); while (id < total) { id = reader.ReadIntPacked(); Ids[id - 1] = ParseId(); } } } reader.SkipBits(8); string ParseId() { reader.SkipBits(32); //Always the same string playerId = reader.SerializePropertyNetId(); reader.SkipBits(8); //Always 0 return(playerId); } }
public void Serialize(NetBitReader reader) { if (reader.EngineNetworkVersion >= EngineNetworkVersionHistory.HISTORY_FAST_ARRAY_DELTA_STRUCT) { reader.ReadBit(); } reader.ReadBit(); Id = reader.ReadIntPacked(); reader.SkipBits(31); }
public void Serialize(NetBitReader reader) { reader.ReadBits(2); //Unknown Id = new NetworkGUID { Value = reader.ReadIntPacked() }; reader.ReadBits(31); //Unknown }
public void Serialize(NetBitReader reader) { bool repPosition = reader.ReadBoolean(); if (repPosition) { bRepPosition = true; SectionIdToPlay = 0; SkipPositionCorrection = false; uint packedPosition = reader.ReadIntPacked(); Position = packedPosition / 100; } else { bRepPosition = false; SkipPositionCorrection = true; Position = 0; SectionIdToPlay = reader.ReadBitsToInt(7); } IsStopped = reader.ReadBit(); ForcePlayBit = reader.ReadBit(); SkipPositionCorrection = reader.ReadBit(); bSkipPlayRate = reader.ReadBit(); AnimMontage = new UObjectGUID { Value = reader.ReadIntPacked() }; PlayRate = reader.SerializePropertyFloat(); BlendTime = reader.SerializePropertyFloat(); NextSectionID = reader.ReadByte(); PredictionKey = new FPredictionKey(); PredictionKey.Serialize(reader); }
/* * private FRepMovement AsRepMovement() * { * _reader.Reset(); * * FRepMovement repMovement = _reader.SerializeRepMovement(); * * if(_reader.IsError || !_reader.AtEnd()) * { * return null; * } * * return repMovement; * } */ private string AsStaticName() { _reader.Reset(); var isHardcoded = _reader.ReadBoolean(); if (isHardcoded) { uint nameIndex; if (_reader.EngineNetworkVersion < EngineNetworkVersionHistory.HISTORY_CHANNEL_NAMES) { nameIndex = _reader.ReadUInt32(); } else { nameIndex = _reader.ReadIntPacked(); } if (_reader.IsError || !_reader.AtEnd()) { return(null); } return(((UnrealNames)nameIndex).ToString()); } var inString = _reader.ReadFString(); var inNumber = _reader.ReadInt32(); if (_reader.IsError || !_reader.AtEnd()) { return(null); } return(inString); }
public void Serialize(NetBitReader reader) { TagIndex = reader.ReadIntPacked(); }
private uint AsIntPacked() { _reader.Reset(); return(_reader.ReadIntPacked()); }
/// <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); } }
public void Serialize(NetBitReader reader) { Value = reader.ReadIntPacked(); }