Example #1
0
        protected override void OnEntityCreationFinished(EntityCreationFinishedEventArgs args)
        {
            IMovementData             movementData       = MovementDataMappable.RetrieveEntity(args.EntityGuid);
            IEntityDataFieldContainer dataFieldContainer = EntityDataMappable.RetrieveEntity(args.EntityGuid);

            EntityCreationData data = new EntityCreationData(args.EntityGuid, movementData, EntityDataUpdateFactory.Create(new EntityFieldUpdateCreationContext(dataFieldContainer, dataFieldContainer.DataSetIndicationArray)));

            var senderContext = new GenericSingleTargetMessageContext <PlayerSelfSpawnEventPayload>(args.EntityGuid, new PlayerSelfSpawnEventPayload(data));

            Sender.Send(senderContext);
        }
Example #2
0
        /// <inheritdoc />
        public async Task SendAsync(GenericSingleTargetMessageContext <TPayloadType> context)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            if (!SessionMappable.ContainsKey(context.EntityGuid))
            {
                LogNoSessionError(context.EntityGuid);
            }
            else
            {
                //Should we configure await false?
                //TODO: Develivery method?
                await SessionMappable.RetrieveEntity(context.EntityGuid).SendMessage(context.PayloadToSend)
                .ConfigureAwaitFalse();
            }
        }
Example #3
0
        /// <inheritdoc />
        public void Send(GenericSingleTargetMessageContext <TPayloadType> context)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            if (!SessionMappable.ContainsKey(context.EntityGuid))
            {
                LogNoSessionError(context.EntityGuid);
            }
            else
            {
                //We MUST unwrap the task otherwise we will not get exceptions. Which is BAD.
                //TODO: Develivery method?
                SessionMappable.RetrieveEntity(context.EntityGuid).SendMessageImmediately(context.PayloadToSend)
                .ConfigureAwaitFalse()
                .GetAwaiter()
                .GetResult();
            }
        }