callback renaming

This commit is contained in:
kremsy 2017-03-25 13:57:42 +01:00
parent 9a19691420
commit 1010c1db6b
2 changed files with 58 additions and 59 deletions

View File

@ -30,35 +30,36 @@ interface Callbacks {
*/ */
//NEW Callbacks //NEW Callbacks
const XMLRPC_CALLBACKSLIST = 'Callbacks.XmlRpcCallbacksList'; const XMLRPC_CALLBACKSLIST = 'XmlRpc.CallbacksList';
const MP_STARTSERVERSTART = 'Callbacks.ManiaPlanetStartServerStart';
const MP_STARTSERVEREND = 'Callbacks.ManiaPlanetStartServerEnd'; const MP_STARTSERVERSTART = 'Maniaplanet.StartServer_Start';
const MP_STARTMATCHSTART = 'Callbacks.ManiaPlanetStartMatchStart'; const MP_STARTSERVEREND = 'Maniaplanet.StartServer_End';
const MP_STARTMATCHEND = 'Callbacks.ManiaPlanetStartMatchEnd'; const MP_STARTMATCHSTART = 'Maniaplanet.StartMatch_Start';
//const MP_STARTMAPSTART = 'Callbacks.ManiaPlanetStartMapStart'; const MP_STARTMATCHEND = 'Maniaplanet.StartMatch_End';
//const MP_STARTMAPEND = 'Callbacks.ManiaPlanetStartMapEnd'; //const MP_STARTMAPSTART = 'Maniaplanet.StartMap_Start';
const MP_STARTROUNDSTART = 'Callbacks.ManiaPlanetStartRoundStart'; //const MP_STARTMAPEND = 'Maniaplanet.StartMap_End';
const MP_STARTROUNDEND = 'Callbacks.ManiaPlanetStartRoundEnd'; const MP_STARTROUNDSTART = 'Maniaplanet.StartRound_Start';
const MP_STARTTURNSTART = 'Callbacks.ManiaPlanetStartTurnStart'; const MP_STARTROUNDEND = 'Maniaplanet.StartRound_End';
const MP_STARTTURNEND = 'Callbacks.ManiaPlanetStartTurnEnd'; const MP_STARTTURNSTART = 'Maniaplanet.StartTurn_Start';
const MP_STARTPLAYLOOPSTART = 'Callbacks.ManiaPlanetStartPlayLoopStart'; const MP_STARTTURNEND = 'Maniaplanet.StartTurn_End';
const MP_STARTPLAYLOOPEND = 'Callbacks.ManiaPlanetStartPlayLoopEnd'; const MP_STARTPLAYLOOP = 'Maniaplanet.StartPlayLoop';
const MP_ENDTURNSTART = 'Callbacks.ManiaPlanetEndTurnStart'; const MP_ENDPLAYLOOP = 'Maniaplanet.EndPlayLoop';
const MP_ENDTURNEND = 'Callbacks.ManiaPlanetEndTurnEnd'; const MP_ENDTURNSTART = 'Maniaplanet.EndTurn_Start';
const MP_ENDROUNDSTART = 'Callbacks.ManiaPlanetEndRoundStart'; const MP_ENDTURNEND = 'Maniaplanet.EndTurn_End';
const MP_ENDROUNDEND = 'Callbacks.ManiaPlanetEndRoundEnd'; const MP_ENDROUNDSTART = 'Maniaplanet.EndRound_Start';
//const MP_ENDMAPSTART = 'Callbacks.ManiaPlanetEndMapStart'; const MP_ENDROUNDEND = 'Maniaplanet.EndRound_End';
//const MP_ENDMAPEND = 'Callbacks.ManiaPlanetEndMapEnd'; //const MP_ENDMAPSTART = 'Maniaplanet.EndMap_Start';
const MP_ENDMATCHSTART = 'Callbacks.ManiaPlanetEndMatchStart'; //const MP_ENDMAPEND = 'Maniaplanet.EndMap_End';
const MP_ENDMATCHEND = 'Callbacks.ManiaPlanetEndMatchEnd'; const MP_ENDMATCHSTART = 'Maniaplanet.EndMatch_Start';
const MP_ENDSERVERSTART = 'Callbacks.ManiaPlanetEndServerStart'; const MP_ENDMATCHEND = 'Maniaplanet.EndMatch_End';
const MP_ENDSERVEREND = 'Callbacks.ManiaPlanetEndServerEnd'; const MP_ENDSERVERSTART = 'Maniaplanet.EndServer_Start';
const MP_LOADINGMAPSTART = 'Callbacks.ManiaPlanetLoadingMapStart'; const MP_ENDSERVEREND = 'Maniaplanet.EndServer_End';
const MP_LOADINGMAPEND = 'Callbacks.ManiaPlanetLoadingMapEnd'; const MP_LOADINGMAPSTART = 'Maniaplanet.LoadingMap_Start';
const MP_UNLOADINGMAPSTART = 'Callbacks.ManiaPlanetUnLoadingMapStart'; const MP_LOADINGMAPEND = 'Maniaplanet.LoadingMap_End';
const MP_UNLOADINGMAPEND = 'Callbacks.ManiaPlanetUnLoadingMapEnd'; const MP_UNLOADINGMAPSTART = 'Maniaplanet.UnloadingMap_Start';
const MP_PODIUMSTART = 'Callbacks.ManiaPlanetPodiumStart'; const MP_UNLOADINGMAPEND = 'Maniaplanet.UnloadingMap_End';
const MP_PODIUMEND = 'Callbacks.ManiaPlanetPodiumEnd'; const MP_PODIUMSTART = 'Maniaplanet.Podium_Start';
const MP_PODIUMEND = 'Maniaplanet.Podium_End';
const SM_SCORES = "Shootmania.Scores"; const SM_SCORES = "Shootmania.Scores";

View File

@ -44,26 +44,25 @@ class LibXmlRpcCallbacks implements CallbackListener {
* @param mixed $data * @param mixed $data
*/ */
public function handleScriptCallback($name, $data) { public function handleScriptCallback($name, $data) {
var_dump($name);
if (!$this->maniaControl->getCallbackManager()->callbackListeningExists($name)) { if (!$this->maniaControl->getCallbackManager()->callbackListeningExists($name)) {
return; return;
} }
var_dump($name);
//var_dump($data);
switch ($name) { switch ($name) {
//New callbacks //New callbacks
case 'XmlRpc.CallbacksList': case Callbacks::XMLRPC_CALLBACKSLIST:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::XMLRPC_CALLBACKSLIST, new CallbacksListStructure($this->maniaControl, $data)); $this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::XMLRPC_CALLBACKSLIST, new CallbacksListStructure($this->maniaControl, $data));
break; break;
case 'Maniaplanet.StartServer_Start': case Callbacks::MP_STARTSERVERSTART:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_STARTSERVERSTART, new StartServerStructure($this->maniaControl, $data)); $this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_STARTSERVERSTART, new StartServerStructure($this->maniaControl, $data));
break; break;
case 'Maniaplanet.StartServer_End': case Callbacks::MP_STARTSERVEREND:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_STARTSERVEREND, new StartServerStructure($this->maniaControl, $data)); $this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_STARTSERVEREND, new StartServerStructure($this->maniaControl, $data));
break; break;
case 'ManiaPlanet.StartMatch_Start': case Callbacks::MP_STARTMATCHSTART:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_STARTMATCHSTART, new StartEndStructure($this->maniaControl, $data)); $this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_STARTMATCHSTART, new StartEndStructure($this->maniaControl, $data));
break; break;
case 'ManiaPlanet.StartMatch_End': case Callbacks::MP_STARTMATCHEND:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_STARTMATCHEND, new StartEndStructure($this->maniaControl, $data)); $this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_STARTMATCHEND, new StartEndStructure($this->maniaControl, $data));
break; break;
case 'Maniaplanet.StartMap_Start': //Use the MapManager Callback case 'Maniaplanet.StartMap_Start': //Use the MapManager Callback
@ -74,34 +73,34 @@ class LibXmlRpcCallbacks implements CallbackListener {
$this->maniaControl->getMapManager()->handleScriptBeginMap($jsonData->map->uid, 'False'); $this->maniaControl->getMapManager()->handleScriptBeginMap($jsonData->map->uid, 'False');
//TODO Test if json is correctly parsed //TODO Test if json is correctly parsed
break; break;
case 'ManiaPlanet.StartRound_Start': case Callbacks::MP_STARTROUNDSTART:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_STARTROUNDSTART, new StartEndStructure($this->maniaControl, $data)); $this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_STARTROUNDSTART, new StartEndStructure($this->maniaControl, $data));
break; break;
case 'ManiaPlanet.StartRound_End': case Callbacks::MP_STARTROUNDEND:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_STARTROUNDEND, new StartEndStructure($this->maniaControl, $data)); $this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_STARTROUNDEND, new StartEndStructure($this->maniaControl, $data));
break; break;
case 'ManiaPlanet.StartTurn_Start': case Callbacks::MP_STARTTURNSTART:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_STARTTURNSTART, new StartEndStructure($this->maniaControl, $data)); $this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_STARTTURNSTART, new StartEndStructure($this->maniaControl, $data));
break; break;
case 'ManiaPlanet.StartTurn_End': case Callbacks::MP_STARTTURNEND:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_STARTTURNEND, new StartEndStructure($this->maniaControl, $data)); $this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_STARTTURNEND, new StartEndStructure($this->maniaControl, $data));
break; break;
case 'ManiaPlanet.StartPlayLoop_Start': case Callbacks::MP_STARTPLAYLOOP:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_STARTPLAYLOOPSTART, new StartEndStructure($this->maniaControl, $data)); $this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_STARTPLAYLOOP, new StartEndStructure($this->maniaControl, $data));
break; break;
case 'ManiaPlanet.StartPlayLoop_End': case Callbacks::MP_ENDPLAYLOOP:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_STARTPLAYLOOPEND, new StartEndStructure($this->maniaControl, $data)); $this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_ENDPLAYLOOP, new StartEndStructure($this->maniaControl, $data));
break; break;
case 'ManiaPlanet.EndTurn_Start': case Callbacks::MP_ENDTURNSTART:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_ENDTURNSTART, new StartEndStructure($this->maniaControl, $data)); $this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_ENDTURNSTART, new StartEndStructure($this->maniaControl, $data));
break; break;
case 'ManiaPlanet.EndTurn_End': case Callbacks::MP_ENDTURNEND:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_ENDTURNEND, new StartEndStructure($this->maniaControl, $data)); $this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_ENDTURNEND, new StartEndStructure($this->maniaControl, $data));
break; break;
case 'ManiaPlanet.EndRound_Start': case Callbacks::MP_ENDROUNDSTART:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_ENDROUNDSTART, new StartEndStructure($this->maniaControl, $data)); $this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_ENDROUNDSTART, new StartEndStructure($this->maniaControl, $data));
break; break;
case 'ManiaPlanet.EndRound_End': case Callbacks::MP_ENDROUNDEND:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_ENDROUNDEND, new StartEndStructure($this->maniaControl, $data)); $this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_ENDROUNDEND, new StartEndStructure($this->maniaControl, $data));
break; break;
case 'Maniaplanet.EndMap_Start': case 'Maniaplanet.EndMap_Start':
@ -110,38 +109,37 @@ class LibXmlRpcCallbacks implements CallbackListener {
case 'Maniaplanet.EndMap_End': //Use the MapManager Callback case 'Maniaplanet.EndMap_End': //Use the MapManager Callback
$this->maniaControl->getMapManager()->handleScriptEndMap(); //Verify if better here or at EndMap_End $this->maniaControl->getMapManager()->handleScriptEndMap(); //Verify if better here or at EndMap_End
break; break;
case 'ManiaPlanet.EndMatch_Start': case Callbacks::MP_ENDMATCHSTART:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_ENDMATCHSTART, new StartEndStructure($this->maniaControl, $data)); $this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_ENDMATCHSTART, new StartEndStructure($this->maniaControl, $data));
break; break;
case 'ManiaPlanet.EndMatch_End': case Callbacks::MP_ENDMATCHEND:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_ENDMATCHEND, new StartEndStructure($this->maniaControl, $data)); $this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_ENDMATCHEND, new StartEndStructure($this->maniaControl, $data));
break; break;
case 'Maniaplanet.EndServer_Start': case Callbacks::MP_ENDSERVERSTART:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_ENDSERVERSTART, new StartServerStructure($this->maniaControl, $data)); $this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_ENDSERVERSTART, new StartServerStructure($this->maniaControl, $data));
break; break;
case 'Maniaplanet.EndServer_End': case Callbacks::MP_ENDSERVEREND:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_ENDSERVEREND, new StartServerStructure($this->maniaControl, $data)); $this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_ENDSERVEREND, new StartServerStructure($this->maniaControl, $data));
break; break;
case 'Maniaplanet.LoadingMap_Start': case Callbacks::MP_LOADINGMAPSTART:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_LOADINGMAPSTART); $this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_LOADINGMAPSTART);
break; break;
case 'Maniaplanet.LoadingMap_End': case Callbacks::MP_LOADINGMAPEND:
$jsonData = json_decode($data[0]); $jsonData = json_decode($data[0]);
$map = $this->maniaControl->getMapManager()->getMapByUid($jsonData->map->uid); //Verify Json $map = $this->maniaControl->getMapManager()->getMapByUid($jsonData->map->uid); //Verify Json
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_LOADINGMAPEND, $map); $this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_LOADINGMAPEND, $map);
break; break;
case 'Maniaplanet.UnloadingMap_Start': case Callbacks::MP_UNLOADINGMAPSTART:
$jsonData = json_decode($data[0]); $jsonData = json_decode($data[0]);
$map = $this->maniaControl->getMapManager()->getMapByUid($jsonData->map->uid); //Verify Json $map = $this->maniaControl->getMapManager()->getMapByUid($jsonData->map->uid); //Verify Json
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_LOADINGMAPSTART, $map); $this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_LOADINGMAPSTART, $map);
break; break;
case 'Maniaplanet.UnloadingMap_End': case Callbacks::MP_UNLOADINGMAPEND:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_LOADINGMAPEND); $this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_LOADINGMAPEND);
break; break;
case 'Maniaplanet.Podium_Start': case Callbacks::MP_PODIUMSTART:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_PODIUMSTART); $this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_PODIUMSTART);
break; break;
case 'Maniaplanet.Podium_End':
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_PODIUMEND); $this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_PODIUMEND);
break; break;