jukebox beginn
This commit is contained in:
parent
ebe09a8828
commit
5bc897cf33
@ -35,6 +35,7 @@ require_once __DIR__ . '/Manialinks/ManialinkManager.php';
|
||||
require_once __DIR__ . '/Maps/Map.php';
|
||||
require_once __DIR__ . '/Maps/MapManager.php';
|
||||
require_once __DIR__ . '/Maps/MapList.php';
|
||||
require_once __DIR__ . '/Maps/Jukebox.php';
|
||||
require_once __DIR__ . '/Players/PlayerManager.php';
|
||||
require_once __DIR__ . '/Players/PlayerActions.php';
|
||||
require_once __DIR__ . '/Plugins/PluginManager.php';
|
||||
|
51
application/core/Maps/Jukebox.php
Normal file
51
application/core/Maps/Jukebox.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace ManiaControl\Maps;
|
||||
use ManiaControl\ManiaControl;
|
||||
|
||||
/**
|
||||
* Jukebox Class
|
||||
*
|
||||
* @author steeffeen & kremsy
|
||||
*/
|
||||
class Jukebox {
|
||||
/**
|
||||
* Constants
|
||||
*/
|
||||
const CB_JUKEBOX_CHANGED = 'Jukebox.JukeBoxChanged';
|
||||
|
||||
/**
|
||||
* Private properties
|
||||
*/
|
||||
private $maniaControl = null;
|
||||
private $jukedMaps = array();
|
||||
|
||||
/**
|
||||
* Create a new server jukebox
|
||||
*
|
||||
* @param ManiaControl $maniaControl
|
||||
*/
|
||||
public function __construct(ManiaControl $maniaControl) {
|
||||
$this->maniaControl = $maniaControl;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function addMapToJukebox($uid){
|
||||
|
||||
//Check if the map is already juked
|
||||
if(array_key_exists($uid, $this->jukedMaps)){
|
||||
//TODO message map already juked
|
||||
return;
|
||||
}
|
||||
|
||||
//TODO recently maps not able to add to jukebox setting, and management
|
||||
|
||||
$this->jukedMaps[$uid] = $this->maniaControl->mapManager->getMapByUid($uid);
|
||||
|
||||
//TODO Message
|
||||
|
||||
// Trigger callback
|
||||
$this->maniaControl->callbackManager->triggerCallback(self::CB_JUKEBOX_CHANGED, array('add', $this->jukedMaps[$uid]));
|
||||
}
|
||||
}
|
@ -54,7 +54,6 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
public function __construct(ManiaControl $maniaControl) {
|
||||
$this->maniaControl = $maniaControl;
|
||||
|
||||
|
||||
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(ManialinkManager::CB_MAIN_WINDOW_CLOSED, $this,
|
||||
'closeWidget');
|
||||
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this,
|
||||
@ -65,7 +64,6 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
$this->height = 80;
|
||||
$this->quadStyle = Quad_BgRaceScore2::STYLE; //TODO add default menu style to style manager
|
||||
$this->quadSubstyle = Quad_BgRaceScore2::SUBSTYLE_HandleSelectable;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -9,6 +9,7 @@ use ManiaControl\FileUtil;
|
||||
use ManiaControl\ManiaControl;
|
||||
use ManiaControl\Callbacks\CallbackListener;
|
||||
use ManiaControl\Callbacks\CallbackManager;
|
||||
use ManiaControl\Players\PlayerList;
|
||||
use MXInfoFetcher;
|
||||
|
||||
|
||||
@ -32,6 +33,11 @@ class MapManager implements CallbackListener {
|
||||
private $mapListUids = array();
|
||||
private $currentMap = null;
|
||||
|
||||
/**
|
||||
* Public Properties
|
||||
*/
|
||||
public $jukebox = null;
|
||||
|
||||
/**
|
||||
* Construct map manager
|
||||
*
|
||||
@ -45,11 +51,13 @@ class MapManager implements CallbackListener {
|
||||
|
||||
// Create map commands instance
|
||||
$this->mapCommands = new MapCommands($maniaControl);
|
||||
$this->jukebox = new Jukebox($this->maniaControl);
|
||||
|
||||
// Register for callbacks
|
||||
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_ONINIT, $this, 'handleOnInit');
|
||||
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_BEGINMAP, $this, 'handleBeginMap');
|
||||
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_MAPLISTMODIFIED, $this, 'mapListModified');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -201,12 +209,20 @@ class MapManager implements CallbackListener {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null
|
||||
* @return currentMap
|
||||
*/
|
||||
public function getCurrentMap(){
|
||||
return $this->currentMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns map By UID
|
||||
* @param $uid
|
||||
* @return mixed
|
||||
*/
|
||||
public function getMapByUid($uid){
|
||||
return $this->mapListUids[$uid];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
@ -33,7 +33,11 @@ class PlayerManager implements CallbackListener {
|
||||
private $playerCommands = null;
|
||||
private $playerList = array();
|
||||
|
||||
/**
|
||||
* Public properties
|
||||
*/
|
||||
public $playerActions = null;
|
||||
|
||||
/**
|
||||
* Construct player manager
|
||||
*
|
||||
@ -44,7 +48,6 @@ class PlayerManager implements CallbackListener {
|
||||
$this->initTables();
|
||||
|
||||
$this->playerCommands = new PlayerCommands($maniaControl);
|
||||
|
||||
$this->playerActions = new PlayerActions($maniaControl);
|
||||
|
||||
// Init settings
|
||||
|
Loading…
Reference in New Issue
Block a user