activated tooltip option OnClick
This commit is contained in:
parent
7c2508a0af
commit
eb37af0579
@ -205,7 +205,7 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
|
||||
$backgroundQuad->setStyles($quadStyle, $quadSubstyle);
|
||||
$backgroundQuad->setSize(count($this->adminMenuItems) * $itemSize * 1.15 + 2, $itemSize * $itemMarginFactorY);
|
||||
|
||||
$script->addTooltip($itemQuad, $popoutFrame, Script::OPTION_TOOLTIP_STAYONCLICK);
|
||||
$script->addTooltip($itemQuad, $popoutFrame, Script::OPTION_TOOLTIP_ONCLICK);
|
||||
|
||||
// Add items
|
||||
$x = -1;
|
||||
@ -273,7 +273,7 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
|
||||
$backgroundQuad->setStyles($quadStyle, $quadSubstyle);
|
||||
$backgroundQuad->setSize(count($this->playerMenuItems) * $itemSize * 1.15 + 2, $itemSize * $itemMarginFactorY);
|
||||
|
||||
$script->addTooltip($itemQuad, $popoutFrame, Script::OPTION_TOOLTIP_STAYONCLICK);
|
||||
$script->addTooltip($itemQuad, $popoutFrame, Script::OPTION_TOOLTIP_ONCLICK);
|
||||
|
||||
// Add items
|
||||
$x = -1;
|
||||
|
@ -20,7 +20,7 @@ use ManiaControl\Plugins\Plugin;
|
||||
/**
|
||||
* Donation plugin
|
||||
*
|
||||
* @author steeffeen and Lukas
|
||||
* @author steeffeen & kremsy
|
||||
*/
|
||||
class DonationPlugin implements CallbackListener, CommandListener, Plugin {
|
||||
/**
|
||||
@ -44,7 +44,10 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
|
||||
/**
|
||||
* Private properties
|
||||
*/
|
||||
/** @var maniaControl $maniaControl */
|
||||
/**
|
||||
*
|
||||
* @var maniaControl $maniaControl
|
||||
*/
|
||||
private $maniaControl = null;
|
||||
private $openBills = array();
|
||||
|
||||
@ -64,7 +67,8 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
|
||||
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_BILLUPDATED, $this, 'handleBillUpdated');
|
||||
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_ONINIT, $this, 'handleOnInit');
|
||||
$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERJOINED, $this, 'handlePlayerConnect');
|
||||
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer');
|
||||
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this,
|
||||
'handleManialinkPageAnswer');
|
||||
|
||||
// Define player stats
|
||||
$this->maniaControl->statisticManager->defineStatMetaData(self::STAT_PLAYER_DONATIONS);
|
||||
@ -148,18 +152,11 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
|
||||
public function handleManialinkPageAnswer(array $callback) {
|
||||
$actionId = $callback[1][2];
|
||||
$boolSetting = (strpos($actionId, self::ACTION_DONATE_VALUE) === 0);
|
||||
if(!$boolSetting) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$boolSetting) return;
|
||||
$login = $callback[1][1];
|
||||
|
||||
$player = $this->maniaControl->playerManager->getPlayer($login);
|
||||
|
||||
$actionArray = explode(".", $callback[1][2]);
|
||||
|
||||
$this->handleDonation($player, intval($actionArray[2]));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -194,7 +191,6 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
|
||||
$itemSize = $width;
|
||||
|
||||
$maniaLink = new ManiaLink(self::MLID_DONATE_WIDGET);
|
||||
|
||||
$script = new Script();
|
||||
$maniaLink->setScript($script);
|
||||
|
||||
@ -232,10 +228,9 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
|
||||
$quad->setStyles($quadStyle, $quadSubstyle);
|
||||
$quad->setSize(strlen($values) * 2 + count($valueArray) * 1, $itemSize * $itemMarginFactorY);
|
||||
|
||||
|
||||
$popoutFrame->add($quad);
|
||||
|
||||
$script->addTooltip($itemQuad, $popoutFrame, Script::OPTION_TOOLTIP_STAYONCLICK);
|
||||
$script->addTooltip($itemQuad, $popoutFrame, Script::OPTION_TOOLTIP_ONCLICK);
|
||||
|
||||
// Description Label
|
||||
$descriptionFrame = new Frame();
|
||||
@ -267,7 +262,6 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
|
||||
$x -= strlen($value) * 2 + 1.7;
|
||||
}
|
||||
|
||||
|
||||
// Send manialink
|
||||
$manialinkText = $maniaLink->render()->saveXML();
|
||||
$this->maniaControl->manialinkManager->sendManialink($manialinkText, $login);
|
||||
@ -296,8 +290,8 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
|
||||
$receiver = $params[2];
|
||||
$receiverPlayer = $this->maniaControl->playerManager->getPlayer($receiver);
|
||||
$receiverName = ($receiverPlayer ? $receiverPlayer['NickName'] : $receiver);
|
||||
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$receiver = '';
|
||||
$receiverName = $this->maniaControl->server->getName();
|
||||
}
|
||||
@ -318,7 +312,9 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
|
||||
|
||||
$message = 'Donate ' . $amount . ' Planets to $<' . $receiverName . '$>?';
|
||||
if (!$this->maniaControl->client->query('SendBill', $player->login, $amount, $message, $receiver)) {
|
||||
trigger_error("Couldn't create donation of {$amount} planets from '{$player->login}' for '{$receiver}'. " . $this->maniaControl->getClientErrorText());
|
||||
trigger_error(
|
||||
"Couldn't create donation of {$amount} planets from '{$player->login}' for '{$receiver}'. " .
|
||||
$this->maniaControl->getClientErrorText());
|
||||
$this->maniaControl->chat->sendError("Creating donation failed.", $player->login);
|
||||
return false;
|
||||
}
|
||||
@ -353,12 +349,14 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
|
||||
}
|
||||
if (count($params) >= 3) {
|
||||
$receiver = $params[2];
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$receiver = $player->login;
|
||||
}
|
||||
$message = 'Payout from $<' . $this->maniaControl->server->getName() . '$>.';
|
||||
if (!$this->maniaControl->client->query('Pay', $receiver, $amount, $message)) {
|
||||
trigger_error("Couldn't create payout of {$amount} planets by '{$player->login}' for '{$receiver}'. " . $this->maniaControl->getClientErrorText());
|
||||
trigger_error(
|
||||
"Couldn't create payout of {$amount} planets by '{$player->login}' for '{$receiver}'. " . $this->maniaControl->getClientErrorText());
|
||||
$this->maniaControl->chat->sendError("Creating payout failed.", $player->login);
|
||||
return false;
|
||||
}
|
||||
@ -416,17 +414,21 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
|
||||
// To player
|
||||
$message = "Successfully donated {$amount} to '{$receiver}'!";
|
||||
$this->maniaControl->chat->sendSuccess($message, $login);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// To server
|
||||
if ($this->maniaControl->settingManager->getSetting($this, self::SETTING_ANNOUNCE_SERVERDONATION, true)) {
|
||||
$message = '$<' . $player->nickname . '$> donated ' . $amount . ' Planets! Thanks.';
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$message = 'Donation successful! Thanks.';
|
||||
}
|
||||
$this->maniaControl->chat->sendSuccess($message, $login);
|
||||
$this->maniaControl->statisticManager->insertStat(self::STAT_PLAYER_DONATIONS, $player, $this->maniaControl->server->getServerId(), $amount);
|
||||
$this->maniaControl->statisticManager->insertStat(self::STAT_PLAYER_DONATIONS, $player,
|
||||
$this->maniaControl->server->getServerId(), $amount);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// Payout
|
||||
$message = "Successfully payed out {$amount} to '{$receiver}'!";
|
||||
$this->maniaControl->chat->sendSuccess($message, $login);
|
||||
|
Loading…
Reference in New Issue
Block a user