begin added jukebox places into maplist

This commit is contained in:
kremsy 2013-12-28 23:52:09 +01:00
parent 3b38cb3b68
commit b3ce20819e
2 changed files with 33 additions and 0 deletions

View File

@ -120,6 +120,20 @@ class Jukebox implements CallbackListener {
} }
/**
* Returns a list with the indexes of the juked maps
* @return array
*/
public function getJukeBoxRanking(){
$i = 1;
$jukedMaps = array();
foreach($this->jukedMaps as $map){
$map = $map[1];
$jukedMaps[$map->uid] = $i;
$i++;
}
return $jukedMaps;
}
public function printAllMaps(){ public function printAllMaps(){
foreach($this->jukedMaps as $map){ foreach($this->jukedMaps as $map){

View File

@ -3,6 +3,7 @@
namespace ManiaControl\Maps; namespace ManiaControl\Maps;
use FML\Controls\Control; use FML\Controls\Control;
use FML\Controls\Label; use FML\Controls\Label;
use FML\Controls\Labels\Label_Text;
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;
@ -63,6 +64,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, $this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this,
'handleManialinkPageAnswer'); 'handleManialinkPageAnswer');
$this->maniaControl->callbackManager->registerCallbackListener(Jukebox::CB_JUKEBOX_CHANGED, $this, 'updateWidget');
$this->maniaControl->callbackManager->registerCallbackListener(MapManager::CB_MAPLIST_UPDATED, $this, 'updateWidget'); $this->maniaControl->callbackManager->registerCallbackListener(MapManager::CB_MAPLIST_UPDATED, $this, 'updateWidget');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_BEGINMAP, $this, 'updateWidget'); //TODO not working yet $this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_BEGINMAP, $this, 'updateWidget'); //TODO not working yet
@ -244,6 +246,8 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
//TODO add pages //TODO add pages
$jukedMaps = $this->maniaControl->mapManager->jukebox->getJukeBoxRanking();
$id = 1; $id = 1;
$y = $this->height / 2 - 10; $y = $this->height / 2 - 10;
foreach($mapList as $map){ foreach($mapList as $map){
@ -252,6 +256,21 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$this->displayMap($id, $map, $mapFrame, $tooltips); $this->displayMap($id, $map, $mapFrame, $tooltips);
$mapFrame->setY($y); $mapFrame->setY($y);
//Juke-Map-Label
if(isset($jukedMaps[$map->uid])){
echo "yes";
var_dump($jukedMaps[$map->uid]);
$jukeLabel = new Label_Text();
$mapFrame->add($jukeLabel);
$jukeLabel->setX($this->width/2 - 25);
$jukeLabel->setAlign(Control::CENTER,Control::CENTER);
$jukeLabel->setZ(0.2);
$jukeLabel->setTextSize(1.5);
$jukeLabel->setText($jukedMaps[$map->uid]);
$jukeLabel->setTextColor("FFF");
}
//Juke-Map-Button //Juke-Map-Button
$jukeQuad = new Quad_Icons128x128_1(); $jukeQuad = new Quad_Icons128x128_1();
$mapFrame->add($jukeQuad); $mapFrame->add($jukeQuad);