composants.adoc 9.5 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

51
interface GameService as nai
52
53
54

interface Security as swi

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

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
126
- TPlayer tPlayer1 = {"Jean", "192.168.1.12:4200"}
- TPlayer tPlayer2 = {"Sébastien", "192.168.1.13:4200"}
127

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

134
135
136
137
138
139
140
141
142
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)
Corentin Guillevic's avatar
Corentin Guillevic committed
143
C1Client <-- S1Serveur : gameDescription
144
C2Client -> S1Serveur : getGameDescription(tPlayer2)
Corentin Guillevic's avatar
Corentin Guillevic committed
145
C2Client <-- S1Serveur : gameDescription
146
----
147

148
=== Diagramme de séquence du déroulement d'une manche
149

150
151
- TPlayer tPlayerTraque = {"Jean", "192.168.1.12:4200"}
- TPlayer tPlayerCreature = {"Sébastien", "192.168.1.13:4200"}
152

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

158
159
160
161
C1Client <<-- S1Serveur : sendStartPhase("PREPHASE_1", {GameDescription})
C2Client <<-- S1Serveur : sendStartPhase("PREPHASE_1", {GameDescription})
C1Client --> S1Serveur : sendResist(tPlayerTraque, 1)
C1Client <-- S1Serveur : {true, ""}
Corentin Guillevic's avatar
Corentin Guillevic committed
162
163
C1Client --> S1Serveur : sendPlayCards(tPlayerTraque, ["Adrenaline"])
C1Client <-- S1Serveur : {true, ""}
164
165
166
167
C1Client --> S1Serveur : sendFinishPhase(tPlayerTraque, "PREPHASE_1")
C1Client <-- S1Serveur : {true, ""}
C2Client --> S1Serveur : sendFinishPhase(tPlayerCreature, "PREPHASE_1")
C2Client <-- S1Serveur : {true, ""}
168

169
170
171
172
173
174
175
176
C1Client <<-- S1Serveur : sendStartPhase("PHASE_1", {GameDescription})
C2Client <<-- S1Serveur : sendStartPhase("PHASE_1", {GameDescription})
C2Client --> S1Serveur : sendFinishPhase(tPlayerCreature, "PHASE_1")
C2Client <-- S1Serveur : {true, ""}
C1Client --> S1Serveur : sendPlayCards(tPlayerTraque, ["La_Plage"])
C1Client <-- S1Serveur : {true, ""}
C1Client --> S1Serveur : sendFinishPhase(tPlayerTraque, "PHASE_1")
C1Client <-- S1Serveur : {true, ""}
177

178
179
180
181
182
183
C1Client <<-- S1Serveur :  sendStartPhase("POSTPHASE_1", {GameDescription})
C2Client <<-- S1Serveur :  sendStartPhase("POSTPHASE_1", {GameDescription})
C1Client --> S1Serveur : sendFinishPhase(tPlayerTraque, "POSTPHASE_1")
C1Client <-- S1Serveur : {true, ""}
C2Client --> S1Serveur : sendFinishPhase(tPlayerCreature, "POSTPHASE_1")
C2Client <-- S1Serveur : {true, ""}
184

185
186
187
188
189
190
191
192
C1Client <<-- S1Serveur : sendStartPhase("PREPHASE_2", {GameDescription})
C2Client <<-- S1Serveur : sendStartPhase("PREPHASE_2", {GameDescription})
C1Client --> S1Serveur : sendFinishPhase(tPlayerTraque, "PREPHASE_2")
C1Client <-- S1Serveur : {true, ""}
C2Client --> S1Serveur : sendPlayCards(tPlayerCreature, ["Soif_de_sang"])
C2Client <-- S1Serveur : {true, ""}
C2Client --> S1Serveur : sendFinishPhase(tPlayerCreature, "PREPHASE_2")
C2Client <-- S1Serveur : {true, ""}
193

194
195
196
197
198
199
200
201
C1Client <<-- S1Serveur : sendStartPhase("PHASE_2", {GameDescription})
C2Client <<-- S1Serveur : sendStartPhase("PHASE_2", {GameDescription})
C1Client --> S1Serveur : sendFinishPhase(tPlayerTraque, "PHASE_2")
C1Client <-- S1Serveur : {true, ""}
C2Client --> S1Serveur : sendPlaceJetons(tPlayerCreature, "{{"Creature", "Place_1"}, {"Cible", "Place_7"}}")
C2Client <-- S1Serveur : {true, ""}
C2Client --> S1Serveur : sendFinishPhase(tPlayerCreature, "PHASE_2")
C2Client <-- S1Serveur : {true, ""}
202

203
204
205
206
207
208
C1Client <<-- S1Serveur : sendStartPhase("POSTPHASE_2", {GameDescription})
C2Client <<-- S1Serveur : sendStartPhase("POSTPHASE_2", {GameDescription})
C2Client --> S1Serveur : sendFinishPhase(tPlayerCreature, "POSTPHASE_2")
C2Client <-- S1Serveur : {true, ""}
C1Client --> S1Serveur : sendFinishPhase(tPlayerTraque, "POSTPHASE_2")
C1Client <-- S1Serveur : {true, ""}
209

210
211
212
213
214
215
C1Client <<-- S1Serveur : sendStartPhase("PREPHASE_3", {GameDescription})
C2Client <<-- S1Serveur : sendStartPhase("PREPHASE_3", {GameDescription})
C1Client --> S1Serveur : sendFinishPhase(tPlayerTraque, "PREPHASE_3")
C1Client <-- S1Serveur : {true, ""}
C2Client --> S1Serveur : sendFinishPhase(tPlayerCreature, "PREPHASE_3")
C2Client <-- S1Serveur : {true, ""}
216

217
218
219
220
221
222
223
224
C1Client <<-- S1Serveur : sendStartPhase("PHASE_3", {GameDescription})
C2Client <<-- S1Serveur : sendStartPhase("PHASE_3", {GameDescription})
C1Client <- S1Serveur : askAction({"CHOOSE_POWER" ,"Choose a power",[{"1", "Power 1"}, {"2", "Power 2"}]})
C1Client --> S1Serveur : {"CHOOSE_POWER", ["1"]}
C1Client --> S1Serveur : sendFinishPhase(tPlayerTraque, "PHASE_3")
C1Client <-- S1Serveur : {true, ""}
C2Client --> S1Serveur : sendFinishPhase(tPlayerCreature, "PHASE_3")
C2Client <-- S1Serveur : {true, ""}
225

226
227
228
229
230
231
C1Client <<-- S1Serveur : sendStartPhase("POSTPHASE_3", {GameDescription})
C2Client <<-- S1Serveur : sendStartPhase("POSTPHASE_3", {GameDescription})
C1Client --> S1Serveur : sendFinishPhase(tPlayerTraque, "POSTPHASE_3")
C1Client <-- S1Serveur : {true, ""}
C2Client --> S1Serveur : sendFinishPhase(tPlayerCreature, "POSTPHASE_3")
C2Client <-- S1Serveur : {true, ""}
232

233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
C1Client <<-- S1Serveur : sendStartPhase("PREPHASE_4", {GameDescription})
C2Client <<-- S1Serveur : sendStartPhase("PREPHASE_4", {GameDescription})
C1Client --> S1Serveur : sendFinishPhase(tPlayerTraque, "PREPHASE_4")
C1Client <-- S1Serveur : {true, ""}
C2Client --> S1Serveur : sendFinishPhase(tPlayerCreature, "PREPHASE_4")
C2Client <-- S1Serveur : {true, ""}

C1Client <<-- S1Serveur : sendStartPhase("PHASE_4", {GameDescription})
C2Client <<-- S1Serveur : sendStartPhase("PHASE_4", {GameDescription})
C1Client --> S1Serveur : sendFinishPhase(tPlayerTraque, "PHASE_4")
C1Client <-- S1Serveur : {true, ""}
C2Client --> S1Serveur : sendFinishPhase(tPlayerCreature, "PHASE_4")
C2Client <-- S1Serveur : {true, ""}

C1Client <<-- S1Serveur : sendStartPhase("POSTPHASE_4", "GameDescription")
C2Client <<-- S1Serveur : sendStartPhase("POSTPHASE_4", {GameDescription})
C1Client --> S1Serveur : sendFinishPhase(tPlayerTraque, "POSTPHASE_4")
C1Client <-- S1Serveur : {true, ""}
C2Client --> S1Serveur : sendFinishPhase(tPlayerCreature, "POSTPHASE_4")
C2Client <-- S1Serveur : {true, ""}

----