private void FlushRecordInvokeEntriesAndSend() { if (this._invokeTableOffsets.Count > 0) { MPSendPacketContainer pc = Singleton <MPManager> .Instance.CreateSendPacket(typeof(Packet_Ability_InvocationTable), this._invokeTableBuilder); VectorOffset invokesOffset = Packet_Ability_InvocationTable.CreateInvokesVector(pc.builder, this._invokeTableOffsets.ToArray()); Offset <Packet_Ability_InvocationTable> offset = Packet_Ability_InvocationTable.CreatePacket_Ability_InvocationTable(pc.builder, invokesOffset); pc.Finish <Packet_Ability_InvocationTable>(offset); if (this._abilityIdentity.isAuthority) { Singleton <MPManager> .Instance.SendReliableToOthers(base._owner.runtimeID, pc); } else { Singleton <MPManager> .Instance.SendReliableToPeer(base._owner.runtimeID, this._abilityIdentity.GetPeerID(), pc); } this._invokeTableBuilder.Clear(); this._invokeTableOffsets.Clear(); } }
public void HandleInvokes(Packet_Ability_InvocationTable table, int fromPeerID) { int invokesLength = table.InvokesLength; for (int i = 0; i < invokesLength; i++) { AbilityInvokeEntry invokes = table.GetInvokes(i); if (invokes.LocalID == 0xff) { if (this._abilityIdentity.isAuthority) { this.MetaAuthorityInvokeHandler(invokes); } else { this.MetaRemoteInvokeHandler(invokes); } } else { ActorAbility parentAbility; ActorModifier instancedModifierByID; uint target = invokes.Target; BaseAbilityActor actor = (target != 0) ? Singleton <EventManager> .Instance.GetActor <BaseAbilityActor>(target) : base._owner; if (actor == null) { return; } int instancedModifierID = invokes.InstancedModifierID; if (instancedModifierID != 0) { instancedModifierByID = this.GetInstancedModifierByID(instancedModifierID); parentAbility = instancedModifierByID.parentAbility; } else { instancedModifierByID = null; parentAbility = this.GetInstancedAbilityByID(invokes.InstancedAbilityID); } BaseActionContainer container = parentAbility.config.InvokeSites[invokes.LocalID]; if (container is ConfigAbilityAction) { ConfigAbilityAction actionConfig = (ConfigAbilityAction)container; actionConfig.MPGetRemoteHandler(this)(actionConfig, parentAbility, instancedModifierByID, actor, invokes); } else { BaseAbilityMixin instancedMixin = null; if (instancedModifierByID != null) { instancedMixin = instancedModifierByID.GetInstancedMixin(invokes.LocalID); } if (instancedMixin == null) { instancedMixin = parentAbility.GetInstancedMixin(invokes.LocalID); } instancedMixin.HandleMixinInvokeEntry(invokes, fromPeerID); } } } }