fixed scriptsettings

This commit is contained in:
kremsy 2014-01-17 17:00:06 +01:00 committed by Steffen Schröder
parent 7e18d36dac
commit dff10f74ee

View File

@ -145,16 +145,20 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
$pagesId = 'ScriptSettingsPages'; $pagesId = 'ScriptSettingsPages';
$frame = new Frame(); $frame = new Frame();
//$scriptInfo = (array)$this->maniaControl->client->getModeScriptInfo(); $scriptInfo = $this->maniaControl->client->getModeScriptInfo();
$scriptInfo = $this->maniaControl->client->execute('GetModeScriptInfo'); //$scriptInfo = $this->maniaControl->client->execute('GetModeScriptInfo');
if(isset($scriptInfo['faultCode'])) {
//TODO:
/*if(isset($scriptInfo['faultCode'])) {
// Not in script mode // Not in script mode
$label = new Label(); $label = new Label();
$frame->add($label); $frame->add($label);
$label->setText($scriptInfo['faultString']); $label->setText($scriptInfo['faultString']);
return $frame; return $frame;
} }
$scriptParams = $scriptInfo['ParamDescs']; $scriptParams = $scriptInfo['ParamDescs'];*/
$scriptParams = $scriptInfo->paramDescs;
$scriptSettings = $this->maniaControl->client->getModeScriptSettings(); $scriptSettings = $this->maniaControl->client->getModeScriptSettings();
@ -193,7 +197,8 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
$pageFrames = array(); $pageFrames = array();
$y = 0.; $y = 0.;
foreach($scriptParams as $index => $scriptParam) { foreach($scriptParams as $index => $scriptParam) {
$settingName = $scriptParam['Name']; /** @var \Maniaplanet\DedicatedServer\Structures\ScriptSettings $scriptParam */
$settingName = $scriptParam->name;
if(!isset($scriptSettings[$settingName])) { if(!isset($scriptSettings[$settingName])) {
continue; continue;
@ -260,7 +265,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
$descriptionLabel->setSize($width * 0.7, $settingHeight); $descriptionLabel->setSize($width * 0.7, $settingHeight);
$descriptionLabel->setTextSize($labelTextSize); $descriptionLabel->setTextSize($labelTextSize);
$descriptionLabel->setTranslate(true); $descriptionLabel->setTranslate(true);
$descriptionLabel->setText($scriptParam['Desc']); $descriptionLabel->setText($scriptParam->desc);
$script->addTooltip($nameLabel, $descriptionLabel); $script->addTooltip($nameLabel, $descriptionLabel);
$y -= $settingHeight; $y -= $settingHeight;