Esempio n. 1
0
        public async Task <List <List <Move> > > getAllReplayesOfInActiveGames()
        {
            string res = await gameCenterHubProxy.Invoke <string>("getAllReplayesOfInActiveGames");

            return(MoveTypesConverter.deserializeObject <List <List <Move> > >(res));
        }
Esempio n. 2
0
        public async Task <List <Move> > getReplayByGameId(int gameId)
        {
            string res = await gameCenterHubProxy.Invoke <string>("getReplayByGameId", gameId);

            return(MoveTypesConverter.deserializeObject <List <Move> >(res));
        }
Esempio n. 3
0
        public void initOnFunctions()
        {
            gameHubProxy.On <string, int>("pushMove", (serializeMove, gameID) =>
            {
                Application.Current.Dispatcher.InvokeAsync(() =>
                {
                    Move move = MoveTypesConverter.deserializeObject <Move>(serializeMove);
                    serverToClient.PushMoveToGame(move, gameID);
                });
            });

            gameHubProxy.On <string, int>("removePlayer", (user, gameID) =>
            {
                Application.Current.Dispatcher.InvokeAsync(() =>
                {
                    serverToClient.PlayerQuitGame(user, gameID);
                });
            });

            gameHubProxy.On <string, int>("removeSpectator", (user, gameID) =>
            {
            });

            gameHubProxy.On <string, string, int>("pushMessage", (user, message, gameID) =>
            {
                Application.Current.Dispatcher.InvokeAsync(() =>
                {
                    serverToClient.PushChatMessage(gameID, user, message);
                });
            });

            gameHubProxy.On <string, string, int>("pushWhisperMessage", (from, message, gameID) =>
            {
                Application.Current.Dispatcher.InvokeAsync(() =>
                {
                    serverToClient.PushPMMessage(gameID, from, message);
                });
            });

            gameHubProxy.On <List <string>, int>("pushWinners", (winners, gameID) =>
            {
                Application.Current.Dispatcher.InvokeAsync(() =>
                {
                    serverToClient.PushWinners(winners, gameID);
                });
            });

            gameHubProxy.On <int, int>("yourTurn", (minimumBet, gameId) =>
            {
                Application.Current.Dispatcher.InvokeAsync(() =>
                {
                    serverToClient.NotifyTurn(minimumBet, gameId);
                });
            });

            gameHubProxy.On <PlayerHand, int>("setHand", (playerHand, gameId) =>
            {
                Application.Current.Dispatcher.InvokeAsync(() =>
                {
                    serverToClient.PushHand(playerHand, gameId);
                });
            });
        }