Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ProductGameServer {
- /**
- * Démarrer un serveur de jeu
- *
- * @param int $gameserverId
- * @return mixed
- */
- public function GameServer_Game_Start($gameserverId) {
- try {
- //Initialisation d'une installation
- $gameinstall = new GameInstall();
- $gameinstallId = $gameinstall->getGameInstallIdByServerOnly($gameserverId);
- //Récupération des informations DB d'un serveur de jeu
- $gameserverInfos = $this->getInfoGameServer($gameserverId);
- //Vérification si le jeu est défini en tant qu'architecture non standard
- if(class_exists($gameserverInfos->soap_game)) {
- //Initialisation de la classe dédiée au jeu
- $gameClass = new $gameserverInfos->soap_game;
- //Vérification de l'existence d'une fonction de démarrage spécifique pour ce jeu
- if(method_exists($gameClass,'Service_' . $gameserverInfos->soap_game . '_Start')) {
- //Utilisation de la fonction spécifique pour le démarrage
- $useOwnClass = true;
- }
- }
- //Lancement d'un démarrage spécifique pour le jeu
- if($useOwnClass === true) {
- call_user_func(array($gameClass, 'Service_' . $gameserverInfos->soap_game . '_Start'), array($gameserverId, 'GameServer',&$zidReturn));
- return $zidReturn;
- } else {
- //Initialisation d'un service client
- $customerproduct = new CustomerProduct();
- $customerproductInfos = $customerproduct->getCustomerProduct($gameserverInfos->customerproduct_id);
- //Initialisation d'un serveur (machine)
- $server = new Server();
- $serverInfos = $server->getInfoServer($gameserverInfos->id_server);
- //Initialisation d'une opération du robot de traitement Ziggy
- $ziggyoperation = new ZiggyOperation();
- //Construction de l'opération à envoyer
- $infos = array(
- 'customer_id' => $customer->id_customer,
- 'function_ziggyoperation' => 'GameServer_'.$gameserverInfos->soap_game.'_Start',
- 'params_ziggyoperation' => array(
- $serverInfos->address_ip, //Adresse IP de la machine
- $customerproductInfos->customer_id, //Identification client sur le NAS
- $gameserverInfos->name_serveronly, //Nom du serveur de jeu
- $gameserverInfos->port_serveronly), //Port du serveur de jeu
- 'actionok_ziggyoperation' => 'ProductGameServer:editStatusGameServer:2,'.$gameserverId //Edition du statut du serveur
- );
- }
- //Envoi de l'opération et récupération de l'identifiant de suivi
- $ziggyId = $ziggyoperation->createZiggyOperation($infos,false);
- if($ziggyId) {
- return $ziggyId;
- } else {
- return false;
- }
- }
- } catch (Exception $e) {
- throw new Exception($e->getMessage());
- }
- }
- }
Add Comment
Please, Sign In to add comment