Add an option for default label style

This commit is contained in:
Beu 2022-04-26 14:49:01 +02:00
parent fb63e13d5c
commit 4b56a790bb

View File

@ -43,6 +43,7 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
// MapWidget Properties // MapWidget Properties
const MLID_MAP_WIDGET = 'WidgetPlugin.MapWidget'; const MLID_MAP_WIDGET = 'WidgetPlugin.MapWidget';
const SETTING_USE_SERVER_DEFAULT_LABEL_STYLE = 'Use Server default Label Style';
const SETTING_MAP_WIDGET_ACTIVATED = 'Map-Widget Activated'; const SETTING_MAP_WIDGET_ACTIVATED = 'Map-Widget Activated';
const SETTING_MAP_WIDGET_NICKNAME = 'Map-Widget display Author Nickname instead of Login'; const SETTING_MAP_WIDGET_NICKNAME = 'Map-Widget display Author Nickname instead of Login';
const SETTING_MAP_WIDGET_POSX = 'Map-Widget-Position: X'; const SETTING_MAP_WIDGET_POSX = 'Map-Widget-Position: X';
@ -53,7 +54,7 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
const SETTING_MAP_WIDGET_TIME_GOLD = 'Map-Widget-Time: Show Gold'; const SETTING_MAP_WIDGET_TIME_GOLD = 'Map-Widget-Time: Show Gold';
const SETTING_MAP_WIDGET_TIME_SILVER = 'Map-Widget-Time: Show Silver'; const SETTING_MAP_WIDGET_TIME_SILVER = 'Map-Widget-Time: Show Silver';
const SETTING_MAP_WIDGET_TIME_BRONZE = 'Map-Widget-Time: Show Bronze'; const SETTING_MAP_WIDGET_TIME_BRONZE = 'Map-Widget-Time: Show Bronze';
const SETTING_DISPLAY_MX_LOGO = 'Map-Widget Display ManiaExchange logo if available'; const SETTING_MAP_WIDGET_DISPLAY_MX_LOGO = 'Map-Widget Display ManiaExchange logo if available';
// ClockWidget Properties // ClockWidget Properties
const MLID_CLOCK_WIDGET = 'WidgetPlugin.ClockWidget'; const MLID_CLOCK_WIDGET = 'WidgetPlugin.ClockWidget';
@ -147,6 +148,8 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
$this->maniaControl->getCallbackManager()->registerCallbackListener(SettingManager::CB_SETTING_CHANGED, $this, 'updateSettings'); $this->maniaControl->getCallbackManager()->registerCallbackListener(SettingManager::CB_SETTING_CHANGED, $this, 'updateSettings');
// Settings // Settings
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_USE_SERVER_DEFAULT_LABEL_STYLE, false, "", 50);
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MAP_WIDGET_ACTIVATED, true); $this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MAP_WIDGET_ACTIVATED, true);
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MAP_WIDGET_NICKNAME, true); $this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MAP_WIDGET_NICKNAME, true);
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MAP_WIDGET_POSX, 160 - 20); $this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MAP_WIDGET_POSX, 160 - 20);
@ -157,7 +160,7 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MAP_WIDGET_TIME_GOLD, false); $this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MAP_WIDGET_TIME_GOLD, false);
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MAP_WIDGET_TIME_SILVER, false); $this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MAP_WIDGET_TIME_SILVER, false);
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MAP_WIDGET_TIME_BRONZE, false); $this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MAP_WIDGET_TIME_BRONZE, false);
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_DISPLAY_MX_LOGO, true); $this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_MAP_WIDGET_DISPLAY_MX_LOGO, true);
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_SERVERINFO_WIDGET_ACTIVATED, true); $this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_SERVERINFO_WIDGET_ACTIVATED, true);
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_SERVERINFO_WIDGET_POSX, -160 + 17.5); $this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_SERVERINFO_WIDGET_POSX, -160 + 17.5);
@ -245,10 +248,15 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
$posY = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MAP_WIDGET_POSY); $posY = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MAP_WIDGET_POSY);
$width = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MAP_WIDGET_WIDTH); $width = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MAP_WIDGET_WIDTH);
$height = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MAP_WIDGET_HEIGHT); $height = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MAP_WIDGET_HEIGHT);
$labelStyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultLabelStyle();
$quadStyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadStyle(); $quadStyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadStyle();
$quadSubstyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadSubstyle(); $quadSubstyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadSubstyle();
if ($this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_USE_SERVER_DEFAULT_LABEL_STYLE)) {
$labelStyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultLabelStyle();
} else {
$labelStyle = "";
}
$maniaLink = new ManiaLink(self::MLID_MAP_WIDGET); $maniaLink = new ManiaLink(self::MLID_MAP_WIDGET);
$script = new Script(); $script = new Script();
$maniaLink->setScript($script); $maniaLink->setScript($script);
@ -335,7 +343,7 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
$label->setTextSize(1); $label->setTextSize(1);
} }
if (isset($map->mx->pageurl) && $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_DISPLAY_MX_LOGO)) { if (isset($map->mx->pageurl) && $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_MAP_WIDGET_DISPLAY_MX_LOGO)) {
$quad = new Quad(); $quad = new Quad();
$frame->addChild($quad); $frame->addChild($quad);
$quad->setImageFocusUrl($this->maniaControl->getManialinkManager()->getIconManager()->getIcon(IconManager::MX_ICON_MOVER)); $quad->setImageFocusUrl($this->maniaControl->getManialinkManager()->getIconManager()->getIcon(IconManager::MX_ICON_MOVER));
@ -359,10 +367,15 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
$posY = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_CLOCK_WIDGET_POSY); $posY = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_CLOCK_WIDGET_POSY);
$width = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_CLOCK_WIDGET_WIDTH); $width = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_CLOCK_WIDGET_WIDTH);
$height = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_CLOCK_WIDGET_HEIGHT); $height = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_CLOCK_WIDGET_HEIGHT);
$labelStyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultLabelStyle();
$quadStyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadStyle(); $quadStyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadStyle();
$quadSubstyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadSubstyle(); $quadSubstyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadSubstyle();
if ($this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_USE_SERVER_DEFAULT_LABEL_STYLE)) {
$labelStyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultLabelStyle();
} else {
$labelStyle = "";
}
$maniaLink = new ManiaLink(self::MLID_CLOCK_WIDGET); $maniaLink = new ManiaLink(self::MLID_CLOCK_WIDGET);
// mainframe // mainframe
@ -401,10 +414,15 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
$posY = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_SERVERINFO_WIDGET_POSY); $posY = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_SERVERINFO_WIDGET_POSY);
$width = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_SERVERINFO_WIDGET_WIDTH); $width = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_SERVERINFO_WIDGET_WIDTH);
$height = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_SERVERINFO_WIDGET_HEIGHT); $height = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_SERVERINFO_WIDGET_HEIGHT);
$labelStyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultLabelStyle();
$quadStyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadStyle(); $quadStyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadStyle();
$quadSubstyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadSubstyle(); $quadSubstyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadSubstyle();
if ($this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_USE_SERVER_DEFAULT_LABEL_STYLE)) {
$labelStyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultLabelStyle();
} else {
$labelStyle = "";
}
$maniaLink = new ManiaLink(self::MLID_SERVERINFO_WIDGET); $maniaLink = new ManiaLink(self::MLID_SERVERINFO_WIDGET);
// mainframe // mainframe
@ -548,7 +566,12 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
$height = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_NEXTMAP_WIDGET_HEIGHT); $height = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_NEXTMAP_WIDGET_HEIGHT);
$quadStyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadStyle(); $quadStyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadStyle();
$quadSubstyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadSubstyle(); $quadSubstyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultQuadSubstyle();
if ($this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_USE_SERVER_DEFAULT_LABEL_STYLE)) {
$labelStyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultLabelStyle(); $labelStyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultLabelStyle();
} else {
$labelStyle = "";
}
$maniaLink = new ManiaLink(self::MLID_NEXTMAP_WIDGET); $maniaLink = new ManiaLink(self::MLID_NEXTMAP_WIDGET);