Hide server password in server options
This commit is contained in:
parent
cc46f63155
commit
32e00a8051
@ -294,10 +294,7 @@ class ServerOptionsMenu implements CallbackListener, ConfiguratorMenu, TimerList
|
||||
|
||||
foreach ($serverOptionsArray as $name => $value) {
|
||||
// Continue on CurrentMaxPlayers...
|
||||
$pos = strpos($name, 'Current'); // TODO: display 'Current...' somewhere
|
||||
if ($pos !== false) {
|
||||
continue;
|
||||
}
|
||||
if (str_contains($name, 'Current')) continue; // TODO: display 'Current...' somewhere
|
||||
|
||||
if ($index % 13 === 0) {
|
||||
$pageFrame = new Frame();
|
||||
@ -331,6 +328,25 @@ class ServerOptionsMenu implements CallbackListener, ConfiguratorMenu, TimerList
|
||||
$optionsFrame->setY($posY - $optionHeight * 1.5);
|
||||
$posY -= $optionHeight * 3.;
|
||||
$index += 3;
|
||||
} else if (str_contains($name, 'Password')) {
|
||||
$entry->setTextFormat("Password");
|
||||
$entry->setId($name);
|
||||
|
||||
$quad = new Quad();
|
||||
$quad->setPosition(-4, 0, -0.01)->setSize(4, 4);
|
||||
$checkBox = new CheckBox(null, false, $quad);
|
||||
$checkBox->setEnabledDesign("UICommon64_1", "Eye_light");
|
||||
$checkBox->setDisabledDesign("UICommon64_1", "Eye_light");
|
||||
$checkBox->setCustomScript("
|
||||
declare CMlEntry Entry <=> (Quad_CheckBox.Parent.Parent.GetFirstChild(\"$name\") as CMlEntry);
|
||||
if (Entry != Null) {
|
||||
if (Quad_CheckBox.StyleSelected) {
|
||||
Entry.TextFormat = CMlEntry::ETextFormat::Basic;
|
||||
} else {
|
||||
Entry.TextFormat = CMlEntry::ETextFormat::Password;
|
||||
}
|
||||
}");
|
||||
$optionsFrame->addChild($checkBox);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -143,6 +143,30 @@ class CheckBox implements Renderable, ScriptFeatureable
|
||||
return $this->feature->getDisabledDesign();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set script launched when clicking on the checkbox
|
||||
*
|
||||
* @api
|
||||
* @param string $customScript script
|
||||
* @return static
|
||||
*/
|
||||
public function setCustomScript(string $customScript)
|
||||
{
|
||||
$this->feature->setCustomScript($customScript);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get script launched when clicking on the checkbox
|
||||
*
|
||||
* @api
|
||||
* @return string
|
||||
*/
|
||||
public function getCustomScript()
|
||||
{
|
||||
return $this->feature->getCustomScript();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the disabled design
|
||||
*
|
||||
|
@ -53,6 +53,11 @@ class CheckBoxFeature extends ScriptFeature
|
||||
*/
|
||||
protected $disabledDesign = null;
|
||||
|
||||
/**
|
||||
* @var string $customScript Script executed when clicking on the checkbox
|
||||
*/
|
||||
protected $customScript = "";
|
||||
|
||||
/**
|
||||
* Construct a new CheckBox Feature
|
||||
*
|
||||
@ -199,6 +204,30 @@ class CheckBoxFeature extends ScriptFeature
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get script launched when clicking on the checkbox
|
||||
*
|
||||
* @api
|
||||
* @return string
|
||||
*/
|
||||
public function getCustomScript()
|
||||
{
|
||||
return $this->customScript;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set script launched when clicking on the checkbox
|
||||
*
|
||||
* @api
|
||||
* @param string $customScript script
|
||||
* @return static
|
||||
*/
|
||||
public function setCustomScript(string $customScript)
|
||||
{
|
||||
$this->customScript = $customScript;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ScriptFeature::prepare()
|
||||
*/
|
||||
@ -290,6 +319,7 @@ EntryId = \"{$entryId}\";
|
||||
if (Event.ControlId == \"{$quadId}\") {
|
||||
declare Quad_CheckBox <=> (Event.Control as CMlQuad);
|
||||
" . self::FUNCTION_UPDATE_QUAD_DESIGN . "(Quad_CheckBox);
|
||||
" . $this->customScript . "
|
||||
}";
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user