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';
}