Example #1
0
        public async Task EnterScene(IYield yield)
        {
            var responseParameters = await ServerPeerHandler.SendOperation <EmptyParameters, EnterSceneResponseParameters>
                                         (yield, (byte)GameOperations.EnterScene, new EmptyParameters(), MessageSendOptions.DefaultReliable());

            SceneEntered?.Invoke(responseParameters);
        }
Example #2
0
        public async Task <GameServersProviderResponseParameters> ProvideGameServers(IYield yield)
        {
            var responseParameters = await ServerPeerHandler.SendOperation <EmptyParameters, GameServersProviderResponseParameters>
                                         (yield, (byte)GameServerProviderOperations.ProvideGameServers, new EmptyParameters(), MessageSendOptions.DefaultReliable());

            return(responseParameters);
        }
Example #3
0
        public async Task <ValidateCharacterResponseParameters> ValidateCharacter(IYield yield, ValidateCharacterRequestParameters parameters)
        {
            var responseParameters = await ServerPeerHandler.SendOperation <ValidateCharacterRequestParameters, ValidateCharacterResponseParameters>
                                         (yield, (byte)CharacterOperations.ValidateCharacter, parameters, MessageSendOptions.DefaultReliable());

            if (responseParameters.Status == CharacterValidationStatus.Ok)
            {
                ServiceContainer.GameService.SetPeerLogic <GameScenePeerLogic, GameOperations, GameEvents>();
            }
            return(responseParameters);
        }
        public async Task <AuthenticateResponseParameters> Authenticate(IYield yield, AuthenticateRequestParameters parameters)
        {
            var responseParameters = await ServerPeerHandler.SendOperation <AuthenticateRequestParameters, AuthenticateResponseParameters>
                                         (yield, (byte)LoginOperations.Authenticate, parameters, MessageSendOptions.DefaultReliable());

            if (responseParameters.HasAccessToken)
            {
                AccessTokenProvider.AccessToken = responseParameters.AccessToken;
            }
            return(new AuthenticateResponseParameters(responseParameters.Status));
        }
Example #5
0
 public async Task <RemoveCharacterResponseParameters> RemoveCharacter(IYield yield, RemoveCharacterRequestParameters parameters)
 {
     return(await ServerPeerHandler.SendOperation <RemoveCharacterRequestParameters, RemoveCharacterResponseParameters>
                (yield, (byte)CharacterOperations.RemoveCharacter, parameters, MessageSendOptions.DefaultReliable()));
 }
Example #6
0
 public async Task <GetCharactersResponseParameters> GetCharacters(IYield yield)
 {
     return(await ServerPeerHandler.SendOperation <EmptyParameters, GetCharactersResponseParameters>
                (yield, (byte)CharacterOperations.GetCharacters, new EmptyParameters(), MessageSendOptions.DefaultReliable()));
 }
Example #7
0
 public void UpdatePosition(UpdatePositionRequestParameters parameters) =>
 ServerPeerHandler.SendOperation((byte)GameOperations.PositionChanged, parameters, MessageSendOptions.DefaultUnreliable((byte)GameDataChannels.Position));
Example #8
0
 public async Task <ChangeSceneResponseParameters> ChangeScene(IYield yield, ChangeSceneRequestParameters parameters)
 {
     return(await ServerPeerHandler.SendOperation <ChangeSceneRequestParameters, ChangeSceneResponseParameters>
                (yield, (byte)GameOperations.ChangeScene, parameters, MessageSendOptions.DefaultReliable()));
 }
Example #9
0
 public void UpdatePlayerState(UpdatePlayerStateRequestParameters parameters) =>
 ServerPeerHandler.SendOperation((byte)GameOperations.PlayerStateChanged, parameters, MessageSendOptions.DefaultUnreliable((byte)GameDataChannels.Animations));
 public void SendChatMessage(ChatMessageRequestParameters parameters)
 {
     ServerPeerHandler.SendOperation((byte)ChatOperations.ChatMessage, parameters, MessageSendOptions.DefaultReliable());
 }
 public async Task <AuthorizeResponseParameters> Authorize(IYield yield, AuthorizeRequestParameters parameters)
 {
     return(await ServerPeerHandler.SendOperation <AuthorizeRequestParameters, AuthorizeResponseParameters>
                (yield, (byte)AuthorizationOperations.Authorize, parameters, MessageSendOptions.DefaultReliable()));
 }