updated manialink code for FML 1.1

This commit is contained in:
Steffen Schröder 2014-04-27 16:22:12 +02:00
parent 332f8d76fb
commit 483d673e5f
26 changed files with 222 additions and 137 deletions

View File

@ -226,7 +226,7 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
$backgroundQuad->setStyles($quadStyle, $quadSubstyle);
$backgroundQuad->setSize(count($this->adminMenuItems) * $itemSize * 1.15 + 2, $itemSize * $itemMarginFactorY);
$script->addToggle($itemQuad, $popoutFrame);
$itemQuad->addToggleFeature($popoutFrame);
// Add items
$x = -1;
@ -245,7 +245,7 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
if($menuItem[1]) {
$description = '$s' . $menuItem[1];
$script->addTooltip($menuQuad, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => $description));
$menuQuad->addTooltipLabelFeature($descriptionLabel, $description);
}
}
}
@ -294,7 +294,7 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
$backgroundQuad->setHAlign(Control::RIGHT);
$backgroundQuad->setStyles($quadStyle, $quadSubstyle);
$backgroundQuad->setSize(count($this->playerMenuItems) * $itemSize * 1.15 + 2, $itemSize * $itemMarginFactorY);
$script->addToggle($itemQuad, $popoutFrame);
$itemQuad->addToggleFeature($popoutFrame);
// Add items
$x = -1;
@ -313,7 +313,7 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
if($menuItem[1]) {
$description = '$s' . $menuItem[1];
$script->addTooltip($menuQuad, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => $description));
$menuQuad->addTooltipLabelFeature($descriptionLabel, $description);
}
}
}

View File

@ -10,7 +10,7 @@ use FML\Controls\Quads\Quad_BgRaceScore2;
use FML\Controls\Quads\Quad_BgsPlayerCard;
use FML\Controls\Quads\Quad_UIConstruction_Buttons;
use FML\ManiaLink;
use FML\Script\Script;
use FML\Script\Features\Paging;
use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\ManiaControl;
@ -90,6 +90,8 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener {
//Create ManiaLink
$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID);
$script = $maniaLink->getScript();
$paging = new Paging();
$script->addFeature($paging);
// Main frame
$frame = $this->maniaControl->manialinkManager->styleManager->getDefaultListFrame($script, $pagesId);
@ -122,7 +124,7 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener {
}
array_push($pageFrames, $pageFrame);
$y = $height / 2 - 10;
$script->addPage($pageFrame, count($pageFrames), $pagesId);
$paging->addPage($pageFrame);
}
@ -155,8 +157,9 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener {
$rightLabel->setX($x + 13.9);
$rightLabel->setTextSize(0.8);
$rightLabel->setZ(10);
$rightLabel->setText($this->maniaControl->authenticationManager->getAuthLevelAbbreviation($admin->authLevel));
$script->addTooltip($rightLabel, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => $this->maniaControl->authenticationManager->getAuthLevelName($admin->authLevel) . " " . $admin->nickname));
$rightLabel->setText($this->maniaControl->authenticationManager->getAuthLevelAbbreviation($admin));
$description = $this->maniaControl->authenticationManager->getAuthLevelName($admin) . " " . $admin->nickname;
$rightLabel->addTooltipLabelFeature($descriptionLabel, $description);
//Revoke Button
if ($admin->authLevel > 0 && $this->maniaControl->authenticationManager->checkRight($player, $admin->authLevel + 1)) {

View File

@ -230,10 +230,15 @@ class AuthenticationManager implements CallbackListener {
/**
* Get Name of the Authentication Level from Level Int
*
* @param int $authLevelInt
* @param mixed $authLevelInt
* @return string
*/
public static function getAuthLevelName($authLevelInt) {
if ($authLevelInt instanceof Player) {
$authLevelInt = $authLevelInt->authLevel;
} else {
$authLevelInt = (int) $authLevelInt;
}
if ($authLevelInt == self::AUTH_LEVEL_MASTERADMIN) {
return 'MasterAdmin';
}
@ -252,10 +257,15 @@ class AuthenticationManager implements CallbackListener {
/**
* Get the Abbreviation of the Authentication Level from Level Int
*
* @param int $authLevelInt
* @param mixed $authLevelInt
* @return string
*/
public static function getAuthLevelAbbreviation($authLevelInt) {
if ($authLevelInt instanceof Player) {
$authLevelInt = $authLevelInt->authLevel;
} else {
$authLevelInt = (int) $authLevelInt;
}
if ($authLevelInt == self::AUTH_LEVEL_MASTERADMIN) {
return 'MA';
}

View File

@ -10,7 +10,7 @@ use FML\Controls\Quads\Quad_BgRaceScore2;
use FML\Controls\Quads\Quad_Icons64x64_1;
use FML\Controls\Quads\Quad_UIConstruction_Buttons;
use FML\ManiaLink;
use FML\Script\Script;
use FML\Script\Features\Menu;
use ManiaControl\Admin\AuthenticationManager;
use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager;
@ -285,8 +285,9 @@ class Configurator implements CallbackListener, CommandListener, ManialinkPageAn
$menusFrame->setX($menuWidth * -0.5 + $menuListWidth + $subMenuWidth * 0.5);
// Create script and features
$script = new Script();
$manialink->setScript($script);
$script = $manialink->getScript();
$menuScript = new Menu();
$script->addFeature($menuScript);
$menuItemY = $menuHeight * 0.42;
$menuId = 0;
@ -306,7 +307,7 @@ class Configurator implements CallbackListener, CommandListener, ManialinkPageAn
if ($menuId == $menuIdShown) {
$menuControl = $menu->getMenu($subMenuWidth, $subMenuHeight, $script);
$menusFrame->add($menuControl);
$script->addMenu($menuItemLabel, $menuControl);
$menuScript->addElement($menuItemLabel, $menuControl);
}
$menuItemY -= $menuItemHeight * 1.1;

View File

@ -8,6 +8,7 @@ use FML\Controls\Frame;
use FML\Controls\Label;
use FML\Controls\Labels\Label_Text;
use FML\Controls\Quads\Quad_Icons64x64_1;
use FML\Script\Features\Paging;
use FML\Script\Script;
use ManiaControl\Admin\AuthenticationManager;
use ManiaControl\Callbacks\CallbackListener;
@ -67,7 +68,8 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
* @return \FML\Controls\Frame
*/
public function getMenu($width, $height, Script $script) {
$pagesId = 'ManiaControlSettingsPages';
$paging = new Paging();
$script->addFeature($paging);
$frame = new Frame();
// Config
@ -89,8 +91,8 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
$pagerNext->setSize($pagerSize, $pagerSize);
$pagerNext->setSubStyle(Quad_Icons64x64_1::SUBSTYLE_ArrowNext);
$script->addPager($pagerPrev, -1, $pagesId);
$script->addPager($pagerNext, 1, $pagesId);
$paging->addButton($pagerNext);
$paging->addButton($pagerPrev);
$pageCountLabel = new Label();
$frame->add($pageCountLabel);
@ -99,8 +101,7 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
$pageCountLabel->setStyle('TextTitle1');
$pageCountLabel->setTextSize(2);
$script->addPageLabel($pageCountLabel, $pagesId);
$paging->setLabel($pageCountLabel);
/** @var ManiaControl/SettingManager $this->maniaControl->settingManager */
$settings = $this->maniaControl->settingManager->getSettings();
@ -125,7 +126,7 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
}
array_push($pageFrames, $pageFrame);
$y = $height * 0.41;
$script->addPage($pageFrame, count($pageFrames), $pagesId);
$paging->addPage($pageFrame);
}
$settingFrame = new Frame();
@ -155,7 +156,7 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
}
array_push($pageFrames, $pageFrame);
$y = $height * 0.41;
$script->addPage($pageFrame, count($pageFrames), $pagesId);
$paging->addPage($pageFrame);
}
$index++;

View File

@ -8,6 +8,7 @@ use FML\Controls\Frame;
use FML\Controls\Label;
use FML\Controls\Labels\Label_Text;
use FML\Controls\Quads\Quad_Icons64x64_1;
use FML\Script\Features\Paging;
use FML\Script\Script;
use ManiaControl\Admin\AuthenticationManager;
use ManiaControl\Callbacks\CallbackListener;
@ -164,7 +165,8 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
* @see \ManiaControl\Configurators\ConfiguratorMenu::getMenu()
*/
public function getMenu($width, $height, Script $script) {
$pagesId = 'ScriptSettingsPages';
$paging = new Paging();
$script->addFeature($paging);
$frame = new Frame();
try {
@ -203,8 +205,8 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
$pagerNext->setSize($pagerSize, $pagerSize);
$pagerNext->setSubStyle(Quad_Icons64x64_1::SUBSTYLE_ArrowNext);
$script->addPager($pagerPrev, -1, $pagesId);
$script->addPager($pagerNext, 1, $pagesId);
$paging->addButton($pagerNext);
$paging->addButton($pagerPrev);
$pageCountLabel = new Label();
$frame->add($pageCountLabel);
@ -213,7 +215,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
$pageCountLabel->setStyle('TextTitle1');
$pageCountLabel->setTextSize(2);
$script->addPageLabel($pageCountLabel, $pagesId);
$paging->setLabel($pageCountLabel);
// Setting pages
$pageFrames = array();
@ -234,7 +236,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
}
array_push($pageFrames, $pageFrame);
$y = $height * 0.41;
$script->addPage($pageFrame, count($pageFrames), $pagesId);
$paging->addPage($pageFrame);
}
$settingFrame = new Frame();
@ -288,7 +290,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
$descriptionLabel->setTextSize($labelTextSize);
$descriptionLabel->setTranslate(true);
$descriptionLabel->setText($scriptParam->desc);
$script->addTooltip($nameLabel, $descriptionLabel);
$nameLabel->addTooltipFeature($descriptionLabel);
$y -= $settingHeight;
if ($index % $pageMaxCount == $pageMaxCount - 1) {

View File

@ -8,6 +8,7 @@ use FML\Controls\Frame;
use FML\Controls\Label;
use FML\Controls\Labels\Label_Text;
use FML\Controls\Quads\Quad_Icons64x64_1;
use FML\Script\Features\Paging;
use FML\Script\Script;
use ManiaControl\Admin\AuthenticationManager;
use ManiaControl\Callbacks\CallbackListener;
@ -137,7 +138,8 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
* @see \ManiaControl\Configurators\ConfiguratorMenu::getMenu()
*/
public function getMenu($width, $height, Script $script) {
$pagesId = 'ServerSettingsPages';
$paging = new Paging();
$script->addFeature($paging);
$frame = new Frame();
$serverSettings = $this->maniaControl->client->getServerOptions()->toArray();
@ -161,8 +163,8 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
$pagerNext->setSize($pagerSize, $pagerSize);
$pagerNext->setSubStyle(Quad_Icons64x64_1::SUBSTYLE_ArrowNext);
$script->addPager($pagerPrev, -1, $pagesId);
$script->addPager($pagerNext, 1, $pagesId);
$paging->addButton($pagerNext);
$paging->addButton($pagerPrev);
$pageCountLabel = new Label();
$frame->add($pageCountLabel);
@ -171,7 +173,7 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
$pageCountLabel->setStyle('TextTitle1');
$pageCountLabel->setTextSize(2);
$script->addPageLabel($pageCountLabel, $pagesId);
$paging->setLabel($pageCountLabel);
// Setting pages
$pageFrames = array();
@ -192,7 +194,7 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
}
array_push($pageFrames, $pageFrame);
$y = $height * 0.41;
$script->addPage($pageFrame, count($pageFrames), $pagesId);
$paging->addPage($pageFrame);
}
$settingFrame = new Frame();

View File

@ -13,7 +13,7 @@ use FML\Controls\Quad;
use FML\Controls\Quads\Quad_BgsPlayerCard;
use FML\Controls\Quads\Quad_Icons64x64_1;
use FML\ManiaLink;
use FML\Script\Script;
use FML\Script\Features\Paging;
use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\ColorUtil;
@ -130,6 +130,8 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener
//Create ManiaLink
$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID);
$script = $maniaLink->getScript();
$paging = new Paging();
$script->addFeature($paging);
$pagesId = 'MxListPages';
@ -161,7 +163,8 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener
}
array_push($pageFrames, $pageFrame);
$y = $height / 2 - 16;
$script->addPage($pageFrame, count($pageFrames), $pagesId);
$paging->addPage($pageFrame);
}
// Map Frame
@ -194,7 +197,8 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener
$mxQuad->setX($x + 56);
$mxQuad->setUrl($map->pageurl);
$mxQuad->setZ(0.01);
$script->addTooltip($mxQuad, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => "View " . $map->name . " on Mania-Exchange"));
$description = 'View $<' . $map->name . '$> on Mania-Exchange';
$mxQuad->addTooltipLabelFeature($descriptionLabel, $description);
if ($this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP)) {
$addQuad = new Quad_Icons64x64_1();
@ -206,7 +210,8 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener
$addQuad->setAction(self::ACTION_ADD_MAP . '.' . $map->id);
$addQuad->setZ(0.01);
$script->addTooltip($addQuad, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => 'Add-Map: $<' . $map->name . '$>'));
$description = 'Add-Map: $<' . $map->name . '$>';
$addQuad->addTooltipLabelFeature($descriptionLabel, $description);
}
//Award Quad

View File

@ -261,7 +261,6 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener
$textSize = (isset($properties['textSize']) ? $properties['textSize'] : 1.5);
$textColor = (isset($properties['textColor']) ? $properties['textColor'] : 'FFF');
$profile = (isset($properties['profile']) ? $properties['profile'] : false);
$script = (isset($properties['script']) ? $properties['script'] : null);
$labels = array();
foreach($labelStrings as $text => $x) {
@ -275,7 +274,7 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener
$label->setTextColor($textColor);
if ($profile) {
$script->addProfileButton($label, $profile);
$label->addPlayerProfileFeature($profile);
}
$labels[] = $label; // add Label to the labels array

View File

@ -9,6 +9,7 @@ use FML\Controls\Labels\Label_Text;
use FML\Controls\Quad;
use FML\Controls\Quads\Quad_BgRaceScore2;
use FML\Controls\Quads\Quad_Icons64x64_1;
use FML\Script\Features\Paging;
use FML\Script\Script;
use ManiaControl\ManiaControl;
@ -159,6 +160,11 @@ class StyleManager {
* @return Frame $frame
*/
public function getDefaultListFrame(Script $script = null, $pagesId = '') {
$paging = null;
if ($script) {
$paging = new Paging();
$script->addFeature($paging);
}
$width = $this->getListWidgetsWidth();
$height = $this->getListWidgetsHeight();
$quadStyle = $this->getDefaultMainWindowStyle();
@ -197,8 +203,10 @@ class StyleManager {
$pagerNext->setSize($pagerSize, $pagerSize);
$pagerNext->setSubStyle(Quad_Icons64x64_1::SUBSTYLE_ArrowNext);
$script->addPager($pagerPrev, -1, $pagesId);
$script->addPager($pagerNext, 1, $pagesId);
if ($paging) {
$paging->addButton($pagerNext);
$paging->addButton($pagerPrev);
}
$pageCountLabel = new Label_Text();
$frame->add($pageCountLabel);
@ -206,7 +214,9 @@ class StyleManager {
$pageCountLabel->setPosition($width * 0.40, $height * -0.44, 1);
$pageCountLabel->setStyle($pageCountLabel::STYLE_TextTitle1);
$pageCountLabel->setTextSize(1.3);
$script->addPageLabel($pageCountLabel, $pagesId);
if ($paging) {
$paging->setLabel($pageCountLabel);
}
}
return $frame;

View File

@ -13,8 +13,7 @@ use FML\Controls\Quad;
use FML\Controls\Quads\Quad_BgsPlayerCard;
use FML\Controls\Quads\Quad_Icons64x64_1;
use FML\ManiaLink;
use FML\Script\Script;
use KarmaPlugin;
use FML\Script\Features\Paging;
use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\ColorUtil;
@ -25,6 +24,7 @@ use ManiaControl\Manialinks\ManialinkManager;
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
use ManiaControl\Players\Player;
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
use MCTeam\KarmaPlugin;
/**
* MapList Widget Class
@ -135,6 +135,8 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
//Create ManiaLink
$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID);
$script = $maniaLink->getScript();
$paging = new Paging();
$script->addFeature($paging);
// Main frame
$frame = $this->maniaControl->manialinkManager->styleManager->getDefaultListFrame($script, $pagesId);
@ -225,7 +227,8 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
}
array_push($pageFrames, $pageFrame);
$y = $height / 2 - 10;
$script->addPage($pageFrame, count($pageFrames), $pagesId);
$paging->addPage($pageFrame);
}
// Map Frame
@ -263,7 +266,8 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$mxQuad->setX($x + 65);
$mxQuad->setUrl($map->mx->pageurl);
$mxQuad->setZ(0.01);
$script->addTooltip($mxQuad, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => "View $<" . $map->name . "$> on Mania-Exchange"));
$description = 'View $<' . $map->name . '$> on Mania-Exchange';
$mxQuad->addTooltipLabelFeature($descriptionLabel, $description);
if ($map->updateAvailable()) {
$mxQuad = new Quad();
@ -274,7 +278,8 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$mxQuad->setX($x + 62);
$mxQuad->setUrl($map->mx->pageurl);
$mxQuad->setZ(0.01);
$script->addTooltip($mxQuad, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => "Update of $<" . $map->name . "$> available on Mania-Exchange"));
$description = 'Update for $<' . $map->name . '$> available on Mania-Exchange!';
$mxQuad->addTooltipLabelFeature($descriptionLabel, $description);
//Update Button
if ($this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP)) {
@ -288,7 +293,10 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$array = array($id => $x + 5, $mxId => $x + 10, Formatter::stripDirtyCodes($map->name) => $x + 20, $map->authorNick => $x + 68);
$labels = $this->maniaControl->manialinkManager->labelLine($mapFrame, $array);
if (isset($labels[3])) {
$script->addTooltip($labels[3], $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => '$<' . $map->name . '$> made by $<' . $map->authorLogin . '$>'));
/** @var Label $label */
$label = $labels[3];
$description = '$<' . $map->name . '$> made by $<' . $map->authorLogin . '$>';
$label->addTooltipLabelFeature($descriptionLabel, $description);
}
// TODO action detailed map info including mx info
@ -307,10 +315,12 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
//Checks if the Player who openend the Widget has queued the map
$queuer = $this->maniaControl->mapManager->mapQueue->getQueuer($map->uid);
if ($queuer->login == $player->login) {
$script->addTooltip($label, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => 'Remove $<' . $map->name . '$> from the Map Queue'));
$description = 'Remove $<' . $map->name . '$> from the Map Queue';
$label->addTooltipLabelFeature($descriptionLabel, $description);
$label->setAction(self::ACTION_UNQUEUE_MAP . '.' . $map->uid);
} else {
$script->addTooltip($label, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => '$<' . $map->name . '$> is on Map-Queue Position: ' . $queuedMaps[$map->uid]));
$description = '$<' . $map->name . '$> is on Map-Queue Position: ' . $queuedMaps[$map->uid];
$label->addTooltipLabelFeature($descriptionLabel, $description);
}
} else {
@ -324,7 +334,8 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$queueLabel->setText('+');
$queueLabel->setTextColor('09f');
$script->addTooltip($queueLabel, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => 'Add $<' . $map->name . '$> to the Map Queue'));
$description = 'Add $<' . $map->name . '$> to the Map Queue';
$queueLabel->addTooltipLabelFeature($descriptionLabel, $description);
}
if ($this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_REMOVE_MAP)) {
@ -339,11 +350,11 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$eraseLabel->setTextColor('a00');
$confirmFrame = $this->buildConfirmFrame($maniaLink, $y, $id, $map->uid);
$script->addToggle($eraseLabel, $confirmFrame);
$script->addTooltip($eraseLabel, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => 'Remove Map: $<' . $map->name . '$>'));
$eraseLabel->addToggleFeature($confirmFrame);
$description = 'Remove Map: $<' . $map->name . '$>';
$eraseLabel->addToggleFeature($descriptionLabel, $description);
}
if ($this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP)) {
// Switch to map
$switchLabel = new Label_Button();
@ -356,9 +367,11 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$switchLabel->setTextColor('0f0');
$confirmFrame = $this->buildConfirmFrame($maniaLink, $y, $id);
$script->addToggle($switchLabel, $confirmFrame);
$switchLabel->addToggleFeature($confirmFrame);
$description = 'Switch Directly to Map: $<' . $map->name . '$>';
$switchLabel->addTooltipLabelFeature($descriptionLabel, $description);
$script->addTooltip($switchLabel, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => 'Switch Directly to Map: $<' . $map->name . '$>'));
} else if ($this->maniaControl->pluginManager->isPluginActive(self::DEFAULT_CUSTOM_VOTE_PLUGIN)) {
//Switch Map Voting
$switchLabel = new Label_Button();
@ -372,7 +385,8 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$switchLabel->setAction(self::ACTION_START_SWITCH_VOTE . '.' . ($id - 1));
$script->addTooltip($switchLabel, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => 'Start Map-Switch vote: $<' . $map->name . '$>'));
$description = 'Start Map-Switch Vote: $<' . $map->name . '$>';
$switchLabel->addTooltipLabelFeature($descriptionLabel, $description);
}
// Display Karma bar

View File

@ -14,7 +14,7 @@ use FML\Controls\Quads\Quad_Emblems;
use FML\Controls\Quads\Quad_Icons64x64_1;
use FML\Controls\Quads\Quad_UIConstruction_Buttons;
use FML\ManiaLink;
use FML\Script\Script;
use FML\Script\Features\Paging;
use ManiaControl\Admin\AuthenticationManager;
use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager;
@ -115,6 +115,8 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
//create manialink
$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID);
$script = $maniaLink->getScript();
$paging = new Paging();
$script->addFeature($paging);
// Main frame
$frame = $this->maniaControl->manialinkManager->styleManager->getDefaultListFrame($script, $pagesId);
@ -152,7 +154,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
}
array_push($pageFrames, $pageFrame);
$y = $height / 2 - 10;
$script->addPage($pageFrame, count($pageFrames), $pagesId);
$paging->addPage($pageFrame);
}
$path = $listPlayer->getProvince();
@ -219,7 +221,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
$countryQuad->setSize(4, 4);
$countryQuad->setZ(1);
$script->addTooltip($countryQuad, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => "$<" . $listPlayer->nickname . "$> from " . $listPlayer->path));
$countryQuad->addTooltipLabelFeature($descriptionLabel, '$<' . $listPlayer->nickname . '$> from ' . $listPlayer->path);
}
// Level Quad
@ -238,7 +240,8 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
$rightLabel->setText($this->maniaControl->authenticationManager->getAuthLevelAbbreviation($listPlayer->authLevel));
$rightLabel->setTextColor("fff");
$script->addTooltip($rightLabel, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => $this->maniaControl->authenticationManager->getAuthLevelName($listPlayer->authLevel) . " " . $listPlayer->nickname));
$description = $this->maniaControl->authenticationManager->getAuthLevelName($listPlayer) . " " . $listPlayer->nickname;
$rightLabel->addTooltipLabelFeature($descriptionLabel, $description);
// Player Statistics
$playerQuad = new Quad_Icons64x64_1();
@ -248,7 +251,8 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
$playerQuad->setSubStyle($playerQuad::SUBSTYLE_TrackInfo);
$playerQuad->setSize(2.7, 2.7);
$playerQuad->setAction(self::ACTION_OPEN_PLAYER_DETAILED . "." . $listPlayer->login);
$script->addTooltip($playerQuad, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => "View Statistics of " . $listPlayer->nickname));
$description = 'View Statistics of $<'.$listPlayer->nickname. '$>';
$playerQuad->addTooltipLabelFeature($descriptionLabel, $description);
// Camera Quad
$playerQuad = new Quad_UIConstruction_Buttons();
@ -257,7 +261,8 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
$playerQuad->setZ(3);
$playerQuad->setSubStyle($playerQuad::SUBSTYLE_Camera);
$playerQuad->setSize(3.8, 3.8);
$script->addTooltip($playerQuad, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => "Spectate " . $listPlayer->nickname));
$description = 'Spectate $<'.$listPlayer->nickname.'$>';
$playerQuad->addTooltipLabelFeature($descriptionLabel, $description);
$playerQuad->setAction(self::ACTION_SPECTATE_PLAYER . "." . $listPlayer->login);
// Player Profile Quad
@ -267,10 +272,11 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
$playerQuad->setZ(3);
$playerQuad->setSubStyle($playerQuad::SUBSTYLE_Author);
$playerQuad->setSize(3.8, 3.8);
$script->addProfileButton($playerQuad, $listPlayer->login);
$playerQuad->addPlayerProfileFeature($listPlayer->login);
// Description Label
$script->addTooltip($playerQuad, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => "View Player profile of " . $listPlayer->nickname));
$description = 'View Player Profile of $<' . $listPlayer->nickname.'$>';
$playerQuad->addTooltipLabelFeature($descriptionLabel, $description);
if ($this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_MODERATOR)) {
// Further Player actions Quad
@ -283,7 +289,8 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
$playerQuad->setAction(self::ACTION_PLAYER_ADV . "." . $listPlayer->login);
// Description Label
$script->addTooltip($playerQuad, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => "Advanced Player Actions on " . $listPlayer->nickname));
$description = 'Advanced Player Actions for $<' . $listPlayer->nickname.'$>';
$playerQuad->addTooltipLabelFeature($descriptionLabel, $description);
}
if ($this->maniaControl->server->isTeamMode()) {
@ -298,7 +305,8 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
$redQuad->setAction(self::ACTION_FORCE_RED . "." . $listPlayer->login);
// Force to Red-Team Description Label
$script->addTooltip($redQuad, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => "Force $<" . $listPlayer->nickname . '$> to Red Team!'));
$description = 'Force $<' . $listPlayer->nickname . '$> to Red Team!';
$redQuad->addTooltipLabelFeature($descriptionLabel, $description);
// Force to Blue-Team Quad
$blueQuad = new Quad_Emblems();
@ -310,7 +318,8 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
$blueQuad->setAction(self::ACTION_FORCE_BLUE . "." . $listPlayer->login);
// Force to Blue-Team Description Label
$script->addTooltip($blueQuad, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => "Force $<" . $listPlayer->nickname . '$> to Blue Team!'));
$description = 'Force $<' . $listPlayer->nickname . '$> to Blue Team!';
$blueQuad->addTooltipLabelFeature($descriptionLabel, $description);
} else if ($this->maniaControl->pluginManager->isPluginActive(self::DEFAULT_CUSTOM_VOTE_PLUGIN)) {
// Kick Player Vote
@ -322,8 +331,8 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
$kickQuad->setSize(3.8, 3.8);
$kickQuad->setAction(self::ACTION_KICK_PLAYER_VOTE . "." . $listPlayer->login);
// Force to Spectator Description Label
$script->addTooltip($kickQuad, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => "Vote a kick vote on $<" . $listPlayer->nickname . '$>!'));
$description = 'Start a Kick Vote on $<' . $listPlayer->nickname . '$>!';
$kickQuad->addTooltipLabelFeature($descriptionLabel, $description);
}
} else {
if ($this->maniaControl->authenticationManager->checkPermission($player, PlayerActions::SETTING_PERMISSION_FORCE_PLAYER_PLAY)) {
@ -336,8 +345,8 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
$playQuad->setSize(3.8, 3.8);
$playQuad->setAction(self::ACTION_FORCE_PLAY . "." . $listPlayer->login);
// Force to Blue-Team Description Label
$script->addTooltip($playQuad, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => "Force " . $listPlayer->nickname . '$z to Play!'));
$description = 'Force $<' . $listPlayer->nickname . '$> to Play!';
$playQuad->addTooltipLabelFeature($descriptionLabel, $description);
}
}
@ -352,7 +361,8 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
$spectatorQuad->setAction(self::ACTION_FORCE_SPEC . "." . $listPlayer->login);
// Force to Spectator Description Label
$script->addTooltip($spectatorQuad, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => "Force " . $listPlayer->nickname . '$z to Spectator!'));
$description = 'Force $<' . $listPlayer->nickname . '$> to Spectator!';
$spectatorQuad->addTooltipLabelFeature($descriptionLabel, $description);
} else if ($this->maniaControl->pluginManager->isPluginActive(self::DEFAULT_CUSTOM_VOTE_PLUGIN)) {
// Force to Spectator Quad
$spectatorQuad = new Quad_BgRaceScore2();
@ -364,7 +374,8 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
$spectatorQuad->setAction(self::ACTION_FORCE_SPEC_VOTE . "." . $listPlayer->login);
// Force to Spectator Description Label
$script->addTooltip($spectatorQuad, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => "Vote for force " . $listPlayer->nickname . '$z to Spectator!'));
$description = 'Start a Vote to force $<' . $listPlayer->nickname . '$> to Spectator!';
$spectatorQuad->addTooltipLabelFeature($descriptionLabel, $description);
}
$y -= 4;

View File

@ -11,6 +11,7 @@ use FML\Controls\Labels\Label_Text;
use FML\Controls\Quads\Quad_Icons128x32_1;
use FML\Controls\Quads\Quad_Icons128x128_1;
use FML\Controls\Quads\Quad_Icons64x64_1;
use FML\Script\Features\Paging;
use FML\Script\Script;
use ManiaControl\Admin\AuthenticationManager;
use ManiaControl\Callbacks\CallbackListener;
@ -81,7 +82,8 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
* @see \ManiaControl\Configurators\ConfiguratorMenu::getMenu()
*/
public function getMenu($width, $height, Script $script) {
$pagesId = 'PluginPages';
$paging = new Paging();
$script->addFeature($paging);
$frame = new Frame();
$pluginClasses = $this->maniaControl->pluginManager->getPluginClasses();
@ -105,8 +107,8 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
$pagerNext->setSize($pagerSize, $pagerSize);
$pagerNext->setSubStyle(Quad_Icons64x64_1::SUBSTYLE_ArrowNext);
$script->addPager($pagerPrev, -1, $pagesId);
$script->addPager($pagerNext, 1, $pagesId);
$paging->addButton($pagerNext);
$paging->addButton($pagerPrev);
$pageCountLabel = new Label_Text();
$frame->add($pageCountLabel);
@ -115,8 +117,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
$pageCountLabel->setStyle($pageCountLabel::STYLE_TextTitle1);
$pageCountLabel->setTextSize(2);
$script->addPageLabel($pageCountLabel, $pagesId);
$paging->setLabel($pageCountLabel);
//Show Settings Menu
if ($this->settingsClass != '') { //TODO improve
@ -136,7 +137,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
}
array_push($pageFrames, $pageFrame);
$y = $height * 0.41;
$script->addPage($pageFrame, count($pageFrames), $pagesId);
$paging->addPage($pageFrame);
}
$settingFrame = new Frame();
@ -165,11 +166,10 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
}
array_push($pageFrames, $pageFrame);
$y = $height * 0.41;
$script->addPage($pageFrame, count($pageFrames), $pagesId);
$paging->addPage($pageFrame);
}
}
$settingFrame = new Frame();
$pageFrame->add($settingFrame);
$settingFrame->setY($y);
@ -187,7 +187,6 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
$substyle = '';
$entry = new Entry();
$settingFrame->add($entry);
$entry->setStyle(Label_Text::STYLE_TextValueSmall);
@ -255,7 +254,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
}
array_push($pageFrames, $pageFrame);
$script->addPage($pageFrame, count($pageFrames), $pagesId);
$paging->addPage($pageFrame);
$y = $height * 0.41;
}
@ -296,7 +295,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu, ManialinkPageAns
$descriptionLabel->setMaxLines(5);
$description = "Author: {$pluginClass::getAuthor()}\nVersion: {$pluginClass::getVersion()}\nDesc: {$pluginClass::getDescription()}";
$descriptionLabel->setText($description);
$script->addTooltip($nameLabel, $descriptionLabel);
$nameLabel->addTooltipFeature($descriptionLabel);
$quad = new Quad_Icons128x32_1();
$pluginFrame->add($quad);

View File

@ -11,7 +11,6 @@ use FML\Controls\Quads\Quad_BgsPlayerCard;
use FML\Controls\Quads\Quad_Icons64x64_1;
use FML\Controls\Quads\Quad_UIConstruction_Buttons;
use FML\ManiaLink;
use FML\Script\Script;
use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\Commands\CommandListener;
@ -125,7 +124,6 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener,
$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID);
$script = $maniaLink->getScript();
$width = $this->statsWidth + 60;
//TODO handle size when stats are empty
@ -195,9 +193,11 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener,
break;
}
/** @var Label_Text $labels [] */
$labels[$i]->setAction(self::ACTION_SORT_STATS . '.' . $statArray["Name"]);
$script->addTooltip($labels[$i], $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => '$o ' . $statArray["Name"]));
/** @var Label_Text $label [] */
$label = $labels[$i];
$label->setAction(self::ACTION_SORT_STATS . '.' . $statArray["Name"]);
$label->addTooltipLabelFeature($descriptionLabel, '$o '.$statArray["Name"]);
$i++;
}
@ -262,7 +262,7 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener,
$label->setTextSize($textSize);
$label->setText($array['Value']);
$label->setTextColor($textColor);
$script->addTooltip($label, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => '$o ' . $key));
$label->addTooltipLabelFeature($descriptionLabel, '$o '.$key);
$x += $array['Width'];
}

View File

@ -8,6 +8,7 @@ use FML\Controls\Label;
use FML\Controls\Labels\Label_Button;
use FML\Controls\Labels\Label_Text;
use FML\Controls\Quads\Quad_Icons64x64_1;
use FML\Script\Features\Paging;
use FML\Script\Script;
use ManiaControl\Admin\AuthenticationManager;
use ManiaControl\Callbacks\CallbackListener;
@ -58,7 +59,10 @@ class PluginInstallMenu implements CallbackListener, ConfiguratorMenu, Manialink
* @return \FML\Controls\Frame
*/
public function getMenu($width, $height, Script $script) {
$pagesId = 'PluginInstallPages';
$paging = new Paging();
$script->addFeature($paging);
$paging = new Paging();
$script->addFeature($paging);
$frame = new Frame();
// Config
@ -82,8 +86,8 @@ class PluginInstallMenu implements CallbackListener, ConfiguratorMenu, Manialink
$pagerNext->setSize($pagerSize, $pagerSize);
$pagerNext->setSubStyle(Quad_Icons64x64_1::SUBSTYLE_ArrowNext);
$script->addPager($pagerPrev, -1, $pagesId);
$script->addPager($pagerNext, 1, $pagesId);
$paging->addButton($pagerNext);
$paging->addButton($pagerPrev);
$pageCountLabel = new Label_Text();
$frame->add($pageCountLabel);
@ -92,7 +96,7 @@ class PluginInstallMenu implements CallbackListener, ConfiguratorMenu, Manialink
$pageCountLabel->setStyle($pageCountLabel::STYLE_TextTitle1);
$pageCountLabel->setTextSize(2);
$script->addPageLabel($pageCountLabel, $pagesId);
$paging->setLabel($pageCountLabel);
$url = ManiaControl::URL_WEBSERVICE . 'plugins';
$dataJson = FileUtil::loadFile($url);
@ -116,7 +120,7 @@ class PluginInstallMenu implements CallbackListener, ConfiguratorMenu, Manialink
}
array_push($pageFrames, $pageFrame);
$script->addPage($pageFrame, count($pageFrames), $pagesId);
$paging->addPage($pageFrame);
$y = $height * 0.41;
}
@ -145,7 +149,7 @@ class PluginInstallMenu implements CallbackListener, ConfiguratorMenu, Manialink
$descriptionLabel->setMaxLines(5);
$description = "Author: {$plugin->author}\nVersion: {$plugin->currentVersion->version}\nDesc: {$plugin->description}";
$descriptionLabel->setText($description);
$script->addTooltip($nameLabel, $descriptionLabel);
$nameLabel->addTooltipFeature($descriptionLabel);
$installButton = new Label_Button();
$pluginFrame->add($installButton);

View File

@ -1,4 +1,7 @@
<?php
namespace MCTeam;
use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\Files\FileUtil;

View File

@ -12,7 +12,6 @@ use FML\Controls\Quads\Quad_Icons128x32_1;
use FML\Controls\Quads\Quad_Icons64x64_1;
use FML\Controls\Quads\Quad_UIConstruction_Buttons;
use FML\ManiaLink;
use FML\Script\Script;
use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\Callbacks\TimerListener;
@ -668,7 +667,6 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
$itemSize = $width;
$maniaLink = new ManiaLink(self::MLID_ICON);
$script = $maniaLink->getScript();
//Custom Vote Menu Iconsframe
$frame = new Frame();
@ -716,7 +714,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
$backgroundQuad->setStyles($quadStyle, $quadSubstyle);
$backgroundQuad->setSize($menuEntries * $itemSize * 1.15 + 2, $itemSize * $itemMarginFactorY);
$script->addToggle($itemQuad, $popoutFrame);
$itemQuad->addToggleFeature($popoutFrame);
// Add items
$x = -1;
@ -734,7 +732,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
if ($menuItem[1]) {
$description = '$s' . $menuItem[1];
$script->addTooltip($menuQuad, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => $description));
$menuQuad->addTooltipLabelFeature($descriptionLabel, $description);
}
}
}

View File

@ -7,6 +7,7 @@ use FML\Controls\Label;
use FML\Controls\Quad;
use FML\Controls\Quads\Quad_BgsPlayerCard;
use FML\ManiaLink;
use FML\Script\Features\Paging;
use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\Callbacks\TimerListener;
@ -502,6 +503,8 @@ class Dedimania implements CallbackListener, CommandListener, TimerListener, Plu
//create manialink
$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID);
$script = $maniaLink->getScript();
$paging = new Paging();
$script->addFeature($paging);
// Main frame
$frame = $this->maniaControl->manialinkManager->styleManager->getDefaultListFrame($script, $pagesId);
@ -534,7 +537,7 @@ class Dedimania implements CallbackListener, CommandListener, TimerListener, Plu
}
array_push($pageFrames, $pageFrame);
$y = $height / 2 - 10;
$script->addPage($pageFrame, count($pageFrames), $pagesId);
$paging->addPage($pageFrame);
}
$recordFrame = new Frame();

View File

@ -7,7 +7,6 @@ use FML\Controls\Labels\Label_Text;
use FML\Controls\Quad;
use FML\Controls\Quads\Quad_Icons128x128_1;
use FML\ManiaLink;
use FML\Script\Script;
use ManiaControl\Admin\AuthenticationManager;
use ManiaControl\Bills\BillManager;
use ManiaControl\Callbacks\CallbackListener;
@ -209,7 +208,6 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
$itemSize = $width;
$maniaLink = new ManiaLink(self::MLID_DONATE_WIDGET);
$script = $maniaLink->getScript();
// Donate Menu Icon Frame
$frame = new Frame();
@ -247,8 +245,7 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
$quad->setSize(strlen($values) * 2 + count($valueArray) * 1, $itemSize * $itemMarginFactorY);
$popoutFrame->add($quad);
$script->addToggle($itemQuad, $popoutFrame);
$itemQuad->addToggleFeature($popoutFrame);
// Description Label
$descriptionFrame = new Frame();
@ -275,7 +272,8 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
$label->setTextSize(1.2);
$label->setAction(self::ACTION_DONATE_VALUE . "." . $value);
$label->setStyle(Label_Text::STYLE_TextCardSmall);
$script->addTooltip($label, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => "Donate " . $value . " Planets"));
$description = "Donate {$value} Planets";
$label->addTooltipLabelFeature($descriptionLabel, $description);
$x -= strlen($value) * 2 + 1.7;
}

View File

@ -1,4 +1,7 @@
<?php
namespace steeffeen;
use ManiaControl\ManiaControl;
use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager;

View File

@ -1,4 +1,7 @@
<?php
namespace MCTeam;
use FML\Controls\Frame;
use FML\Controls\Gauge;
use FML\Controls\Label;
@ -209,7 +212,9 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
$this->buildManialink();
// Update karma gauge & label
/** @var Gauge $karmaGauge */
$karmaGauge = $this->manialink->karmaGauge;
/** @var Label $karmaLabel */
$karmaLabel = $this->manialink->karmaLabel;
if (is_numeric($karma) && $voteCount > 0) {
$karma = floatval($karma);
@ -228,10 +233,8 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
// Get player vote
// TODO: show the player his own vote in some way
//$vote = $this->getPlayerVote($player, $map);
// Adjust manialink for player's vote
$votesFrame = $this->manialink->votesFrame;
$votesFrame->removeChildren();
//$votesFrame = $this->manialink->votesFrame;
//$votesFrame->removeChildren();
// Send manialink
$this->maniaControl->manialinkManager->sendManialink($this->manialink, $login);

View File

@ -1,10 +1,14 @@
<?php
namespace MCTeam;
use FML\Controls\Control;
use FML\Controls\Frame;
use FML\Controls\Label;
use FML\Controls\Quad;
use FML\Controls\Quads\Quad_BgsPlayerCard;
use FML\ManiaLink;
use FML\Script\Features\Paging;
use ManiaControl\Admin\AuthenticationManager;
use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager;
@ -396,6 +400,8 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList
//create manialink
$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID);
$script = $maniaLink->getScript();
$paging = new Paging();
$script->addFeature($paging);
// Main frame
$frame = $this->maniaControl->manialinkManager->styleManager->getDefaultListFrame($script, $pagesId);
@ -428,7 +434,8 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList
}
array_push($pageFrames, $pageFrame);
$y = $height / 2 - 10;
$script->addPage($pageFrame, count($pageFrames), $pagesId);
$paging->addPage($pageFrame);
}
$recordFrame = new Frame();

View File

@ -1,4 +1,7 @@
<?php
namespace steeffeen;
use ManiaControl\ManiaControl;
use ManiaControl\Admin\AuthenticationManager;
use ManiaControl\Callbacks\CallbackListener;

View File

@ -210,7 +210,7 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener {
break;
case self::RANKING_TYPE_RECORDS: //TODO verify workable status
if (!$this->maniaControl->pluginManager->isPluginActive('LocalRecordsPlugin')) {
if (!$this->maniaControl->pluginManager->isPluginActive('\MCTeam\LocalRecordsPlugin')) {
return;
}
@ -218,7 +218,7 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener {
$maxRecords = $this->maniaControl->settingManager->getSetting($this, self::SETTING_MAX_STORED_RECORDS);
$query = 'SELECT playerIndex, COUNT(*) AS Cnt
FROM ' . LocalRecordsPlugin::TABLE_RECORDS . '
FROM ' . \MCTeam\LocalRecordsPlugin::TABLE_RECORDS . '
GROUP BY PlayerIndex
HAVING Cnt >=' . $requiredRecords;
@ -229,7 +229,7 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener {
}
$result->free_result();
/** @var LocalRecordsPlugin $localRecordsPlugin */
/** @var \MCTeam\LocalRecordsPlugin $localRecordsPlugin */
$localRecordsPlugin = $this->maniaControl->pluginManager->getPlugin('LocalRecordsPlugin');
$maps = $this->maniaControl->mapManager->getMaps();
foreach($maps as $map) {

View File

@ -293,44 +293,48 @@ class TeamSpeakPlugin implements CallbackListener, CommandListener, ManialinkPag
if ($channel['channel_maxclients'] == 0 || strpos($channel['channel_name'], 'spacer') > 0) {
continue;
}
$channels[$i] = new Label_Text();
$frame->add($channels[$i]);
$channelLabel = new Label_Text();
$frame->add($channelLabel);
$y = 17.5 + ($i * 2.5);
$channels[$i]->setY($height / 2 - $y);
$channelLabel->setY($height / 2 - $y);
$x = $startx;
if ($channel['pid'] != 0) {
$x = $startx + 5;
}
$channels[$i]->setX($x);
$channels[$i]->setStyle($channels[$i]::STYLE_TextCardMedium);
$channels[$i]->setHAlign('left');
$channels[$i]->setTextSize(1);
$channels[$i]->setScale(0.9);
$channelLabel->setX($x);
$channelLabel->setStyle($channels[$i]::STYLE_TextCardMedium);
$channelLabel->setHAlign('left');
$channelLabel->setTextSize(1);
$channelLabel->setScale(0.9);
if ($channel['channel_flag_default'] == 1) {
$channel['total_clients'] = ($channel['total_clients'] - 1);
} // remove query client
$channels[$i]->setText('$o' . $channel['channel_name'] . '$o (' . $channel['total_clients'] . ')');
$channels[$i]->setTextColor('fff');
$channelLabel->setText('$o' . $channel['channel_name'] . '$o (' . $channel['total_clients'] . ')');
$channelLabel->setTextColor('fff');
$channels[$i] = $channelLabel;
$i++;
foreach($this->serverData['users'] as $user) {
if ($user['cid'] == $channel['cid']) {
$users[$userid] = new Label_Text();
$frame->add($users[$userid]);
$userLabel = new Label_Text();
$frame->add($userLabel);
$y = 17.5 + ($i * 2.5);
$users[$userid]->setY($height / 2 - $y);
$userLabel->setY($height / 2 - $y);
if ($channel['pid'] != 0) {
$x = $startx + 7;
} else {
$x = $startx + 2;
}
$users[$userid]->setX($x);
$users[$userid]->setStyle($users[$userid]::STYLE_TextCardMedium);
$users[$userid]->setHAlign('left');
$users[$userid]->setTextSize(1);
$users[$userid]->setScale(0.9);
$users[$userid]->setText($user['client_nickname']);
$users[$userid]->setTextColor('fff');
$userLabel->setX($x);
$userLabel->setStyle($userLabel::STYLE_TextCardMedium);
$userLabel->setHAlign('left');
$userLabel->setTextSize(1);
$userLabel->setScale(0.9);
$userLabel->setText($user['client_nickname']);
$userLabel->setTextColor('fff');
$users[$userid] = $userLabel;
$userid++;
$i++;

View File

@ -1,4 +1,7 @@
<?php
namespace MCTeam;
use FML\Controls\Control;
use FML\Controls\Frame;
use FML\Controls\Labels\Label_Text;
@ -190,7 +193,7 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
$frame->add($backgroundQuad);
$backgroundQuad->setSize($width, $height);
$backgroundQuad->setStyles($quadStyle, $quadSubstyle);
$script->addMapInfoButton($backgroundQuad);
$backgroundQuad->addMapInfoFeature();
$map = $this->maniaControl->mapManager->getCurrentMap();
@ -247,7 +250,6 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
$quadSubstyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadSubstyle();
$maniaLink = new ManiaLink(self::MLID_CLOCKWIDGET);
$script = $maniaLink->getScript();
// mainframe
$frame = new Frame();
@ -269,7 +271,7 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
$label->setZ(0.2);
$label->setTextSize(1);
$label->setTextColor("FFF");
$script->addTimeLabel($label, true);
$label->addClockFeature(true);
// Send manialink
$this->maniaControl->manialinkManager->sendManialink($maniaLink, $login);