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

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 { PlayerService } from '../player/player-service';
export class ClientServiceHandler<Context> implements IHandler<Context> {
private service: PlayerService;
private service: PlayerService[] = [];
private proxy: GameProxy;
private PROXY_CONFIG = {
hostName:'localhost',
port: 8080
}
constructor() {
this.service = new PlayerService(new TPlayer());
this.proxy = new GameProxy(this.PROXY_CONFIG)
}
createGame(creator: TPlayer, numberOfPlayers: number, context?: Context): number | Promise<number> {
throw new Error('Method not implemented.');
}
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.');
return this.proxy.createGame(creator, numberOfPlayers);
}
public join(gameId: number, request: IJoinRequest, context?: Context): number | Promise<number> {
throw new Error('Method not implemented.');
}*/
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.');
join(request: IJoinRequest, context?: Context): number | Promise<number> {
const joinRequest = new JoinRequest({gameId:request.gameId, player: request.player})
return this.proxy.join(joinRequest);
}
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> {
throw new Error('Method not implemented.');
return this.resits(hunted);
}
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> {
throw new Error('Method not implemented.');
return this.proxy.playPlaceCard(hunted, card);
}
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> {
throw new Error('Method not implemented.');
return this.proxy.playHuntCard(creature, card);
}
}
}
\ No newline at end of file
......@@ -6755,6 +6755,7 @@
"resolved": "https://registry.npmjs.org/node-sass/-/node-sass-4.14.1.tgz",
"integrity": "sha512-sjCuOlvGyCJS40R8BscF5vhVlQjNN069NtQ1gSxyK1u9iqvn6tf7O1R4GNowVZfiZUCRt5MmMs1xd+4V/7Yr0g==",
"dev": true,
"hasInstallScript": true,
"optional": true,
"dependencies": {
"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