Commit d5207408 authored by Mamadou Saliou DIALLO's avatar Mamadou Saliou DIALLO

fix: fix import errors

parent a669937e
import { ITPlayer } from 'src/codegen/common/TPlayer';
import { ITPlayer } from './../codegen/common/TPlayer';
import { JoinRequest } from './../codegen/common/JoinRequest';
import { GameProxy } from './../thrift/game-proxy';
import { ICard, IJoinRequest, IPhase, IPhaseArgs, IPlace, IResponseArgs, IToken, TPlayer } from '../codegen/common';
......@@ -9,9 +9,9 @@ export class ClientServiceHandler<Context> implements IHandler<Context> {
private services: PlayerService[];
private proxy: GameProxy;
private PROXY_CONFIG = {
hostName:'localhost',
hostName: 'localhost',
port: 8080
}
};
constructor() {
this.proxy = new GameProxy(this.PROXY_CONFIG);
......@@ -27,8 +27,8 @@ export class ClientServiceHandler<Context> implements IHandler<Context> {
* Create new PlayerService and add it to the playerService list.
* @param player player to add
*/
private addPlayerService(player:TPlayer): void {
const playerService:PlayerService = new PlayerService(player);
private addPlayerService(player: TPlayer): void {
const playerService: PlayerService = new PlayerService(player);
this.services.push(playerService);
}
......@@ -36,16 +36,16 @@ export class ClientServiceHandler<Context> implements IHandler<Context> {
* Convert ITPlayer object to TPlayer.
* @param iplayer ITPlayer instance to convert
*/
private ITPlayerToTPlayer(iplayer: ITPlayer):TPlayer{
return new TPlayer(iplayer)
private ITPlayerToTPlayer(iplayer: ITPlayer): TPlayer {
return new TPlayer(iplayer);
}
join(request: IJoinRequest, context?: Context): number | Promise<number> {
const joinRequest = new JoinRequest({gameId:request.gameId, player: request.player})
const joinRequest = new JoinRequest({gameId: request.gameId, player: request.player});
return this.proxy.join(joinRequest).then( gameID => {
if(gameID > 0) {
if(request.player != undefined) {
this.addPlayerService(this.ITPlayerToTPlayer(request.player))
if (gameID > 0) {
if (request.player !== undefined) {
this.addPlayerService(this.ITPlayerToTPlayer(request.player));
}
}
return gameID;
......@@ -75,4 +75,4 @@ export class ClientServiceHandler<Context> implements IHandler<Context> {
playHuntCard(creature: any, card: ICard, context?: Context): IResponseArgs | Promise<IResponseArgs> {
return this.proxy.playHuntCard(creature, card);
}
}
\ No newline at end of file
}
import { TPlayer } from 'src/codegen/common/TPlayer';
import { TPlayer } from './../codegen/common/TPlayer';
import { Winner } from './../codegen/common/Winner';
import { BoardGameState } from './../codegen/common/BoardGameState';
import { PlayerStateResponse } from './../codegen/common/PlayerStateResponse';
import { PlayerState } from 'src/codegen/common';
import { PlayerState } from './../codegen/common';
export class PlayerService {
private player: TPlayer;
......
import { Client } from 'src/codegen/common/GameService';
import { Client } from './../codegen/common/GameService';
import { GameInterface } from '../core/game';
import { CoreOptions } from 'request';
import { createHttpClient, ICreateHttpClientOptions } from '@creditkarma/thrift-client';
import { JoinRequest } from '../codegen/common/JoinRequest';
import { ITPlayer, TPlayer } from 'src/codegen/common/TPlayer';
import { IPhase, ICard, IResponse, IToken, IPlace } from 'src/codegen/common';
import { ITPlayer, TPlayer } from './../codegen/common/TPlayer';
import { IPhase, ICard, IResponse, IToken, IPlace } from './../codegen/common';
export class GameProxy implements GameInterface {
private thriftClient: Client<CoreOptions>;
......
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