callbacks draft
This commit is contained in:
parent
157a4347a4
commit
ff054839ea
@ -49,6 +49,7 @@ class CallbackManager {
|
||||
* Public Properties
|
||||
*/
|
||||
public $shootManiaCallbacks = null;
|
||||
public $libXmlRpcCallbacks = null;
|
||||
|
||||
/*
|
||||
* Private Properties
|
||||
@ -66,6 +67,7 @@ class CallbackManager {
|
||||
$this->maniaControl = $maniaControl;
|
||||
|
||||
$this->shootManiaCallbacks = new ShootManiaCallbacks($maniaControl, $this);
|
||||
$this->libXmlRpcCallbacks = new LibXmlRpcCallbackManager($maniaControl, $this);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -249,5 +251,6 @@ class CallbackManager {
|
||||
$scriptCallbackData = $callback[1];
|
||||
$scriptCallbackName = $scriptCallbackData[0];
|
||||
$this->triggerScriptCallback($scriptCallbackName, $scriptCallbackData);
|
||||
$this->triggerCallback(Callbacks::ScriptCallback, $scriptCallbackName, $scriptCallbackData[1]);
|
||||
}
|
||||
}
|
||||
|
19
application/core/Callbacks/Callbacks.php
Normal file
19
application/core/Callbacks/Callbacks.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
namespace ManiaControl\Callbacks;
|
||||
|
||||
/**
|
||||
* Callbacks Interface
|
||||
*
|
||||
* @author steeffeen & kremsy
|
||||
* @copyright ManiaControl Copyright © 2014 ManiaControl Team
|
||||
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||
*/
|
||||
interface Callbacks {
|
||||
const ScriptCallback = 'Callbacks.ScriptCallback';
|
||||
/** BeginMatch Callback, param1 MapNumber */
|
||||
const LibXmlRpc_BeginMatch = "Callbacks.LibXmlRpc_BeginMatch";
|
||||
/** BeginMatch Callback, param1 MapNumber */
|
||||
const LibXmlRpc_LoadingMap = "Callbacks.LibXmlRpc_LoadingMap";
|
||||
/** BeginMatch Callback, param1 MapNumber */
|
||||
const LibXmlRpc_BeginMap = "Callbacks.LibXmlRpc_BeginMap";
|
||||
}
|
50
application/core/Callbacks/LibXmlRpcCallbackManager.php
Normal file
50
application/core/Callbacks/LibXmlRpcCallbackManager.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Lukas
|
||||
* Date: 24.04.14
|
||||
* Time: 16:57
|
||||
*/
|
||||
|
||||
namespace ManiaControl\Callbacks;
|
||||
|
||||
|
||||
use ManiaControl\ManiaControl;
|
||||
|
||||
class LibXmlRpcCallbackManager implements CallbackListener{
|
||||
/*
|
||||
* Private Properties
|
||||
*/
|
||||
private $maniaControl = null;
|
||||
|
||||
/**
|
||||
* Create a new ShootMania Callbacks Instance
|
||||
*
|
||||
* @param ManiaControl $maniaControl
|
||||
*/
|
||||
public function __construct(ManiaControl $maniaControl, CallbackManager $callbackManager) {
|
||||
$this->maniaControl = $maniaControl;
|
||||
$callbackManager->registerCallbackListener(Callbacks::ScriptCallback, $this, 'handleScriptCallbacks');
|
||||
}
|
||||
|
||||
public function handleScriptCallbacks($name, $data){
|
||||
switch($name){
|
||||
case 'LibXmlRpc_BeginMatch':
|
||||
$this->maniaControl->callbackManager->triggerCallback(Callbacks::LibXmlRpc_BeginMatch, $data[0]);
|
||||
break;
|
||||
case 'LibXmlRpc_LoadingMap':
|
||||
$this->maniaControl->callbackManager->triggerCallback(Callbacks::LibXmlRpc_LoadingMap, $data[0]);
|
||||
break;
|
||||
case 'LibXmlRpc_BeginMap':
|
||||
$this->maniaControl->callbackManager->triggerCallback(Callbacks::LibXmlRpc_BeginMap, $data[0]);
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
var_dump($name);
|
||||
var_dump($data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user