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/Map.php';
|
||||||
require_once __DIR__ . '/Maps/MapManager.php';
|
require_once __DIR__ . '/Maps/MapManager.php';
|
||||||
require_once __DIR__ . '/Maps/MapList.php';
|
require_once __DIR__ . '/Maps/MapList.php';
|
||||||
|
require_once __DIR__ . '/Maps/Jukebox.php';
|
||||||
require_once __DIR__ . '/Players/PlayerManager.php';
|
require_once __DIR__ . '/Players/PlayerManager.php';
|
||||||
require_once __DIR__ . '/Players/PlayerActions.php';
|
require_once __DIR__ . '/Players/PlayerActions.php';
|
||||||
require_once __DIR__ . '/Plugins/PluginManager.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) {
|
public function __construct(ManiaControl $maniaControl) {
|
||||||
$this->maniaControl = $maniaControl;
|
$this->maniaControl = $maniaControl;
|
||||||
|
|
||||||
|
|
||||||
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(ManialinkManager::CB_MAIN_WINDOW_CLOSED, $this,
|
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(ManialinkManager::CB_MAIN_WINDOW_CLOSED, $this,
|
||||||
'closeWidget');
|
'closeWidget');
|
||||||
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this,
|
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this,
|
||||||
@ -65,7 +64,6 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$this->height = 80;
|
$this->height = 80;
|
||||||
$this->quadStyle = Quad_BgRaceScore2::STYLE; //TODO add default menu style to style manager
|
$this->quadStyle = Quad_BgRaceScore2::STYLE; //TODO add default menu style to style manager
|
||||||
$this->quadSubstyle = Quad_BgRaceScore2::SUBSTYLE_HandleSelectable;
|
$this->quadSubstyle = Quad_BgRaceScore2::SUBSTYLE_HandleSelectable;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ use ManiaControl\FileUtil;
|
|||||||
use ManiaControl\ManiaControl;
|
use ManiaControl\ManiaControl;
|
||||||
use ManiaControl\Callbacks\CallbackListener;
|
use ManiaControl\Callbacks\CallbackListener;
|
||||||
use ManiaControl\Callbacks\CallbackManager;
|
use ManiaControl\Callbacks\CallbackManager;
|
||||||
|
use ManiaControl\Players\PlayerList;
|
||||||
use MXInfoFetcher;
|
use MXInfoFetcher;
|
||||||
|
|
||||||
|
|
||||||
@ -32,6 +33,11 @@ class MapManager implements CallbackListener {
|
|||||||
private $mapListUids = array();
|
private $mapListUids = array();
|
||||||
private $currentMap = null;
|
private $currentMap = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Public Properties
|
||||||
|
*/
|
||||||
|
public $jukebox = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct map manager
|
* Construct map manager
|
||||||
*
|
*
|
||||||
@ -45,11 +51,13 @@ class MapManager implements CallbackListener {
|
|||||||
|
|
||||||
// Create map commands instance
|
// Create map commands instance
|
||||||
$this->mapCommands = new MapCommands($maniaControl);
|
$this->mapCommands = new MapCommands($maniaControl);
|
||||||
|
$this->jukebox = new Jukebox($this->maniaControl);
|
||||||
|
|
||||||
// Register for callbacks
|
// Register for callbacks
|
||||||
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_ONINIT, $this, 'handleOnInit');
|
$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_MC_BEGINMAP, $this, 'handleBeginMap');
|
||||||
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_MAPLISTMODIFIED, $this, 'mapListModified');
|
$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(){
|
public function getCurrentMap(){
|
||||||
return $this->currentMap;
|
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 $playerCommands = null;
|
||||||
private $playerList = array();
|
private $playerList = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Public properties
|
||||||
|
*/
|
||||||
public $playerActions = null;
|
public $playerActions = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct player manager
|
* Construct player manager
|
||||||
*
|
*
|
||||||
@ -44,7 +48,6 @@ class PlayerManager implements CallbackListener {
|
|||||||
$this->initTables();
|
$this->initTables();
|
||||||
|
|
||||||
$this->playerCommands = new PlayerCommands($maniaControl);
|
$this->playerCommands = new PlayerCommands($maniaControl);
|
||||||
|
|
||||||
$this->playerActions = new PlayerActions($maniaControl);
|
$this->playerActions = new PlayerActions($maniaControl);
|
||||||
|
|
||||||
// Init settings
|
// Init settings
|
||||||
|
Loading…
Reference in New Issue
Block a user