Skip to content
This repository has been archived by the owner on Jun 7, 2019. It is now read-only.

CardGameResources Library Documentation

Jean-Sébastien Herbaux edited this page Nov 12, 2017 · 5 revisions

CardGameResources Library

Card Deck
TrumpInfos Envcall
EnvInfos Err
Errcall GameAction
Gamecall Packet
PacketType Syscall
SysCommand

Card

Class used to define a Card object.

Constructor(v, c)

Main constructor for a Card

Name Description
v System.Char
The value of the card
c System.String
The color of the card

Color

Getter and Setter for the color of the Card

Value

Getter and Setter for the value of the Card.

Deck

Class used to store and manipulate one or multiples Card

Constructor

Default constructor for Deck

Constructor(array_)

Second constructor for Deck. It allow to fill directly the Deck with some Card.

Name Description
array_ System.Collections.Generic.List{CardGameResources.Game.Card}
The List of Card which will be copied into the Deck

Add(card_)

Add a Card into the Deck

Name Description
card_ CardGameResources.Game.Card
The Card which will be append to thee Deck

Returns

This method always returns true

Array

Getter and Setter for the List of Card contained in the Deck

Clear

Remove all the Card objects in the Deck

Contains(card)

Check if a Card is in the Deck

Name Description
card CardGameResources.Game.Card
The Card used for the search

Returns

True if the Card is contained in the Deck, false otherwise.

Remove(card)

Remove a specific Card from the Deck

Name Description
card CardGameResources.Game.Card
The Card which will be removed

Remove(index)

Remove a Card by its index in the Deck

Name Description
index System.Int32
The index of the Card

Returns

False if the index is greater than the number of cards in the Deck, true otherwise.

TrumpInfos

TrumpInfos is a class used to store information about a trump in a card game.

Constructor

Default constructor for TrumpInfos

Constructor(card_, owner_, realColor_)

Complete constructor for TrumpInfos

Name Description
card_ CardGameResources.Game.Card
The card which will be stored as the trump
owner_ System.String
The name of the player which took the Trump
realColor_ System.String
The real color of the Trump. It can differ from the Card color

Constructor(card_)

Constructor which take a Card in parameter

Name Description
card_ CardGameResources.Game.Card
The TrumpInfos.Card associated to the trump, the color of the card may differs from the real trump color

Card

Getter and Setter for the Card

Owner

Getter and Setter for the Owner of the trump Card

RealColor

Getter and Setter for the trump real color

Envcall

This class have to be used as the System.Object parameter for a Packet with a PacketType of value PacketType.ENV.

Constructor(CardGameResources.Net.EnvInfos,System.Object)

Complete constructor for Envcall

Data

Getter and Setter for the data System.Object of the Envcall

Type

Getter and Setter for the type of the Envcall

EnvInfos

Enum for the ENV part of the communication protocol.

S_SCORES

Communication direction: Server => Client.

Give to the client the scores for the two teams.
The object associated with the command must a List of integer of size 2

S_SET_REMAINING_TIME

Communication direction: Server => Client.

Give to the client the remaining time before the end of the round. The object associated with the command must a System.Int32

S_SET_TEAM

Communication direction: Server => Client.

Give to the client the information about the teams' composition.
The object associated with the command must a Dictionary which link a player name with its team number

S_SET_TOUR

Communication direction: Server => Client.

Give to the clients the name of the current player.
The object associated to the command must be a System.String

S_USER_LIST

Communication direction: Server => Client.

Give to the client the list of connected users The object associated to the command must a List of string of size 1 to 4

Err

Enum for the ERROR part of the communication protocol.

BAD_ARGUMENT

Communication direction: Server => Client.

Inform the client that the server has received a bad argument on one of the client's request.

The object associated with the command must be null

BROKEN_RULE

Communication direction: Server => Client.

Inform the client that he broke a rule by one of its action.

The object associated with the command must be null

FORBIDDEN_ACTION

Communication direction: Server => Client.

Inform the client that the action he did was not allowed.

The object associated with the command must be null

FORBIDDEN_CARD

Communication direction: Server => Client.

Inform the client that the card he played was not valid.

The object associated with the command must be null

SERVER_FULL

Communication direction: Server => Client.

Inform the client that he can't register to the server because it has no remaining slot.

The object associated with the command must be null

UNKNOWN_ERROR

Communication direction: Server => Client.

Inform the client that an unexpected error has been thrown on the server.

The object associated with the command must be null

Errcall

This class have to be used as the System.Object parameter for a Packet with a PacketType of value PacketType.ERR.

Constructor

Default constructor for Errcall

Constructor(CardGameResources.Net.Err,System.String)

Complete constructor for Errcall

Constructor(CardGameResources.Net.Err)

Constructor with type defined only for Errcall

Message

Getter and Setter for the data System.Object of the Errcall

Type

Getter and Setter for the type of the Errcall

GameAction

Enum for the GAME part of the communication protocol.

C_PLAY_CARD

Communication direction: Client => Server.

Inform the server that the client want to play a specific CardGameResources.Game.Card of its CardGameResources.Game.Deck.
The object associated to the command must be a CardGameResources.Game.Card

C_TAKE_TRUMP

Communication direction: Client => Server.

This is the answer to the first lap of the trump phase.
The client uses this command to inform if want (or not) to take the trump.

The object associated with the command must be a System.Boolean

C_TAKE_TRUMP_AS

Communication direction: Client => Server.

This is the answer to the second lap of the trump phase.
The client uses this command to inform if want (or not) to take the trump as the color of its choice.

The object associated with the command must be a System.String (either empty or with the name of the wanted color)

S_REQUEST_TRUMP_FROM

Communication direction: Server => Client.

The server uses this command to ask if a client wants to take the trump or not.
Following the lap number (1 or 2), the answer might be either GameAction.C_TAKE_TRUMP or GameAction.C_TAKE_TRUMP_AS.

The object associated with the command must be a KeyValuePair(int, string) where the key is the lap number and the string the player targeted.

S_SET_BOARD_DECK

Communication direction: Server => Client.

The server use this command to send the updated board CardGameResources.Game.Deck.
The object associated to the command must be a CardGameResources.Game.Deck.

S_SET_LASTROUND_DECK

Communication direction: Server => Client.

The server uses this command to send the updated CardGameResources.Game.Deck for the last played round.

The object associated with the command must be a Dictionary(string, Card) of size 4 where each key represents the name of the player which play the card in Value.

S_SET_TRUMP

Communication direction: Server => Client.

The server uses this command to send the information about the trump to clients.
The object associated to the command must be a CardGameResources.Game.TrumpInfos

S_SET_USER_DECK

Communication direction: Server => Client.

The server use this command to send the updated user CardGameResources.Game.Deck to the client.
The object associated to the command must be a CardGameResources.Game.Deck.

Gamecall

This class have to be used as the System.Object parameter for a Packet with a PacketType of value PacketType.GAME.

Constructor(action_, data_)

Main constructor for Gamecall

Name Description
action_ CardGameResources.Net.GameAction
The type of the action you want to send. See also

See also

Action

Getter and Setter for the action of the Gamecall

Data

Getter and Setter for the data System.Object of the Gamecall

Packet

Class used to transfer data across the network.

Constructor

Default constructor for a Packet

Constructor(name_, type_, data_, registration_)

Registration constructor for client side. The key is initialized to 0.

Name Description
name_ System.String
The name of the emitter.
type_ CardGameResources.Net.PacketType
The type of the System.Object member
data_ System.Object
The System.Object which contain the data
registration_ System.Boolean
This boolean must be set to tru only if the type is PacketType.SYS and the data's command is of value SysCommand.C_REGISTER

Constructor(name_, type_, data_)

Main constructor for client side. The key is initialized to 0 and the registration state to false.

Name Description
name_ System.String
The name of the emitter.
type_ CardGameResources.Net.PacketType
The type of the System.Object member
data_ System.Object
The System.Object which contain the data

Constructor(name_, key_, type_, data_)

Main constructor for server side, the key must be initialized with a value.

Name Description
name_ System.String
The name of the emitter. For server side, it will be "root"
key_ System.UInt32
The value of the Locker key
type_ CardGameResources.Net.PacketType
The type of the System.Object member
data_ System.Object
The System.Object which contain the data

Data

Getter and Setter for the Packet's data.

Key

Getter and Setter for the Packet's reference on a Locker key

Name

Getter and Setter for the Packet's emitter name.

Registration

Getter and Setter for the registration state

Type

Getter and Setter for the Packet's type.

PacketType

Enum used to defined the type of the Packet's System.Object

ENV

The associated object must be an Envcall

ERR

The associated object must be an Errcall

GAME

The associated object must be a Gamecall

SYS

The associated object must be a Syscall

Syscall

This class have to be used as the System.Object parameter for a Packet with a PacketType of value PacketType.SYS.

Constructor(command_, data_)

Main constructor for Syscall

Name Description
command_ CardGameResources.Net.SysCommand
The type of the command you want to send. See also

See also

Command

Getter and Setter for the command of the Syscall

Data

Getter and Setter for the data System.Object of the Syscall

SysCommand

Enum for the SYS part of the communication protocol.

C_QUIT

Communication direction: Client => Server.

Request a registration to the server from a client.
This command must be called only once by game.

The object associated with the command must be null.

C_REGISTER

Communication direction: Client => Server.

Request a registration to the server from a client.
This command must be called only once by game.

The object associated with the command must be null.

S_CONNECTED

Communication direction: Server => Clien

Inform the client that he has been disconnected from the server.

The object associated with the command must be null.

S_DISCONNECTED

Communication direction: Client => Server.

Inform the client that a client is about to be ejected from the server.

The object associated with the command must be the name of a client.

S_END_GAME

Communication direction: Server => Client.

Inform the client that the game has ended.

The object associated with the command must be null.

S_POKE

Communication direction: Client => Server.

Indicate to the server that you have successfully received a message. It also unlocks the next action for the server.
You must send this request less than one second after you received the server message with the same key.
The key of the Packet must match the Locker key you want to unlock.

The object associated with the command must be null.

S_START_GAME

Communication direction: Server => Client.

Inform the client that the game has begun.

The object associated with the command must be null.

Clone this wiki locally