🎲

Turn base system

First of all, create a new class and add this using (in my case, my class name is TestTurnBase)

using TcpServerKit.Tools;

Then inherit from TurnBase class

Public class TestTurnBase : TurnBase

Create constructor

public TestTurnBase(Room room, User starter, int turnsCount, Order selectionMode) : base(room, starter, turnsCount, selectionMode)
{

}

Methods

💡
Tip: StartTurn() must be called first.

return true if done and return false if the round already is completed.

implement 3 abstract tasks

💡
Tip: every turn consists 1 or multiple rounds

public override Task RoundStartedAsync(User user)

public override Task TurnCompletedAsync(int roundsPlayed)

user : current user in the turn.

roundsPlayed : Number of played rounds.

  • run when the round is completed.

public override Task RoundCompletedAsync(User user, TimeSpan time)

User : last user who plays.

time : game duration time.