GodotMattohaLobbySystem 0.2.4
|
Public Member Functions | |
delegate void | ConnectedToServerEventHandler () |
Emmited when connection to server is succeed. | |
delegate void | PlayerRegisteredEventHandler (Dictionary< string, Variant > playerData) |
Emmited when player is connected and registered in server memory. | |
delegate void | LoadLobbyPlayersSucceedEventHandler (Array< Dictionary< string, Variant > > players) |
Emmited when loading lobby players loaded successfully. | |
delegate void | LoadLobbyPlayersFailedEventHandler (string cause) |
Emmited when loading lobby player failed. | |
delegate void | LoadAvailableLobbiesSucceedEventHandler (Array< Dictionary< string, Variant > > lobbies) |
Emmited when available lobbies loaded successfully. | |
delegate void | LoadAvailableLobbiesFailedEventHandler (string cause) |
Emmited when available lobbies failed to load. | |
delegate void | SetPlayerDataSucceedEventHandler (Dictionary< string, Variant > playerData) |
Emitted when setting player data succeeds. | |
delegate void | SetPlayerIsInGameSucceedEventHandler (bool value) |
Emitted when change IsInGame value for the current player is done. | |
delegate void | SetPlayerDataFailedEventHandler (string cause) |
Emitted when setting player data fails. | |
delegate void | CreateLobbySucceedEventHandler (Dictionary< string, Variant > lobbyData) |
Emitted when creating a lobby succeeds. | |
delegate void | CreateLobbyFailedEventHandler (string cause) |
Emitted when creating a lobby fails. | |
delegate void | SetLobbyDataSucceedEventHandler (Dictionary< string, Variant > lobbyData) |
Emitted when setting lobby data succeeds. | |
delegate void | SetLobbyDataFailedEventHandler (string cause) |
Emitted when setting lobby data fails. | |
delegate void | SetLobbyOwnerSucceedEventHandler (Dictionary< string, Variant > lobbyData) |
Emitted when setting the lobby owner succeeds. | |
delegate void | SetLobbyOwnerFailedEventHandler (string cause) |
Emitted when setting the lobby owner fails. | |
delegate void | StartGameSucceedEventHandler (Dictionary< string, Variant > lobbyData) |
Emitted when starting the game succeeds. | |
delegate void | StartGameFailedEventHandler (string cause) |
Emitted when starting the game fails. | |
delegate void | EndGameSucceedEventHandler (Dictionary< string, Variant > lobbyData) |
Emitted when ending the game succeeds. | |
delegate void | EndGameFailedEventHandler (string cause) |
Emitted when ending the game fails. | |
delegate void | JoinLobbySucceedEventHandler (Dictionary< string, Variant > lobbyData) |
Emitted when joining a lobby succeeds. | |
delegate void | JoinLobbyFailedEventHandler (string cause) |
Emitted when joining a lobby fails. | |
delegate void | LeaveLobbySucceedEventHandler () |
Emitted when leaving a lobby succeeds. | |
delegate void | JoinTeamSucceedEventHandler (int newTeam) |
Emitted when joining a team succeeds. | |
delegate void | JoinTeamFailedEventHandler (string cause) |
Emitted when joining a team fails. | |
delegate void | NewPlayerJoinedEventHandler (Dictionary< string, Variant > playerData) |
Emitted when a new player joins. | |
delegate void | JoinedPlayerUpdatedEventHandler (Dictionary< string, Variant > playerData) |
Emitted when a joined player updates their information. | |
delegate void | PlayerChangedHisTeamEventHandler (Dictionary< string, Variant > playerData) |
Emitted when a player changes their team. | |
delegate void | PlayerJoinedEventHandler (Dictionary< string, Variant > playerData) |
Emitted when a player joins current lobby. | |
delegate void | PlayerLeftEventHandler (Dictionary< string, Variant > playerData) |
Emitted when a player leaves. | |
delegate void | SpawnNodeRequestedEventHandler (Dictionary< string, Variant > nodeData) |
Emitted when a node spawn is requested. | |
delegate void | SpawnNodeFailedEventHandler (string cause) |
Emitted when node spawning fails. | |
delegate void | SpawnLobbyNodesSucceedEventHandler () |
Emitted when spawning lobby nodes finishes. | |
delegate void | SpawnLobbyNodesFailedEventHandler (string cause) |
Emitted when spawning lobby nodes fails. | |
delegate void | DespawnNodeRequestedEventHandler (Dictionary< string, Variant > nodeData) |
Emitted when a node despawn is requested. | |
delegate void | DespawnNodeFailedEventHandler (string cause) |
Emitted when node despawning fails. | |
delegate void | DespawnRemovedSceneNodesFailedEventHandler (string cause) |
Emitted when despawning removed scene nodes fails. | |
delegate void | GlobalMessageReceivedEventHandler (Dictionary< string, Variant > senderData, string message) |
Emitted when a global message is received. | |
delegate void | GlobalMessageFailedEventHandler (string cause) |
Emitted when sending a global message fails. | |
delegate void | LobbyMessageReceivedEventHandler (Dictionary< string, Variant > senderData, string message) |
Emitted when a lobby message is received. | |
delegate void | LobbyMessageFailedEventHandler (string cause) |
Emitted when sending a lobby message fails. | |
delegate void | TeamMessageReceivedEventHandler (Dictionary< string, Variant > senderData, string message) |
Emitted when a team message is received. | |
delegate void | TeamMessageFailedEventHandler (string cause) |
Emitted when sending a team message fails. | |
override void | _Ready () |
Array< long > | GetLobbyPlayersIds (bool onlyInGamePlayers=true) |
Returns joined lobby players Ids. | |
bool | IsPlayerInLobby (long playerId) |
Check if peer id is joined in lobby or not. | |
bool | IsPlayerInMyTeam (long playerId) |
Check if the player id is in same team. | |
bool | IsPlayerInGame (long playerId) |
Returns true if player entered the game scene and spawned lobby nodes, this will be used under the hood for replication purposes. | |
void | SetPlayerData (Dictionary< string, Variant > playerData) |
Set Player data in server, this will emit "SetPlayerDataSucceed" or "SetPlayerDataFailed", for current client and emmit "JoinedPlayerUpdated" for other lobby players. Base player keys you can edit in addition to your custom keys: | |
void | CreateLobby (Dictionary< string, Variant > lobbyData, string lobbySceneFile) |
Create new lobby on server, this will emmit "CreateLobbySucceed and SetPlayerDataSucceed" or "CreateLobbyFailed" for creator, and "LoadAvailableLobbiesSucceed" for all online players if "AutoLoadAvailableLobbies" is enabled. Base lobby keys you can edit in addition to your custom keys: | |
void | SetLobbyData (Dictionary< string, Variant > lobbyData) |
Set Lobby data and sync it, this will emmit "SetLobbyDataFailed" for caller user if Setting Data failed, and sync the data for all joined players - including caller user - then emmit "SetLobbyDataSucceed" for them, and "LoadAvailableLobbiesSucceed" for all online players if "AutoLoadAvailableLobbies" is enabled. Base lobby keys you can edit in addition to your custom keys: | |
void | SetLobbyOwner (int newOwnerId) |
Change lobby owner, this will emmit "SetLobbyOwnerSucceed" for all joined players including caller user if changing owner is succeed, and emmit "SetLobbyOwnerFailed" for caller user if setting owner fails, ONLY owner of the lobby can set new lobby owner. | |
void | LoadAvailableLobbies () |
Load Available lobbies, this will emmit "LoadAvailableLobbiesSucceed" or "LoadAvailableLobbiesFailed" for caller user. | |
void | JoinLobby (int lobbyId) |
Join lobby by it's ID, this will emmit "JoinLobbySucceed" or "JoinLobbyFailed" for caller user, and "NewPlayerJoined" for other joined players, and "LoadAvailableLobbiesSucceed" for all online players if "AutoLoadAvailableLobbies" is enabled. | |
void | StartGame () |
Start Lobby Game, this will emmit "StartGameSucceed" for all joined players or "StartGameFailed" for caller user, and "LoadAvailableLobbiesSucceed" for all online players if "AutoLoadAvailableLobbies" is enabled. | |
void | EndGame () |
End Lobby Game, this ewill emmit "EndGameSucceed" for all joined players or "EndGameFailed" for caller user, and "LoadAvailableLobbiesSucceed" for all online players if "AutoLoadAvailableLobbies" is enabled. | |
void | LoadLobbyPlayers () |
Load players data that joined in same lobby, this will emmit "LoadLobbyPlayersSucceed" or "LoadLobbyPlayersFailed" for the caller user. | |
void | SpawnNode (Node node, bool teamOnly=false, Array< string > additionalProps=null) |
Spawn node for all joined players in same lobby or same team, this will emmit "SpawnNodeRequested" for joined players or players in teams, "SpawnNodeFailed" will be emmited and node will be locally despawned if spawning node failed. | |
void | SpawnLobbyNodes () |
Spawn all lobby nodes tha has been spawned by other players, team only nodes will not be spawned until player in same team, this method will emmit "SpawnLobbyNodesSucceed" or "SpawnLobbyNodesFailed". | |
void | SetPlayerIsInGame (bool value) |
Change the state of the current player if he is in game or not. | |
void | DespawnNode (Node node) |
Despawn node and sync that with all players, this will emmit "DespawnNodeRequested" for all players and "DespawnNodeFailed" for caller user if despawning fails and then respawning the node in case if player destroyed it. | |
void | DespawnRemovedSceneNodes () |
Despawn All scene nodes that despawned during game player, used by gameholder when new player enter the game scene, this will emmit "DespawnRemovedSceneNodesSucceed" or "DespawnRemovedSceneNodesFailed". | |
void | JoinTeam (int teamId) |
Join or change a team, this will emmit "JoinTeamSucceed" or "JoinTeamFailed" if joingin failed, in addition, "PlayerChangedHisTeam" will be emmited on all lobby players including the player itself. | |
void | SendTeamMessage (string message) |
Send a message for team members, this will emmit "TeamMessageSucceed" for all players or "TeamMessageFailed" for caller user. | |
void | SendLobbyMessage (string message) |
Send a message for lobby members, this will emmit "LobbyMessageSucceed" for all players or "LobbyMessageFailed" for caller user. | |
void | SendGlobalMessage (string message) |
Send a global message for all online users, this will emmit "GlobalMessageSucceed" for all players or "GlobalMessageFailed" for caller user. | |
void | LeaveLobby () |
Leave joined lobby, this will emmit "LeaveLobbySucceed" for caller user and "PlayerLeft" for all joined players. | |
void Mattoha.Nodes.MattohaClient.CreateLobby | ( | Dictionary< string, Variant > | lobbyData, |
string | lobbySceneFile ) |
Create new lobby on server, this will emmit "CreateLobbySucceed and SetPlayerDataSucceed" or "CreateLobbyFailed" for creator, and "LoadAvailableLobbiesSucceed" for all online players if "AutoLoadAvailableLobbies" is enabled.
Base lobby keys you can edit in addition to your custom keys:
lobbyData | Lobby Data to create. |
lobbySceneFile | The scene file for lobby game, for example: "res://maps/arean.tscn". |
delegate void Mattoha.Nodes.MattohaClient.CreateLobbyFailedEventHandler | ( | string | cause | ) |
Emitted when creating a lobby fails.
cause | The cause of the failure. |
delegate void Mattoha.Nodes.MattohaClient.CreateLobbySucceedEventHandler | ( | Dictionary< string, Variant > | lobbyData | ) |
Emitted when creating a lobby succeeds.
lobbyData | The data of the created lobby. |
void Mattoha.Nodes.MattohaClient.DespawnNode | ( | Node | node | ) |
Despawn node and sync that with all players, this will emmit "DespawnNodeRequested" for all players and "DespawnNodeFailed" for caller user if despawning fails and then respawning the node in case if player destroyed it.
node |
delegate void Mattoha.Nodes.MattohaClient.DespawnNodeFailedEventHandler | ( | string | cause | ) |
Emitted when node despawning fails.
cause | The cause of the failure. |
delegate void Mattoha.Nodes.MattohaClient.DespawnNodeRequestedEventHandler | ( | Dictionary< string, Variant > | nodeData | ) |
Emitted when a node despawn is requested.
nodeData | The data of the node to be despawned. |
delegate void Mattoha.Nodes.MattohaClient.DespawnRemovedSceneNodesFailedEventHandler | ( | string | cause | ) |
Emitted when despawning removed scene nodes fails.
cause | The cause of the failure. |
delegate void Mattoha.Nodes.MattohaClient.EndGameFailedEventHandler | ( | string | cause | ) |
Emitted when ending the game fails.
cause | The cause of the failure. |
delegate void Mattoha.Nodes.MattohaClient.EndGameSucceedEventHandler | ( | Dictionary< string, Variant > | lobbyData | ) |
Emitted when ending the game succeeds.
lobbyData | The updated lobby data after ending the game. |
Array< long > Mattoha.Nodes.MattohaClient.GetLobbyPlayersIds | ( | bool | onlyInGamePlayers = true | ) |
Returns joined lobby players Ids.
delegate void Mattoha.Nodes.MattohaClient.GlobalMessageFailedEventHandler | ( | string | cause | ) |
Emitted when sending a global message fails.
cause | The cause of the failure. |
delegate void Mattoha.Nodes.MattohaClient.GlobalMessageReceivedEventHandler | ( | Dictionary< string, Variant > | senderData, |
string | message ) |
Emitted when a global message is received.
senderData | The data of the message sender. |
message | The received message. |
bool Mattoha.Nodes.MattohaClient.IsPlayerInGame | ( | long | playerId | ) |
Returns true if player entered the game scene and spawned lobby nodes, this will be used under the hood for replication purposes.
playerId | player id to check. |
bool Mattoha.Nodes.MattohaClient.IsPlayerInLobby | ( | long | playerId | ) |
Check if peer id is joined in lobby or not.
playerId | peer id |
bool Mattoha.Nodes.MattohaClient.IsPlayerInMyTeam | ( | long | playerId | ) |
Check if the player id is in same team.
playerId | player id to check. |
delegate void Mattoha.Nodes.MattohaClient.JoinedPlayerUpdatedEventHandler | ( | Dictionary< string, Variant > | playerData | ) |
Emitted when a joined player updates their information.
playerData | The updated player data. |
void Mattoha.Nodes.MattohaClient.JoinLobby | ( | int | lobbyId | ) |
Join lobby by it's ID, this will emmit "JoinLobbySucceed" or "JoinLobbyFailed" for caller user, and "NewPlayerJoined" for other joined players, and "LoadAvailableLobbiesSucceed" for all online players if "AutoLoadAvailableLobbies" is enabled.
lobbyId | Lobby id to join to. |
delegate void Mattoha.Nodes.MattohaClient.JoinLobbyFailedEventHandler | ( | string | cause | ) |
Emitted when joining a lobby fails.
cause | The cause of the failure. |
delegate void Mattoha.Nodes.MattohaClient.JoinLobbySucceedEventHandler | ( | Dictionary< string, Variant > | lobbyData | ) |
Emitted when joining a lobby succeeds.
lobbyData | The data of the joined lobby. |
void Mattoha.Nodes.MattohaClient.JoinTeam | ( | int | teamId | ) |
Join or change a team, this will emmit "JoinTeamSucceed" or "JoinTeamFailed" if joingin failed, in addition, "PlayerChangedHisTeam" will be emmited on all lobby players including the player itself.
teamId | Team ID to join to. |
delegate void Mattoha.Nodes.MattohaClient.JoinTeamFailedEventHandler | ( | string | cause | ) |
Emitted when joining a team fails.
cause | The cause of the failure. |
delegate void Mattoha.Nodes.MattohaClient.JoinTeamSucceedEventHandler | ( | int | newTeam | ) |
Emitted when joining a team succeeds.
newTeam | The team the player joined. |
delegate void Mattoha.Nodes.MattohaClient.LoadAvailableLobbiesFailedEventHandler | ( | string | cause | ) |
Emmited when available lobbies failed to load.
cause | fail cause |
delegate void Mattoha.Nodes.MattohaClient.LoadAvailableLobbiesSucceedEventHandler | ( | Array< Dictionary< string, Variant > > | lobbies | ) |
Emmited when available lobbies loaded successfully.
lobbies | Available lobbies |
delegate void Mattoha.Nodes.MattohaClient.LoadLobbyPlayersFailedEventHandler | ( | string | cause | ) |
Emmited when loading lobby player failed.
cause | Fail cause. |
delegate void Mattoha.Nodes.MattohaClient.LoadLobbyPlayersSucceedEventHandler | ( | Array< Dictionary< string, Variant > > | players | ) |
Emmited when loading lobby players loaded successfully.
players | Joined players in lobby. |
delegate void Mattoha.Nodes.MattohaClient.LobbyMessageFailedEventHandler | ( | string | cause | ) |
Emitted when sending a lobby message fails.
cause | The cause of the failure. |
delegate void Mattoha.Nodes.MattohaClient.LobbyMessageReceivedEventHandler | ( | Dictionary< string, Variant > | senderData, |
string | message ) |
Emitted when a lobby message is received.
senderData | The data of the message sender. |
message | The received message. |
delegate void Mattoha.Nodes.MattohaClient.NewPlayerJoinedEventHandler | ( | Dictionary< string, Variant > | playerData | ) |
Emitted when a new player joins.
playerData | The data of the new player. |
delegate void Mattoha.Nodes.MattohaClient.PlayerChangedHisTeamEventHandler | ( | Dictionary< string, Variant > | playerData | ) |
Emitted when a player changes their team.
playerData | The data of the player who changed teams. |
delegate void Mattoha.Nodes.MattohaClient.PlayerJoinedEventHandler | ( | Dictionary< string, Variant > | playerData | ) |
Emitted when a player joins current lobby.
playerData | The data of the player who joined. |
delegate void Mattoha.Nodes.MattohaClient.PlayerLeftEventHandler | ( | Dictionary< string, Variant > | playerData | ) |
Emitted when a player leaves.
playerData | The data of the player who left. |
delegate void Mattoha.Nodes.MattohaClient.PlayerRegisteredEventHandler | ( | Dictionary< string, Variant > | playerData | ) |
Emmited when player is connected and registered in server memory.
playerData | Initial player data. |
void Mattoha.Nodes.MattohaClient.SendGlobalMessage | ( | string | message | ) |
Send a global message for all online users, this will emmit "GlobalMessageSucceed" for all players or "GlobalMessageFailed" for caller user.
message | message to send. |
void Mattoha.Nodes.MattohaClient.SendLobbyMessage | ( | string | message | ) |
Send a message for lobby members, this will emmit "LobbyMessageSucceed" for all players or "LobbyMessageFailed" for caller user.
message | message to send. |
void Mattoha.Nodes.MattohaClient.SendTeamMessage | ( | string | message | ) |
Send a message for team members, this will emmit "TeamMessageSucceed" for all players or "TeamMessageFailed" for caller user.
message | message to send. |
void Mattoha.Nodes.MattohaClient.SetLobbyData | ( | Dictionary< string, Variant > | lobbyData | ) |
Set Lobby data and sync it, this will emmit "SetLobbyDataFailed" for caller user if Setting Data failed, and sync the data for all joined players - including caller user - then emmit "SetLobbyDataSucceed" for them, and "LoadAvailableLobbiesSucceed" for all online players if "AutoLoadAvailableLobbies" is enabled.
Base lobby keys you can edit in addition to your custom keys:
lobbyData | A dictionary containing the keys you want to update, its ok to use one key, no need for full lobby data. |
delegate void Mattoha.Nodes.MattohaClient.SetLobbyDataFailedEventHandler | ( | string | cause | ) |
Emitted when setting lobby data fails.
cause | The cause of the failure. |
delegate void Mattoha.Nodes.MattohaClient.SetLobbyDataSucceedEventHandler | ( | Dictionary< string, Variant > | lobbyData | ) |
Emitted when setting lobby data succeeds.
lobbyData | The updated lobby data. |
void Mattoha.Nodes.MattohaClient.SetLobbyOwner | ( | int | newOwnerId | ) |
Change lobby owner, this will emmit "SetLobbyOwnerSucceed" for all joined players including caller user if changing owner is succeed, and emmit "SetLobbyOwnerFailed" for caller user if setting owner fails, ONLY owner of the lobby can set new lobby owner.
newOwnerId | New owner id |
delegate void Mattoha.Nodes.MattohaClient.SetLobbyOwnerFailedEventHandler | ( | string | cause | ) |
Emitted when setting the lobby owner fails.
cause | The cause of the failure. |
delegate void Mattoha.Nodes.MattohaClient.SetLobbyOwnerSucceedEventHandler | ( | Dictionary< string, Variant > | lobbyData | ) |
Emitted when setting the lobby owner succeeds.
lobbyData | The updated lobby data with the new owner. |
void Mattoha.Nodes.MattohaClient.SetPlayerData | ( | Dictionary< string, Variant > | playerData | ) |
Set Player data in server, this will emit "SetPlayerDataSucceed" or "SetPlayerDataFailed", for current client and emmit "JoinedPlayerUpdated" for other lobby players.
Base player keys you can edit in addition to your custom keys:
playerData | A dictionary containing the keys to update, its ok to put only one key, no need for full player data. |
delegate void Mattoha.Nodes.MattohaClient.SetPlayerDataFailedEventHandler | ( | string | cause | ) |
Emitted when setting player data fails.
cause | The cause of the failure. |
delegate void Mattoha.Nodes.MattohaClient.SetPlayerDataSucceedEventHandler | ( | Dictionary< string, Variant > | playerData | ) |
Emitted when setting player data succeeds.
playerData | The updated player data. |
void Mattoha.Nodes.MattohaClient.SetPlayerIsInGame | ( | bool | value | ) |
Change the state of the current player if he is in game or not.
value | true if IsInGame should be true, otherwise false |
delegate void Mattoha.Nodes.MattohaClient.SetPlayerIsInGameSucceedEventHandler | ( | bool | value | ) |
Emitted when change IsInGame value for the current player is done.
playerData | The updated player data. |
delegate void Mattoha.Nodes.MattohaClient.SpawnLobbyNodesFailedEventHandler | ( | string | cause | ) |
Emitted when spawning lobby nodes fails.
cause | The cause of the failure. |
void Mattoha.Nodes.MattohaClient.SpawnNode | ( | Node | node, |
bool | teamOnly = false, | ||
Array< string > | additionalProps = null ) |
Spawn node for all joined players in same lobby or same team, this will emmit "SpawnNodeRequested" for joined players or players in teams, "SpawnNodeFailed" will be emmited and node will be locally despawned if spawning node failed.
node | Node object (should be existing in tree) |
teamOnly | true if spawning should be for team only. |
additionalProps | Additional properties that will be synced during spawning node across players. |
delegate void Mattoha.Nodes.MattohaClient.SpawnNodeFailedEventHandler | ( | string | cause | ) |
Emitted when node spawning fails.
cause | The cause of the failure. |
delegate void Mattoha.Nodes.MattohaClient.SpawnNodeRequestedEventHandler | ( | Dictionary< string, Variant > | nodeData | ) |
Emitted when a node spawn is requested.
nodeData | The data of the node to be spawned. |
delegate void Mattoha.Nodes.MattohaClient.StartGameFailedEventHandler | ( | string | cause | ) |
Emitted when starting the game fails.
cause | The cause of the failure. |
delegate void Mattoha.Nodes.MattohaClient.StartGameSucceedEventHandler | ( | Dictionary< string, Variant > | lobbyData | ) |
Emitted when starting the game succeeds.
lobbyData | The updated lobby data after starting the game. |
delegate void Mattoha.Nodes.MattohaClient.TeamMessageFailedEventHandler | ( | string | cause | ) |
Emitted when sending a team message fails.
cause | The cause of the failure. |
delegate void Mattoha.Nodes.MattohaClient.TeamMessageReceivedEventHandler | ( | Dictionary< string, Variant > | senderData, |
string | message ) |
Emitted when a team message is received.
senderData | The data of the message sender. |
message | The received message. |