-
Notifications
You must be signed in to change notification settings - Fork 1
Server Documentation
Program | Core |
Game | Referee |
Entry point of the server project
Core class of the server
Default constructor of the Core
Getter and Setter of the singleton instance of the Core
Getter and Setter for the locker state of the Core
Start the server's dependencies like the Network and loop infinitly the execution.
Game Logic for the Belote card Game used by Referee
Default constructor for Game
Main entry point for all the AI actions
Name | Description |
---|---|
name |
System.String Define the name of the player which the AI will play for. |
p |
CardGameResources.Net.Packet The packet transmission that the AI will use |
Logic for AI on CardGameResources.Net.EnvInfos.S_SET_TOUR event.
Name | Description |
---|---|
name |
System.String The name of the player who must play |
Logic for AI on CardGameResources.Net.GameAction.S_REQUEST_TRUMP_FROM event.
Name | Description |
---|---|
data |
System.Collections.Generic.KeyValuePair{System.Int32,System.String} A pair of value which contains the lap number and the name of the player who must play |
Assign a name and a color to the Game.TrumpInfos
Name | Description |
---|---|
name |
System.String The name of the owner |
color |
System.String The name of the real color of the tump |
This method check who's the winner for the current round, update the scores and notify the users about it
The name of the winner
This method will randomly fill the CardGameResources.Game.Deck of all the connected users with a limit of 8 CardGameResources.Game.Card per user.
Utility method mainly used by Game.PlayCard_callback(System.String,CardGameResources.Game.Card) to check if a user can play a specific CardGameResources.Game.Card
Name | Description |
---|---|
userDeck |
CardGameResources.Game.Deck The deck from which "playedCard" is issued |
playedCard |
CardGameResources.Game.Card The CardGameResources.Game.Card played |
board |
CardGameResources.Game.Deck The current CardGameResources.Game.Deck on the board |
color |
System.String The current board main color |
powerCheck |
System.Boolean If set to true, the method will also check if the user have a better card in he's CardGameResources.Game.Deck |
Get the amount of point for a specific CardGameResources.Game.Card. This method take in consideration the actual trump.
Name | Description |
---|---|
card |
CardGameResources.Game.Card |
The amount of point for card
Return the real value for the paramaeter card. This method allow the user to do some arithmetics and comparaison with the cards.
Name | Description |
---|---|
card |
CardGameResources.Game.Card |
The value of the card as an integer
Generate a new list of user which indicate the order of the plays
Name | Description |
---|---|
begin |
System.String The username which will play first |
The ordered list of players
This method distribute randomly 5 CardGameResources.Game.Card per user
This method will initialize each component of the game logic
Initialize the master deck, which is a constant CardGameResources.Game.Deck of all the 32 avalaible cards.
Initialize the user CardGameResources.Game.Decks with 5 CardGameResources.Game.Card
This method will check if there is at least one CardGameResources.Game.Card with the color color in the deck
Name | Description |
---|---|
deck |
CardGameResources.Game.Deck The CardGameResources.Game.Deck of card which will be the object of the search. |
color |
System.String The color which will be used for the search. |
The number of CardGameResources.Game.Card which match the color
Entry point of the main rules method. It will be called when the server receive a request of type CardGameResources.Net.GameAction.C_PLAY_CARD This function act also as a referee by checking if the user movement does not break any rules.
Name | Description |
---|---|
name |
System.String The name of the user who sent the command |
card |
CardGameResources.Game.Card The card that the user want to play |
This function will play a specific CardGameResources.Game.Card for name. It'll also update all the needed variables and trigger all the changes to the users.
Name | Description |
---|---|
name |
System.String The name of the user who sent the command |
card |
CardGameResources.Game.Card The card that the user want to play |
Entry point for the main gameplay phase. Manage the core of the game.
Reconnect a player who's been previously disconnect from the server.
Name | Description |
---|---|
name |
System.String The name of the player who just registered |
This method is designed to totally reset the game logic.
Start the GamePlay phases: TrumpPhase, PlayPhase ; then end the game
Send some data of type "type" to all registered users.
Name | Description |
---|---|
type |
CardGameResources.Net.PacketType The type of data which will be send |
data |
System.Object The data which will be send |
Send some data of type "type" to name.
Name | Description |
---|---|
name |
System.String The username who will receive the request |
type |
CardGameResources.Net.PacketType The type of the data which will be send |
data |
System.Object The data which will be send |
Entry point of the game. Called by the referee when 4 players are connected
Callback method when the server receive a CardGameResources.Net.GameAction.C_TAKE_TRUMP request
Name | Description |
---|---|
name |
System.String The name of the user who sent the request |
ans |
System.Boolean The answer of the user |
Callback method when the server receive a CardGameResources.Net.GameAction.C_TAKE_TRUMP_AS request
Name | Description |
---|---|
name |
System.String The name of the user who sent the request |
color |
System.String A string containing the color of the trump, or nothing |
This method will chose a card for the trump randomly and will then notify all the clients about it
Manage the trump phase: init, request, chose, assign and notify
Manage the locks for the trump phase
Name | Description |
---|---|
phase |
System.Int32 |
Lock the actions for trump phase
Name | Description |
---|---|
phase |
System.Int32 |
The mission of the referee is to regulate the flow of request handled by the Network.Server. It also act as a router and can interact directly with the Referee.Game.
Check if the client can register to the server
Name | Description |
---|---|
name |
System.String The name of the client |
This method is triggered when the server receive an object. It Will redirect the object trhough the different routes
Name | Description |
---|---|
obj |
System.Object The CardGameResources.Net.Packet object serialized as an System.Object |
GAME FUNCTIONS This function is called by the main entry point when the received object is of type CardGameResources.Net.PacketType.GAME
Name | Description |
---|---|
p |
CardGameResources.Net.Packet The CardGameResources.Net.Packet received from the server |
A getter and a setter for the Referee singleton instance
This method is used to handle synchronous events. It will unlock the Network.Lock.Locker associated to the key of the CardGameResources.Net.Packet
Name | Description |
---|---|
key |
System.UInt32 The key of the Network.Lock.Locker |
name |
System.String The name of the client who try to unlock the Network.Lock.Locker |
Try to register a user into the server. If the server went full, it'll start the game.
Name | Description |
---|---|
name |
System.String The name of the client who try to register |
evt |
CardGameResources.Net.Syscall The content of the CardGameResources.Net.Syscall event contained in the received CardGameResources.Net.Packet |
SYS FUNCTIONS This function is called by the main entry point when the received object is of type CardGameResources.Net.PacketType.SYS
Name | Description |
---|---|
p |
CardGameResources.Net.Packet The CardGameResources.Net.Packet received from the server |