Compare commits

..

2 Commits

4 changed files with 49 additions and 2 deletions

View File

@ -4,6 +4,7 @@ namespace ManiaControl\Configurator;
use FML\Components\CheckBox; use FML\Components\CheckBox;
use FML\Controls\Entry; use FML\Controls\Entry;
use FML\Controls\TextEdit;
use FML\Controls\Frame; use FML\Controls\Frame;
use FML\Controls\Label; use FML\Controls\Label;
use FML\Controls\Labels\Label_Text; use FML\Controls\Labels\Label_Text;
@ -439,7 +440,7 @@ class GameModeSettings implements ConfiguratorMenu, CallbackListener, Communicat
$quad->setX(0.27 * $width); $quad->setX(0.27 * $width);
$checkBox = new CheckBox(self::ACTION_PREFIX_SETTING . $settingName, $settingValue, $quad); $checkBox = new CheckBox(self::ACTION_PREFIX_SETTING . $settingName, $settingValue, $quad);
$settingFrame->addChild($checkBox); $settingFrame->addChild($checkBox);
} else { } else if (is_numeric($settingValue)) {
// Value entry // Value entry
$entry = new Entry(); $entry = new Entry();
$settingFrame->addChild($entry); $settingFrame->addChild($entry);
@ -449,6 +450,19 @@ class GameModeSettings implements ConfiguratorMenu, CallbackListener, Communicat
$entry->setStyle(Label_Text::STYLE_TextValueSmall); $entry->setStyle(Label_Text::STYLE_TextValueSmall);
$entry->setTextSize(1); $entry->setTextSize(1);
$entry->setX(0.275 * $width); $entry->setX(0.275 * $width);
} else {
// Standard entry
$textedit = new TextEdit();
$settingFrame->addChild($textedit);
$textedit->setX(0.275 * $width);
$textedit->setSize(0.3 * $width, 0.9 * $settingHeight);
$textedit->setStyle(Label_Text::STYLE_TextValueSmall);
$textedit->setTextSize(1);
$textedit->setName(self::ACTION_PREFIX_SETTING . $settingName);
$textedit->setDefault($settingValue);
$textedit->setHorizontalAlign(TextEdit::CENTER);
$textedit->setVerticalAlign(TextEdit::CENTER);
$textedit->setMaxLines(1);
} }
if ($isScriptMode) { if ($isScriptMode) {

View File

@ -10,6 +10,7 @@ use FML\Controls\Labels\Label_Button;
use FML\Controls\Labels\Label_Text; use FML\Controls\Labels\Label_Text;
use FML\Controls\Quad; use FML\Controls\Quad;
use FML\Controls\Quads\Quad_Icons64x64_1; use FML\Controls\Quads\Quad_Icons64x64_1;
use FML\Controls\TextEdit;
use FML\Script\Features\Paging; use FML\Script\Features\Paging;
use FML\Script\Script; use FML\Script\Script;
use ManiaControl\Admin\AuthenticationManager; use ManiaControl\Admin\AuthenticationManager;
@ -218,7 +219,7 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
$label->setTextSize(1); $label->setTextSize(1);
$valuePicker = new ValuePicker($settingName, $setting->set, $setting->value, $label); $valuePicker = new ValuePicker($settingName, $setting->set, $setting->value, $label);
$settingFrame->addChild($valuePicker); $settingFrame->addChild($valuePicker);
} else { } else if ($setting->type === Setting::TYPE_INT) {
// Standard entry // Standard entry
$entry = new Entry(); $entry = new Entry();
$settingFrame->addChild($entry); $settingFrame->addChild($entry);
@ -228,6 +229,19 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
$entry->setTextSize(1); $entry->setTextSize(1);
$entry->setName($settingName); $entry->setName($settingName);
$entry->setDefault($setting->value); $entry->setDefault($setting->value);
} else {
// Standard TextEdit
$textedit = new TextEdit();
$settingFrame->addChild($textedit);
$textedit->setX($width * 0.33);
$textedit->setSize($width * 0.3, $settingHeight * 0.9);
$textedit->setStyle(Label_Text::STYLE_TextValueSmall);
$textedit->setTextSize(1);
$textedit->setName(self::ACTION_PREFIX_SETTING . $setting->index);
$textedit->setDefault($setting->value);
$textedit->setHorizontalAlign(TextEdit::CENTER);
$textedit->setVerticalAlign(TextEdit::CENTER);
$textedit->setMaxLines(1);
} }
$posY -= $settingHeight; $posY -= $settingHeight;

View File

@ -5,6 +5,7 @@ namespace ManiaControl\Plugins;
use FML\Components\CheckBox; use FML\Components\CheckBox;
use FML\Components\ValuePicker; use FML\Components\ValuePicker;
use FML\Controls\Entry; use FML\Controls\Entry;
use FML\Controls\TextEdit;
use FML\Controls\Frame; use FML\Controls\Frame;
use FML\Controls\Label; use FML\Controls\Label;
use FML\Controls\Labels\Label_Button; use FML\Controls\Labels\Label_Button;
@ -347,6 +348,19 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
$label->setTextSize(1); $label->setTextSize(1);
$valuePicker = new ValuePicker(self::ACTION_PREFIX_SETTING . $setting->index, $setting->set, $setting->value, $label); $valuePicker = new ValuePicker(self::ACTION_PREFIX_SETTING . $setting->index, $setting->set, $setting->value, $label);
$settingFrame->addChild($valuePicker); $settingFrame->addChild($valuePicker);
} else if ($setting->type === Setting::TYPE_STRING) {
// Standard entry
$textedit = new TextEdit();
$settingFrame->addChild($textedit);
$textedit->setX($width * 0.33);
$textedit->setSize($width * 0.3, $settingHeight * 0.9);
$textedit->setStyle(Label_Text::STYLE_TextValueSmall);
$textedit->setTextSize(1);
$textedit->setName(self::ACTION_PREFIX_SETTING . $setting->index);
$textedit->setDefault($setting->value);
$textedit->setHorizontalAlign(TextEdit::CENTER);
$textedit->setVerticalAlign(TextEdit::CENTER);
$textedit->setMaxLines(1);
} else { } else {
// Value entry // Value entry
$entry = new Entry(); $entry = new Entry();

View File

@ -26,6 +26,11 @@ class TextEdit extends Control implements MultiLineable, Scriptable, Styleable,
const FORMAT_Password = "Password"; const FORMAT_Password = "Password";
const FORMAT_NewPassword = "NewPassword"; const FORMAT_NewPassword = "NewPassword";
/**
* @var string $name TextEdit name
*/
protected $name = null;
/** /**
* @var string $default Default value * @var string $default Default value
*/ */