From 4948d5219cad9e449a032d1b7fba15ea30b3c8f3 Mon Sep 17 00:00:00 2001 From: beu Date: Sun, 3 Apr 2022 11:57:36 +0200 Subject: [PATCH] Keep search field & allow search by nickname --- core/Maps/MapCommands.php | 2 +- core/Maps/MapList.php | 8 ++++---- core/Maps/MapManager.php | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/Maps/MapCommands.php b/core/Maps/MapCommands.php index bfc49130..b5d7c607 100644 --- a/core/Maps/MapCommands.php +++ b/core/Maps/MapCommands.php @@ -418,7 +418,7 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb return; } - $this->maniaControl->getMapManager()->getMapList()->showMapList($player, $mapList); + $this->maniaControl->getMapManager()->getMapList()->showMapList($player, $mapList, -1, $author); } /** diff --git a/core/Maps/MapList.php b/core/Maps/MapList.php index 5c7de992..d4dc0652 100644 --- a/core/Maps/MapList.php +++ b/core/Maps/MapList.php @@ -124,7 +124,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { * @param Map[] $mapList * @param int $pageIndex */ - public function showMapList(Player $player, $mapList = null, $pageIndex = -1) { + public function showMapList(Player $player, $mapList = null, $pageIndex = -1, $entryvalue = "") { $width = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsWidth(); $height = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsHeight(); $buttonY = -$height / 2 + 9; @@ -210,7 +210,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { $labelLine->setY(-7); $labelLine->render(); - $searchFrame = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultMapSearch(self::ACTION_SEARCH_MAP_NAME, self::ACTION_SEARCH_AUTHOR, self::ACTION_RESET); + $searchFrame = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultMapSearch(self::ACTION_SEARCH_MAP_NAME, self::ACTION_SEARCH_AUTHOR, self::ACTION_RESET, $entryvalue); $headFrame->addChild($searchFrame); // Predefine description Label @@ -690,7 +690,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { } else { $maps = null; } - $this->showMapList($player, $maps); + $this->showMapList($player, $maps, -1, $searchString); } @@ -711,7 +711,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { $maps = null; } - $this->showMapList($player, $maps); + $this->showMapList($player, $maps, -1, $searchString); } /** diff --git a/core/Maps/MapManager.php b/core/Maps/MapManager.php index b31e0446..7557eab5 100644 --- a/core/Maps/MapManager.php +++ b/core/Maps/MapManager.php @@ -1077,7 +1077,7 @@ class MapManager implements CallbackListener, CommunicationListener, UsageInform } break; case self::SEARCH_BY_AUTHOR: - if (strpos(strtolower($map->authorLogin), $searchString) !== false) { + if (strpos(strtolower($map->authorLogin), $searchString) !== false || strpos(strtolower($map->authorNick), $searchString) !== false) { array_push($result, $map); } }