design improvements

This commit is contained in:
kremsy 2013-12-31 02:27:40 +01:00
parent eafab8deee
commit 34be67569f
3 changed files with 71 additions and 24 deletions

View File

@ -4,7 +4,10 @@ namespace ManiaControl\Maps;
use FML\Controls\Control; use FML\Controls\Control;
use FML\Controls\Gauge; use FML\Controls\Gauge;
use FML\Controls\Label; use FML\Controls\Label;
use FML\Controls\Labels\Label_Button;
use FML\Controls\Labels\Label_Text; use FML\Controls\Labels\Label_Text;
use FML\Controls\Quads\Quad_Bgs1;
use FML\Controls\Quads\Quad_BgsPlayerCard;
use FML\Controls\Quads\Quad_Icons128x128_1; use FML\Controls\Quads\Quad_Icons128x128_1;
use FML\Controls\Quads\Quad_Icons64x64_1; use FML\Controls\Quads\Quad_Icons64x64_1;
use FML\Controls\Quads\Quad_UIConstruction_Buttons; use FML\Controls\Quads\Quad_UIConstruction_Buttons;
@ -267,13 +270,22 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$y = $this->height / 2 - 10; $y = $this->height / 2 - 10;
/** @var Map $map */ /** @var Map $map */
foreach($mapList as $map){ foreach($mapList as $map){
//Map Frame //Map Frame
$mapFrame = new Frame(); $mapFrame = new Frame();
$frame->add($mapFrame); $frame->add($mapFrame);
$mapFrame->setZ(0.1); $mapFrame->setZ(0.1);
$mapFrame->setY($y); $mapFrame->setY($y);
if($id % 2 != 0){
$lineQuad = new Quad_BgsPlayerCard();
$mapFrame->add($lineQuad);
$lineQuad->setSize($this->width, 4);
$lineQuad->setSubStyle($lineQuad::SUBSTYLE_BgPlayerCardBig);
$lineQuad->setZ(0.001);
}
if($this->maniaControl->mapManager->getCurrentMap() === $map){ if($this->maniaControl->mapManager->getCurrentMap() === $map){
$currentQuad = new Quad_Icons64x64_1(); $currentQuad = new Quad_Icons64x64_1();
$mapFrame->add($currentQuad); $mapFrame->add($currentQuad);
@ -319,13 +331,17 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$tooltips->add($jukeLabel, $descriptionLabel); $tooltips->add($jukeLabel, $descriptionLabel);
}else{ }else{
//Juke-Map-Button //Juke-Map-Button
$jukeQuad = new Quad_Icons128x128_1(); //$jukeQuad = new Quad_Icons128x128_1();
$jukeQuad = new Label_Button();
$mapFrame->add($jukeQuad); $mapFrame->add($jukeQuad);
$jukeQuad->setX($this->width/2 - 15); $jukeQuad->setX($this->width/2 - 15);
$jukeQuad->setZ(0.2); $jukeQuad->setZ(0.2);
$jukeQuad->setSize(4,4); $jukeQuad->setSize(3,3);
$jukeQuad->setSubStyle($jukeQuad::SUBSTYLE_Load); // $jukeQuad->setSubStyle($jukeQuad::SUBSTYLE_Load);
$jukeQuad->setAction(self::ACTION_JUKE_MAP . "." . $map->uid); $jukeQuad->setAction(self::ACTION_JUKE_MAP . "." . $map->uid);
$jukeQuad->setText("+");
$jukeQuad->setTextColor("09F");
$descriptionLabel->setText("Add Map to Jukebox: {$map->name}"); $descriptionLabel->setText("Add Map to Jukebox: {$map->name}");
$tooltips->add($jukeQuad, $descriptionLabel); $tooltips->add($jukeQuad, $descriptionLabel);
@ -333,12 +349,16 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
if($this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_ADMIN)){ //TODO SET as setting who can add maps if($this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_ADMIN)){ //TODO SET as setting who can add maps
//erase map quad //erase map quad
$eraseQuad = new Quad_UIConstruction_Buttons(); //$eraseQuad = new Quad_UIConstruction_Buttons();
$eraseQuad = new Label_Button(); //TODO change name to label
$mapFrame->add($eraseQuad); $mapFrame->add($eraseQuad);
$eraseQuad->setX($this->width/2 - 5); $eraseQuad->setX($this->width/2 - 5);
$eraseQuad->setZ(0.2); $eraseQuad->setZ(0.2);
$eraseQuad->setSize(4,4); $eraseQuad->setSize(3,3);
$eraseQuad->setSubStyle($eraseQuad::SUBSTYLE_Erase); $eraseQuad->setTextSize(1);
$eraseQuad->setText("x");
$eraseQuad->setTextColor("A00");
//$eraseQuad->setSubStyle($eraseQuad::SUBSTYLE_Erase);
$eraseQuad->setAction(self::ACTION_ERASE_MAP . "." .($id-1) . "." . $map->uid); $eraseQuad->setAction(self::ACTION_ERASE_MAP . "." .($id-1) . "." . $map->uid);
//Description Label //Description Label
@ -354,12 +374,16 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
} }
if($this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_OPERATOR)){ //TODO SET as setting who can add maps if($this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_OPERATOR)){ //TODO SET as setting who can add maps
//switch to map quad //switch to map quad
$switchToQuad = new Quad_Icons64x64_1(); //$switchToQuad = new Quad_Icons64x64_1(); //TODO change name to label
$switchToQuad = new Label_Button();
$mapFrame->add($switchToQuad); $mapFrame->add($switchToQuad);
$switchToQuad->setX($this->width/2 - 10); $switchToQuad->setX($this->width/2 - 10);
$switchToQuad->setZ(0.2); $switchToQuad->setZ(0.2);
$switchToQuad->setSize(4, 4); $switchToQuad->setSize(3, 3);
$switchToQuad->setSubStyle($switchToQuad::SUBSTYLE_ArrowFastNext); //$switchToQuad->setSubStyle($switchToQuad::SUBSTYLE_ArrowFastNext);
$switchToQuad->setText("»");
$switchToQuad->setTextColor("0F0");
$switchToQuad->setAction(self::ACTION_SWITCH_MAP . "." .($id-1)); $switchToQuad->setAction(self::ACTION_SWITCH_MAP . "." .($id-1));
$descriptionLabel = new Label(); $descriptionLabel = new Label();
@ -380,6 +404,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
if(is_numeric($karma)){ if(is_numeric($karma)){
$karmaGauge = new Gauge(); $karmaGauge = new Gauge();
$mapFrame->add($karmaGauge); $mapFrame->add($karmaGauge);
$karmaGauge->setZ(2);
$karmaGauge->setX($x + 120); $karmaGauge->setX($x + 120);
$karmaGauge->setSize(20, 9); $karmaGauge->setSize(20, 9);
$karmaGauge->setDrawBg(false); $karmaGauge->setDrawBg(false);
@ -390,6 +415,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$karmaLabel = new Label(); $karmaLabel = new Label();
$mapFrame->add($karmaLabel); $mapFrame->add($karmaLabel);
$karmaLabel->setZ(2);
$karmaLabel->setX($x + 120); $karmaLabel->setX($x + 120);
$karmaLabel->setSize(20 * 0.9, 5); $karmaLabel->setSize(20 * 0.9, 5);
$karmaLabel->setTextSize(0.9); $karmaLabel->setTextSize(0.9);

View File

@ -145,6 +145,16 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
$path = $listPlayer->getProvince(); $path = $listPlayer->getProvince();
$playerFrame = new Frame(); $playerFrame = new Frame();
$frame->add($playerFrame); $frame->add($playerFrame);
if($i % 2 != 0){
$lineQuad = new Quad_BgsPlayerCard();
$playerFrame->add($lineQuad);
$lineQuad->setSize($this->width, 4);
$lineQuad->setSubStyle($lineQuad::SUBSTYLE_BgPlayerCardBig);
$lineQuad->setZ(0.001);
}
//$array = array($i => $x + 5, $listPlayer->nickname => $x + 10, $listPlayer->login => $x + 50, $listPlayer->ladderRank => $x + 60, $listPlayer->ladderScore => $x + 70, $path => $x + 85); //$array = array($i => $x + 5, $listPlayer->nickname => $x + 10, $listPlayer->login => $x + 50, $listPlayer->ladderRank => $x + 60, $listPlayer->ladderScore => $x + 70, $path => $x + 85);
$array = array($i => $x + 5, $listPlayer->nickname => $x + 18, $listPlayer->login => $x + 60, $path => $x + 91); $array = array($i => $x + 5, $listPlayer->nickname => $x + 18, $listPlayer->login => $x + 60, $path => $x + 91);
$this->maniaControl->manialinkManager->labelLine($playerFrame,$array); $this->maniaControl->manialinkManager->labelLine($playerFrame,$array);
@ -199,7 +209,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
$rightQuad = new Quad_BgRaceScore2(); $rightQuad = new Quad_BgRaceScore2();
$playerFrame->add($rightQuad); $playerFrame->add($rightQuad);
$rightQuad->setX($x + 13); $rightQuad->setX($x + 13);
$rightQuad->setZ(-0.1); $rightQuad->setZ(5);
$rightQuad->setSubStyle($rightQuad::SUBSTYLE_CupFinisher); $rightQuad->setSubStyle($rightQuad::SUBSTYLE_CupFinisher);
$rightQuad->setSize(7,3.5); $rightQuad->setSize(7,3.5);
@ -207,7 +217,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
$playerFrame->add($rightLabel); $playerFrame->add($rightLabel);
$rightLabel->setX($x + 13.9); $rightLabel->setX($x + 13.9);
$rightLabel->setTextSize(0.8); $rightLabel->setTextSize(0.8);
$rightLabel->setZ(10);
//Description Label //Description Label
$descriptionLabel = new Label(); $descriptionLabel = new Label();
@ -221,8 +231,8 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
$tooltips->add($rightQuad, $descriptionLabel); $tooltips->add($rightQuad, $descriptionLabel);
switch($listPlayer->authLevel){ switch($listPlayer->authLevel){
case authenticationManager::AUTH_LEVEL_MASTERADMIN: case authenticationManager::AUTH_LEVEL_MASTERADMIN: $rightLabel->setText("MA"); break;
case authenticationManager::AUTH_LEVEL_SUPERADMIN: $rightLabel->setText("MA"); break; case authenticationManager::AUTH_LEVEL_SUPERADMIN: $rightLabel->setText("SA"); break;
case authenticationManager::AUTH_LEVEL_ADMIN: $rightLabel->setText("AD"); break; case authenticationManager::AUTH_LEVEL_ADMIN: $rightLabel->setText("AD"); break;
case authenticationManager::AUTH_LEVEL_OPERATOR: $rightLabel->setText("MOD"); case authenticationManager::AUTH_LEVEL_OPERATOR: $rightLabel->setText("MOD");
} }
@ -436,7 +446,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
$label->setStyle($style); $label->setStyle($style);
$label->setTextSize($textSize); $label->setTextSize($textSize);
$label->setText("Kick"); $label->setText("Kick");
$label->setTextColor($textColor); $label->setTextColor("F90");
$y -= 5; $y -= 5;
//Show Ban //Show Ban
@ -456,7 +466,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
$label->setStyle($style); $label->setStyle($style);
$label->setTextSize($textSize); $label->setTextSize($textSize);
$label->setText("Ban"); $label->setText("Ban");
$label->setTextColor($textColor); $label->setTextColor("700");
$y -= 10; $y -= 10;
//Show Add as Master-Admin //Show Add as Master-Admin
@ -476,7 +486,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
$label->setStyle($style); $label->setStyle($style);
$label->setTextSize($textSize); $label->setTextSize($textSize);
$label->setText("Add MasterAdmin"); $label->setText("Set SuperAdmin");
$label->setTextColor($textColor); $label->setTextColor($textColor);
@ -497,7 +507,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
$label->setY($y); $label->setY($y);
$label->setStyle($style); $label->setStyle($style);
$label->setTextSize($textSize); $label->setTextSize($textSize);
$label->setText("Add Admin"); $label->setText("Set Admin");
$label->setTextColor($textColor); $label->setTextColor($textColor);
$y -= 5; $y -= 5;
@ -517,7 +527,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
$label->setY($y); $label->setY($y);
$label->setStyle($style); $label->setStyle($style);
$label->setTextSize($textSize); $label->setTextSize($textSize);
$label->setText("Add Moderator"); $label->setText("Set Moderator");
$label->setTextColor($textColor); $label->setTextColor($textColor);
@ -540,7 +550,8 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
$label->setStyle($style); $label->setStyle($style);
$label->setTextSize($textSize); $label->setTextSize($textSize);
$label->setText("Revoke Rights"); $label->setText("Revoke Rights");
$label->setTextColor($textColor); $label->setTextColor("700");
} }
return $frame; return $frame;

View File

@ -81,7 +81,7 @@ class WidgetPlugin implements CallbackListener, Plugin {
// Set CustomUI Setting // Set CustomUI Setting
$this->maniaControl->manialinkManager->customUIManager->setChallengeInfoVisible(false); $this->maniaControl->manialinkManager->customUIManager->setChallengeInfoVisible(false);
// Register for callbacks // Register for callbacks
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_ONINIT, $this, 'handleOnInit'); $this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_ONINIT, $this, 'handleOnInit');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_BEGINMAP, $this, 'handleOnBeginMap'); $this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_BEGINMAP, $this, 'handleOnBeginMap');
@ -96,9 +96,9 @@ class WidgetPlugin implements CallbackListener, Plugin {
$this->maniaControl->settingManager->initSetting($this, self::SETTING_MAP_WIDGET_HEIGHT, 9.); $this->maniaControl->settingManager->initSetting($this, self::SETTING_MAP_WIDGET_HEIGHT, 9.);
$this->maniaControl->settingManager->initSetting($this, self::SETTING_SERVERINFO_WIDGET_ACTIVATED, true); $this->maniaControl->settingManager->initSetting($this, self::SETTING_SERVERINFO_WIDGET_ACTIVATED, true);
$this->maniaControl->settingManager->initSetting($this, self::SETTING_SERVERINFO_WIDGET_POSX, -160 + 20); $this->maniaControl->settingManager->initSetting($this, self::SETTING_SERVERINFO_WIDGET_POSX, -160 + 17.5);
$this->maniaControl->settingManager->initSetting($this, self::SETTING_SERVERINFO_WIDGET_POSY, 90 - 4.5); $this->maniaControl->settingManager->initSetting($this, self::SETTING_SERVERINFO_WIDGET_POSY, 90 - 4.5);
$this->maniaControl->settingManager->initSetting($this, self::SETTING_SERVERINFO_WIDGET_WIDTH, 40); $this->maniaControl->settingManager->initSetting($this, self::SETTING_SERVERINFO_WIDGET_WIDTH, 35);
$this->maniaControl->settingManager->initSetting($this, self::SETTING_SERVERINFO_WIDGET_HEIGHT, 9.); $this->maniaControl->settingManager->initSetting($this, self::SETTING_SERVERINFO_WIDGET_HEIGHT, 9.);
$this->maniaControl->settingManager->initSetting($this, self::SETTING_NEXTMAP_WIDGET_ACTIVATED, true); $this->maniaControl->settingManager->initSetting($this, self::SETTING_NEXTMAP_WIDGET_ACTIVATED, true);
@ -287,12 +287,12 @@ class WidgetPlugin implements CallbackListener, Plugin {
$frame->setSize($width, $height); $frame->setSize($width, $height);
$frame->setPosition($pos_x, $pos_y); $frame->setPosition($pos_x, $pos_y);
// Background Quad // Background Quad
$backgroundQuad = new Quad(); $backgroundQuad = new Quad();
$frame->add($backgroundQuad); $frame->add($backgroundQuad);
$backgroundQuad->setSize($width, $height); $backgroundQuad->setSize($width, $height);
$backgroundQuad->setStyles($quadStyle, $quadSubstyle); $backgroundQuad->setStyles($quadStyle, $quadSubstyle);
#
$this->maniaControl->client->query('GetMaxPlayers'); $this->maniaControl->client->query('GetMaxPlayers');
$maxPlayers = $this->maniaControl->client->getResponse(); $maxPlayers = $this->maniaControl->client->getResponse();
@ -356,6 +356,16 @@ class WidgetPlugin implements CallbackListener, Plugin {
$quad->setSize(3.3,2.5); $quad->setSize(3.3,2.5);
$quad->setHAlign(Control::CENTER); $quad->setHAlign(Control::CENTER);
//Favorite quad
//$quad = new Quad_Icons64x64_1();
$quad = new Quad_Icons128x128_1();
$frame->add($quad);
//$quad->setSubStyle($quad::SUBSTYLE_StateFavourite);
$quad->setSubStyle($quad::SUBSTYLE_ServersFavorites);
$quad->setPosition($width / 2 - 4, -1.5, -0.5);
$quad->setSize(4,4);
$quad->setHAlign(Control::CENTER);
//$TODO add server to favorite
// Send manialink // Send manialink
$manialinkText = $maniaLink->render()->saveXML(); $manialinkText = $maniaLink->render()->saveXML();