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\Gauge;
use FML\Controls\Label;
use FML\Controls\Labels\Label_Button;
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_Icons64x64_1;
use FML\Controls\Quads\Quad_UIConstruction_Buttons;
@ -267,13 +270,22 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$y = $this->height / 2 - 10;
/** @var Map $map */
foreach($mapList as $map){
//Map Frame
$mapFrame = new Frame();
$frame->add($mapFrame);
$mapFrame->setZ(0.1);
$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){
$currentQuad = new Quad_Icons64x64_1();
$mapFrame->add($currentQuad);
@ -319,13 +331,17 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$tooltips->add($jukeLabel, $descriptionLabel);
}else{
//Juke-Map-Button
$jukeQuad = new Quad_Icons128x128_1();
//$jukeQuad = new Quad_Icons128x128_1();
$jukeQuad = new Label_Button();
$mapFrame->add($jukeQuad);
$jukeQuad->setX($this->width/2 - 15);
$jukeQuad->setZ(0.2);
$jukeQuad->setSize(4,4);
$jukeQuad->setSubStyle($jukeQuad::SUBSTYLE_Load);
$jukeQuad->setSize(3,3);
// $jukeQuad->setSubStyle($jukeQuad::SUBSTYLE_Load);
$jukeQuad->setAction(self::ACTION_JUKE_MAP . "." . $map->uid);
$jukeQuad->setText("+");
$jukeQuad->setTextColor("09F");
$descriptionLabel->setText("Add Map to Jukebox: {$map->name}");
$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
//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);
$eraseQuad->setX($this->width/2 - 5);
$eraseQuad->setZ(0.2);
$eraseQuad->setSize(4,4);
$eraseQuad->setSubStyle($eraseQuad::SUBSTYLE_Erase);
$eraseQuad->setSize(3,3);
$eraseQuad->setTextSize(1);
$eraseQuad->setText("x");
$eraseQuad->setTextColor("A00");
//$eraseQuad->setSubStyle($eraseQuad::SUBSTYLE_Erase);
$eraseQuad->setAction(self::ACTION_ERASE_MAP . "." .($id-1) . "." . $map->uid);
//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
//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);
$switchToQuad->setX($this->width/2 - 10);
$switchToQuad->setZ(0.2);
$switchToQuad->setSize(4, 4);
$switchToQuad->setSubStyle($switchToQuad::SUBSTYLE_ArrowFastNext);
$switchToQuad->setSize(3, 3);
//$switchToQuad->setSubStyle($switchToQuad::SUBSTYLE_ArrowFastNext);
$switchToQuad->setText("»");
$switchToQuad->setTextColor("0F0");
$switchToQuad->setAction(self::ACTION_SWITCH_MAP . "." .($id-1));
$descriptionLabel = new Label();
@ -380,6 +404,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
if(is_numeric($karma)){
$karmaGauge = new Gauge();
$mapFrame->add($karmaGauge);
$karmaGauge->setZ(2);
$karmaGauge->setX($x + 120);
$karmaGauge->setSize(20, 9);
$karmaGauge->setDrawBg(false);
@ -390,6 +415,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$karmaLabel = new Label();
$mapFrame->add($karmaLabel);
$karmaLabel->setZ(2);
$karmaLabel->setX($x + 120);
$karmaLabel->setSize(20 * 0.9, 5);
$karmaLabel->setTextSize(0.9);

View File

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

View File

@ -81,7 +81,7 @@ class WidgetPlugin implements CallbackListener, Plugin {
// Set CustomUI Setting
$this->maniaControl->manialinkManager->customUIManager->setChallengeInfoVisible(false);
// Register for callbacks
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_ONINIT, $this, 'handleOnInit');
$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_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_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_NEXTMAP_WIDGET_ACTIVATED, true);
@ -287,12 +287,12 @@ class WidgetPlugin implements CallbackListener, Plugin {
$frame->setSize($width, $height);
$frame->setPosition($pos_x, $pos_y);
// Background Quad
$backgroundQuad = new Quad();
$frame->add($backgroundQuad);
$backgroundQuad->setSize($width, $height);
$backgroundQuad->setStyles($quadStyle, $quadSubstyle);
#
$this->maniaControl->client->query('GetMaxPlayers');
$maxPlayers = $this->maniaControl->client->getResponse();
@ -356,6 +356,16 @@ class WidgetPlugin implements CallbackListener, Plugin {
$quad->setSize(3.3,2.5);
$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
$manialinkText = $maniaLink->render()->saveXML();