performance improve

This commit is contained in:
kremsy 2017-05-12 22:11:20 +02:00
parent dcdb15286a
commit 6908ff36e4
2 changed files with 8 additions and 7 deletions

View File

@ -73,10 +73,11 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener,
$itemQuad->setSubStyle($itemQuad::SUBSTYLE_Stats); $itemQuad->setSubStyle($itemQuad::SUBSTYLE_Stats);
$itemQuad->setAction(self::ACTION_OPEN_STATSLIST); $itemQuad->setAction(self::ACTION_OPEN_STATSLIST);
$this->maniaControl->getActionsMenu()->addMenuItem($itemQuad, true, 14, 'Open Statistics'); $this->maniaControl->getActionsMenu()->addMenuItem($itemQuad, true, 14, 'Open Statistics');
//TODO Chunking
//TODO settings if a stat get shown //TODO settings if a stat get shown
$this->registerStat(PlayerManager::STAT_SERVERTIME, 10, "ST", 20, StatisticManager::STAT_TYPE_TIME); $this->registerStat(PlayerManager::STAT_SERVERTIME, 10, "ST", 20, StatisticManager::STAT_TYPE_TIME);
$this->registerStat(StatisticCollector::STAT_ON_HIT, 20, "H"); $this->registerStat(StatisticCollector::STAT_ARROW_HIT, 20, "H");
$this->registerStat(StatisticCollector::STAT_ON_NEARMISS, 30, "NM"); $this->registerStat(StatisticCollector::STAT_ON_NEARMISS, 30, "NM");
$this->registerStat(StatisticCollector::STAT_ON_KILL, 40, "K"); $this->registerStat(StatisticCollector::STAT_ON_KILL, 40, "K");
$this->registerStat(StatisticCollector::STAT_ON_DEATH, 50, "D"); $this->registerStat(StatisticCollector::STAT_ON_DEATH, 50, "D");
@ -128,6 +129,7 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener,
$quadSubstyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultMainWindowSubStyle(); $quadSubstyle = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultMainWindowSubStyle();
$order = StatisticCollector::STAT_ARROW_HIT;
$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID); $maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID);
$width = $this->statsWidth + 60; $width = $this->statsWidth + 60;
//TODO handle size when stats are empty //TODO handle size when stats are empty
@ -211,7 +213,6 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener,
} }
$i = 0;
foreach ($statRankings[$order] as $playerId => $value) { foreach ($statRankings[$order] as $playerId => $value) {
if ($index % self::MAX_PLAYERS_PER_PAGE === 1) { if ($index % self::MAX_PLAYERS_PER_PAGE === 1) {
$pageFrame = new Frame(); $pageFrame = new Frame();
@ -264,7 +265,7 @@ $i = 0;
} }
$labelLine->addLabelEntryText($index, $xStart + 5, 9); $labelLine->addLabelEntryText($index, $xStart + 5, 9);
$labelLine->addLabelEntryText($listPlayer->nickname, $xStart + 14, 41); $labelLine->addLabelEntryText($listPlayer->login, $xStart + 14, 41);
$labelLine->render(); $labelLine->render();
$playerFrame->setY($posY); $playerFrame->setY($posY);

View File

@ -202,7 +202,7 @@ class StatisticManager implements UsageInformationAble {
* @internal param $orderedBy * @internal param $orderedBy
* @return array * @return array
*/ */
public function getStatsRanking($statName = '', $serverIndex = -1, $minValue = -1, $limit = 500) { public function getStatsRanking($statName = '', $serverIndex = -1, $minValue = -1, $limit = 200) {
if (isset($this->specialStats[$statName])) { if (isset($this->specialStats[$statName])) {
return $this->getStatsRankingOfSpecialStat($statName, $serverIndex, $limit); return $this->getStatsRankingOfSpecialStat($statName, $serverIndex, $limit);
} }
@ -218,7 +218,7 @@ class StatisticManager implements UsageInformationAble {
$query .= "ORDER BY `value` DESC"; $query .= "ORDER BY `value` DESC";
if ($limit > 0) { if ($limit > 0) {
$query .= " LIMIT 500"; $query .= " LIMIT " . $limit;
} }
$query .= ";"; $query .= ";";
@ -256,7 +256,7 @@ class StatisticManager implements UsageInformationAble {
* @param int $limit * @param int $limit
* @return array * @return array
*/ */
public function getStatsRankingOfSpecialStat($statName = '', $serverIndex = -1, $limit = 500) { public function getStatsRankingOfSpecialStat($statName = '', $serverIndex = -1, $limit = 200) {
$statsArray = array(); $statsArray = array();
switch ($statName) { switch ($statName) {
case self::SPECIAL_STAT_KD_RATIO: case self::SPECIAL_STAT_KD_RATIO: