added direct invoke callback for methods
This commit is contained in:
parent
6ad6768caa
commit
067536458e
@ -31,6 +31,14 @@ interface Callbacks {
|
||||
//NEW Callbacks
|
||||
|
||||
const XMLRPC_CALLBACKSLIST = 'XmlRpc.CallbacksList';
|
||||
const XMLRPC_ENABLEDCALLBACKS = 'XmlRpc.CallbacksList_Enabled';
|
||||
const XMLRPC_DISABLEDCALLBACKS = 'XmlRpc.CallbacksList_Disabled';
|
||||
const XMLRPC_CALLBACKHELP = 'XmlRpc.CallbackHelp';
|
||||
const XMLRPC_METHODSLIST = 'XmlRpc.MethodsList';
|
||||
const XMLRPC_METHODHELP = 'XmlRpc.MethodHelp';
|
||||
const XMLRPC_DOCUMENTATION = 'XmlRpc.MethodHelp';
|
||||
const XMLRPC_APIVERSION = 'XmlRpc.ApiVersion';
|
||||
const XMLRPC_ALLAPIVERSIONS = 'XmlRpc.AllApiVersions';
|
||||
|
||||
const MP_STARTSERVERSTART = 'Maniaplanet.StartServer_Start';
|
||||
const MP_STARTSERVEREND = 'Maniaplanet.StartServer_End';
|
||||
@ -65,6 +73,7 @@ interface Callbacks {
|
||||
const MP_WARMUP_END = 'Maniaplanet.WarmUp.End';
|
||||
const MP_WARMUP_STATUS = 'Maniaplanet.WarmUp.Status';
|
||||
|
||||
const SM_UIPROPERTIES = 'Shootmania.UIProperties';
|
||||
const SM_SCORES = "Shootmania.Scores";
|
||||
|
||||
const SM_ONEVENTDEFAULT = "Shootmania.Event.Default";
|
||||
@ -86,7 +95,7 @@ interface Callbacks {
|
||||
const SM_ONPLAYERREQUESTACTIONCHANGE = "Shootmania.Event.OnPlayerRequestActionChange";
|
||||
|
||||
//SM GameMode Callbacks
|
||||
const SM_COMBO_PAUSE = 'Shootmania.Combo.Pause';
|
||||
const SM_COMBO_PAUSESTATUS = 'Shootmania.Combo.Pause';
|
||||
const SM_ELITE_STARTTURN = 'Shootmania.Elite.StartTurn';
|
||||
const SM_ELITE_ENDTURN = 'Shootmania.Elite.EndTurn';
|
||||
const SM_JOUST_ONRELOAD = 'Shootmania.Joust.OnReload';
|
||||
@ -113,6 +122,10 @@ interface Callbacks {
|
||||
const TM_WARMUPENDROUND = "Trackmania.WarmUp.EndRound";
|
||||
const TM_WARMUPEND = "Trackmania.WarmUp.End";
|
||||
|
||||
const TM_UIPROPERTIES = 'Trackmania.UIProperties';
|
||||
|
||||
const TM_POINTSREPARTITION = 'Trackmania.PointsRepartition';
|
||||
|
||||
//ManiaControl Callbacks
|
||||
/** BeginMap Callback: Map */
|
||||
const BEGINMAP = 'Callbacks.BeginMap';
|
||||
|
@ -52,6 +52,27 @@ class LibXmlRpcCallbacks implements CallbackListener {
|
||||
case Callbacks::XMLRPC_CALLBACKSLIST:
|
||||
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::XMLRPC_CALLBACKSLIST, new CallbacksListStructure($this->maniaControl, $data));
|
||||
break;
|
||||
case Callbacks::XMLRPC_ENABLEDCALLBACKS:
|
||||
//TODO
|
||||
break;
|
||||
case Callbacks::XMLRPC_DISABLEDCALLBACKS:
|
||||
//TODO
|
||||
break;
|
||||
case Callbacks::XMLRPC_APIVERSION:
|
||||
//TODO
|
||||
break;
|
||||
case Callbacks::XMLRPC_ALLAPIVERSIONS:
|
||||
//TODO
|
||||
break;
|
||||
case Callbacks::XMLRPC_DOCUMENTATION:
|
||||
//TODO
|
||||
break;
|
||||
case Callbacks::XMLRPC_METHODSLIST:
|
||||
//TODO
|
||||
break;
|
||||
case Callbacks::XMLRPC_METHODHELP:
|
||||
//TODO
|
||||
break;
|
||||
case Callbacks::MP_STARTSERVERSTART:
|
||||
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_STARTSERVERSTART, new StartServerStructure($this->maniaControl, $data));
|
||||
break;
|
||||
|
@ -71,7 +71,9 @@ class ShootManiaCallbacks implements CallbackListener {
|
||||
case Callbacks::SM_SCORES:
|
||||
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::SM_SCORES, new OnScoresStructure($this->maniaControl, $data));
|
||||
break;
|
||||
//TODO UI Properties Later
|
||||
case Callbacks::SM_UIPROPERTIES:
|
||||
//TODO
|
||||
break;
|
||||
case Callbacks::SM_ONEVENTDEFAULT:
|
||||
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::SM_ONEVENTDEFAULT, new OnDefaultEventStructure($this->maniaControl, $data));
|
||||
break;
|
||||
@ -117,7 +119,7 @@ class ShootManiaCallbacks implements CallbackListener {
|
||||
case Callbacks::SM_ONPLAYERREQUESTACTIONCHANGE:
|
||||
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::SM_ONPLAYERREQUESTACTIONCHANGE, new OnPlayerRequestActionChange($this->maniaControl, $data));
|
||||
break;
|
||||
case Callbacks::SM_COMBO_PAUSE:
|
||||
case Callbacks::SM_COMBO_PAUSESTATUS:
|
||||
//TODO
|
||||
break;
|
||||
case Callbacks::SM_ELITE_STARTTURN:
|
||||
|
29
core/Callbacks/Structures/Common/BaseResponseStructure.php
Normal file
29
core/Callbacks/Structures/Common/BaseResponseStructure.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Lukas
|
||||
* Date: 07. Apr. 2017
|
||||
* Time: 17:56
|
||||
*/
|
||||
|
||||
namespace ManiaControl\Callbacks\Structures\Common;
|
||||
|
||||
|
||||
use ManiaControl\ManiaControl;
|
||||
|
||||
class BaseResponseStructure extends BaseStructure {
|
||||
protected $responseId;
|
||||
|
||||
/**
|
||||
* Get the Response Id
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getResponseId() {
|
||||
return $this->responseId;
|
||||
}
|
||||
|
||||
public function __construct(ManiaControl $maniaControl, $data) {
|
||||
parent::__construct($maniaControl, $data);
|
||||
}
|
||||
}
|
@ -16,8 +16,7 @@ use ManiaControl\ManiaControl;
|
||||
* @copyright 2014-2017 ManiaControl Team
|
||||
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||
*/
|
||||
class CommonScoresStructure extends BaseStructure {
|
||||
protected $responseId;
|
||||
class CommonScoresStructure extends BaseResponseStructure {
|
||||
protected $section;
|
||||
protected $useTeams;
|
||||
protected $winnerTeam;
|
||||
@ -64,15 +63,6 @@ class CommonScoresStructure extends BaseStructure {
|
||||
return $this->winnerPlayer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Response Id
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getResponseId() {
|
||||
return $this->responseId;
|
||||
}
|
||||
|
||||
/**
|
||||
* < Current progress of the match. Can be "" | "EndRound" | "EndMap" | "EndMatch"
|
||||
*
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace ManiaControl\Callbacks\Structures\XmlRpc;
|
||||
|
||||
use ManiaControl\Callbacks\Structures\Common\BaseResponseStructure;
|
||||
use ManiaControl\Callbacks\Structures\Common\BaseStructure;
|
||||
use ManiaControl\ManiaControl;
|
||||
|
||||
@ -12,9 +13,7 @@ use ManiaControl\ManiaControl;
|
||||
* @copyright 2014-2017 ManiaControl Team
|
||||
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||
*/
|
||||
class CallbacksListStructure extends BaseStructure {
|
||||
/** @var string $responseId */
|
||||
private $responseId;
|
||||
class CallbacksListStructure extends BaseResponseStructure {
|
||||
/** @var array $callbacks */
|
||||
private $callbacks;
|
||||
|
||||
@ -31,14 +30,6 @@ class CallbacksListStructure extends BaseStructure {
|
||||
$this->callbacks = $this->getPlainJsonObject()->callbacks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Response Id //TODO Trait for all Response Ids
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getResponseId() {
|
||||
return $this->responseId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Array of the Callbacks
|
||||
|
58
core/Script/InvokeScriptCallback.php
Normal file
58
core/Script/InvokeScriptCallback.php
Normal file
@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace ManiaControl\Script;
|
||||
|
||||
|
||||
use ManiaControl\Callbacks\CallbackListener;
|
||||
use ManiaControl\Callbacks\Structures\Common\BaseResponseStructure;
|
||||
use ManiaControl\General\UsageInformationAble;
|
||||
use ManiaControl\General\UsageInformationTrait;
|
||||
|
||||
//TODO test
|
||||
class InvokeScriptCallback implements CallbackListener, UsageInformationAble {
|
||||
use UsageInformationTrait;
|
||||
|
||||
/**
|
||||
* @var \ManiaControl\ManiaControl $maniaControl
|
||||
*/
|
||||
private $maniaControl;
|
||||
private $callbackName;
|
||||
private $responseId;
|
||||
|
||||
/**
|
||||
* InvokeScriptCallback constructor.
|
||||
*
|
||||
* @param $maniaControl
|
||||
* @param $callbackName
|
||||
* @param $responseId
|
||||
*/
|
||||
public function __construct($maniaControl, $callbackName, $responseId) {
|
||||
$this->maniaControl = $maniaControl;
|
||||
$this->callbackName = $callbackName;
|
||||
$this->responseId = $responseId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a Callable to be called back with the Information
|
||||
*
|
||||
* @api
|
||||
* @param callable $function async Function to Call back
|
||||
*/
|
||||
public function setCallable(callable $function) {
|
||||
$this->maniaControl->getCallbackManager()->registerCallbackListener($this->callbackName, $this, function(BaseResponseStructure $callBackData) use (&$function){
|
||||
if($callBackData == $this->responseId){
|
||||
call_user_func_array($function, array($callBackData));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Generated ResponseId
|
||||
*
|
||||
* @api
|
||||
* @return mixed
|
||||
*/
|
||||
public function getResponseId() {
|
||||
return $this->responseId;
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace ManiaControl\Script;
|
||||
|
||||
use ManiaControl\Callbacks\Callbacks;
|
||||
use ManiaControl\General\UsageInformationAble;
|
||||
use ManiaControl\General\UsageInformationTrait;
|
||||
use ManiaControl\ManiaControl;
|
||||
@ -49,15 +50,19 @@ class ModeScriptEventManager implements UsageInformationAble {
|
||||
/**
|
||||
* Request a list of all available callbacks. This method will trigger the "XmlRpc.CallbacksList" callback.
|
||||
*
|
||||
* @param string $responseId
|
||||
* @api
|
||||
* @return \ManiaControl\Script\InvokeScriptCallback You can directly set a callable on it via setCallable()
|
||||
*/
|
||||
public function getCallbacksList($responseId = "DefaultResponseId") {
|
||||
public function getCallbacksList() {
|
||||
$responseId = $this->generateResponseId();
|
||||
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.GetCallbacksList', array($responseId));
|
||||
return new InvokeScriptCallback($this->maniaControl, Callbacks::XMLRPC_CALLBACKSLIST, $responseId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide a Array of Callbacks you want to Block
|
||||
*
|
||||
* @api
|
||||
* @param array $callbackNames
|
||||
*/
|
||||
public function blockCallbacks($callbackNames) {
|
||||
@ -67,6 +72,7 @@ class ModeScriptEventManager implements UsageInformationAble {
|
||||
/**
|
||||
* Block a Single Callback
|
||||
*
|
||||
* @api
|
||||
* @param $callbackName
|
||||
*/
|
||||
public function blockCallback($callbackName) {
|
||||
@ -76,6 +82,7 @@ class ModeScriptEventManager implements UsageInformationAble {
|
||||
/**
|
||||
* Provide a Array of Callbacks you want to Block
|
||||
*
|
||||
* @api
|
||||
* @param array $callbackNames
|
||||
*/
|
||||
public function unBlockCallbacks($callbackNames) {
|
||||
@ -85,6 +92,7 @@ class ModeScriptEventManager implements UsageInformationAble {
|
||||
/**
|
||||
* Block a Single Callback
|
||||
*
|
||||
* @api
|
||||
* @param $callbackName
|
||||
*/
|
||||
public function unBlockCallback($callbackName) {
|
||||
@ -93,40 +101,52 @@ class ModeScriptEventManager implements UsageInformationAble {
|
||||
|
||||
/**
|
||||
* Request a list of all enabled callbacks. This method will trigger the "XmlRpc.CallbacksList_Enabled" callback.
|
||||
*@api
|
||||
*
|
||||
* @param string $responseId
|
||||
* @return \ManiaControl\Script\InvokeScriptCallback You can directly set a callable on it via setCallable()
|
||||
*/
|
||||
public function getListOfEnabledCallbacks($responseId = "DefaultResponseId") {
|
||||
public function getListOfEnabledCallbacks() {
|
||||
$responseId = $this->generateResponseId();
|
||||
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.GetCallbacksList_Enabled', array($responseId));
|
||||
return new InvokeScriptCallback($this->maniaControl, Callbacks::XMLRPC_ENABLEDCALLBACKS, $responseId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Request a list of all disabled callbacks. This method will trigger the "XmlRpc.CallbacksList_Enabled" callback.
|
||||
*
|
||||
* @param string $responseId
|
||||
* @api
|
||||
* @return \ManiaControl\Script\InvokeScriptCallback You can directly set a callable on it via setCallable()
|
||||
*/
|
||||
public function getListOfDisabledCallbacks($responseId) {
|
||||
public function getListOfDisabledCallbacks() {
|
||||
$responseId = $this->generateResponseId();
|
||||
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.GetCallbacksList_Disabled', array($responseId));
|
||||
return new InvokeScriptCallback($this->maniaControl, Callbacks::XMLRPC_DISABLEDCALLBACKS, $responseId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Description: Request help about a callback. This method will trigger the "XmlRpc.CallbackHelp" callback.
|
||||
*
|
||||
* @api
|
||||
* @param $callbackName
|
||||
* @param string $responseId
|
||||
* @return \ManiaControl\Script\InvokeScriptCallback You can directly set a callable on it via setCallable()
|
||||
*/
|
||||
public function getCallbackHelp($callbackName, $responseId = "DefaultResponseId") {
|
||||
public function getCallbackHelp($callbackName) {
|
||||
$responseId = $this->generateResponseId();
|
||||
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.GetCallbackHelp', array($callbackName, $responseId));
|
||||
return new InvokeScriptCallback($this->maniaControl, Callbacks::XMLRPC_CALLBACKHELP, $responseId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Request a list of all available methods. This method will trigger the "XmlRpc.MethodsList" callback.s
|
||||
*
|
||||
* @param string $responseId
|
||||
* @api
|
||||
* @return \ManiaControl\Script\InvokeScriptCallback You can directly set a callable on it via setCallable()
|
||||
*/
|
||||
public function getMethodsList($responseId = "DefaultResponseId") {
|
||||
public function getMethodsList() {
|
||||
$responseId = $this->generateResponseId();
|
||||
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.GetMethodsList', array($responseId));
|
||||
return new InvokeScriptCallback($this->maniaControl, Callbacks::XMLRPC_METHODSLIST, $responseId);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -141,44 +161,57 @@ class ModeScriptEventManager implements UsageInformationAble {
|
||||
/**
|
||||
* Gets the Api Version
|
||||
*
|
||||
* @param string $version
|
||||
* @api
|
||||
* @return \ManiaControl\Script\InvokeScriptCallback You can directly set a callable on it via setCallable()
|
||||
*/
|
||||
public function getApiVersion($responseId = "DefaultResponseId") {
|
||||
public function getApiVersion() {
|
||||
$responseId = $this->generateResponseId();
|
||||
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.GetApiVersion', array($responseId));
|
||||
return new InvokeScriptCallback($this->maniaControl, Callbacks::XMLRPC_APIVERSION, $responseId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Request help about a method. This method will trigger the "XmlRpc.MethodHelp" callback.
|
||||
*
|
||||
* @param $callbackName
|
||||
* @param string $responseId
|
||||
* @api
|
||||
* @param $methodName
|
||||
* @return \ManiaControl\Script\InvokeScriptCallback You can directly set a callable on it via setCallable()
|
||||
*/
|
||||
public function getMethodHelp($methodName, $responseId = "DefaultResponseId") {
|
||||
public function getMethodHelp($methodName) {
|
||||
$responseId = $this->generateResponseId();
|
||||
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.GetMethodHelp', array($methodName, $responseId));
|
||||
return new InvokeScriptCallback($this->maniaControl, Callbacks::XMLRPC_METHODHELP, $responseId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Request the current game mode xmlrpc callbacks and methods documentation. This method will trigger the "XmlRpc.Documentation" callback.
|
||||
*
|
||||
* @param string $responseId
|
||||
* @api
|
||||
* @return \ManiaControl\Script\InvokeScriptCallback You can directly set a callable on it via setCallable()
|
||||
*/
|
||||
public function getDocumentation($responseId = "DefaultResponseId") {
|
||||
public function getDocumentation() {
|
||||
$responseId = $this->generateResponseId();
|
||||
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.GetDocumentation', array($responseId));
|
||||
return new InvokeScriptCallback($this->maniaControl, Callbacks::XMLRPC_DOCUMENTATION, $responseId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a List of All Api Version
|
||||
*
|
||||
* @param string $responseId
|
||||
* @api
|
||||
* @return \ManiaControl\Script\InvokeScriptCallback You can directly set a callable on it via setCallable()
|
||||
*/
|
||||
public function getAllApiVersions($responseId = "DefaultResponseId") {
|
||||
public function getAllApiVersions() {
|
||||
$responseId = $this->generateResponseId();
|
||||
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.GetAllApiVersions', array($responseId));
|
||||
return new InvokeScriptCallback($this->maniaControl, Callbacks::XMLRPC_ALLAPIVERSIONS, $responseId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Extend the duration of any ongoing warmup.
|
||||
*
|
||||
* @api
|
||||
* @param $milisec < the duration of the extension in milliseconds.
|
||||
*/
|
||||
public function extendManiaPlanetWarmup($milisec) {
|
||||
@ -187,6 +220,7 @@ class ModeScriptEventManager implements UsageInformationAble {
|
||||
|
||||
/**
|
||||
* Stop any ongoing warmup.
|
||||
* @api
|
||||
*/
|
||||
public function stopManiaPlanetWarmup() {
|
||||
$this->maniaControl->getClient()->triggerModeScriptEvent('Maniaplanet.WarmUp.Stop');
|
||||
@ -195,42 +229,55 @@ class ModeScriptEventManager implements UsageInformationAble {
|
||||
/**
|
||||
* Get the status of the warmup.
|
||||
*
|
||||
* @param string $responseId
|
||||
* @api
|
||||
* @return \ManiaControl\Script\InvokeScriptCallback You can directly set a callable on it via setCallable()
|
||||
*/
|
||||
public function getWarmupStatus($responseId = "DefaultResponseId") {
|
||||
public function getWarmupStatus() {
|
||||
$responseId = $this->generateResponseId();
|
||||
$this->maniaControl->getClient()->triggerModeScriptEvent('Maniaplanet.WarmUp.GetStatus', array($responseId));
|
||||
return new InvokeScriptCallback($this->maniaControl, Callbacks::MP_WARMUP_STATUS, $responseId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the status of the pause.
|
||||
*
|
||||
* @param string $responseId
|
||||
* @api
|
||||
* @return \ManiaControl\Script\InvokeScriptCallback You can directly set a callable on it via setCallable()
|
||||
*/
|
||||
public function getComboPauseStatus($responseId = "DefaultResponseId") {
|
||||
public function getComboPauseStatus() {
|
||||
$responseId = $this->generateResponseId();
|
||||
$this->maniaControl->getClient()->triggerModeScriptEvent('Shootmania.Combo.GetPause', array($responseId));
|
||||
return new InvokeScriptCallback($this->maniaControl, Callbacks::SM_COMBO_PAUSESTATUS, $responseId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Start a Pause in Combo
|
||||
* Start a Pause in Combo and triggers a Callback for the Pause Status
|
||||
*
|
||||
* @param string $responseId
|
||||
* @api
|
||||
* @return \ManiaControl\Script\InvokeScriptCallback To get The Pause Status You can directly set a callable on it via setCallable()
|
||||
*/
|
||||
public function startComboPause($responseId = "DefaultResponseId") {
|
||||
public function startComboPause() {
|
||||
$responseId = $this->generateResponseId();
|
||||
$this->maniaControl->getClient()->triggerModeScriptEvent('Shootmania.Combo.SetPause', array(true, $responseId));
|
||||
return new InvokeScriptCallback($this->maniaControl, Callbacks::SM_COMBO_PAUSESTATUS, $responseId);
|
||||
}
|
||||
|
||||
/**
|
||||
* End a Pause in Combo
|
||||
* End a Pause in Combo and triggers a Callback for the Pause Status
|
||||
*
|
||||
* @param string $responseId
|
||||
* @api
|
||||
* @return \ManiaControl\Script\InvokeScriptCallback To get The Pause Status You can directly set a callable on it via setCallable()
|
||||
*/
|
||||
public function endComboPause($responseId = "DefaultResponseId") {
|
||||
public function endComboPause() {
|
||||
$responseId = $this->generateResponseId();
|
||||
$this->maniaControl->getClient()->triggerModeScriptEvent('Shootmania.Combo.SetPause', array(false, $responseId));
|
||||
return new InvokeScriptCallback($this->maniaControl, Callbacks::SM_COMBO_PAUSESTATUS, $responseId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Move the spectators' timers UI.
|
||||
*
|
||||
* @api
|
||||
* @param $x
|
||||
* @param $y
|
||||
* @param $z
|
||||
@ -242,6 +289,7 @@ class ModeScriptEventManager implements UsageInformationAble {
|
||||
/**
|
||||
* Move the progression UI.
|
||||
*
|
||||
* @api
|
||||
* @param $x
|
||||
* @param $y
|
||||
* @param $z
|
||||
@ -254,24 +302,31 @@ class ModeScriptEventManager implements UsageInformationAble {
|
||||
/**
|
||||
* Request the current scores. This method will trigger the "Shootmania.Scores" callback.
|
||||
*
|
||||
* @param string $responseId
|
||||
* @api
|
||||
* @return \ManiaControl\Script\InvokeScriptCallback You can directly set a callable on it via setCallable()
|
||||
*/
|
||||
public function getShootmaniaScores($responseId = "DefaultResponseId") {
|
||||
public function getShootmaniaScores() {
|
||||
$responseId = $this->generateResponseId();
|
||||
$this->maniaControl->getClient()->triggerModeScriptEvent('Shootmania.GetScores', array($responseId));
|
||||
return new InvokeScriptCallback($this->maniaControl, Callbacks::SM_SCORES, $responseId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Request the current ui properties. This method will trigger the "Shootmania.UIProperties" callback.
|
||||
*
|
||||
* @param string $responseId
|
||||
* @api
|
||||
* @return \ManiaControl\Script\InvokeScriptCallback You can directly set a callable on it via setCallable()
|
||||
*/
|
||||
public function getShootmaniaUIProperties($responseId = "DefaultResponseId") {
|
||||
public function getShootmaniaUIProperties() {
|
||||
$responseId = $this->generateResponseId();
|
||||
$this->maniaControl->getClient()->triggerModeScriptEvent('Shootmania.GetUIProperties', array($responseId));
|
||||
return new InvokeScriptCallback($this->maniaControl, Callbacks::SM_UIPROPERTIES, $responseId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the ui properties.
|
||||
*
|
||||
* @api
|
||||
* @param string Json-Encoded Xml UI Property String
|
||||
*/
|
||||
public function setShootmaniaUIProperties($properties) {
|
||||
@ -281,24 +336,31 @@ class ModeScriptEventManager implements UsageInformationAble {
|
||||
/**
|
||||
* Request the current scores. This method will trigger the "Trackmania.Scores" callback.
|
||||
*
|
||||
* @param string $responseId
|
||||
* @api
|
||||
* @return \ManiaControl\Script\InvokeScriptCallback You can directly set a callable on it via setCallable()
|
||||
*/
|
||||
public function getTrackmaniaScores($responseId = "DefaultResponseId") {
|
||||
public function getTrackmaniaScores() {
|
||||
$responseId = $this->generateResponseId();
|
||||
$this->maniaControl->getClient()->triggerModeScriptEvent('Trackmania.GetScores', array($responseId));
|
||||
return new InvokeScriptCallback($this->maniaControl, Callbacks::TM_SCORES, $responseId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Request the current points repartition. This method will trigger the "Trackmania.PointsRepartition" callback.
|
||||
*
|
||||
* @param string $responseId
|
||||
* @api
|
||||
* @return \ManiaControl\Script\InvokeScriptCallback You can directly set a callable on it via setCallable()
|
||||
*/
|
||||
public function getTrackmaniaPointsRepartition($responseId = "DefaultResponseId") {
|
||||
public function getTrackmaniaPointsRepartition() {
|
||||
$responseId = $this->generateResponseId();
|
||||
$this->maniaControl->getClient()->triggerModeScriptEvent('Trackmania.GetPointsRepartition', array($responseId));
|
||||
return new InvokeScriptCallback($this->maniaControl, Callbacks::TM_POINTSREPARTITION, $responseId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the points repartition.
|
||||
*
|
||||
* @api
|
||||
* @param array String Array of Points
|
||||
*/
|
||||
public function setTrackmaniaPointsRepartition($pointArray) {
|
||||
@ -308,15 +370,18 @@ class ModeScriptEventManager implements UsageInformationAble {
|
||||
/**
|
||||
* Request the current ui properties. This method will trigger the "Shootmania.UIProperties" callback.
|
||||
*
|
||||
* @param string $responseId
|
||||
* @api
|
||||
* @return \ManiaControl\Script\InvokeScriptCallback You can directly set a callable on it via setCallable()
|
||||
*/
|
||||
public function getTrackmaniaUIProperties($responseId = "DefaultResponseId") {
|
||||
public function getTrackmaniaUIProperties() {
|
||||
$responseId = $this->generateResponseId();
|
||||
$this->maniaControl->getClient()->triggerModeScriptEvent('Trackmania.GetUIProperties', array($responseId));
|
||||
return new InvokeScriptCallback($this->maniaControl, Callbacks::TM_SCORES, $responseId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the ui properties.
|
||||
*
|
||||
* @api
|
||||
* @param string Json-Encoded Xml UI Property String
|
||||
*/
|
||||
public function setTrackmaniaUIProperties($properties) {
|
||||
@ -325,6 +390,7 @@ class ModeScriptEventManager implements UsageInformationAble {
|
||||
|
||||
/**
|
||||
* Stop the whole warm up sequence.
|
||||
* @api
|
||||
*/
|
||||
public function stopTrackmaniaWarmup() {
|
||||
$this->maniaControl->getClient()->triggerModeScriptEvent('Trackmania.WarmUp.Stop');
|
||||
@ -332,6 +398,7 @@ class ModeScriptEventManager implements UsageInformationAble {
|
||||
|
||||
/**
|
||||
* Stop the current warm up round.
|
||||
* @api
|
||||
*/
|
||||
public function stopTrackmaniaRound() {
|
||||
$this->maniaControl->getClient()->triggerModeScriptEvent('Trackmania.WarmUp.StopRound');
|
||||
@ -340,8 +407,17 @@ class ModeScriptEventManager implements UsageInformationAble {
|
||||
|
||||
/**
|
||||
* Stop the current round. Only available in Cup, Rounds and Team modes.
|
||||
* @api
|
||||
*/
|
||||
public function forceTrackmaniaRoundEnd() {
|
||||
$this->maniaControl->getClient()->triggerModeScriptEvent('Trackmania.ForceEndRound');
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the needed Unique ResponseId
|
||||
* @return string
|
||||
*/
|
||||
private function generateResponseId() {
|
||||
return uniqid("ManiaControl.");
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user