awardcount on xlist
This commit is contained in:
parent
051c7a916b
commit
711c20f045
@ -19,14 +19,14 @@ class IconManager implements CallbackListener {
|
|||||||
* Constants
|
* Constants
|
||||||
*/
|
*/
|
||||||
const DEFAULT_IMG_URL = 'http://images.maniacontrol.com/icons/';
|
const DEFAULT_IMG_URL = 'http://images.maniacontrol.com/icons/';
|
||||||
const PRELOAD_MLID = 'IconManager.Preload.MLID';
|
const PRELOAD_MLID = 'IconManager.Preload.MLID';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Some Default icons
|
* Some Default icons
|
||||||
*/
|
*/
|
||||||
const MX_ICON = 'ManiaExchange.png';
|
const MX_ICON = 'ManiaExchange.png';
|
||||||
const MX_ICON_MOVER = 'ManiaExchange_logo_press.png';
|
const MX_ICON_MOVER = 'ManiaExchange_logo_press.png';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private Properties
|
* Private Properties
|
||||||
*/
|
*/
|
||||||
@ -41,7 +41,7 @@ class IconManager implements CallbackListener {
|
|||||||
public function __construct(ManiaControl $maniaControl) {
|
public function __construct(ManiaControl $maniaControl) {
|
||||||
$this->maniaControl = $maniaControl;
|
$this->maniaControl = $maniaControl;
|
||||||
$this->addDefaultIcons();
|
$this->addDefaultIcons();
|
||||||
|
|
||||||
// Register for callbacks
|
// Register for callbacks
|
||||||
$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_ONINIT, $this, 'handleOnInit');
|
$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_ONINIT, $this, 'handleOnInit');
|
||||||
$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERJOINED, $this, 'handlePlayerConnect');
|
$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERJOINED, $this, 'handlePlayerConnect');
|
||||||
@ -72,7 +72,7 @@ class IconManager implements CallbackListener {
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getIcon($iconName) {
|
public function getIcon($iconName) {
|
||||||
if (!isset($this->icons[$iconName])) {
|
if(!isset($this->icons[$iconName])) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return $this->icons[$iconName];
|
return $this->icons[$iconName];
|
||||||
@ -104,17 +104,17 @@ class IconManager implements CallbackListener {
|
|||||||
*/
|
*/
|
||||||
private function preloadIcons($login = false) {
|
private function preloadIcons($login = false) {
|
||||||
$maniaLink = new ManiaLink(self::PRELOAD_MLID);
|
$maniaLink = new ManiaLink(self::PRELOAD_MLID);
|
||||||
$frame = new Frame();
|
$frame = new Frame();
|
||||||
$maniaLink->add($frame);
|
$maniaLink->add($frame);
|
||||||
$frame->setPosition(500, 500);
|
$frame->setPosition(500, 500);
|
||||||
|
|
||||||
foreach ($this->icons as $iconUrl) {
|
foreach($this->icons as $iconUrl) {
|
||||||
$iconQuad = new Quad();
|
$iconQuad = new Quad();
|
||||||
$iconQuad->setImage($iconUrl);
|
$iconQuad->setImage($iconUrl);
|
||||||
$iconQuad->setSize(1, 1);
|
$iconQuad->setSize(1, 1);
|
||||||
$frame->add($iconQuad);
|
$frame->add($iconQuad);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send manialink
|
// Send manialink
|
||||||
$manialinkText = $maniaLink->render()->saveXML();
|
$manialinkText = $maniaLink->render()->saveXML();
|
||||||
$this->maniaControl->manialinkManager->sendManialink($manialinkText, $login);
|
$this->maniaControl->manialinkManager->sendManialink($manialinkText, $login);
|
||||||
|
@ -34,17 +34,18 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
/**
|
/**
|
||||||
* Constants
|
* Constants
|
||||||
*/
|
*/
|
||||||
const ACTION_ADD_MAP = 'MapList.AddMap';
|
const ACTION_ADD_MAP = 'MapList.AddMap';
|
||||||
const ACTION_SEARCH_MAPNAME = 'MapList.SearchMapName';
|
const ACTION_SEARCH_MAPNAME = 'MapList.SearchMapName';
|
||||||
const ACTION_SEARCH_AUTHOR = 'MapList.SearchAuthor';
|
const ACTION_SEARCH_AUTHOR = 'MapList.SearchAuthor';
|
||||||
const ACTION_ERASE_MAP = 'MapList.EraseMap';
|
const ACTION_GET_MAPS_FROM_AUTHOR = 'MapList.GetMapsFromAuthor';
|
||||||
const ACTION_SWITCH_MAP = 'MapList.SwitchMap';
|
const ACTION_ERASE_MAP = 'MapList.EraseMap';
|
||||||
const ACTION_QUEUED_MAP = 'MapList.QueueMap';
|
const ACTION_SWITCH_MAP = 'MapList.SwitchMap';
|
||||||
const MAX_MAPS_PER_PAGE = 15;
|
const ACTION_QUEUED_MAP = 'MapList.QueueMap';
|
||||||
const MAX_MX_MAPS_PER_PAGE = 14;
|
const MAX_MAPS_PER_PAGE = 15;
|
||||||
const SHOW_MX_LIST = 1;
|
const MAX_MX_MAPS_PER_PAGE = 14;
|
||||||
const SHOW_MAP_LIST = 2;
|
const SHOW_MX_LIST = 1;
|
||||||
const DEFAULT_KARMA_PLUGIN = 'KarmaPlugin';
|
const SHOW_MAP_LIST = 2;
|
||||||
|
const DEFAULT_KARMA_PLUGIN = 'KarmaPlugin';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private Properties
|
* Private Properties
|
||||||
@ -138,22 +139,41 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$headFrame = new Frame();
|
$headFrame = new Frame();
|
||||||
$frame->add($headFrame);
|
$frame->add($headFrame);
|
||||||
$headFrame->setY($y - 5);
|
$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);
|
$this->maniaControl->manialinkManager->labelLine($headFrame, $array);
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$y -= 10;
|
$y -= 10;
|
||||||
foreach($maps as $map) { //TODO pagers, click on nickname...
|
foreach($maps as $map) { //TODO pagers, click on nickname...
|
||||||
/** @var MxMapInfo $map */
|
/** @var MxMapInfo $map */
|
||||||
|
|
||||||
$time = Formatter::time_elapsed_string(strtotime($map->updated));
|
$time = Formatter::time_elapsed_string(strtotime($map->updated));
|
||||||
|
|
||||||
$mapFrame = new Frame();
|
$mapFrame = new Frame();
|
||||||
$frame->add($mapFrame);
|
$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);
|
$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);
|
$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)) {
|
if($this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_ADMIN)) {
|
||||||
// TODO: SET as setting who can add maps Add-Map-Button
|
// TODO: SET as setting who can add maps Add-Map-Button
|
||||||
$addQuad = new Quad_Icons64x64_1();
|
$addQuad = new Quad_Icons64x64_1();
|
||||||
@ -605,6 +625,10 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$mapId = (int)$actionArray[2];
|
$mapId = (int)$actionArray[2];
|
||||||
|
|
||||||
switch($action) {
|
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:
|
case self::ACTION_ADD_MAP:
|
||||||
$this->maniaControl->mapManager->addMapFromMx($mapId, $player->login);
|
$this->maniaControl->mapManager->addMapFromMx($mapId, $player->login);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user