Commit 0a730747 authored by Mamadou Saliou DIALLO's avatar Mamadou Saliou DIALLO
Browse files

feat: implements client service handler

parent 4cb11592
This diff is collapsed.
import { ICard, IJoinRequest, IPhase, IPhaseArgs, IPlace, ITPlayer, IResponseArgs, IToken, TPlayer} from 'src/codegen/common'; import { JoinRequest } from './../codegen/common/JoinRequest';
import { GameProxy } from './../thrift/game-proxy';
import { ICard, IJoinRequest, IPhase, IPhaseArgs, IPlace, IResponseArgs, IToken, TPlayer } from '../codegen/common';
import { IHandler } from '../codegen/common/GameService'; import { IHandler } from '../codegen/common/GameService';
import { PlayerService } from '../player/player-service'; import { PlayerService } from '../player/player-service';
export class ClientServiceHandler<Context> implements IHandler<Context> { export class ClientServiceHandler<Context> implements IHandler<Context> {
private service: PlayerService; private service: PlayerService[] = [];
private proxy: GameProxy;
private PROXY_CONFIG = {
hostName:'localhost',
port: 8080
}
constructor() { constructor() {
this.service = new PlayerService(new TPlayer()); this.proxy = new GameProxy(this.PROXY_CONFIG)
} }
createGame(creator: TPlayer, numberOfPlayers: number, context?: Context): number | Promise<number> { createGame(creator: TPlayer, numberOfPlayers: number, context?: Context): number | Promise<number> {
throw new Error('Method not implemented.'); return this.proxy.createGame(creator, numberOfPlayers);
}
join(request: IJoinRequest, context?: Context): number | Promise<number> {
throw new Error('Method not implemented.');
}
/*public createGame(numberOfPlayers: number, context?: Context): number | Promise<number> {
throw new Error('Method not implemented.');
} }
public join(gameId: number, request: IJoinRequest, context?: Context): number | Promise<number> { join(request: IJoinRequest, context?: Context): number | Promise<number> {
throw new Error('Method not implemented.'); const joinRequest = new JoinRequest({gameId:request.gameId, player: request.player})
}*/ return this.proxy.join(joinRequest);
public startGame(gameId: number): void | Promise<void> {
return this.service.startGame(gameId);
}
isConnected(player: any, params: any, context?: Context): IResponseArgs | Promise<IResponseArgs> {
throw new Error('Method not implemented.');
} }
nextPhase(phase: IPhase, context?: Context): IPhaseArgs | Promise<IPhaseArgs> { nextPhase(phase: IPhase, context?: Context): IPhaseArgs | Promise<IPhaseArgs> {
throw new Error('Method not implemented.'); return this.nextPhase(phase);
} }
resits(hunted: any, context?: Context): IResponseArgs | Promise<IResponseArgs> { resits(hunted: any, context?: Context): IResponseArgs | Promise<IResponseArgs> {
throw new Error('Method not implemented.'); return this.resits(hunted);
} }
letGo(hunted: any, context?: Context): IResponseArgs | Promise<IResponseArgs> { letGo(hunted: any, context?: Context): IResponseArgs | Promise<IResponseArgs> {
throw new Error('Method not implemented.'); return this.proxy.letGo(hunted);
} }
playPlaceCard(hunted: any, card: ICard, context?: Context): IResponseArgs | Promise<IResponseArgs> { playPlaceCard(hunted: any, card: ICard, context?: Context): IResponseArgs | Promise<IResponseArgs> {
throw new Error('Method not implemented.'); return this.proxy.playPlaceCard(hunted, card);
} }
putToken(token: IToken, place: IPlace, context?: Context): IResponseArgs | Promise<IResponseArgs> { putToken(token: IToken, place: IPlace, context?: Context): IResponseArgs | Promise<IResponseArgs> {
throw new Error('Method not implemented.'); return this.proxy.putToken(token, place);
} }
playHuntCard(creature: any, card: ICard, context?: Context): IResponseArgs | Promise<IResponseArgs> { playHuntCard(creature: any, card: ICard, context?: Context): IResponseArgs | Promise<IResponseArgs> {
throw new Error('Method not implemented.'); return this.proxy.playHuntCard(creature, card);
} }
} }
\ No newline at end of file
...@@ -6755,6 +6755,7 @@ ...@@ -6755,6 +6755,7 @@
"resolved": "https://registry.npmjs.org/node-sass/-/node-sass-4.14.1.tgz", "resolved": "https://registry.npmjs.org/node-sass/-/node-sass-4.14.1.tgz",
"integrity": "sha512-sjCuOlvGyCJS40R8BscF5vhVlQjNN069NtQ1gSxyK1u9iqvn6tf7O1R4GNowVZfiZUCRt5MmMs1xd+4V/7Yr0g==", "integrity": "sha512-sjCuOlvGyCJS40R8BscF5vhVlQjNN069NtQ1gSxyK1u9iqvn6tf7O1R4GNowVZfiZUCRt5MmMs1xd+4V/7Yr0g==",
"dev": true, "dev": true,
"hasInstallScript": true,
"optional": true, "optional": true,
"dependencies": { "dependencies": {
"async-foreach": "^0.1.3", "async-foreach": "^0.1.3",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment