improved player detailed
This commit is contained in:
parent
05eb8b96a7
commit
b0b6e6ef17
@ -8,7 +8,6 @@ use FML\Controls\Labels\Label_Button;
|
|||||||
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_BgsPlayerCard;
|
||||||
use FML\Controls\Quads\Quad_Icons64x64_1;
|
|
||||||
use FML\ManiaLink;
|
use FML\ManiaLink;
|
||||||
use FML\Script\Script;
|
use FML\Script\Script;
|
||||||
use ManiaControl\Formatter;
|
use ManiaControl\Formatter;
|
||||||
@ -22,7 +21,10 @@ use ManiaControl\Statistics\StatisticManager;
|
|||||||
* @author steeffeen & kremsy
|
* @author steeffeen & kremsy
|
||||||
*/
|
*/
|
||||||
class PlayerDetailed {
|
class PlayerDetailed {
|
||||||
|
/**
|
||||||
|
* Constants
|
||||||
|
*/
|
||||||
|
const STATS_PER_COLUMN = 13;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private properties
|
* Private properties
|
||||||
@ -42,40 +44,25 @@ class PlayerDetailed {
|
|||||||
$this->height = $this->maniaControl->manialinkManager->styleManager->getListWidgetsHeight();
|
$this->height = $this->maniaControl->manialinkManager->styleManager->getListWidgetsHeight();
|
||||||
$this->quadStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultMainWindowStyle();
|
$this->quadStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultMainWindowStyle();
|
||||||
$this->quadSubstyle = $this->maniaControl->manialinkManager->styleManager->getDefaultMainWindowSubStyle();
|
$this->quadSubstyle = $this->maniaControl->manialinkManager->styleManager->getDefaultMainWindowSubStyle();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function showPlayerDetailed(Player $player, $targetLogin) {
|
public function showPlayerDetailed(Player $player, $targetLogin) {
|
||||||
$target = $this->maniaControl->playerManager->getPlayer($targetLogin);
|
$target = $this->maniaControl->playerManager->getPlayer($targetLogin);
|
||||||
|
|
||||||
|
//Create ManiaLink
|
||||||
$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID);
|
$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID);
|
||||||
|
$script = $maniaLink->getScript();
|
||||||
|
|
||||||
|
// Main frame
|
||||||
|
$frame = $this->maniaControl->manialinkManager->styleManager->defaultListFrame($script);
|
||||||
|
$maniaLink->add($frame);
|
||||||
|
|
||||||
// Create script and features
|
// Create script and features
|
||||||
$script = new Script();
|
$script = new Script();
|
||||||
$maniaLink->setScript($script);
|
$maniaLink->setScript($script);
|
||||||
|
|
||||||
// mainframe
|
$y = $this->height / 2 - 7;
|
||||||
$frame = new Frame();
|
|
||||||
$maniaLink->add($frame);
|
|
||||||
$frame->setSize($this->width, $this->height);
|
|
||||||
$frame->setPosition(0, 0);
|
|
||||||
|
|
||||||
// Background Quad
|
|
||||||
$backgroundQuad = new Quad();
|
|
||||||
$frame->add($backgroundQuad);
|
|
||||||
$backgroundQuad->setSize($this->width, $this->height);
|
|
||||||
$backgroundQuad->setStyles($this->quadStyle, $this->quadSubstyle);
|
|
||||||
|
|
||||||
// Add Close Quad (X)
|
|
||||||
$closeQuad = new Quad_Icons64x64_1();
|
|
||||||
$frame->add($closeQuad);
|
|
||||||
$closeQuad->setPosition($this->width * 0.483, $this->height * 0.467, 3);
|
|
||||||
$closeQuad->setSize(6, 6);
|
|
||||||
$closeQuad->setSubStyle(Quad_Icons64x64_1::SUBSTYLE_QuitRace);
|
|
||||||
$closeQuad->setAction(ManialinkManager::ACTION_CLOSEWIDGET);
|
|
||||||
|
|
||||||
|
|
||||||
$y = $this->height / 2 - 10;
|
|
||||||
|
|
||||||
//Nation Quad
|
//Nation Quad
|
||||||
$countryQuad = new Quad();
|
$countryQuad = new Quad();
|
||||||
@ -88,7 +75,6 @@ class PlayerDetailed {
|
|||||||
$countryQuad->setHAlign(Control::LEFT);
|
$countryQuad->setHAlign(Control::LEFT);
|
||||||
|
|
||||||
//Nickname
|
//Nickname
|
||||||
|
|
||||||
$label = new Label_Text();
|
$label = new Label_Text();
|
||||||
$frame->add($label);
|
$frame->add($label);
|
||||||
$label->setPosition(-$this->width / 2 + 15, $y);
|
$label->setPosition(-$this->width / 2 + 15, $y);
|
||||||
@ -97,7 +83,7 @@ class PlayerDetailed {
|
|||||||
|
|
||||||
|
|
||||||
//Define MainLabel (Login)
|
//Define MainLabel (Login)
|
||||||
$y -= 5;
|
$y -= 8;
|
||||||
$mainLabel = new Label_Text();
|
$mainLabel = new Label_Text();
|
||||||
$frame->add($mainLabel);
|
$frame->add($mainLabel);
|
||||||
$mainLabel->setPosition(-$this->width / 2 + 10, $y);
|
$mainLabel->setPosition(-$this->width / 2 + 10, $y);
|
||||||
@ -139,7 +125,13 @@ class PlayerDetailed {
|
|||||||
$label = clone $mainLabel;
|
$label = clone $mainLabel;
|
||||||
$frame->add($label);
|
$frame->add($label);
|
||||||
$label->setY($y);
|
$label->setY($y);
|
||||||
$label->setText("Plays since:");
|
$label->setText("Inscribed Zone:");
|
||||||
|
|
||||||
|
$y -= 5;
|
||||||
|
$label = clone $mainLabel;
|
||||||
|
$frame->add($label);
|
||||||
|
$label->setY($y);
|
||||||
|
$label->setText('Avatar');
|
||||||
|
|
||||||
//Login
|
//Login
|
||||||
$y = $this->height / 2 - 15;
|
$y = $this->height / 2 - 15;
|
||||||
@ -192,18 +184,10 @@ class PlayerDetailed {
|
|||||||
$label->setY($y);
|
$label->setY($y);
|
||||||
$label->setText(date("d M Y", time() - 3600 * 24 * $target->maniaPlanetPlayDays));
|
$label->setText(date("d M Y", time() - 3600 * 24 * $target->maniaPlanetPlayDays));
|
||||||
|
|
||||||
//Avatar
|
|
||||||
$label = new Label_Text();
|
|
||||||
$frame->add($label);
|
|
||||||
$label->setPosition($this->width / 2 - 10, $this->height / 2 - 10);
|
|
||||||
$label->setText("Avatar");
|
|
||||||
$label->setTextSize(1.3);
|
|
||||||
$label->setHAlign(Control::RIGHT);
|
|
||||||
|
|
||||||
$quad = new Quad();
|
$quad = new Quad();
|
||||||
$frame->add($quad);
|
$frame->add($quad);
|
||||||
$quad->setImage('file://' . $target->avatar);
|
$quad->setImage('file://' . $target->avatar);
|
||||||
$quad->setPosition($this->width / 2 - 10, $this->height / 2 - 10);
|
$quad->setPosition(-$this->width / 2 + 50, -$this->height / 2 + 34);
|
||||||
$quad->setAlign(Control::RIGHT, Control::TOP);
|
$quad->setAlign(Control::RIGHT, Control::TOP);
|
||||||
$quad->setSize(20, 20);
|
$quad->setSize(20, 20);
|
||||||
|
|
||||||
@ -216,7 +200,7 @@ class PlayerDetailed {
|
|||||||
$quad->setStyle($quad::STYLE_CardMain_Quit);
|
$quad->setStyle($quad::STYLE_CardMain_Quit);
|
||||||
$quad->setHAlign(Control::LEFT);
|
$quad->setHAlign(Control::LEFT);
|
||||||
$quad->setScale(0.75);
|
$quad->setScale(0.75);
|
||||||
$quad->setText("Back to Playerlist");
|
$quad->setText("Back");
|
||||||
$quad->setPosition(-$this->width / 2 + 7, -$this->height / 2 + 7);
|
$quad->setPosition(-$this->width / 2 + 7, -$this->height / 2 + 7);
|
||||||
$quad->setAction(PlayerCommands::ACTION_OPEN_PLAYERLIST);
|
$quad->setAction(PlayerCommands::ACTION_OPEN_PLAYERLIST);
|
||||||
|
|
||||||
@ -227,21 +211,19 @@ class PlayerDetailed {
|
|||||||
public function statisticsFrame($player) {
|
public function statisticsFrame($player) {
|
||||||
$frame = new Frame();
|
$frame = new Frame();
|
||||||
|
|
||||||
/*$mainLabel = new Label_Text();
|
|
||||||
$frame->add($mainLabel);
|
|
||||||
$mainLabel->setPosition(-$this->width / 2 + 50, $this->height / 2 - 10);
|
|
||||||
$mainLabel->setTextSize(1.2);
|
|
||||||
$mainLabel->setHAlign(Control::LEFT);
|
|
||||||
$mainLabel->setText("Statistics");*/
|
|
||||||
|
|
||||||
$playerStats = $this->maniaControl->statisticManager->getAllPlayerStats($player);
|
$playerStats = $this->maniaControl->statisticManager->getAllPlayerStats($player);
|
||||||
|
|
||||||
$y = $this->height / 2 - 15;
|
$y = $this->height / 2 - 15;
|
||||||
|
$x = -$this->width / 2 + 52;
|
||||||
$id = 1;
|
$id = 1;
|
||||||
foreach($playerStats as $stat) {
|
foreach($playerStats as $stat) {
|
||||||
$statProperties = $stat[0];
|
$statProperties = $stat[0];
|
||||||
$value = $stat[1];
|
$value = $stat[1];
|
||||||
|
|
||||||
|
if ((int)$value == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if ($statProperties->type == StatisticManager::STAT_TYPE_TIME) {
|
if ($statProperties->type == StatisticManager::STAT_TYPE_TIME) {
|
||||||
$value = Formatter::formatTimeH($value);
|
$value = Formatter::formatTimeH($value);
|
||||||
}
|
}
|
||||||
@ -251,26 +233,32 @@ class PlayerDetailed {
|
|||||||
$frame->add($lineQuad);
|
$frame->add($lineQuad);
|
||||||
$lineQuad->setSize(49, 4);
|
$lineQuad->setSize(49, 4);
|
||||||
$lineQuad->setSubStyle($lineQuad::SUBSTYLE_BgPlayerCardBig);
|
$lineQuad->setSubStyle($lineQuad::SUBSTYLE_BgPlayerCardBig);
|
||||||
$lineQuad->setPosition(-$this->width / 2 + 66, $y, 0.001);
|
$lineQuad->setPosition($x, $y, 0.001);
|
||||||
$lineQuad->setHAlign(Control::LEFT);
|
$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($x + 4, $y);
|
||||||
$label->setText($statProperties->name);
|
$label->setText($statProperties->name);
|
||||||
$label->setHAlign(Control::LEFT);
|
$label->setHAlign(Control::LEFT);
|
||||||
$label->setTextSize(1.5);
|
$label->setTextSize(1.5);
|
||||||
|
|
||||||
$label = new Label_Text();
|
$label = new Label_Text();
|
||||||
$frame->add($label);
|
$frame->add($label);
|
||||||
$label->setPosition(-$this->width / 2 + 100, $y);
|
$label->setPosition($x + 40, $y);
|
||||||
$label->setText($value);
|
$label->setText($value);
|
||||||
$label->setHAlign(Control::LEFT);
|
$label->setVAlign(Control::CENTER2);
|
||||||
$label->setTextSize(1.5);
|
$label->setTextSize(1.5);
|
||||||
|
|
||||||
$y -= 4;
|
$y -= 4;
|
||||||
$id++;
|
$id++;
|
||||||
|
|
||||||
|
if ($id > self::STATS_PER_COLUMN) {
|
||||||
|
$y = $this->height / 2 - 15;
|
||||||
|
$x += 47;
|
||||||
|
$id = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $frame;
|
return $frame;
|
||||||
}
|
}
|
||||||
|
@ -32,13 +32,13 @@ class StatisticCollector implements CallbackListener {
|
|||||||
const STAT_ON_PLAYER_REQUEST_RESPAWN = 'Respawns';
|
const STAT_ON_PLAYER_REQUEST_RESPAWN = 'Respawns';
|
||||||
const STAT_ON_KILL = 'Kills';
|
const STAT_ON_KILL = 'Kills';
|
||||||
const STAT_LASER_SHOT = 'Laser Shots';
|
const STAT_LASER_SHOT = 'Laser Shots';
|
||||||
const STAT_LASER_HIT = 'Laser Hit';
|
const STAT_LASER_HIT = 'Laser Hits';
|
||||||
const STAT_ROCKET_SHOT = 'Rocket Shots';
|
const STAT_ROCKET_SHOT = 'Rocket Shots';
|
||||||
const STAT_ROCKET_HIT = 'Rocket Hit';
|
const STAT_ROCKET_HIT = 'Rocket Hits';
|
||||||
const STAT_ARROW_SHOT = 'Arrow Shots';
|
const STAT_ARROW_SHOT = 'Arrow Shots';
|
||||||
const STAT_ARROW_HIT = 'Arrow Hit';
|
const STAT_ARROW_HIT = 'Arrow Hits';
|
||||||
const STAT_NUCLEUS_SHOT = 'Nucleus Shots';
|
const STAT_NUCLEUS_SHOT = 'Nucleus Shots';
|
||||||
const STAT_NUCLEUS_HIT = 'Nucleus Hit';
|
const STAT_NUCLEUS_HIT = 'Nucleus Hits';
|
||||||
|
|
||||||
const SPECIAL_STAT_KILL_DEATH_RATIO = 'Kill / Death';
|
const SPECIAL_STAT_KILL_DEATH_RATIO = 'Kill / Death';
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user