awardcount on xlist

This commit is contained in:
kremsy 2014-01-09 17:26:59 +01:00
parent 051c7a916b
commit 711c20f045
2 changed files with 49 additions and 25 deletions

View File

@ -72,7 +72,7 @@ class IconManager implements CallbackListener {
* @return string
*/
public function getIcon($iconName) {
if (!isset($this->icons[$iconName])) {
if(!isset($this->icons[$iconName])) {
return null;
}
return $this->icons[$iconName];
@ -108,7 +108,7 @@ class IconManager implements CallbackListener {
$maniaLink->add($frame);
$frame->setPosition(500, 500);
foreach ($this->icons as $iconUrl) {
foreach($this->icons as $iconUrl) {
$iconQuad = new Quad();
$iconQuad->setImage($iconUrl);
$iconQuad->setSize(1, 1);

View File

@ -37,6 +37,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
const ACTION_ADD_MAP = 'MapList.AddMap';
const ACTION_SEARCH_MAPNAME = 'MapList.SearchMapName';
const ACTION_SEARCH_AUTHOR = 'MapList.SearchAuthor';
const ACTION_GET_MAPS_FROM_AUTHOR = 'MapList.GetMapsFromAuthor';
const ACTION_ERASE_MAP = 'MapList.EraseMap';
const ACTION_SWITCH_MAP = 'MapList.SwitchMap';
const ACTION_QUEUED_MAP = 'MapList.QueueMap';
@ -138,22 +139,41 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$headFrame = new Frame();
$frame->add($headFrame);
$headFrame->setY($y - 5);
$array = array('Id' => $x + 5, 'Name' => $x + 17, 'Author' => $x + 65, 'Type' => $x + 100, 'Mood' => $x + 115, 'Updated' => $x + 130);
$array = array('Id' => $x + 5, 'Name' => $x + 17, 'Author' => $x + 65, 'Type' => $x + 100, 'Mood' => $x + 115, 'Last Update' => $x + 130);
$this->maniaControl->manialinkManager->labelLine($headFrame, $array);
$i = 0;
$y -= 10;
foreach($maps as $map) { //TODO pagers, click on nickname...
/** @var MxMapInfo $map */
$time = Formatter::time_elapsed_string(strtotime($map->updated));
$mapFrame = new Frame();
$frame->add($mapFrame);
$array = array($map->id => $x + 5, $map->name => $x + 17, $map->author => $x + 65, str_replace("Arena", "", $map->maptype) => $x + 100, $map->mood => $x + 115, $time => $x + 130);
$this->maniaControl->manialinkManager->labelLine($mapFrame, $array);
$labels = $this->maniaControl->manialinkManager->labelLine($mapFrame, $array);
/** @var Label_Text $authorLabel */
$authorLabel = $labels[2];
$authorLabel->setAction(self::ACTION_GET_MAPS_FROM_AUTHOR . '.' . $map->author);
$mapFrame->setY($y);
if($map->awards > 0) {
$awardQuad = new Quad_Icons64x64_1();
$mapFrame->add($awardQuad);
$awardQuad->setSize(3, 3);
$awardQuad->setSubStyle($awardQuad::SUBSTYLE_OfficialRace);
$awardQuad->setX($x + 93);
$awardLabel = new Label_Text();
$mapFrame->add($awardLabel);
$awardLabel->setX($x + 94.5);
$awardLabel->setHAlign(Control::LEFT);
$awardLabel->setText($map->awards);
$awardLabel->setTextSize(1.3);
}
if($this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_ADMIN)) {
// TODO: SET as setting who can add maps Add-Map-Button
$addQuad = new Quad_Icons64x64_1();
@ -605,6 +625,10 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$mapId = (int)$actionArray[2];
switch($action) {
case self::ACTION_GET_MAPS_FROM_AUTHOR:
$callback[1][2] = 'auth:' . $actionArray[2];
$this->showManiaExchangeList($callback, $player);
break;
case self::ACTION_ADD_MAP:
$this->maniaControl->mapManager->addMapFromMx($mapId, $player->login);
break;