Example #1
0
        /// <inheritdoc />
        public void Send([NotNull] EntityVisibilityChangeContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            NetworkObjectVisibilityChangeEventPayload         changeEventPayload = BuildPayload(context.InterestCollection);
            IPeerPayloadSendService <GameServerPacketPayload> sendService        = RetrieveSendService(context.EntityGuid);

            sendService.SendMessage(changeEventPayload, DeliveryMethod.ReliableOrdered)
            .ConfigureAwait(false);
        }
Example #2
0
        /// <inheritdoc />
        public async Task SendAsync([NotNull] EntityVisibilityChangeContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            NetworkObjectVisibilityChangeEventPayload         changeEventPayload = BuildPayload(context.InterestCollection);
            IPeerPayloadSendService <GameServerPacketPayload> sendService        = RetrieveSendService(context.EntityGuid);

            //TODO: Should we await or return?
            await sendService.SendMessage(changeEventPayload, DeliveryMethod.ReliableOrdered)
            .ConfigureAwaitFalse();
        }
Example #3
0
        //This extension exists mostly to support the old TCP only API
        /// <summary>
        /// Sends the provided <see cref="payload"/>
        /// </summary>
        /// <typeparam name="TPayloadType">The type of payload.</typeparam>
        /// <typeparam name="TPayloadBaseType">The base type of the payload.</typeparam>
        /// <param name="sendService">The extended send service.</param>
        /// <param name="payload">The payload to send.</param>
        /// <returns>Indicates the result of the send message operation.</returns>
        public static Task <SendResult> SendMessage <TPayloadBaseType, TPayloadType>(this IPeerPayloadSendService <TPayloadBaseType> sendService, TPayloadType payload)
            where TPayloadType : class, TPayloadBaseType
            where TPayloadBaseType : class
        {
            if (sendService == null)
            {
                throw new ArgumentNullException(nameof(sendService));
            }
            if (payload == null)
            {
                throw new ArgumentNullException(nameof(payload));
            }

            //We default to reliable ordered as if this is TCP
            return(sendService.SendMessage(payload, DeliveryMethod.ReliableOrdered));
        }
Example #4
0
        protected override void HandleMessage(EntityActorMessageContext messageContext, NetworkedObjectActorState state, BroadcastToInterestSetMessage message)
        {
            IPeerPayloadSendService <GameServerPacketPayload> sender = null;

            foreach (NetworkEntityGuid guid in state.Interest.ContainedEntities)
            {
                //If it's not a player or the message specified that we shouldn't send to self and it's ourselves
                if (guid.EntityType != EntityType.Player || !message.SendToSelf && guid == state.EntityGuid)
                {
                    continue;
                }

                //Try to get the sender and then just forward the message.
                if (SendServiceMappable.TryGetValue(guid, out sender))
                {
                    sender.SendMessage(message.Message);
                }
            }
        }
        private async Task SendTabInterfaces(IPeerPayloadSendService <BaseGameServerPayload> contextPayloadSendService)
        {
            await contextPayloadSendService.SendMessage(new ServerLinkTabsToInterfacePayload(3971, 1));

            await contextPayloadSendService.SendMessage(new ServerLinkTabsToInterfacePayload(638, 2));

            await contextPayloadSendService.SendMessage(new ServerLinkTabsToInterfacePayload(3213, 3));

            await contextPayloadSendService.SendMessage(new ServerLinkTabsToInterfacePayload(1644, 4));

            await contextPayloadSendService.SendMessage(new ServerLinkTabsToInterfacePayload(5608, 5));

            await contextPayloadSendService.SendMessage(new ServerLinkTabsToInterfacePayload(1151, 6));

            await contextPayloadSendService.SendMessage(new ServerLinkTabsToInterfacePayload(short.MaxValue, 7));             //TODO: This one is wrong.

            await contextPayloadSendService.SendMessage(new ServerLinkTabsToInterfacePayload(5065, 8));

            await contextPayloadSendService.SendMessage(new ServerLinkTabsToInterfacePayload(5715, 9));

            await contextPayloadSendService.SendMessage(new ServerLinkTabsToInterfacePayload(2449, 10));

            await contextPayloadSendService.SendMessage(new ServerLinkTabsToInterfacePayload(4445, 11));

            await contextPayloadSendService.SendMessage(new ServerLinkTabsToInterfacePayload(147, 12));

            await contextPayloadSendService.SendMessage(new ServerLinkTabsToInterfacePayload(962, 13));

            await contextPayloadSendService.SendMessage(new ServerLinkTabsToInterfacePayload(2423, 0));

            await contextPayloadSendService.SendMessage(new ServerLinkTabsToInterfacePayload(5855, 0));
        }