fixed tooltips

This commit is contained in:
kremsy 2013-12-31 10:40:03 +01:00
parent decebc1d18
commit eb66424e3c
7 changed files with 47 additions and 39 deletions

View File

@ -219,14 +219,18 @@ class Configurator implements CallbackListener, ManialinkPageAnswerListener {
$script = new Script();
$manialink->setScript($script);
$pages = new Pages();
$pages = null;
/*$pages = new Pages();
$script->addFeature($pages);
$tooltips = new Tooltips();
$script->addFeature($tooltips);
$menus = new Menus();
$script->addFeature($menus);
$script->addFeature($menus);*/
//$script->addPager()
$menuRelationships = array();
$menuItemY = $menuHeight * 0.42;
@ -237,21 +241,22 @@ class Configurator implements CallbackListener, ManialinkPageAnswerListener {
$menuItemLabel->setY($menuItemY);
$menuItemLabel->setSize($menuListWidth * 0.9, $menuItemHeight * 0.9);
$menuItemLabel->setStyle(Label_Text::STYLE_TextCardRaceRank);
$menuItemLabel->setText('$z' . $menu->getTitle() . '$z');
//$menuItemLabel->setText('$z' . $menu->getTitle() . '$z');
// Add menu
$menuControl = $menu->getMenu($subMenuWidth, $subMenuHeight, $pages, $tooltips);
$menuControl = $menu->getMenu($subMenuWidth, $subMenuHeight, $pages, $script);
if ($index > 0) {
$menuControl->setVisible(false);
}
$menusFrame->add($menuControl);
// Add menu relationship
array_push($menuRelationships, array($menuItemLabel, $menuControl));
//array_push($menuRelationships, array($menuItemLabel, $menuControl));
$script->addMenu($menuItemLabel, $menuControl);
$menuItemY -= $menuItemHeight * 1.1;
}
$menus->add($menuRelationships);
//$menus->add($menuRelationships);
// Add Close Quad (X)
$closeQuad = new Quad_Icons64x64_1();

View File

@ -3,6 +3,7 @@
namespace ManiaControl\Configurators;
use FML\Script\Pages;
use FML\Script\Script;
use FML\Script\Tooltips;
use ManiaControl\Players\Player;
@ -23,13 +24,14 @@ interface ConfiguratorMenu {
/**
* Get the configurator menu
*
* @param float $width
* @param float $height
* @param Pages $pages
* @param Tooltips $tooltips
* @param float $width
* @param float $height
* @param $pages temp removed
* @param \FML\Script\Script $script
* @internal param \FML\Script\Tooltips $tooltips
* @return \FML\Controls\Control
*/
public function getMenu($width, $height, Pages $pages, Tooltips $tooltips);
public function getMenu($width, $height, $pages, Script $script);
/**
* Save the config data

View File

@ -2,6 +2,7 @@
namespace ManiaControl\Configurators;
use FML\Script\Script;
use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\Formatter;
@ -58,7 +59,7 @@ class ScriptSettings implements ConfiguratorMenu,CallbackListener {
*
* @see \ManiaControl\Configurators\ConfiguratorMenu::getMenu()
*/
public function getMenu($width, $height, Pages $pages, Tooltips $tooltips) {
public function getMenu($width, $height, $pages, Script $script) {
$frame = new Frame();
$this->maniaControl->client->query('GetModeScriptInfo');
@ -171,15 +172,17 @@ class ScriptSettings implements ConfiguratorMenu,CallbackListener {
$descriptionLabel->setTranslate(true);
//$descriptionLabel->setTextPrefix('Desc: ');
$descriptionLabel->setText($scriptParam['Desc']);
$tooltips->add($nameLabel, $descriptionLabel);
$script->addTooltip($nameLabel, $descriptionLabel);
$y -= $settingHeight;
if ($index % $pageMaxCount == $pageMaxCount - 1) {
unset($pageFrame);
}else{
$script->addPage($pageFrame, $index, "test"); //TODO not working
}
}
$pages->add(array(-1 => $pagerPrev, 1 => $pagerNext), $pageFrames, $pageCountLabel);
//$pages->add(array(-1 => $pagerPrev, 1 => $pagerNext), $pageFrames, $pageCountLabel);
return $frame;
}

View File

@ -246,10 +246,6 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$script = new Script();
$maniaLink->setScript($script);
//$script->addTooltip($script::CLASS_TOOLTIPS);
//$tooltips = new Tooltips();
//$script->addFeature($tooltips);
//Headline
$headFrame = new Frame();
$frame->add($headFrame);
@ -345,7 +341,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$descriptionLabel->setText("Add Map to Jukebox: {$map->name}");
//$tooltips->add($jukeQuad, $descriptionLabel);
$script->addTooltip($jukeQuad, $descriptionLabel);
}
if($this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_ADMIN)){ //TODO SET as setting who can add maps
@ -371,7 +367,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$descriptionLabel->setTextSize(2);
$descriptionLabel->setVisible(false);
$descriptionLabel->setText("Remove Map: {$map->name}");
//$tooltips->add($eraseQuad, $descriptionLabel);
$script->addTooltip($eraseQuad, $descriptionLabel);
}
if($this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_OPERATOR)){ //TODO SET as setting who can add maps
//switch to map quad
@ -395,7 +391,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$descriptionLabel->setTextSize(2);
$descriptionLabel->setVisible(false);
$descriptionLabel->setText("Switch Directly to Map: {$map->name}");
//$tooltips->add($switchToQuad, $descriptionLabel);
$script->addTooltip($switchToQuad, $descriptionLabel);
}
//Display Karma bar

View File

@ -95,9 +95,6 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
$script = new Script();
$maniaLink->setScript($script);
//$tooltips = new Tooltips();
//$script->addFeature($tooltips);
//mainframe
$frame = new Frame();
$maniaLink->add($frame);
@ -202,7 +199,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
$descriptionLabel->setTextSize(2);
$descriptionLabel->setVisible(false);
$descriptionLabel->setText($listPlayer->nickname . " from " . $listPlayer->path);
//$tooltips->add($countryQuad, $descriptionLabel);
$script->addTooltip($countryQuad, $descriptionLabel);
}
//Level Quad
@ -228,7 +225,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
$descriptionLabel->setTextSize(2);
$descriptionLabel->setVisible(false);
$descriptionLabel->setText($this->maniaControl->authenticationManager->getAuthLevelName($listPlayer->authLevel) . " " . $listPlayer->nickname);
//$tooltips->add($rightQuad, $descriptionLabel);
$script->addTooltip($rightQuad, $descriptionLabel);
switch($listPlayer->authLevel){
case authenticationManager::AUTH_LEVEL_MASTERADMIN: $rightLabel->setText("MA"); break;
@ -260,7 +257,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
$descriptionLabel->setTextSize(2);
$descriptionLabel->setVisible(false);
$descriptionLabel->setText("Advanced Player Actions on " . $listPlayer->nickname);
//$tooltips->add($playerQuad, $descriptionLabel);
$script->addTooltip($playerQuad, $descriptionLabel);
//Force to Red-Team Quad
$redQuad = new Quad_Emblems();
@ -280,7 +277,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
$descriptionLabel->setTextSize(2);
$descriptionLabel->setVisible(false);
$descriptionLabel->setText("Force " . $listPlayer->nickname . '$z to Red Team!');
//$tooltips->add($redQuad, $descriptionLabel);
$script->addTooltip($redQuad, $descriptionLabel);
//Force to Blue-Team Quad
$blueQuad = new Quad_Emblems();
@ -300,7 +297,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
$descriptionLabel->setTextSize(2);
$descriptionLabel->setVisible(false);
$descriptionLabel->setText("Force " . $listPlayer->nickname . '$z to Blue Team!');
//$tooltips->add($blueQuad, $descriptionLabel);
$script->addTooltip($blueQuad, $descriptionLabel);
//Force to Spectator Quad
$spectatorQuad = new Quad_BgRaceScore2();
@ -320,7 +317,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
$descriptionLabel->setTextSize(2);
$descriptionLabel->setVisible(false);
$descriptionLabel->setText("Force " . $listPlayer->nickname . '$z to Spectator!');
//$tooltips->add($spectatorQuad, $descriptionLabel);
$script->addTooltip($spectatorQuad, $descriptionLabel);
}
$i++;
$y -= 4;

View File

@ -2,6 +2,7 @@
namespace ManiaControl\Plugins;
use FML\Script\Script;
use ManiaControl\ManiaControl;
use ManiaControl\Players\Player;
use ManiaControl\Configurators\ConfiguratorMenu;
@ -57,7 +58,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu {
*
* @see \ManiaControl\Configurators\ConfiguratorMenu::getMenu()
*/
public function getMenu($width, $height, Pages $pages, Tooltips $tooltips) {
public function getMenu($width, $height, $pages, Script $script) {
$frame = new Frame();
$pluginClasses = $this->maniaControl->pluginManager->getPluginClasses();
@ -137,7 +138,7 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu {
$descriptionLabel->setMaxLines(5);
$description = "Author: {$pluginClass::getAuthor()}\nVersion: {$pluginClass::getVersion()}\nDesc: {$pluginClass::getDescription()}";
$descriptionLabel->setText($description);
$tooltips->add($nameLabel, $descriptionLabel);
$script->addTooltip($nameLabel, $descriptionLabel);
$statusChangeButton = new Label_Button();
$pluginFrame->add($statusChangeButton);
@ -158,10 +159,14 @@ class PluginMenu implements CallbackListener, ConfiguratorMenu {
$y -= $entryHeight;
if ($index % $pageMaxCount == $pageMaxCount - 1) {
unset($pageFrame);
}else{
$script->addPage($pageFrame, 1, "test");
}
}
$pages->add(array(-1 => $pagerPrev, 1 => $pagerNext), $pageFrames, $pageCountLabel);
// $script->addPager($pageFrames, 1 , $pageCountLabel);
// $script->addPage(array(-1 => $pagerPrev, 1 => $pagerNext), $pageFrames, $pageCountLabel);
//$pages->add(array(-1 => $pagerPrev, 1 => $pagerNext), $pageFrames, $pageCountLabel);
return $frame;
}