composants.adoc 12.3 KB
Newer Older
Gerson Sunyé's avatar
Gerson Sunyé committed
1
= Conception préliminaire
2
3
4

== Liste des fonctions de l'interface Client-Serveur

5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
=== Game Service
- createRoom(player : TPlayer) : TRoomId
- joinRoom(player : TPlayer, roomId : TRoomId) : Response
- sendStartGame(player : TPlayer, creatureId : Integer, board : TBoard, color : TColor, placeCards : Tcards[*]) : Response
- getGameDescription(player : TPlayer) : TDescription
- sendFinishPhase(player : TPlayer, phase : TPhase) : void
- sendPlayCards(player : TPlayer, playerCards : TCard[*]) : void
- sendPlaceJetons(player : TPlayer, placedJetons : TPlacedJeton[*]) : void
- sendResist(player : TPlayer, number : Integer) : void
- sendGiveUp(player : TPlayer) : void

=== Player Service

- sendGameDescription(gameDescription : TDescription) : void
- sendGameStart(): void
- sendGameIsFinished(common.TPlayerTeam winner) : void
- sendFirstRoundStart() : void
- sendStartPhase(phase : TPhase, gameDescription : TDescription) : void
- askAction(askedAction : TAskAction) : TAction
- sendAction(askedAction : TAskAction) : void
- sendResponse(response : Response) : void
26

27
== Components diagram
28

29
30
31
32
33
34
35
36
37
- Not alone (Joueur, Créature, Traqué, Main, Carte, Pioche, Réserve, Planète, Partie, Pouvoir)
- Base de données (Sauvegarde de joueurs)
- Authentificateur (SecurityWrapper)
- Client

== Components diagram

[plantuml, components-diagram, png]
....
38
39
40
hide circle
skinparam monochrome true

Corentin Guillevic's avatar
Corentin Guillevic committed
41
component GameService as na
42

Corentin Guillevic's avatar
Corentin Guillevic committed
43
component GameClient as c
44
45

database DataBase as db
46

47
component SecurityWrapper as sw
48

49
50
interface Data as dbi

Corentin Guillevic's avatar
Corentin Guillevic committed
51
interface GameServices as nai
52
53
54

interface Security as swi

Corentin Guillevic's avatar
Corentin Guillevic committed
55
56
57
interface ClientServices as ci

c - ci
58
59
nai - na
na .> "use" swi
Corentin Guillevic's avatar
Corentin Guillevic committed
60
61
c .> "use" nai
na ..> "use" ci
62
63
64
65
66

dbi - db

swi - sw
sw .> "use" dbi 
67

68
69
70
71
72
....

=== Interface

[plantuml, interface-diagrams, png]
73
74
75
76
....
hide circle
skinparam monochrome true

77
class "«interface» \n Data" as dbi{
Corentin Guillevic's avatar
Corentin Guillevic committed
78
	existUser(id : String):Boolean
79
80
81
82
83
84
85
86
87
	findUser(id : String):User
    findPlaceCard(id : String):PlaceCard
    findPlaceCards(ids : String[*]):PlaceCard[*]
    findSurvivalCard(id : String):SurvivalCard
    findSurvivalCards(ids : String[*]):SurvivalCard[*]
    findAllSurvivalCards():SurvivalCard[*]
    findTrackingCard(id : String):TrackingCard
    findTrackingCards(ids : String[*]):TrackingCard[*]
    findAllTrackingCards():TrackingCard[*]
88
89
}

90
class  "«interface» \n Security" as swi{
Corentin Guillevic's avatar
Corentin Guillevic committed
91
92
93
94
95
96
	verifyUser(id : String, password : String):Boolean
	generateToken(id : String , gameId : String):String
	getUser(id : String):User
}

class "«interface» \n GameService" as si{
97
98
99
100
101
102
103
104
105
	createRoom(player : TPlayer) : TRoomId
    joinRoom(player : TPlayer, roomId : TRoomId) : Response
    sendStartGame(player : TPlayer, creatureId : Integer, board : TBoard, color : TColor, placeCards : Tcards[*]) : Response
    getGameDescription(player : TPlayer) : TDescription
    sendFinishPhase(player : TPlayer, phase : TPhase) : void
    sendPlayCards(player : TPlayer, playerCards : TCard[*]) : void
    sendPlaceJetons(player : TPlayer, placedJetons : TPlacedJeton[*]) : void
    sendResist(player : TPlayer, number : Integer) : void
    sendGiveUp(player : TPlayer) : void
106
}
107

108
109
110
111
112
113
114
115
116
class "«interface» \n PlayerService" as csi{
	sendGameDescription(gameDescription : TDescription) : void
    sendGameStart(): void
    sendGameIsFinished(common.TPlayerTeam winner) : void
    sendFirstRoundStart() : void
    sendStartPhase(phase : TPhase, gameDescription : TDescription) : void
    askAction(askedAction : TAskAction) : TAction
    sendAction(askedAction : TAskAction) : void
    sendResponse(response : Response) : void
117
}
118
....
119
120


121
== Diagrammes de séquence
122

123
== Diagramme de séquence de mise en place
124

125
### Pour créer une partie 
126

127
128
- TPlayer tPlayer1 = {"Jean", "192.168.1.12:4200"}
- TPlayer tPlayer2 = {"Sébastien", "192.168.1.13:4200"}
129

130
131
132
133
134
Couleur partie : Bleu
[plantuml]
----
hide circle
skinparam monochrome true
135

136
137
138
139
140
141
142
143
144
145
C1Client -> S1Serveur : createRoom(tPlayer1)
C1Client <-- S1Serveur : 1001
C2Client -> S1Serveur : joinGame(tPlayer2, 1001)
C2Client <-- S1Serveur : {true, ""}
C1Client -> S1Serveur : sendStartGame(tPlayer1, 1, "PLATEAU_RECTO_ID", "Bleu", [Nexus, Jungle, Rivière, Dôme, Plage, Mangrove , Abri, Epave, Fungi, Portail])
C1Client <-- S1Serveur : {true, ""}
S1Serveur ->> C1Client : sendFirstRoundStart()
S1Serveur ->> C2Client : sendFirstRoundStart()
C1Client -> S1Serveur : getGameDescription(tPlayer1)
C2Client -> S1Serveur : getGameDescription(tPlayer2)
146
----
147

148
### Pour rejoindre une partie
149

150
151
- ID de la partie 1001 
- ID du joueur : 10
152

153
154
[plantuml]
----
155
156
157
hide circle
skinparam monochrome true

Corentin Guillevic's avatar
Corentin Guillevic committed
158
C1Client -> S1Serveur : joinGame("1001", "10")
159
C1Client <-- S1Serveur : sendConfirmation("{token : token10}")
Corentin Guillevic's avatar
Corentin Guillevic committed
160
C1Client ->> S1Serveur : waitGameStart("token10")
161
C1Client <<-- S1Serveur : sendConfirmation()
Corentin Guillevic's avatar
Corentin Guillevic committed
162
163
164
C1Client -> S1Serveur : getGameDescription("token10")
C1Client <-- S1Serveur : sendGameDescription("Traqué,{[L'antre,La jungle,La rivière,La plage,Le rover], [], 3, [Riposte]}, 2, [{Antre, []}, {Jungle, []}, ...], [{Marais, 3}, {Abri, 3}, ...], [10, 5, 8, 15], [20]")
C1Client ->> S1Serveur : waitStartPhase("token10", "PREPHASE_1_ID")
165
166
C1Client <<-- S1Serveur : sendConfirmation()
----
167

168
=== Diagramme de séquence du déroulement d'une partie
169

170
### Déroulement d'une manche (Traqué)
171

172
173
- Token du joueur : token5
- Equipe du joueur : Traqué
174

175
176
177
178
[plantuml]
----
hide circle
skinparam monochrome true
179

Corentin Guillevic's avatar
Corentin Guillevic committed
180
181
182
C1Client ->> S1Serveur : waitStartPhase("token5", "PREPHASE_1_ID")
C1Client <<-- S1Serveur : sendStartPhase("PREPHASE_1_ID", "GameDescription")
C1Client -> S1Serveur : sendResist("token5")
183
C1Client <-- S1Serveur : sendConfirmation()
Corentin Guillevic's avatar
Corentin Guillevic committed
184
C1Client -> S1Serveur : sendFinishPhase("token5", "PREPHASE_1_ID")
185
186
C1Client <-- S1Serveur : sendConfirmation()

Corentin Guillevic's avatar
Corentin Guillevic committed
187
188
189
C1Client ->> S1Serveur : waitStartPhase("token5", "PHASE_1_ID")
C1Client <<-- S1Serveur : sendStartPhase("PHASE_1_ID", "GameDescription")
C1Client -> S1Serveur : sendPlayCards("token5", "{La Plage}")
190
C1Client <-- S1Serveur : sendConfirmation()
Corentin Guillevic's avatar
Corentin Guillevic committed
191
C1Client -> S1Serveur : sendFinishPhase("token5", "PHASE_1_ID")
192
193
C1Client <-- S1Serveur : sendConfirmation()

Corentin Guillevic's avatar
Corentin Guillevic committed
194
195
196
C1Client ->> S1Serveur : waitStartPhase("token5", "POSTPHASE_1_ID")
C1Client <<-- S1Serveur :  sendStartPhase("POSTPHASE_1_ID", "GameDescription")
C1Client -> S1Serveur : sendPlayCards("token5", "{Adrénaline}")
197
C1Client <-- S1Serveur : sendConfirmation()
Corentin Guillevic's avatar
Corentin Guillevic committed
198
C1Client -> S1Serveur : sendFinishPhase("token5", "POSTPHASE_1_ID")
199
200
C1Client <-- S1Serveur : sendConfirmation()

Corentin Guillevic's avatar
Corentin Guillevic committed
201
202
203
C1Client ->> S1Serveur : waitStartPhase("token5", "PREPHASE_2_ID")
C1Client <<-- S1Serveur : sendStartPhase("PREPHASE_2_ID", "GameDescription")
C1Client -> S1Serveur : sendFinishPhase("token5", "PREPHASE_2_ID")
204
205
C1Client <-- S1Serveur : sendConfirmation()

Corentin Guillevic's avatar
Corentin Guillevic committed
206
207
208
C1Client ->> S1Serveur : waitStartPhase("token5", "PHASE_2_ID")
C1Client <<-- S1Serveur : sendStartPhase("PHASE_2_ID", "GameDescription")
C1Client -> S1Serveur : sendFinishPhase("token5", "PHASE_2_ID")
209
210
C1Client <-- S1Serveur : sendConfirmation()

Corentin Guillevic's avatar
Corentin Guillevic committed
211
212
213
C1Client ->> S1Serveur : waitStartPhase("token5", "POSTPHASE_2_ID")
C1Client <<-- S1Serveur : sendStartPhase("POSTPHASE_2_ID", "GameDescription")
C1Client -> S1Serveur : sendFinishPhase("token5", "POSTPHASE_2_ID")
214
215
C1Client <-- S1Serveur : sendConfirmation()

Corentin Guillevic's avatar
Corentin Guillevic committed
216
217
218
C1Client ->> S1Serveur : waitStartPhase("token5", "PREPHASE_3_ID")
C1Client <<-- S1Serveur : sendStartPhase("PREPHASE_3_ID", "GameDescription")
C1Client -> S1Serveur : sendFinishPhase("token5", "PREPHASE_3_ID")
219
220
C1Client <-- S1Serveur : sendConfirmation()

Corentin Guillevic's avatar
Corentin Guillevic committed
221
222
223
C1Client ->> S1Serveur : waitStartPhase("token5", "PHASE_3_ID")
C1Client <<-- S1Serveur : sendStartPhase("PHASE_3_ID", "GameDescription")
C1Client -> S1Serveur : sendChooseAction("token5", "POWER_1_ID")
224
C1Client <-- S1Serveur : sendConfirmation()
Corentin Guillevic's avatar
Corentin Guillevic committed
225
C1Client -> S1Serveur : sendFinishPhase("token5", "PHASE_3_ID")
226
227
C1Client <-- S1Serveur : sendConfirmation()

Corentin Guillevic's avatar
Corentin Guillevic committed
228
229
230
C1Client ->> S1Serveur : waitStartPhase("token5", "POSTPHASE_3_ID")
C1Client <<-- S1Serveur : sendStartPhase("POSTPHASE_3_ID", "GameDescription")
C1Client -> S1Serveur : sendFinishPhase("token5", "POSTPHASE_3_ID")
231
232
C1Client <-- S1Serveur : sendConfirmation()

Corentin Guillevic's avatar
Corentin Guillevic committed
233
234
235
C1Client ->> S1Serveur : waitStartPhase("token5", "PREPHASE_4_ID")
C1Client <<-- S1Serveur : sendStartPhase("PREPHASE_4_ID", "GameDescription")
C1Client -> S1Serveur : sendFinishPhase("token5", PREPHASE_4_ID)
236
237
C1Client <-- S1Serveur : sendConfirmation()

Corentin Guillevic's avatar
Corentin Guillevic committed
238
239
240
C1Client ->> S1Serveur : waitStartPhase("token5", "PHASE_4_ID")
C1Client <<-- S1Serveur : sendStartPhase("PHASE_4_ID", "GameDescription")
C1Client -> S1Serveur : sendFinishPhase("token5", "PHASE_4_ID")
241
242
C1Client <-- S1Serveur : sendConfirmation()

Corentin Guillevic's avatar
Corentin Guillevic committed
243
244
245
C1Client ->> S1Serveur : waitStartPhase("token5", "POSTPHASE_4_ID")
C1Client <<-- S1Serveur : sendStartPhase("POSTPHASE_4_ID", "GameDescription")
C1Client -> S1Serveur : sendFinishPhase("token5", "POSTPHASE_4_ID")
246
247
C1Client <-- S1Serveur : sendConfirmation()

Corentin Guillevic's avatar
Corentin Guillevic committed
248
249
C1Client ->> S1Serveur : waitStartPhase("token5", "PREPHASE_1_ID")
C1Client <<-- S1Serveur : sendStartPhase("FINISH_ID", "GameDescription")
250
----
251

252
### Déroulement d'une manche (Créature)
253

254
255
256
257
258
259
260
261
- Equipe du joueur : Créature
- Token du joueur : token8

[plantuml]
----
hide circle
skinparam monochrome true

Corentin Guillevic's avatar
Corentin Guillevic committed
262
263
264
C1Client ->> S1Serveur : waitStartPhase("token8", "PREPHASE_1_ID")
C1Client <<-- S1Serveur : sendStartPhase("PREPHASE_1_ID", "GameDescription")
C1Client -> S1Serveur : sendFinishPhase("token8", "PREPHASE_1_ID")
265
266
C1Client <-- S1Serveur : sendConfirmation()

Corentin Guillevic's avatar
Corentin Guillevic committed
267
268
269
C1Client ->> S1Serveur : waitStartPhase("token8", "PHASE_1_ID")
C1Client <<-- S1Serveur : sendStartPhase("PHASE_1_ID", "GameDescription")
C1Client -> S1Serveur : sendFinishPhase("token8", "PHASE_1_ID")
270
271
C1Client <-- S1Serveur : sendConfirmation()

Corentin Guillevic's avatar
Corentin Guillevic committed
272
273
274
C1Client ->> S1Serveur : waitStartPhase("token8", "POSTPHASE_1_ID")
C1Client <<-- S1Serveur :  sendStartPhase("POSTPHASE_1_ID", "GameDescription")
C1Client -> S1Serveur : sendFinishPhase("token8", "POSTPHASE_1_ID")
275
276
C1Client <-- S1Serveur : sendConfirmation()

Corentin Guillevic's avatar
Corentin Guillevic committed
277
278
279
C1Client ->> S1Serveur : waitStartPhase("token8", "PREPHASE_2_ID")
C1Client <<-- S1Serveur : sendStartPhase("PREPHASE_2_ID", "GameDescription")
C1Client -> S1Serveur : sendPlayCards("token8", "{Soif de sang}")
280
C1Client <-- S1Serveur : sendConfirmation()
Corentin Guillevic's avatar
Corentin Guillevic committed
281
C1Client -> S1Serveur : sendFinishPhase("token8", "PREPHASE_2_ID")
282
283
C1Client <-- S1Serveur : sendConfirmation()

Corentin Guillevic's avatar
Corentin Guillevic committed
284
285
286
C1Client ->> S1Serveur : waitStartPhase("token8", "PHASE_2_ID")
C1Client <<-- S1Serveur : sendStartPhase("PHASE_2_ID", "GameDescription")
C1Client -> S1Serveur : sendPlaceJetons("token8", "{{Créature, EMPLACEMENT_1_ID} {Cible, EMPLACEMENT_7_ID}}")
287
C1Client <-- S1Serveur : sendConfirmation()
Corentin Guillevic's avatar
Corentin Guillevic committed
288
C1Client -> S1Serveur : sendFinishPhase("token8", "PHASE_2_ID")
289
290
C1Client <-- S1Serveur : sendConfirmation()

Corentin Guillevic's avatar
Corentin Guillevic committed
291
292
293
C1Client ->> S1Serveur : waitStartPhase("token8", "POSTPHASE_2_ID")
C1Client <<-- S1Serveur : sendStartPhase("POSTPHASE_2_ID", "GameDescription")
C1Client -> S1Serveur : sendFinishPhase("token8", "POSTPHASE_2_ID")
294
295
C1Client <-- S1Serveur : sendConfirmation()

Corentin Guillevic's avatar
Corentin Guillevic committed
296
297
298
C1Client ->> S1Serveur : waitStartPhase("token8", "PREPHASE_3_ID")
C1Client <<-- S1Serveur : sendStartPhase("PREPHASE_3_ID", "GameDescription")
C1Client -> S1Serveur : sendFinishPhase("token8", "PREPHASE_3_ID")
299
300
C1Client <-- S1Serveur : sendConfirmation()

Corentin Guillevic's avatar
Corentin Guillevic committed
301
302
303
C1Client ->> S1Serveur : waitStartPhase("token8", "PHASE_3_ID")
C1Client <<-- S1Serveur : sendStartPhase("PHASE_3_ID", "GameDescription")
C1Client -> S1Serveur : sendFinishPhase("token8", "PHASE_3_ID")
304
305
C1Client <-- S1Serveur : sendConfirmation()

Corentin Guillevic's avatar
Corentin Guillevic committed
306
307
308
C1Client ->> S1Serveur : waitStartPhase("token8", "POSTPHASE_3_ID")
C1Client <<-- S1Serveur : sendStartPhase("POSTPHASE_3_ID", "GameDescription")
C1Client -> S1Serveur : sendFinishPhase("token8", "POSTPHASE_3_ID")
309
310
C1Client <-- S1Serveur : sendConfirmation()

Corentin Guillevic's avatar
Corentin Guillevic committed
311
312
313
C1Client ->> S1Serveur : waitStartPhase("token8", "PREPHASE_4_ID")
C1Client <<-- S1Serveur : sendStartPhase("PREPHASE_4_ID", "GameDescription")
C1Client -> S1Serveur : sendFinishPhase("token8", "PREPHASE_4_ID")
314
315
C1Client <-- S1Serveur : sendConfirmation()

Corentin Guillevic's avatar
Corentin Guillevic committed
316
317
318
C1Client ->> S1Serveur : waitStartPhase("token8", "PHASE_4_ID")
C1Client <<-- S1Serveur : sendStartPhase("PHASE_4_ID", "GameDescription")
C1Client -> S1Serveur : sendFinishPhase("token8", "PHASE_4_ID")
319
320
C1Client <-- S1Serveur : sendConfirmation()

Corentin Guillevic's avatar
Corentin Guillevic committed
321
322
323
C1Client ->> S1Serveur : waitStartPhase("token8", "POSTPHASE_4_ID")
C1Client <<-- S1Serveur : sendStartPhase("POSTPHASE_4_ID", "GameDescription")
C1Client -> S1Serveur : sendFinishPhase("POSTPHASE_4_ID")
324
325
C1Client <-- S1Serveur : sendConfirmation()

Corentin Guillevic's avatar
Corentin Guillevic committed
326
327
C1Client ->> S1Serveur : waitStartPhase("token8", "PREPHASE_1_ID")
C1Client <<-- S1Serveur : sendStartPhase("FINISH_ID", "GameDescription")
328
----