C
C#7mo ago
wemih

I NEED HELP WITH MY CODE

I'm making this board game called Onitama and in my TableManager code im having a problem on the StartGameForTable code. using Onitama.Core.GameAggregate.Contracts; using Onitama.Core.PlayerAggregate.Contracts; using Onitama.Core.TableAggregate.Contracts; using Onitama.Core.UserAggregate; namespace Onitama.Core.TableAggregate; /// <inheritdoc cref="ITableManager"/> internal class TableManager : ITableManager { private readonly ITableRepository tableRepository; private readonly ITableFactory tableFactory; private readonly IGameRepository gameRepository; private readonly IGameFactory gameFactory; private readonly IGamePlayStrategy gamePlayStrategy; public TableManager( ITableRepository tableRepository, ITableFactory tableFactory, IGameRepository gameRepository, IGameFactory gameFactory, IGamePlayStrategy gamePlayStrategy) { this.tableRepository = tableRepository; this.tableFactory = tableFactory; this.gameRepository = gameRepository; this.gameFactory = gameFactory; this.gamePlayStrategy = gamePlayStrategy; } public ITable AddNewTableForUser(User user, TablePreferences preferences) { ITable table = tableFactory.CreateNewForUser(user, preferences); tableRepository.Add(table); return table; } public void JoinTable(Guid tableId, User user) { ITable table = tableRepository.Get(tableId); table.Join(user); } public void LeaveTable(Guid tableId, User user) { ITable table = tableRepository.Get(tableId); table.Leave(user.Id); if (0 == table.SeatedPlayers.Count) { tableRepository.Remove(table.Id); } } public void FillWithArtificialPlayers(Guid tableId, User user) { tableRepository.Get(tableId).FillWithArtificialPlayers(gamePlayStrategy); } public IGame StartGameForTable(Guid tableId, User user) { ITable table = tableRepository.Get(tableId); TableFactory tableFactory = new TableFactory(); ITable _table = tableFactory.CreateNewForUser(user, table.Preferences); IGame game = gameFactory.CreateNewForTable(_table); gameRepository.Add(game); return game; } }
3 Replies
Angius
Angius7mo ago
And that problem would be...?
Buddy
Buddy7mo ago
$details
MODiX
MODiX7mo ago
When you ask a question, make sure you include as much detail as possible. Such as code, the issue you are facing, what you expect the result to be, what .NET version you are using and what platform/environment (if any) are relevant to your question. Upload code here https://paste.mod.gg/ (see $code for more information on how to paste your code)
Want results from more Discord servers?
Add your server