예제 #1
0
        public TargetUnitFrameUIControllerEventListener(ILocalPlayerSpawnedEventSubscribable subscriptionService,
                                                        IEntityDataChangeCallbackRegisterable entityDataCallbackRegister,
                                                        IReadonlyLocalPlayerDetails playerDetails,
                                                        [NotNull][KeyFilter(UnityUIRegisterationKey.TargetUnitFrame)] IUIUnitFrame targetUnitFrame,
                                                        [NotNull] ILog logger,
                                                        INetworkEntityVisibilityLostEventSubscribable networkVisibilityLostSubscriptionService,
                                                        [NotNull] IPeerPayloadSendService <GameClientPacketPayload> sendService)
            : base(subscriptionService, entityDataCallbackRegister, playerDetails)
        {
            TargetUnitFrame = targetUnitFrame ?? throw new ArgumentNullException(nameof(targetUnitFrame));
            Logger          = logger ?? throw new ArgumentNullException(nameof(logger));
            SendService     = sendService ?? throw new ArgumentNullException(nameof(sendService));

            //Subscribe to when the target actually disappears.
            networkVisibilityLostSubscriptionService.OnNetworkEntityVisibilityLost += (sender, args) =>
            {
                UnityAsyncHelper.UnityMainThreadContext.Post(o =>
                {
                    //This should be safe, we're checking if it was the current target still
                    //user may have clicked on something else but this should be safe this way.
                    if (args.EntityGuid == this.CurrentTarget)
                    {
                        OnPlayerTargetDisappeared();
                    }
                }, null);
            };
        }
        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));
        }
 /// <inheritdoc />
 public DefaultLocalPlayerNetworkMovementController([NotNull] IPeerPayloadSendService <PSOBBGamePacketPayloadClient> sendService, [NotNull] IUnitScalerStrategy unitScaler, [NotNull] IZoneSettings zoneData, [NotNull] IRoomQueryable roomQueryService, [NotNull] ICharacterSlotSelectedModel playerSlotModel)
 {
     SendService      = sendService ?? throw new ArgumentNullException(nameof(sendService));
     UnitScaler       = unitScaler ?? throw new ArgumentNullException(nameof(unitScaler));
     ZoneData         = zoneData ?? throw new ArgumentNullException(nameof(zoneData));
     RoomQueryService = roomQueryService ?? throw new ArgumentNullException(nameof(roomQueryService));
     PlayerSlotModel  = playerSlotModel ?? throw new ArgumentNullException(nameof(playerSlotModel));
 }
 /// <inheritdoc />
 public CharacterServerShipListDataRecieveEventListener(
     [NotNull] IShipListingEventSubscribable subscriptionService,
     [NotNull] IPeerPayloadSendService <PSOBBGamePacketPayloadClient> sendService,
     [KeyFilter(UnityUIRegisterationKey.ServerSelectionButton)][NotNull] IReadOnlyCollection <IUILabeledButton> staticShipButtons)
     : base(subscriptionService, staticShipButtons, sendService, false)
 {
     //false means we don't listen to events through overridable virtuals
 }
예제 #5
0
 public OnConnectionEstablishedClaimSessionEventListener(INetworkConnectionEstablishedEventSubscribable subscriptionService,
                                                         [NotNull] IPeerPayloadSendService <GameClientPacketPayload> sendService,
                                                         [NotNull] IReadonlyAuthTokenRepository authTokenRepository,
                                                         [NotNull] ILocalCharacterDataRepository characterDataRepository)
     : base(subscriptionService)
 {
     SendService             = sendService ?? throw new ArgumentNullException(nameof(sendService));
     AuthTokenRepository     = authTokenRepository ?? throw new ArgumentNullException(nameof(authTokenRepository));
     CharacterDataRepository = characterDataRepository ?? throw new ArgumentNullException(nameof(characterDataRepository));
 }
예제 #6
0
 public DemoSpellCastingActionBarEventListener(IActionBarButtonPressedEventSubscribable subscriptionService,
                                               [NotNull] IPeerPayloadSendService <GameClientPacketPayload> sendService,
                                               [NotNull] IReadonlyActionBarCollection actionBarCollection,
                                               [NotNull] ILog logger)
     : base(subscriptionService)
 {
     SendService         = sendService ?? throw new ArgumentNullException(nameof(sendService));
     ActionBarCollection = actionBarCollection ?? throw new ArgumentNullException(nameof(actionBarCollection));
     Logger = logger ?? throw new ArgumentNullException(nameof(logger));
 }
        /// <inheritdoc />
        public PlayerEntitySessionContext([NotNull] IPeerPayloadSendService <GameServerPacketPayload> zoneSession, int connectionId)
        {
            //TODO: Maybe this should be a uint?
            if (connectionId <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(connectionId));
            }

            ZoneSession  = zoneSession ?? throw new ArgumentNullException(nameof(zoneSession));
            ConnectionId = connectionId;
        }
예제 #8
0
 public HackyInstanceSharedClientData([NotNull] INetworkSerializationService serializerService,
                                      [JetBrains.Annotations.NotNull] MessageHandlerService <GameServerPacketPayload, GameClientPacketPayload> messageHandler,
                                      [JetBrains.Annotations.NotNull] IPeerMessageContextFactory messageContextFactory,
                                      [JetBrains.Annotations.NotNull] IConnectionService connectionService,
                                      [JetBrains.Annotations.NotNull] IPeerPayloadSendService <GameClientPacketPayload> sendService)
 {
     SerializerService     = serializerService ?? throw new ArgumentNullException(nameof(serializerService));
     MessageHandler        = messageHandler ?? throw new ArgumentNullException(nameof(messageHandler));
     MessageContextFactory = messageContextFactory ?? throw new ArgumentNullException(nameof(messageContextFactory));
     ConnectionService     = connectionService ?? throw new ArgumentNullException(nameof(connectionService));
     SendService           = sendService ?? throw new ArgumentNullException(nameof(sendService));
 }
예제 #9
0
 public DemoMakeObjectsClickableInteractableEventListener(IEntityCreationFinishedEventSubscribable subscriptionService,
                                                          [NotNull] IReadonlyEntityGuidMappable <GameObject> gameObjectMappable,
                                                          [NotNull] IPeerPayloadSendService <GameClientPacketPayload> sendService,
                                                          [NotNull] IReadonlyLocalPlayerDetails localPlayerDetails,
                                                          [NotNull] IReadonlyEntityGuidMappable <IEntityDataFieldContainer> entityDataFieldMappable)
     : base(subscriptionService)
 {
     GameObjectMappable      = gameObjectMappable ?? throw new ArgumentNullException(nameof(gameObjectMappable));
     SendService             = sendService ?? throw new ArgumentNullException(nameof(sendService));
     LocalPlayerDetails      = localPlayerDetails ?? throw new ArgumentNullException(nameof(localPlayerDetails));
     EntityDataFieldMappable = entityDataFieldMappable ?? throw new ArgumentNullException(nameof(entityDataFieldMappable));
 }
예제 #10
0
 public OnCameraInputChangedSendRotationUpdateEventListener(ICameraInputChangedEventSubscribable subscriptionService,
                                                            [NotNull] IPeerPayloadSendService <GameClientPacketPayload> sendService,
                                                            [NotNull] IReadonlyNetworkTimeService timeService,
                                                            [NotNull] IReadonlyEntityGuidMappable <WorldTransform> transformMappable,
                                                            [NotNull] IReadonlyLocalPlayerDetails playerDetails)
     : base(subscriptionService)
 {
     SendService       = sendService ?? throw new ArgumentNullException(nameof(sendService));
     TimeService       = timeService ?? throw new ArgumentNullException(nameof(timeService));
     TransformMappable = transformMappable ?? throw new ArgumentNullException(nameof(transformMappable));
     PlayerDetails     = playerDetails ?? throw new ArgumentNullException(nameof(playerDetails));
 }
예제 #11
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);
        }
예제 #12
0
        /// <inheritdoc />
        public PayloadInterceptMessageSendService(IPayloadInterceptable interceptionService, IPeerPayloadSendService <TPayloadBaseType> sendService)
        {
            if (interceptionService == null)
            {
                throw new ArgumentNullException(nameof(interceptionService));
            }
            if (sendService == null)
            {
                throw new ArgumentNullException(nameof(sendService));
            }

            InterceptionService = interceptionService;
            SendService         = sendService;
        }
예제 #13
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();
        }
예제 #14
0
        public LocalPlayerSpawnedBroadcastTrackerStateChangesTickable(ILocalPlayerSpawnedEventSubscribable subscriptionService,
                                                                      [NotNull] ICameraInputChangedEventSubscribable cameraInputSubscriptionService,
                                                                      [NotNull] IFactoryCreatable <PlayerNetworkTrackerChangeUpdateRequest, NetworkMovementTrackerTypeFlags> networkTrackerUpdateFactory,
                                                                      [NotNull] IPeerPayloadSendService <GameClientPacketPayload> sendService)
            : base(subscriptionService)
        {
            if (cameraInputSubscriptionService == null)
            {
                throw new ArgumentNullException(nameof(cameraInputSubscriptionService));
            }

            NetworkTrackerUpdateFactory = networkTrackerUpdateFactory ?? throw new ArgumentNullException(nameof(networkTrackerUpdateFactory));
            SendService = sendService ?? throw new ArgumentNullException(nameof(sendService));
            cameraInputSubscriptionService.OnCameraInputChange += OnCameraInputChanged;
        }
 /// <inheritdoc />
 public HubConnectionMessageContext(
     [JetBrains.Annotations.NotNull] IConnectionService connectionService,
     [JetBrains.Annotations.NotNull] IPeerPayloadSendService <object> payloadSendService,
     [JetBrains.Annotations.NotNull] IPeerRequestSendService <object> requestSendService,
     [JetBrains.Annotations.NotNull] IGroupManager groups,
     [JetBrains.Annotations.NotNull] IHubCallerClients <TRemoteClientHubType> clients,
     [JetBrains.Annotations.NotNull] HubCallerContext hubConntext)
 {
     ConnectionService  = connectionService ?? throw new ArgumentNullException(nameof(connectionService));
     PayloadSendService = payloadSendService ?? throw new ArgumentNullException(nameof(payloadSendService));
     RequestSendService = requestSendService ?? throw new ArgumentNullException(nameof(requestSendService));
     Groups             = groups ?? throw new ArgumentNullException(nameof(groups));
     Clients            = clients ?? throw new ArgumentNullException(nameof(clients));
     HubConntext        = hubConntext ?? throw new ArgumentNullException(nameof(hubConntext));
 }
예제 #16
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));
        }
 public OnConnectionEstablishedClaimSessionEventListener(INetworkConnectionEstablishedEventSubscribable subscriptionService,
                                                         [NotNull] IPeerPayloadSendService <GameClientPacketPayload> sendService,
                                                         [NotNull] IReadonlyAuthTokenRepository authTokenRepository,
                                                         [NotNull] ILocalCharacterDataRepository characterDataRepository,
                                                         [NotNull] ICharacterService characterService,
                                                         [JetBrains.Annotations.NotNull] ILog logger,
                                                         [JetBrains.Annotations.NotNull] IGameContextEventQueueable eventQueueable)
     : base(subscriptionService)
 {
     SendService             = sendService ?? throw new ArgumentNullException(nameof(sendService));
     AuthTokenRepository     = authTokenRepository ?? throw new ArgumentNullException(nameof(authTokenRepository));
     CharacterDataRepository = characterDataRepository ?? throw new ArgumentNullException(nameof(characterDataRepository));
     CharacterService        = characterService ?? throw new ArgumentNullException(nameof(characterService));
     Logger         = logger ?? throw new ArgumentNullException(nameof(logger));
     EventQueueable = eventQueueable ?? throw new ArgumentNullException(nameof(eventQueueable));
 }
예제 #18
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);
                }
            }
        }
예제 #19
0
        /// <inheritdoc />
        public DefaultPeerMessageContext(IConnectionService connectionService, IPeerPayloadSendService <TPayloadBaseType> payloadSendService, IPeerRequestSendService <TPayloadBaseType> requestSendService)
        {
            if (connectionService == null)
            {
                throw new ArgumentNullException(nameof(connectionService));
            }
            if (payloadSendService == null)
            {
                throw new ArgumentNullException(nameof(payloadSendService));
            }
            if (requestSendService == null)
            {
                throw new ArgumentNullException(nameof(requestSendService));
            }

            ConnectionService  = connectionService;
            PayloadSendService = payloadSendService;
            RequestSendService = requestSendService;
        }
        /// <inheritdoc />
        public AuthSessionMessageContext([NotNull] IConnectionService connectionService, [NotNull] IPeerPayloadSendService <AuthenticationServerPayload> payloadSendService, [NotNull] IPeerRequestSendService <AuthenticationServerPayload> requestSendService, [NotNull] SessionDetails details)
        {
            if (connectionService == null)
            {
                throw new ArgumentNullException(nameof(connectionService));
            }
            if (payloadSendService == null)
            {
                throw new ArgumentNullException(nameof(payloadSendService));
            }
            if (requestSendService == null)
            {
                throw new ArgumentNullException(nameof(requestSendService));
            }
            if (details == null)
            {
                throw new ArgumentNullException(nameof(details));
            }

            ConnectionService  = connectionService;
            PayloadSendService = payloadSendService;
            RequestSendService = requestSendService;
            Details            = details;
        }
예제 #21
0
 /// <inheritdoc />
 public SharedMovementInputChangedSendNetworkedInputEventListener(IMovementInputChangedEventSubscribable subscriptionService, [NotNull] IPeerPayloadSendService <GameClientPacketPayload> sendService, [NotNull] ILog logger)
     : base(subscriptionService)
 {
     SendService = sendService ?? throw new ArgumentNullException(nameof(sendService));
     Logger      = logger ?? throw new ArgumentNullException(nameof(logger));
 }
예제 #22
0
 public InitializeRsClientPayloadSenderEventListener(INetworkConnectionEstablishedEventSubscribable subscriptionService,
                                                     [NotNull] IPeerPayloadSendService <GameClientPacketPayload> sendService)
     : base(subscriptionService)
 {
     SendService = sendService ?? throw new ArgumentNullException(nameof(sendService));
 }
예제 #23
0
 /// <inheritdoc />
 public CharacterSelectionRequestOnLoginEventInitializable([NotNull] ILoginResponseEventSubscribable subscriptionService, [NotNull] IPeerPayloadSendService <PSOBBGamePacketPayloadClient> sendService, [NotNull] ILog logger, [NotNull] ICharacterSlotSelectedModel slotModel)
     : base(subscriptionService)
 {
     SendService = sendService ?? throw new ArgumentNullException(nameof(sendService));
     Logger      = logger ?? throw new ArgumentNullException(nameof(logger));
     SlotModel   = slotModel ?? throw new ArgumentNullException(nameof(slotModel));
 }
예제 #24
0
 /// <inheritdoc />
 public DefaultSessionMessageContext([NotNull] IConnectionService connectionService, [NotNull] IPeerPayloadSendService <TPayloadWriteType> payloadSendService, [NotNull] IPeerRequestSendService <TPayloadWriteType> requestSendService, [NotNull] SessionDetails details)
 {
     ConnectionService  = connectionService ?? throw new ArgumentNullException(nameof(connectionService));
     PayloadSendService = payloadSendService ?? throw new ArgumentNullException(nameof(payloadSendService));
     RequestSendService = requestSendService ?? throw new ArgumentNullException(nameof(requestSendService));
     Details            = details ?? throw new ArgumentNullException(nameof(details));
 }
예제 #25
0
 /// <inheritdoc />
 public GenericProxiedMessageContext([NotNull] IManagedNetworkClient <TPayloadReadType, TPayloadWriteType> proxyConnection, [NotNull] IConnectionService connectionService, [NotNull] IPeerPayloadSendService <TPayloadWriteType> payloadSendService, [NotNull] IPeerRequestSendService <TPayloadWriteType> requestSendService)
 {
     ProxyConnection    = proxyConnection ?? throw new ArgumentNullException(nameof(proxyConnection));
     ConnectionService  = connectionService ?? throw new ArgumentNullException(nameof(connectionService));
     PayloadSendService = payloadSendService ?? throw new ArgumentNullException(nameof(payloadSendService));
     RequestSendService = requestSendService ?? throw new ArgumentNullException(nameof(requestSendService));
 }
예제 #26
0
 /// <inheritdoc />
 public CharacterLoginResponseEventInitializable(ILoginResponseEventSubscribable subscriptionService, [NotNull] IPeerPayloadSendService <PSOBBGamePacketPayloadClient> sendService)
     : base(subscriptionService)
 {
     SendService = sendService ?? throw new ArgumentNullException(nameof(sendService));
 }
 /// <inheritdoc />
 protected NetworkedDynamicMenuPopulationEventListener([NotNull] TEventSubsribable subscriptionService, [NotNull] IReadOnlyCollection <IUILabeledButton> staticButtons, [NotNull] IPeerPayloadSendService <PSOBBGamePacketPayloadClient> sendService, bool enableCustomEvents)
     : base(subscriptionService)
 {
     StaticButtons         = staticButtons ?? throw new ArgumentNullException(nameof(staticButtons));
     SendService           = sendService ?? throw new ArgumentNullException(nameof(sendService));
     isCustomEventsEnabled = enableCustomEvents;
 }
 /// <inheritdoc />
 public AreaTeleportOnLocalPlayerSpawnedEventListener(ILocalPlayerWorldRepresentationSpawnedEventSubscribable subscriptionService, [NotNull] IPeerPayloadSendService <PSOBBGamePacketPayloadClient> sendService, [NotNull] IUnitScalerStrategy scalerService, [NotNull] IZoneSettings zoneSettings)
     : base(subscriptionService)
 {
     SendService   = sendService ?? throw new ArgumentNullException(nameof(sendService));
     ScalerService = scalerService ?? throw new ArgumentNullException(nameof(scalerService));
     ZoneSettings  = zoneSettings ?? throw new ArgumentNullException(nameof(zoneSettings));
 }
예제 #29
0
 public DebugTestModelChangeRequest([NotNull] IPeerPayloadSendService <GameClientPacketPayload> sendService)
 {
     SendService = sendService ?? throw new ArgumentNullException(nameof(sendService));
 }
 public IProxiedMessageContext <TPayloadWriteType, TPayloadReadType> CreateMessageContext(IConnectionService connectionService, IPeerPayloadSendService <TPayloadWriteType> sendService, SessionDetails details)
 {
     return(new GenericProxiedMessageContext <TPayloadWriteType, TPayloadReadType>(ProxyConnection, connectionService, sendService, MockedPeerRequestService));
 }