Fixed LocalRecords Bug, Fixed DonationsPlugin and CustomVotesPlugin position
https://github.com/ManiaControl/ManiaControl/issues/101
This commit is contained in:
parent
33616ec10d
commit
fd743a08d9
@ -17,6 +17,8 @@ use ManiaControl\Manialinks\ManialinkManager;
|
|||||||
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
|
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
|
||||||
use ManiaControl\Players\Player;
|
use ManiaControl\Players\Player;
|
||||||
use ManiaControl\Players\PlayerManager;
|
use ManiaControl\Players\PlayerManager;
|
||||||
|
use ManiaControl\Settings\Setting;
|
||||||
|
use ManiaControl\Settings\SettingManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class managing Actions Menus
|
* Class managing Actions Menus
|
||||||
@ -65,6 +67,8 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener, Usag
|
|||||||
$this->maniaControl->getCallbackManager()->registerCallbackListener(Callbacks::AFTERINIT, $this, 'handleAfterInit');
|
$this->maniaControl->getCallbackManager()->registerCallbackListener(Callbacks::AFTERINIT, $this, 'handleAfterInit');
|
||||||
$this->maniaControl->getCallbackManager()->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerJoined');
|
$this->maniaControl->getCallbackManager()->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerJoined');
|
||||||
$this->maniaControl->getCallbackManager()->registerCallbackListener(AuthenticationManager::CB_AUTH_LEVEL_CHANGED, $this, 'handlePlayerJoined');
|
$this->maniaControl->getCallbackManager()->registerCallbackListener(AuthenticationManager::CB_AUTH_LEVEL_CHANGED, $this, 'handlePlayerJoined');
|
||||||
|
$this->maniaControl->getCallbackManager()->registerCallbackListener(SettingManager::CB_SETTING_CHANGED, $this, 'handleSettingChanged');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -329,4 +333,17 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener, Usag
|
|||||||
$maniaLink = $this->buildMenuIconsManialink($player);
|
$maniaLink = $this->buildMenuIconsManialink($player);
|
||||||
$this->maniaControl->getManialinkManager()->sendManialink($maniaLink, $player);
|
$this->maniaControl->getManialinkManager()->sendManialink($maniaLink, $player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle Setting Changed Callback
|
||||||
|
*
|
||||||
|
* @param Setting $setting
|
||||||
|
*/
|
||||||
|
public function handleSettingChanged(Setting $setting) {
|
||||||
|
if (!$setting->belongsToClass($this)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->rebuildAndShowMenu();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ use FML\Controls\Quads\Quad_Icons64x64_1;
|
|||||||
use FML\Controls\Quads\Quad_UIConstruction_Buttons;
|
use FML\Controls\Quads\Quad_UIConstruction_Buttons;
|
||||||
use FML\ManiaLink;
|
use FML\ManiaLink;
|
||||||
use FML\Script\Features\KeyAction;
|
use FML\Script\Features\KeyAction;
|
||||||
|
use ManiaControl\Admin\ActionsMenu;
|
||||||
use ManiaControl\Callbacks\CallbackListener;
|
use ManiaControl\Callbacks\CallbackListener;
|
||||||
use ManiaControl\Callbacks\CallbackManager;
|
use ManiaControl\Callbacks\CallbackManager;
|
||||||
use ManiaControl\Callbacks\Callbacks;
|
use ManiaControl\Callbacks\Callbacks;
|
||||||
@ -29,6 +30,8 @@ use ManiaControl\Plugins\Plugin;
|
|||||||
use ManiaControl\Script\ScriptManager;
|
use ManiaControl\Script\ScriptManager;
|
||||||
use ManiaControl\Server\Commands;
|
use ManiaControl\Server\Commands;
|
||||||
use ManiaControl\Server\Server;
|
use ManiaControl\Server\Server;
|
||||||
|
use ManiaControl\Settings\Setting;
|
||||||
|
use ManiaControl\Settings\SettingManager;
|
||||||
use ManiaControl\Utils\ColorUtil;
|
use ManiaControl\Utils\ColorUtil;
|
||||||
use Maniaplanet\DedicatedServer\Structures\VoteRatio;
|
use Maniaplanet\DedicatedServer\Structures\VoteRatio;
|
||||||
use Maniaplanet\DedicatedServer\Xmlrpc\ChangeInProgressException;
|
use Maniaplanet\DedicatedServer\Xmlrpc\ChangeInProgressException;
|
||||||
@ -47,7 +50,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
|
|||||||
* Constants
|
* Constants
|
||||||
*/
|
*/
|
||||||
const PLUGIN_ID = 5;
|
const PLUGIN_ID = 5;
|
||||||
const PLUGIN_VERSION = 0.1;
|
const PLUGIN_VERSION = 0.2;
|
||||||
const PLUGIN_NAME = 'CustomVotesPlugin';
|
const PLUGIN_NAME = 'CustomVotesPlugin';
|
||||||
const PLUGIN_AUTHOR = 'kremsy';
|
const PLUGIN_AUTHOR = 'kremsy';
|
||||||
|
|
||||||
@ -148,10 +151,18 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
|
|||||||
$this->maniaControl->getCallbackManager()->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerConnect');
|
$this->maniaControl->getCallbackManager()->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerConnect');
|
||||||
$this->maniaControl->getCallbackManager()->registerCallbackListener(Server::CB_TEAM_MODE_CHANGED, $this, 'constructMenu');
|
$this->maniaControl->getCallbackManager()->registerCallbackListener(Server::CB_TEAM_MODE_CHANGED, $this, 'constructMenu');
|
||||||
$this->maniaControl->getCallbackManager()->registerCallbackListener(ScriptManager::CB_PAUSE_STATUS_CHANGED, $this, 'constructMenu');
|
$this->maniaControl->getCallbackManager()->registerCallbackListener(ScriptManager::CB_PAUSE_STATUS_CHANGED, $this, 'constructMenu');
|
||||||
|
$this->maniaControl->getCallbackManager()->registerCallbackListener(SettingManager::CB_SETTING_CHANGED, $this, 'handleSettingChanged');
|
||||||
|
|
||||||
|
$actionsPosX = $this->maniaControl->getSettingManager()->getSettingValue($this->maniaControl->getActionsMenu(), ActionsMenu::SETTING_MENU_POSX);
|
||||||
|
$actionsPosY = $this->maniaControl->getSettingManager()->getSettingValue($this->maniaControl->getActionsMenu(), ActionsMenu::SETTING_MENU_POSY);
|
||||||
|
$iconSize = $this->maniaControl->getSettingManager()->getSettingValue($this->maniaControl->getActionsMenu(), ActionsMenu::SETTING_MENU_ITEMSIZE);
|
||||||
|
|
||||||
|
$itemMarginFactorY = 1.2;
|
||||||
|
$posY = $actionsPosY - 2 * ($iconSize * $itemMarginFactorY);
|
||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_VOTE_ICON_POSX, 156.);
|
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_VOTE_ICON_POSX, $actionsPosX);
|
||||||
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_VOTE_ICON_POSY, -38.6);
|
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_VOTE_ICON_POSY, $posY);
|
||||||
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_VOTE_ICON_WIDTH, 6);
|
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_VOTE_ICON_WIDTH, 6);
|
||||||
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_VOTE_ICON_HEIGHT, 6);
|
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_VOTE_ICON_HEIGHT, 6);
|
||||||
|
|
||||||
@ -794,6 +805,19 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
|
|||||||
// Send manialink
|
// Send manialink
|
||||||
$this->maniaControl->getManialinkManager()->sendManialink($maniaLink);
|
$this->maniaControl->getManialinkManager()->sendManialink($maniaLink);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle Setting Changed Callback
|
||||||
|
*
|
||||||
|
* @param Setting $setting
|
||||||
|
*/
|
||||||
|
public function handleSettingChanged(Setting $setting) {
|
||||||
|
if (!$setting->belongsToClass($this)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->constructMenu();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -10,6 +10,7 @@ use FML\Controls\Quads\Quad_BgRaceScore2;
|
|||||||
use FML\Controls\Quads\Quad_BgsPlayerCard;
|
use FML\Controls\Quads\Quad_BgsPlayerCard;
|
||||||
use FML\ManiaLink;
|
use FML\ManiaLink;
|
||||||
use FML\Script\Features\Paging;
|
use FML\Script\Features\Paging;
|
||||||
|
use ManiaControl\Admin\ActionsMenu;
|
||||||
use ManiaControl\Admin\AuthenticationManager;
|
use ManiaControl\Admin\AuthenticationManager;
|
||||||
use ManiaControl\Bills\BillManager;
|
use ManiaControl\Bills\BillManager;
|
||||||
use ManiaControl\Callbacks\CallbackListener;
|
use ManiaControl\Callbacks\CallbackListener;
|
||||||
@ -116,9 +117,16 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
|
|||||||
// Define player stats
|
// Define player stats
|
||||||
$this->maniaControl->getStatisticManager()->defineStatMetaData(self::STAT_PLAYER_DONATIONS);
|
$this->maniaControl->getStatisticManager()->defineStatMetaData(self::STAT_PLAYER_DONATIONS);
|
||||||
|
|
||||||
|
$actionsPosX = $this->maniaControl->getSettingManager()->getSettingValue($this->maniaControl->getActionsMenu(), ActionsMenu::SETTING_MENU_POSX);
|
||||||
|
$actionsPosY = $this->maniaControl->getSettingManager()->getSettingValue($this->maniaControl->getActionsMenu(), ActionsMenu::SETTING_MENU_POSY);
|
||||||
|
$iconSize = $this->maniaControl->getSettingManager()->getSettingValue($this->maniaControl->getActionsMenu(), ActionsMenu::SETTING_MENU_ITEMSIZE);
|
||||||
|
|
||||||
|
$itemMarginFactorY = 1.2;
|
||||||
|
$posY = $actionsPosY - 3 * ($iconSize * $itemMarginFactorY);
|
||||||
|
|
||||||
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_DONATE_WIDGET_ACTIVATED, true);
|
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_DONATE_WIDGET_ACTIVATED, true);
|
||||||
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_DONATE_WIDGET_POSX, 156.);
|
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_DONATE_WIDGET_POSX, $actionsPosX);
|
||||||
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_DONATE_WIDGET_POSY, -31.4);
|
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_DONATE_WIDGET_POSY, $posY);
|
||||||
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_DONATE_WIDGET_WIDTH, 6);
|
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_DONATE_WIDGET_WIDTH, 6);
|
||||||
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_DONATE_WIDGET_HEIGHT, 6);
|
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_DONATE_WIDGET_HEIGHT, 6);
|
||||||
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_DONATION_VALUES, "20,50,100,500,1000,2000");
|
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_DONATION_VALUES, "20,50,100,500,1000,2000");
|
||||||
|
@ -38,7 +38,7 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList
|
|||||||
* Constants
|
* Constants
|
||||||
*/
|
*/
|
||||||
const ID = 7;
|
const ID = 7;
|
||||||
const VERSION = 0.2;
|
const VERSION = 0.3;
|
||||||
const NAME = 'Local Records Plugin';
|
const NAME = 'Local Records Plugin';
|
||||||
const AUTHOR = 'MCTeam';
|
const AUTHOR = 'MCTeam';
|
||||||
const MLID_RECORDS = 'ml_local_records';
|
const MLID_RECORDS = 'ml_local_records';
|
||||||
@ -352,6 +352,9 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
$this->updateManialink = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -592,7 +595,7 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList
|
|||||||
$pageFrame = new Frame();
|
$pageFrame = new Frame();
|
||||||
$frame->addChild($pageFrame);
|
$frame->addChild($pageFrame);
|
||||||
$posY = $height / 2 - 10;
|
$posY = $height / 2 - 10;
|
||||||
$paging->addPage($pageFrame);
|
$paging->addPageControl($pageFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
$recordFrame = new Frame();
|
$recordFrame = new Frame();
|
||||||
|
Loading…
Reference in New Issue
Block a user