changed old custom vote buttons

This commit is contained in:
Steffen Schröder 2014-04-29 18:35:57 +02:00
parent cbdc291e76
commit f0b03ccb7a

View File

@ -32,7 +32,7 @@ use FML\Script\Features\KeyAction;
/** /**
* ManiaControl Custom-Votes Plugin * ManiaControl Custom-Votes Plugin
* *
* @author kremsy and steeffeen * @author kremsy
* @copyright ManiaControl Copyright © 2014 ManiaControl Team * @copyright ManiaControl Copyright © 2014 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
@ -43,7 +43,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
const PLUGIN_ID = 5; const PLUGIN_ID = 5;
const PLUGIN_VERSION = 0.1; const PLUGIN_VERSION = 0.1;
const PLUGIN_NAME = 'CustomVotesPlugin'; const PLUGIN_NAME = 'CustomVotesPlugin';
const PLUGIN_AUTHOR = 'kremsy and steeffeen'; const PLUGIN_AUTHOR = 'kremsy';
const SETTING_VOTE_ICON_POSX = 'Vote-Icon-Position: X'; const SETTING_VOTE_ICON_POSX = 'Vote-Icon-Position: X';
const SETTING_VOTE_ICON_POSY = 'Vote-Icon-Position: Y'; const SETTING_VOTE_ICON_POSY = 'Vote-Icon-Position: Y';
@ -625,39 +625,35 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
$voteLabel->setText(' ' . round($votePercentage * 100.) . '% (' . $this->currentVote->getVoteCount() . ')'); $voteLabel->setText(' ' . round($votePercentage * 100.) . '% (' . $this->currentVote->getVoteCount() . ')');
$quad = new Quad_BgsPlayerCard(); $positiveQuad = new Quad_BgsPlayerCard();
$frame->add($quad); $frame->add($positiveQuad);
$quad->setX(-$width / 2 + 6); $positiveQuad->setPosition(-$width / 2 + 6, $y);
$quad->setY($y); $positiveQuad->setSubStyle($positiveQuad::SUBSTYLE_BgPlayerCardBig);
$quad->setSubStyle($quad::SUBSTYLE_BgPlayerCardBig); $positiveQuad->setSize(5, 5);
$quad->setSize(5, 5);
$quad->setAction(self::ACTION_POSITIVE_VOTE);
$quad->setActionKey($quad::ACTIONKEY_F5);
$label = new Label_Button(); $positiveLabel = new Label_Button();
$frame->add($label); $frame->add($positiveLabel);
$label->setX(-$width / 2 + 6); $positiveLabel->setPosition(-$width / 2 + 6, $y);
$label->setAlign(Control::CENTER, Control::CENTER); $positiveLabel->setStyle($labelStyle);
$label->setY($y); $positiveLabel->setTextSize(1);
$label->setStyle($labelStyle); $positiveLabel->setSize(3, 3);
$label->setTextSize(1); $positiveLabel->setTextColor("0F0");
$label->setSize(3, 3); $positiveLabel->setText("F1");
$label->setTextColor("0F0");
$label->setText("F5");
$quad = clone $quad; $negativeQuad = clone $positiveQuad;
$frame->add($quad); $frame->add($negativeQuad);
$quad->setX($width / 2 - 6); $negativeQuad->setX($width / 2 - 6);
$quad->setAction(self::ACTION_NEGATIVE_VOTE);
$quad->setActionKey($quad::ACTIONKEY_F6);
$label = clone $label; $negativeLabel = clone $positiveLabel;
$frame->add($label); $frame->add($negativeLabel);
$label->setX($width / 2 - 6); $negativeLabel->setX($width / 2 - 6);
$label->setTextColor("F00"); $negativeLabel->setTextColor("F00");
$label->setText("F6"); $negativeLabel->setText("F2");
// Voting Actions
$positiveQuad->addActionTriggerFeature(self::ACTION_POSITIVE_VOTE);
$negativeQuad->addActionTriggerFeature(self::ACTION_NEGATIVE_VOTE);
// Key Action
$script = $maniaLink->getScript(); $script = $maniaLink->getScript();
$keyActionPositive = new KeyAction(self::ACTION_POSITIVE_VOTE, 'F1'); $keyActionPositive = new KeyAction(self::ACTION_POSITIVE_VOTE, 'F1');
$script->addFeature($keyActionPositive); $script->addFeature($keyActionPositive);