Uploaded by Long Ngo Thang

Diagrams

advertisement
<<interface>>
IStorageFactory
LocalFileStorageFactory
+ GetOrCreateGameSaveStorage():IStorageRepository<GameSaveDto>
+ GetOrCreateGameSaveStorage():GameSaveRepository<GameSaveDto>
+ GetOrCreatePlayerStorage():IStorageRepository<PlayerProfileDto>
+ GetOrCreatePlayerStorage():PlayerProfileRepository<PlayerProfileDto>
PlayerProfileDto
<<interface>>
IStorageRepository<T>
+ id: Guid
StorageListingDto
+ name: string
+ nickname: string
+ InitialiseStorage():void
+ gamesPlayed: int
+ ListAllItems():StorageListing[0,*]
- id: Guid
+ GetAllItems():IEnnurmable<T>
- name: string
+ GetItem(): T
- dateCreated: DateTimeOffset
+ UpsertItem(T item): bool
- itemData: string
+ gamesWon: int
+ gamesLost: int
GameSaveDto
+ RemoveItem(Guid id): bool
+ id: Guid
+ gameType: string
+ datePlayed: DateTimeOffset
LocalGameSaveRepository<GameSaveDto>
- storageLocation: string
+ InitialiseStorage():void
+ ListAllItems():StorageListing[0,*]
+ GetItem(): GameSaveDto
+ GetAllItems():GameSaveDto[0,*]
+ UpsertItem(GameSaveDto item): bool
+ RemoveItem(Guid id): bool
LocalPlayerProfileRepository<PlayerProfile
Dto>
- storageLocation: string
+ gameMoves: GameMoveDto[0,*]
+ players: PlayerDto[0,*]
+ finished: bool
+ InitialiseStorage():void
GameSaveDto
+ ListAllItems():StorageListing[0,*]
+ GetAllItems():PlayerProfileDto[0,*]
GameMoveDto
+ GetItem(): PlayerProfileDto
+ UpsertItem(PlayerProfileDto item): bool
+ playerDtoId: Guid
+ RemoveItem(Guid id): bool
+ datePlayed: DateTimeOffset
+ move: string
PlayerDto
+ id: Guid
+ playerType: PlayerTypes
+ playerId: Guid
+ aiSkill: AISkill
+ gamePiece: string
:LocalGameSaveRepository<GameSaveDto>
storage = "SavedGames.json"
:GameSaveDto
id = '12ad27e3-78fd-4346-b84a-4871c682b636'
gameType = "TicTacToeGame"
datePlayed = "02/04/2023 7:13:50 PM +00:00"
finished = "false"
m1:GameMoveDto
m2:GameMoveDto
m3:GameMoveDto
playerId='81dfe383-f901-496c-9ea2-99949a440b5a'
datePlayed="02/04/2023 7:14:50 PM +00:00"
move="0,1"
playerId='ce664854-9124-4ee6-83d5-69f82088e1cf'
datePlayed="02/04/2023 7:15:50 PM +00:00"
move="0,2"
playerId='81dfe383-f901-496c-9ea2-99949a440b5a'
datePlayed="02/04/2023 7:16:50 PM +00:00"
move="1,1"
p1:PlayerDto
id='81dfe383-f901-496c-9ea2-99949a440b5a'
playerType=PlayerTypes.HUMAN
playerId='65cc2ac2-c432-418d-97bd-afaf98d4bc4a'
gamePeice="Nought"
p2:PlayerDto
id='ce664854-9124-4ee6-83d5-69f82088e1cf'
playerType=PlayerTypes.COMPUTER
aiSkill=AISkill.CLEETUS
gamePeice="Cross"
User
:MainForm
Application Launch
localFactory
:LocalStorageFactory
new LocalStorageFactory()
localGameSave
localPlayerProfile
:LocalGameSaveRepository
:LocalPlayerProfileRepository
gameSession
:GameSession
gameFactory
:TicTacToeGameFactory
game
:TicTacToeGame
gameAI
:TicTacToeGameAI
gameBoard
:TicTacToeGameBoard
new LocalGameSaveRepository()
new LocalPlayerProfileRepository ()
GetLoadedGames()
new GameSession()
Start Game
SelectGame()
ListAllItems()
return IEnumerable<IStorageListing>
SelectUsers()
StartNewGame(game,players)
new TicTacToeGameFactory()
StartGame(players)
new TicTacToeGame()
SetPlayers(players)
new TicTacToeGameAI()
SetAI(gameAI)
InitialiseAI()
new TicTacToeGameBoard()
SetBoard(gameBoard)
result
result
InitialiseGameBoard()
Download