improved: method chaining, phpdoc, constants access, setting value types
This commit is contained in:
parent
f037392acf
commit
87f4d10ea4
@ -7,6 +7,7 @@ use FML\Controls\Label;
|
|||||||
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_BgRaceScore2;
|
use FML\Controls\Quads\Quad_BgRaceScore2;
|
||||||
|
use FML\Controls\Quads\Quad_Bgs1InRace;
|
||||||
use FML\Controls\Quads\Quad_Icons64x64_1;
|
use FML\Controls\Quads\Quad_Icons64x64_1;
|
||||||
use FML\Script\Features\Paging;
|
use FML\Script\Features\Paging;
|
||||||
use FML\Script\Script;
|
use FML\Script\Script;
|
||||||
@ -48,22 +49,22 @@ class StyleManager {
|
|||||||
$this->maniaControl = $maniaControl;
|
$this->maniaControl = $maniaControl;
|
||||||
|
|
||||||
// Init settings
|
// Init settings
|
||||||
$this->maniaControl->settingManager->initSetting($this, self::SETTING_LABEL_DEFAULT_STYLE, 'TextTitle1');
|
$this->maniaControl->settingManager->initSetting($this, self::SETTING_LABEL_DEFAULT_STYLE, Label_Text::STYLE_TextTitle1);
|
||||||
$this->maniaControl->settingManager->initSetting($this, self::SETTING_QUAD_DEFAULT_STYLE, 'Bgs1InRace');
|
$this->maniaControl->settingManager->initSetting($this, self::SETTING_QUAD_DEFAULT_STYLE, Quad_Bgs1InRace::STYLE);
|
||||||
$this->maniaControl->settingManager->initSetting($this, self::SETTING_QUAD_DEFAULT_SUBSTYLE, 'BgTitleShadow');
|
$this->maniaControl->settingManager->initSetting($this, self::SETTING_QUAD_DEFAULT_SUBSTYLE, Quad_Bgs1InRace::SUBSTYLE_BgTitleShadow);
|
||||||
|
|
||||||
// Main Widget
|
// Main Widget
|
||||||
$this->maniaControl->settingManager->initSetting($this, self::SETTING_MAIN_WIDGET_DEFAULT_STYLE, Quad_BgRaceScore2::STYLE);
|
$this->maniaControl->settingManager->initSetting($this, self::SETTING_MAIN_WIDGET_DEFAULT_STYLE, Quad_BgRaceScore2::STYLE);
|
||||||
$this->maniaControl->settingManager->initSetting($this, self::SETTING_MAIN_WIDGET_DEFAULT_SUBSTYLE, Quad_BgRaceScore2::SUBSTYLE_HandleSelectable);
|
$this->maniaControl->settingManager->initSetting($this, self::SETTING_MAIN_WIDGET_DEFAULT_SUBSTYLE, Quad_BgRaceScore2::SUBSTYLE_HandleSelectable);
|
||||||
$this->maniaControl->settingManager->initSetting($this, self::SETTING_LIST_WIDGETS_WIDTH, '150');
|
$this->maniaControl->settingManager->initSetting($this, self::SETTING_LIST_WIDGETS_WIDTH, 150.);
|
||||||
$this->maniaControl->settingManager->initSetting($this, self::SETTING_LIST_WIDGETS_HEIGHT, '80');
|
$this->maniaControl->settingManager->initSetting($this, self::SETTING_LIST_WIDGETS_HEIGHT, 80.);
|
||||||
$this->maniaControl->settingManager->initSetting($this, self::SETTING_ICON_DEFAULT_OFFSET_SM, '20');
|
$this->maniaControl->settingManager->initSetting($this, self::SETTING_ICON_DEFAULT_OFFSET_SM, 20.);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the default Icon Offset for shootmania
|
* Get the default Icon Offset for shootmania
|
||||||
*
|
*
|
||||||
* @return string
|
* @return float
|
||||||
*/
|
*/
|
||||||
public function getDefaultIconOffsetSM() {
|
public function getDefaultIconOffsetSM() {
|
||||||
return $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_ICON_DEFAULT_OFFSET_SM);
|
return $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_ICON_DEFAULT_OFFSET_SM);
|
||||||
@ -99,7 +100,7 @@ class StyleManager {
|
|||||||
/**
|
/**
|
||||||
* Gets the Default Description Label
|
* Gets the Default Description Label
|
||||||
*
|
*
|
||||||
* @return Label
|
* @return \FML\Controls\Label
|
||||||
*/
|
*/
|
||||||
public function getDefaultDescriptionLabel() {
|
public function getDefaultDescriptionLabel() {
|
||||||
$width = $this->getListWidgetsWidth();
|
$width = $this->getListWidgetsWidth();
|
||||||
@ -107,11 +108,11 @@ class StyleManager {
|
|||||||
|
|
||||||
// Predefine Description Label
|
// Predefine Description Label
|
||||||
$descriptionLabel = new Label();
|
$descriptionLabel = new Label();
|
||||||
$descriptionLabel->setAlign($descriptionLabel::LEFT, $descriptionLabel::TOP);
|
$descriptionLabel->setAlign($descriptionLabel::LEFT, $descriptionLabel::TOP)
|
||||||
$descriptionLabel->setPosition(-$width / 2 + 10, -$height / 2 + 5);
|
->setPosition($width * -0.5 + 10, $height * -0.5 + 5)
|
||||||
$descriptionLabel->setSize($width * 0.7, 4);
|
->setSize($width * 0.7, 4)
|
||||||
$descriptionLabel->setTextSize(2);
|
->setTextSize(2)
|
||||||
$descriptionLabel->setVisible(false);
|
->setVisible(false);
|
||||||
|
|
||||||
return $descriptionLabel;
|
return $descriptionLabel;
|
||||||
}
|
}
|
||||||
@ -119,7 +120,7 @@ class StyleManager {
|
|||||||
/**
|
/**
|
||||||
* Get the Default List Widgets Width
|
* Get the Default List Widgets Width
|
||||||
*
|
*
|
||||||
* @return string
|
* @return float
|
||||||
*/
|
*/
|
||||||
public function getListWidgetsWidth() {
|
public function getListWidgetsWidth() {
|
||||||
return $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_LIST_WIDGETS_WIDTH);
|
return $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_LIST_WIDGETS_WIDTH);
|
||||||
@ -128,7 +129,7 @@ class StyleManager {
|
|||||||
/**
|
/**
|
||||||
* Get the default list widget height
|
* Get the default list widget height
|
||||||
*
|
*
|
||||||
* @return string
|
* @return float
|
||||||
*/
|
*/
|
||||||
public function getListWidgetsHeight() {
|
public function getListWidgetsHeight() {
|
||||||
return $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_LIST_WIDGETS_HEIGHT);
|
return $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_LIST_WIDGETS_HEIGHT);
|
||||||
@ -137,9 +138,11 @@ class StyleManager {
|
|||||||
/**
|
/**
|
||||||
* Builds the Default List Frame
|
* Builds the Default List Frame
|
||||||
*
|
*
|
||||||
* @return Frame $frame
|
* @param mixed $script
|
||||||
|
* @param mixed $paging
|
||||||
|
* @return \FML\Controls\Frame
|
||||||
*/
|
*/
|
||||||
public function getDefaultListFrame() {
|
public function getDefaultListFrame($script = null, $paging = null) {
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$script = null;
|
$script = null;
|
||||||
$paging = null;
|
$paging = null;
|
||||||
@ -159,50 +162,49 @@ class StyleManager {
|
|||||||
|
|
||||||
// mainframe
|
// mainframe
|
||||||
$frame = new Frame();
|
$frame = new Frame();
|
||||||
$frame->setSize($width, $height);
|
$frame->setSize($width, $height)
|
||||||
$frame->setPosition(0, 0, 35); //TODO place before scoreboards
|
->setZ(35); //TODO place before scoreboards
|
||||||
|
|
||||||
// Background Quad
|
// Background Quad
|
||||||
$backgroundQuad = new Quad();
|
$backgroundQuad = new Quad();
|
||||||
$frame->add($backgroundQuad);
|
$frame->add($backgroundQuad);
|
||||||
$backgroundQuad->setSize($width, $height);
|
$backgroundQuad->setZ(-1)
|
||||||
$backgroundQuad->setStyles($quadStyle, $quadSubstyle);
|
->setSize($width, $height)
|
||||||
|
->setStyles($quadStyle, $quadSubstyle);
|
||||||
|
|
||||||
// Add Close Quad (X)
|
// Add Close Quad (X)
|
||||||
$closeQuad = new Quad_Icons64x64_1();
|
$closeQuad = new Quad_Icons64x64_1();
|
||||||
$frame->add($closeQuad);
|
$frame->add($closeQuad);
|
||||||
$closeQuad->setPosition($width * 0.483, $height * 0.467, 3);
|
$closeQuad->setPosition($width * 0.483, $height * 0.467, 3)
|
||||||
$closeQuad->setSize(6, 6);
|
->setSize(6, 6)
|
||||||
$closeQuad->setSubStyle(Quad_Icons64x64_1::SUBSTYLE_QuitRace);
|
->setSubStyle($closeQuad::SUBSTYLE_QuitRace)
|
||||||
$closeQuad->setAction(ManialinkManager::ACTION_CLOSEWIDGET);
|
->setAction(ManialinkManager::ACTION_CLOSEWIDGET);
|
||||||
|
|
||||||
if ($script) {
|
if ($script) {
|
||||||
$pagerSize = 6.;
|
$pagerSize = 6.;
|
||||||
$pagerPrev = new Quad_Icons64x64_1();
|
$pagerPrev = new Quad_Icons64x64_1();
|
||||||
$frame->add($pagerPrev);
|
$frame->add($pagerPrev);
|
||||||
$pagerPrev->setPosition($width * 0.42, $height * -0.44, 2);
|
$pagerPrev->setPosition($width * 0.42, $height * -0.44, 2)
|
||||||
$pagerPrev->setSize($pagerSize, $pagerSize);
|
->setSize($pagerSize, $pagerSize)
|
||||||
$pagerPrev->setSubStyle(Quad_Icons64x64_1::SUBSTYLE_ArrowPrev);
|
->setSubStyle($pagerPrev::SUBSTYLE_ArrowPrev);
|
||||||
|
|
||||||
$pagerNext = new Quad_Icons64x64_1();
|
$pagerNext = new Quad_Icons64x64_1();
|
||||||
$frame->add($pagerNext);
|
$frame->add($pagerNext);
|
||||||
$pagerNext->setPosition($width * 0.45, $height * -0.44, 2);
|
$pagerNext->setPosition($width * 0.45, $height * -0.44, 2)
|
||||||
$pagerNext->setSize($pagerSize, $pagerSize);
|
->setSize($pagerSize, $pagerSize)
|
||||||
$pagerNext->setSubStyle(Quad_Icons64x64_1::SUBSTYLE_ArrowNext);
|
->setSubStyle($pagerNext::SUBSTYLE_ArrowNext);
|
||||||
|
|
||||||
if ($paging) {
|
|
||||||
$paging->addButton($pagerNext);
|
|
||||||
$paging->addButton($pagerPrev);
|
|
||||||
}
|
|
||||||
|
|
||||||
$pageCountLabel = new Label_Text();
|
$pageCountLabel = new Label_Text();
|
||||||
$frame->add($pageCountLabel);
|
$frame->add($pageCountLabel);
|
||||||
$pageCountLabel->setHAlign($pageCountLabel::RIGHT);
|
$pageCountLabel->setHAlign($pageCountLabel::RIGHT)
|
||||||
$pageCountLabel->setPosition($width * 0.40, $height * -0.44, 1);
|
->setPosition($width * 0.40, $height * -0.44, 1)
|
||||||
$pageCountLabel->setStyle($pageCountLabel::STYLE_TextTitle1);
|
->setStyle($pageCountLabel::STYLE_TextTitle1)
|
||||||
$pageCountLabel->setTextSize(1.3);
|
->setTextSize(1.3);
|
||||||
|
|
||||||
if ($paging) {
|
if ($paging) {
|
||||||
$paging->setLabel($pageCountLabel);
|
$paging->addButton($pagerNext)
|
||||||
|
->addButton($pagerPrev)
|
||||||
|
->setLabel($pageCountLabel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user