client-service-handler.ts 3.19 KB
Newer Older
1
2
3
import { TDescription, TPlayerTeam, TPhase, TAction, TAskAction, Response } from 'src/codegen/common';
// import { IHandler } from '../codegen/common/GameService';
import { IHandler } from '../codegen/common/PlayerService';
4
5
6
import { PlayerService } from '../player/player-service';

export class ClientServiceHandler<Context> implements IHandler<Context> {
7
    
8
9
10
11
12
13
    private service: PlayerService;

    constructor() {
        this.service = new PlayerService();
    }

14
    /*
15
16
17
18
19
20
21
22
23
24
25
    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> {
        throw new Error('Method not implemented.');
    }

    public startGame(gameId: number): void | Promise<void> {
        return this.service.startGame(gameId);
    }
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
    */

    public ping(): boolean | Promise<boolean> {
        // return this.service.ping();
        throw new Error('Method not implemented.');
    }

    public sendGameDescription(gameDescription: TDescription): void | Promise<void> {
        throw new Error('Method not implemented.');
    }

    public sendGameStart(): void | Promise<void> {
        throw new Error('Method not implemented.');
    }

    public sendGameIsFinished(winner: TPlayerTeam): void | Promise<void> {
        throw new Error('Method not implemented.');
    }

    public sendFirstRoundStart(): void | Promise<void> {
        throw new Error('Method not implemented.');
    }

    public sendStartPhase(phase: TPhase, gameDescription: TDescription): void | Promise<void> {
        throw new Error('Method not implemented.');
    }

    public askAction(askedAction: TAskAction): TAction | Promise<TAction> {
        throw new Error('Method not implemented.');
    }

    public sendAction(askedAction: TAskAction): void | Promise<void> {
        throw new Error('Method not implemented.');
    }

    public sendResponse(response: Response): void | Promise<void> {
        throw new Error('Method not implemented.');
    }

    /*
    public ping(): boolean | Promise<boolean> {
        return service.ping();
    }

    public sendGameDescription(gameDescription: TDescription): void | Promise<void> {
        throw new Error('Method not implemented.');
    }

    public void sendGameStart() : void | Promise<void> {
        throw new Error('Method not implemented.');
    }

    public void sendGameIsFinished(winner : TPlayerTeam) : void | Promise<void> {
        throw new Error('Method not implemented.');
    }
81

82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
    public void sendFirstRoundStart() : void | Promise<void> {
        throw new Error('Method not implemented.');
    }

    public void sendStartPhase(phase : TPhase, gameDescription : TDescription) : void | Promise<void> {
        throw new Error('Method not implemented.');
    }

    public askAction(askedAction : TAskAction) : TAction | Promise<TAction> {
        return null;
    }

    public sendAction(askedAction : TAskAction) : void | Promise<void> {
        throw new Error('Method not implemented.');
    }

    public sendResponse(response : Response) : void | Promise<void> {
        throw new Error('Method not implemented.');
    }
    */
102
103

}