Exemplo n.º 1
0
 public void SerializeToStream(ref IBitStream stream)
 {
     AbilityResultsUtils.SerializeEffectsToStartToStream(ref stream, m_effectsToStart);
     AbilityResultsUtils.SerializeBarriersToStartToStream(ref stream, m_barriersToStart);
     AbilityResultsUtils.SerializeIntListToStream(ref stream, m_effectsToRemove);
     AbilityResultsUtils.SerializeIntListToStream(ref stream, m_barriersToRemove);
     AbilityResultsUtils.SerializeSequenceEndDataListToStream(ref stream, m_sequencesToEnd);
     AbilityResultsUtils.SerializeClientMovementResultsListToStream(ref stream, m_reactionsOnPosHit);
 }
Exemplo n.º 2
0
    public void SerializeToStream(ref IBitStream stream)
    {
        byte bitField1 = ServerClientUtils.CreateBitfieldFromBools(
            m_hasDamage,
            m_hasHealing,
            m_hasTechPointGain,
            m_hasTechPointLoss,
            m_hasTechPointGainOnCaster,
            m_hasKnockback,
            m_targetInCoverWrtDamage,
            m_canBeReactedTo);

        stream.Serialize(ref bitField1);

        byte bitField2 = ServerClientUtils.CreateBitfieldFromBools(
            m_damageBoosted,
            m_damageReduced,
            m_updateCasterLastKnownPos,
            m_updateTargetLastKnownPos,
            m_updateEffectHolderLastKnownPos,
            m_updateOtherLastKnownPos,
            m_isPartOfHealOverTime,
            m_triggerCasterVisOnHitVisualOnly);

        stream.Serialize(ref bitField2);

        if (m_hasDamage)
        {
            short finalDamage = (short)m_finalDamage;
            stream.Serialize(ref finalDamage);
        }
        if (m_hasHealing)
        {
            short finalHealing = (short)m_finalHealing;
            stream.Serialize(ref finalHealing);
        }
        if (m_hasTechPointGain)
        {
            short finalTechPointsGain = (short)m_finalTechPointsGain;
            stream.Serialize(ref finalTechPointsGain);
        }
        if (m_hasTechPointLoss)
        {
            short finalTechPointsLoss = (short)m_finalTechPointsLoss;
            stream.Serialize(ref finalTechPointsLoss);
        }
        if (m_hasTechPointGainOnCaster)
        {
            short finalTechPointGainOnCaster = (short)m_finalTechPointGainOnCaster;
            stream.Serialize(ref finalTechPointGainOnCaster);
        }
        if (m_hasKnockback)
        {
            short actorIndex = (short)(m_knockbackSourceActor?.ActorIndex ?? ActorData.s_invalidActorIndex);
            stream.Serialize(ref actorIndex);
        }
        if (m_hasDamage && m_targetInCoverWrtDamage || m_hasKnockback)
        {
            float damageHitOriginX = m_damageHitOrigin.x;
            float damageHitOriginZ = m_damageHitOrigin.z;
            stream.Serialize(ref damageHitOriginX);
            stream.Serialize(ref damageHitOriginZ);
        }
        if (m_updateEffectHolderLastKnownPos)
        {
            short effectHolderActor = (short)(m_effectHolderActor?.ActorIndex ?? ActorData.s_invalidActorIndex);
            stream.Serialize(ref effectHolderActor);
        }
        if (m_updateOtherLastKnownPos)
        {
            byte otherActorsToUpdateVisibilityNum = (byte)(m_otherActorsToUpdateVisibility?.Count ?? 0);
            stream.Serialize(ref otherActorsToUpdateVisibilityNum);
            for (int i = 0; i < otherActorsToUpdateVisibilityNum; i++)
            {
                short actorIndex = (short)m_otherActorsToUpdateVisibility[i].ActorIndex;
                stream.Serialize(ref actorIndex);
            }
        }

        bool hasEffectsToStart          = !m_effectsToStart.IsNullOrEmpty();
        bool hasEffectsToRemove         = !m_effectsToRemove.IsNullOrEmpty();
        bool hasBarriersToAdd           = !m_barriersToAdd.IsNullOrEmpty();
        bool hasBarriersToRemove        = !m_barriersToRemove.IsNullOrEmpty();
        bool hasSequencesToEnd          = !m_sequencesToEnd.IsNullOrEmpty();
        bool hasReactions               = !m_reactions.IsNullOrEmpty();
        bool hasPowerupsToRemove        = !m_powerupsToRemove.IsNullOrEmpty();
        bool hasPowerupsToSteal         = !m_powerupsToSteal.IsNullOrEmpty();
        bool hasDirectPowerupHits       = !m_directPowerupHits.IsNullOrEmpty();
        bool hasGameModeEvents          = !m_gameModeEvents.IsNullOrEmpty();
        bool isCharacterSpecificAbility = m_isCharacterSpecificAbility;
        bool hasOverconIds              = !m_overconIds.IsNullOrEmpty();
        byte bitField3 = ServerClientUtils.CreateBitfieldFromBools(
            hasEffectsToStart,
            hasEffectsToRemove,
            hasBarriersToRemove,
            hasSequencesToEnd,
            hasReactions,
            hasPowerupsToRemove,
            hasPowerupsToSteal,
            hasDirectPowerupHits);
        byte bitField4 = ServerClientUtils.CreateBitfieldFromBools(
            hasGameModeEvents,
            isCharacterSpecificAbility,
            hasBarriersToAdd,
            hasOverconIds,
            false, false, false, false);

        stream.Serialize(ref bitField3);
        stream.Serialize(ref bitField4);

        if (hasEffectsToStart)
        {
            AbilityResultsUtils.SerializeEffectsToStartToStream(ref stream, m_effectsToStart);
        }
        if (hasEffectsToRemove)
        {
            AbilityResultsUtils.SerializeIntListToStream(ref stream, m_effectsToRemove);
        }
        if (hasBarriersToAdd)
        {
            AbilityResultsUtils.SerializeBarriersToStartToStream(ref stream, m_barriersToAdd);
        }
        if (hasBarriersToRemove)
        {
            AbilityResultsUtils.SerializeIntListToStream(ref stream, m_barriersToRemove);
        }
        if (hasSequencesToEnd)
        {
            AbilityResultsUtils.SerializeSequenceEndDataListToStream(ref stream, m_sequencesToEnd);
        }
        if (hasReactions)
        {
            AbilityResultsUtils.SerializeClientReactionResultsToStream(ref stream, m_reactions);
        }
        if (hasPowerupsToRemove)
        {
            AbilityResultsUtils.SerializeIntListToStream(ref stream, m_powerupsToRemove);
        }
        if (hasPowerupsToSteal)
        {
            AbilityResultsUtils.SerializePowerupsToStealToStream(ref stream, m_powerupsToSteal);
        }
        if (hasDirectPowerupHits)
        {
            AbilityResultsUtils.SerializeClientMovementResultsListToStream(ref stream, m_directPowerupHits);
        }
        if (hasGameModeEvents)
        {
            AbilityResultsUtils.SerializeClientGameModeEventListToStream(ref stream, m_gameModeEvents);
        }
        if (hasOverconIds)
        {
            AbilityResultsUtils.SerializeIntListToStream(ref stream, m_overconIds);
        }
        m_isCharacterSpecificAbility = isCharacterSpecificAbility;
    }