CEL: Crystal Entity Layer: celGameClientManager Class Reference (CEL: Crystal Entity Layer Public API Reference)

| ## Public API Reference

- Main Page
- Classes
- Files

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# celGameClientManager Class Reference

This is an interface you should implement in order to manage the events from the client. More...

`#include <physicallayer/network.h>`

List of all members.

## Public Member Functions
virtual void | ClientEnd ()=0
| The client will be closed.
virtual iCelEntity * | CreateNetworkLinkTarget (celNetworkLinkType link_type, csTicks creation_time, iCelPersistentDataList *creation_data, bool player_controlled)=0
| A network link has been set up on the server side between a server entity and this client.
virtual void | HandleServerEvent (celServerEventType event_type, csTicks event_time, iCelDataBuffer *event_data)=0
| A server event has been catched.
virtual void | LevelChanged (celGameInfo *new_game)=0
| The level has changed.
virtual void | NetworkLinkControlChanged (iCelEntity *entity, bool player_controlled)=0
| There is a change in the way the entity is controlled, ie if it is controlled by the client or by the server side.
virtual void | NetworkLinkRemoved (csTicks deletion_time, iCelEntity *entity)=0
| The network link to the specified entity is closing.
virtual void | PlayerValidated (celPlayer *player)=0
| The data of the player has been validated by the server.

## Detailed Description

This is an interface you should implement in order to manage the events from the client.

You can use it to:

- listen for changes in the state of the network connection to the server.
- get the data of the player validated by the server.
- catch the server events.
- handle the creation and removing of the network links.
- close the client.

Definition at line 664 of file network.h.

## Member Function Documentation

virtual void celGameClientManager::ClientEnd | ( |  | ) | `[pure virtual]`

The client will be closed.

You should delete here the physical layer of the client.

virtual iCelEntity* celGameClientManager::CreateNetworkLinkTarget | ( | celNetworkLinkType | link_type,
|  | csTicks | creation_time,
|  | iCelPersistentDataList * | creation_data,
|  | bool | player_controlled |
| ) |  |  | `[pure virtual]`

A network link has been set up on the server side between a server entity and this client.

A copy entity must be created on this client side. This copy entity will be the adressee of the updates from the network link.

If the server is available in the same process, you can simply use the entity of the server and then return 0 to this function.

Parameters:

  | link_type | the type of the network link. You should use it to know what type of entity has to be created.
  | creation_time | the time at which the network link is created.
  | creation_data | the persistent data of the entity at the creation of the network link.
  | player_controlled | true if the entity is controlled on the client side, false it is controlled on the server side.

Returns:
  the copy entity.

virtual void celGameClientManager::HandleServerEvent | ( | celServerEventType | event_type,
|  | csTicks | event_time,
|  | iCelDataBuffer * | event_data |
| ) |  |  | `[pure virtual]`

A server event has been catched.

virtual void celGameClientManager::LevelChanged | ( | celGameInfo * | new_game | ) | `[pure virtual]`

The level has changed.

The client need to do iCelGameClient::SetReady when the new level is loaded.

virtual void celGameClientManager::NetworkLinkControlChanged | ( | iCelEntity * | entity,
|  | bool | player_controlled |
| ) |  |  | `[pure virtual]`

There is a change in the way the entity is controlled, ie if it is controlled by the client or by the server side.

If the entity is now controlled on the client side, you should then set a behavior to it. Most presumably, the behavior will catch the actions of the player and update accordingly the entity.

If the entity is now controlled on the server side, you should then remove any behavior from the entity and let the client update it from the server.

Parameters:

  | entity | the entity which is networked linked.
  | player_controlled | true if the entity is controlled by the client side, false if it is controlled by the server side.

virtual void celGameClientManager::NetworkLinkRemoved | ( | csTicks | deletion_time,
|  | iCelEntity * | entity |
| ) |  |  | `[pure virtual]`

The network link to the specified entity is closing.

The client can remove the entity from the physical layer.

virtual void celGameClientManager::PlayerValidated | ( | celPlayer * | player | ) | `[pure virtual]`

The data of the player has been validated by the server.

The documentation for this class was generated from the following file:

- physicallayer/network.h