improvement, maps voted statistic

This commit is contained in:
kremsy 2014-01-03 19:41:00 +01:00
parent 7b6ff4dcb8
commit 7fc70f4489
2 changed files with 14 additions and 0 deletions

View File

@ -5,6 +5,7 @@ use FML\Controls\Control;
use FML\Controls\Frame; use FML\Controls\Frame;
use FML\Controls\Labels\Label_Text; use FML\Controls\Labels\Label_Text;
use FML\Controls\Quad; use FML\Controls\Quad;
use FML\Controls\Quads\Quad_BgsPlayerCard;
use FML\Controls\Quads\Quad_Icons64x64_1; use FML\Controls\Quads\Quad_Icons64x64_1;
use FML\ManiaLink; use FML\ManiaLink;
use FML\Script\Script; use FML\Script\Script;
@ -223,6 +224,7 @@ class PlayerDetailed {
$playerStats = $this->maniaControl->statisticManager->getAllPlayerStats($player); $playerStats = $this->maniaControl->statisticManager->getAllPlayerStats($player);
$y = $this->height / 2 - 15; $y = $this->height / 2 - 15;
$id = 1;
foreach($playerStats as $stat){ foreach($playerStats as $stat){
$statProperties = $stat[0]; $statProperties = $stat[0];
$value = $stat[1]; $value = $stat[1];
@ -231,6 +233,15 @@ class PlayerDetailed {
$value = Formatter::formatTimeH($value); $value = Formatter::formatTimeH($value);
} }
if($id % 2 != 0) {
$lineQuad = new Quad_BgsPlayerCard();
$frame->add($lineQuad);
$lineQuad->setSize(49, 4);
$lineQuad->setSubStyle($lineQuad::SUBSTYLE_BgPlayerCardBig);
$lineQuad->setPosition(-$this->width / 2 + 66, $y, 0.001);
$lineQuad->setHAlign(Control::LEFT);
}
$label = new Label_Text(); $label = new Label_Text();
$frame->add($label); $frame->add($label);
$label->setPosition(-$this->width / 2 + 70, $y); $label->setPosition(-$this->width / 2 + 70, $y);
@ -246,6 +257,7 @@ class PlayerDetailed {
$label->setTextSize(1.5); $label->setTextSize(1.5);
$y -= 4; $y -= 4;
$id++;
} }
return $frame; return $frame;
} }

View File

@ -270,7 +270,9 @@ class KarmaPlugin implements CallbackListener, Plugin {
$map = $this->maniaControl->mapManager->getCurrentMap(); $map = $this->maniaControl->mapManager->getCurrentMap();
$voted = $this->getPlayerVote($player, $map); $voted = $this->getPlayerVote($player, $map);
var_dump($voted);
if(!$voted){ if(!$voted){
var_dump("test");
$this->maniaControl->statisticManager->incrementStat(self::STAT_PLAYER_MAPVOTES, $player, $this->maniaControl->server->getLogin()); $this->maniaControl->statisticManager->incrementStat(self::STAT_PLAYER_MAPVOTES, $player, $this->maniaControl->server->getLogin());
} }