simple xlist first version
This commit is contained in:
parent
70b4ab4674
commit
7c2b718e3c
@ -196,6 +196,7 @@ class ManialinkManager implements CallbackListener {
|
|||||||
* @param Frame $frame
|
* @param Frame $frame
|
||||||
* @param array $labelStrings
|
* @param array $labelStrings
|
||||||
* @param array $properties
|
* @param array $properties
|
||||||
|
* @return array Returns the frames (to add special Properties later)
|
||||||
*/
|
*/
|
||||||
public function labelLine(Frame $frame, array $labelStrings, array $properties = array()){
|
public function labelLine(Frame $frame, array $labelStrings, array $properties = array()){
|
||||||
//TODO overwrite standard properties with properties from array
|
//TODO overwrite standard properties with properties from array
|
||||||
@ -206,6 +207,7 @@ class ManialinkManager implements CallbackListener {
|
|||||||
$textSize = 1.5;
|
$textSize = 1.5;
|
||||||
$textColor = 'FFF';
|
$textColor = 'FFF';
|
||||||
|
|
||||||
|
$frames = array();
|
||||||
foreach($labelStrings as $text => $x){
|
foreach($labelStrings as $text => $x){
|
||||||
$label = new Label_Text();
|
$label = new Label_Text();
|
||||||
$frame->add($label);
|
$frame->add($label);
|
||||||
@ -215,6 +217,9 @@ class ManialinkManager implements CallbackListener {
|
|||||||
$label->setTextSize($textSize);
|
$label->setTextSize($textSize);
|
||||||
$label->setText($text);
|
$label->setText($text);
|
||||||
$label->setTextColor($textColor);
|
$label->setTextColor($textColor);
|
||||||
}
|
|
||||||
|
$frames[] = $frame; //add Frame to the frames array
|
||||||
|
}
|
||||||
|
return $frames;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ use MXInfoSearcher;
|
|||||||
|
|
||||||
class MapList implements ManialinkPageAnswerListener {
|
class MapList implements ManialinkPageAnswerListener {
|
||||||
const ACTION_CLOSEWIDGET = 'MapList.CloseWidget';
|
const ACTION_CLOSEWIDGET = 'MapList.CloseWidget';
|
||||||
|
const MAX_MAPS_PER_PAGE = 15;
|
||||||
/**
|
/**
|
||||||
* Private properties
|
* Private properties
|
||||||
*/
|
*/
|
||||||
@ -55,6 +55,11 @@ class MapList implements ManialinkPageAnswerListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays the Mania Exchange List
|
||||||
|
* @param array $chatCallback
|
||||||
|
* @param Player $player
|
||||||
|
*/
|
||||||
public function showManiaExchangeList(array $chatCallback, Player $player){
|
public function showManiaExchangeList(array $chatCallback, Player $player){
|
||||||
$params = explode(' ', $chatCallback[1][2]);
|
$params = explode(' ', $chatCallback[1][2]);
|
||||||
//$commandCount = count(explode(' ', $chatCallback[1][2]));
|
//$commandCount = count(explode(' ', $chatCallback[1][2]));
|
||||||
@ -99,7 +104,36 @@ class MapList implements ManialinkPageAnswerListener {
|
|||||||
|
|
||||||
$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID);
|
$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID);
|
||||||
$frame = $this->buildMainFrame();
|
$frame = $this->buildMainFrame();
|
||||||
|
$maniaLink->add($frame);
|
||||||
|
|
||||||
|
//Start offsets
|
||||||
|
$x = -$this->width / 2;
|
||||||
|
$y = $this->height / 2;
|
||||||
|
|
||||||
|
//Headline
|
||||||
|
$headFrame = new Frame();
|
||||||
|
$frame->add($headFrame);
|
||||||
|
$headFrame->setY($y - 3);
|
||||||
|
$array = array("Id" => $x + 5, "MapName" => $x + 15, "MapAuthor" => $x + 70, "MapMood" => $x + 90, "MapType" => $x + 105);
|
||||||
|
$this->maniaControl->manialinkManager->labelLine($headFrame,$array);
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
$y -= 10;
|
||||||
|
foreach($maps as $map){
|
||||||
|
$mapFrame = new Frame();
|
||||||
|
$frame->add($mapFrame);
|
||||||
|
$array = array($map->id => $x + 5, $map->name => $x + 15, $map->author => $x + 70, $map->mood => $x + 90, $map->maptype => $x + 105);
|
||||||
|
$this->maniaControl->manialinkManager->labelLine($mapFrame,$array);
|
||||||
|
$mapFrame->setY($y);
|
||||||
|
$y -= 4;
|
||||||
|
|
||||||
|
$i++;
|
||||||
|
if($i == self::MAX_MAPS_PER_PAGE)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO add MX info screen
|
||||||
|
//TODO add download Map button
|
||||||
|
|
||||||
//render and display xml
|
//render and display xml
|
||||||
$this->maniaControl->manialinkManager->displayWidget($maniaLink, $player);
|
$this->maniaControl->manialinkManager->displayWidget($maniaLink, $player);
|
||||||
@ -153,6 +187,9 @@ class MapList implements ManialinkPageAnswerListener {
|
|||||||
//Get Maplist
|
//Get Maplist
|
||||||
$mapList = $this->maniaControl->mapManager->getMapList();
|
$mapList = $this->maniaControl->mapManager->getMapList();
|
||||||
|
|
||||||
|
$mapList = array_slice($mapList, 0, self::MAX_MAPS_PER_PAGE);
|
||||||
|
//TODO add pages
|
||||||
|
|
||||||
$id = 1;
|
$id = 1;
|
||||||
$y = $this->height / 2 - 10;
|
$y = $this->height / 2 - 10;
|
||||||
foreach($mapList as $map){
|
foreach($mapList as $map){
|
||||||
@ -162,12 +199,20 @@ class MapList implements ManialinkPageAnswerListener {
|
|||||||
$mapFrame->setY($y);
|
$mapFrame->setY($y);
|
||||||
$y -= 4;
|
$y -= 4;
|
||||||
$id++;
|
$id++;
|
||||||
|
if($id == self::MAX_MAPS_PER_PAGE - 1)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//render and display xml
|
//render and display xml
|
||||||
$this->maniaControl->manialinkManager->displayWidget($maniaLink, $player);
|
$this->maniaControl->manialinkManager->displayWidget($maniaLink, $player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays a single Map in the Maplist
|
||||||
|
* @param $id
|
||||||
|
* @param Map $map
|
||||||
|
* @param Frame $frame
|
||||||
|
*/
|
||||||
private function displayMap($id, Map $map, Frame $frame){
|
private function displayMap($id, Map $map, Frame $frame){
|
||||||
$frame->setZ(-0.01);
|
$frame->setZ(-0.01);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user