mxlist improvements
This commit is contained in:
parent
160d10b766
commit
051c7a916b
@ -12,17 +12,17 @@ abstract class Formatter {
|
||||
/**
|
||||
* Formats the given Time (Milliseconds)
|
||||
*
|
||||
* @param int $time
|
||||
* @param int $time
|
||||
* @return string
|
||||
*/
|
||||
public static function formatTime($time) {
|
||||
if (!is_int($time)) {
|
||||
$time = (int) $time;
|
||||
if(!is_int($time)) {
|
||||
$time = (int)$time;
|
||||
}
|
||||
$milliseconds = $time % 1000;
|
||||
$seconds = floor($time / 1000);
|
||||
$minutes = floor($seconds / 60);
|
||||
$hours = floor($minutes / 60);
|
||||
$seconds = floor($time / 1000);
|
||||
$minutes = floor($seconds / 60);
|
||||
$hours = floor($minutes / 60);
|
||||
$minutes -= $hours * 60;
|
||||
$seconds -= $hours * 60 + $minutes * 60;
|
||||
$format = ($hours > 0 ? $hours . ':' : '');
|
||||
@ -32,10 +32,34 @@ abstract class Formatter {
|
||||
return $format;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formatts a Elapset time String (2 days ago...) by a given timestamp
|
||||
*
|
||||
* @param $ptime
|
||||
* @return string
|
||||
*/
|
||||
public static function time_elapsed_string($ptime) {
|
||||
$etime = time() - $ptime;
|
||||
|
||||
if($etime < 1) {
|
||||
return '0 seconds';
|
||||
}
|
||||
|
||||
$a = array(12 * 30 * 24 * 60 * 60 => 'year', 30 * 24 * 60 * 60 => 'month', 24 * 60 * 60 => 'day', 60 * 60 => 'hour', 60 => 'minute', 1 => 'second');
|
||||
|
||||
foreach($a as $secs => $str) {
|
||||
$d = $etime / $secs;
|
||||
if($d >= 1) {
|
||||
$r = round($d);
|
||||
return $r . ' ' . $str . ($r > 1 ? 's' : '') . ' ago';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats the given Time (Seconds) to hh:mm:ss
|
||||
*
|
||||
* @param int $seconds
|
||||
* @param int $seconds
|
||||
* @return string
|
||||
*/
|
||||
public static function formatTimeH($seconds) {
|
||||
@ -45,7 +69,7 @@ abstract class Formatter {
|
||||
/**
|
||||
* Convert the given Time (Seconds) to MySQL Timestamp
|
||||
*
|
||||
* @param int $seconds
|
||||
* @param int $seconds
|
||||
* @return string
|
||||
*/
|
||||
public static function formatTimestamp($seconds) {
|
||||
@ -56,7 +80,7 @@ abstract class Formatter {
|
||||
* Remove possibly dangerous Codes
|
||||
* (Dangerous Codes are Links and Formats that might screw up the following Styling)
|
||||
*
|
||||
* @param string $string
|
||||
* @param string $string
|
||||
* @return string
|
||||
*/
|
||||
public static function stripDirtyCodes($string) {
|
||||
@ -68,7 +92,7 @@ abstract class Formatter {
|
||||
/**
|
||||
* Remove all Codes from the String
|
||||
*
|
||||
* @param string $string
|
||||
* @param string $string
|
||||
* @return string
|
||||
*/
|
||||
public static function stripCodes($string) {
|
||||
@ -81,7 +105,7 @@ abstract class Formatter {
|
||||
/**
|
||||
* Remove Links from the String
|
||||
*
|
||||
* @param string $string
|
||||
* @param string $string
|
||||
* @return string
|
||||
*/
|
||||
public static function stripLinks($string) {
|
||||
@ -91,7 +115,7 @@ abstract class Formatter {
|
||||
/**
|
||||
* Remove Colors from the String
|
||||
*
|
||||
* @param string $string
|
||||
* @param string $string
|
||||
* @return string
|
||||
*/
|
||||
public static function stripColors($string) {
|
||||
@ -104,50 +128,18 @@ abstract class Formatter {
|
||||
* Based on http://en.wikipedia.org/wiki/List_of_IOC_country_codes
|
||||
* See also http://en.wikipedia.org/wiki/Comparison_of_IOC,_FIFA,_and_ISO_3166_country_codes
|
||||
*
|
||||
* @param string $country
|
||||
* @param string $country
|
||||
* @return string
|
||||
*/
|
||||
public static function mapCountry($country) {
|
||||
$nations = array('Afghanistan' => 'AFG', 'Albania' => 'ALB', 'Algeria' => 'ALG', 'Andorra' => 'AND', 'Angola' => 'ANG',
|
||||
'Argentina' => 'ARG', 'Armenia' => 'ARM', 'Aruba' => 'ARU', 'Australia' => 'AUS', 'Austria' => 'AUT', 'Azerbaijan' => 'AZE',
|
||||
'Bahamas' => 'BAH', 'Bahrain' => 'BRN', 'Bangladesh' => 'BAN', 'Barbados' => 'BAR', 'Belarus' => 'BLR', 'Belgium' => 'BEL',
|
||||
'Belize' => 'BIZ', 'Benin' => 'BEN', 'Bermuda' => 'BER', 'Bhutan' => 'BHU', 'Bolivia' => 'BOL',
|
||||
'Bosnia&Herzegovina' => 'BIH', 'Botswana' => 'BOT', 'Brazil' => 'BRA', 'Brunei' => 'BRU', 'Bulgaria' => 'BUL',
|
||||
'Burkina Faso' => 'BUR', 'Burundi' => 'BDI', 'Cambodia' => 'CAM', 'Cameroon' => 'CAR', // actually CMR
|
||||
'Canada' => 'CAN', 'Cape Verde' => 'CPV', 'Central African Republic' => 'CAF', 'Chad' => 'CHA', 'Chile' => 'CHI',
|
||||
'China' => 'CHN', 'Chinese Taipei' => 'TPE', 'Colombia' => 'COL', 'Congo' => 'CGO', 'Costa Rica' => 'CRC',
|
||||
'Croatia' => 'CRO', 'Cuba' => 'CUB', 'Cyprus' => 'CYP', 'Czech Republic' => 'CZE', 'Czech republic' => 'CZE',
|
||||
'DR Congo' => 'COD', 'Denmark' => 'DEN', 'Djibouti' => 'DJI', 'Dominica' => 'DMA', 'Dominican Republic' => 'DOM',
|
||||
'Ecuador' => 'ECU', 'Egypt' => 'EGY', 'El Salvador' => 'ESA', 'Eritrea' => 'ERI', 'Estonia' => 'EST', 'Ethiopia' => 'ETH',
|
||||
'Fiji' => 'FIJ', 'Finland' => 'FIN', 'France' => 'FRA', 'Gabon' => 'GAB', 'Gambia' => 'GAM', 'Georgia' => 'GEO',
|
||||
'Germany' => 'GER', 'Ghana' => 'GHA', 'Greece' => 'GRE', 'Grenada' => 'GRN', 'Guam' => 'GUM', 'Guatemala' => 'GUA',
|
||||
'Guinea' => 'GUI', 'Guinea-Bissau' => 'GBS', 'Guyana' => 'GUY', 'Haiti' => 'HAI', 'Honduras' => 'HON', 'Hong Kong' => 'HKG',
|
||||
'Hungary' => 'HUN', 'Iceland' => 'ISL', 'India' => 'IND', 'Indonesia' => 'INA', 'Iran' => 'IRI', 'Iraq' => 'IRQ',
|
||||
'Ireland' => 'IRL', 'Israel' => 'ISR', 'Italy' => 'ITA', 'Ivory Coast' => 'CIV', 'Jamaica' => 'JAM', 'Japan' => 'JPN',
|
||||
'Jordan' => 'JOR', 'Kazakhstan' => 'KAZ', 'Kenya' => 'KEN', 'Kiribati' => 'KIR', 'Korea' => 'KOR', 'Kuwait' => 'KUW',
|
||||
'Kyrgyzstan' => 'KGZ', 'Laos' => 'LAO', 'Latvia' => 'LAT', 'Lebanon' => 'LIB', 'Lesotho' => 'LES', 'Liberia' => 'LBR',
|
||||
'Libya' => 'LBA', 'Liechtenstein' => 'LIE', 'Lithuania' => 'LTU', 'Luxembourg' => 'LUX', 'Macedonia' => 'MKD',
|
||||
'Malawi' => 'MAW', 'Malaysia' => 'MAS', 'Mali' => 'MLI', 'Malta' => 'MLT', 'Mauritania' => 'MTN', 'Mauritius' => 'MRI',
|
||||
'Mexico' => 'MEX', 'Moldova' => 'MDA', 'Monaco' => 'MON', 'Mongolia' => 'MGL', 'Montenegro' => 'MNE', 'Morocco' => 'MAR',
|
||||
'Mozambique' => 'MOZ', 'Myanmar' => 'MYA', 'Namibia' => 'NAM', 'Nauru' => 'NRU', 'Nepal' => 'NEP', 'Netherlands' => 'NED',
|
||||
'New Zealand' => 'NZL', 'Nicaragua' => 'NCA', 'Niger' => 'NIG', 'Nigeria' => 'NGR', 'Norway' => 'NOR', 'Oman' => 'OMA',
|
||||
'Other Countries' => 'OTH', 'Pakistan' => 'PAK', 'Palau' => 'PLW', 'Palestine' => 'PLE', 'Panama' => 'PAN',
|
||||
'Paraguay' => 'PAR', 'Peru' => 'PER', 'Philippines' => 'PHI', 'Poland' => 'POL', 'Portugal' => 'POR',
|
||||
'Puerto Rico' => 'PUR', 'Qatar' => 'QAT', 'Romania' => 'ROM', // actually ROU
|
||||
'Russia' => 'RUS', 'Rwanda' => 'RWA', 'Samoa' => 'SAM', 'San Marino' => 'SMR', 'Saudi Arabia' => 'KSA', 'Senegal' => 'SEN',
|
||||
'Serbia' => 'SCG', // actually SRB
|
||||
'Sierra Leone' => 'SLE', 'Singapore' => 'SIN', 'Slovakia' => 'SVK', 'Slovenia' => 'SLO', 'Somalia' => 'SOM',
|
||||
'South Africa' => 'RSA', 'Spain' => 'ESP', 'Sri Lanka' => 'SRI', 'Sudan' => 'SUD', 'Suriname' => 'SUR',
|
||||
'Swaziland' => 'SWZ', 'Sweden' => 'SWE', 'Switzerland' => 'SUI', 'Syria' => 'SYR', 'Taiwan' => 'TWN', 'Tajikistan' => 'TJK',
|
||||
'Tanzania' => 'TAN', 'Thailand' => 'THA', 'Togo' => 'TOG', 'Tonga' => 'TGA', 'Trinidad and Tobago' => 'TRI',
|
||||
'Tunisia' => 'TUN', 'Turkey' => 'TUR', 'Turkmenistan' => 'TKM', 'Tuvalu' => 'TUV', 'Uganda' => 'UGA', 'Ukraine' => 'UKR',
|
||||
'United Arab Emirates' => 'UAE', 'United Kingdom' => 'GBR', 'United States of America' => 'USA', 'Uruguay' => 'URU',
|
||||
'Uzbekistan' => 'UZB', 'Vanuatu' => 'VAN', 'Venezuela' => 'VEN', 'Vietnam' => 'VIE', 'Yemen' => 'YEM', 'Zambia' => 'ZAM',
|
||||
'Zimbabwe' => 'ZIM');
|
||||
if (array_key_exists($country, $nations)) {
|
||||
$nations = array('Afghanistan' => 'AFG', 'Albania' => 'ALB', 'Algeria' => 'ALG', 'Andorra' => 'AND', 'Angola' => 'ANG', 'Argentina' => 'ARG', 'Armenia' => 'ARM', 'Aruba' => 'ARU', 'Australia' => 'AUS', 'Austria' => 'AUT', 'Azerbaijan' => 'AZE', 'Bahamas' => 'BAH', 'Bahrain' => 'BRN', 'Bangladesh' => 'BAN', 'Barbados' => 'BAR', 'Belarus' => 'BLR', 'Belgium' => 'BEL', 'Belize' => 'BIZ', 'Benin' => 'BEN', 'Bermuda' => 'BER', 'Bhutan' => 'BHU', 'Bolivia' => 'BOL', 'Bosnia&Herzegovina' => 'BIH', 'Botswana' => 'BOT', 'Brazil' => 'BRA', 'Brunei' => 'BRU', 'Bulgaria' => 'BUL', 'Burkina Faso' => 'BUR', 'Burundi' => 'BDI', 'Cambodia' => 'CAM', 'Cameroon' => 'CAR', // actually CMR
|
||||
'Canada' => 'CAN', 'Cape Verde' => 'CPV', 'Central African Republic' => 'CAF', 'Chad' => 'CHA', 'Chile' => 'CHI', 'China' => 'CHN', 'Chinese Taipei' => 'TPE', 'Colombia' => 'COL', 'Congo' => 'CGO', 'Costa Rica' => 'CRC', 'Croatia' => 'CRO', 'Cuba' => 'CUB', 'Cyprus' => 'CYP', 'Czech Republic' => 'CZE', 'Czech republic' => 'CZE', 'DR Congo' => 'COD', 'Denmark' => 'DEN', 'Djibouti' => 'DJI', 'Dominica' => 'DMA', 'Dominican Republic' => 'DOM', 'Ecuador' => 'ECU', 'Egypt' => 'EGY', 'El Salvador' => 'ESA', 'Eritrea' => 'ERI', 'Estonia' => 'EST', 'Ethiopia' => 'ETH', 'Fiji' => 'FIJ', 'Finland' => 'FIN', 'France' => 'FRA', 'Gabon' => 'GAB', 'Gambia' => 'GAM', 'Georgia' => 'GEO', 'Germany' => 'GER', 'Ghana' => 'GHA', 'Greece' => 'GRE', 'Grenada' => 'GRN', 'Guam' => 'GUM', 'Guatemala' => 'GUA', 'Guinea' => 'GUI', 'Guinea-Bissau' => 'GBS', 'Guyana' => 'GUY', 'Haiti' => 'HAI', 'Honduras' => 'HON', 'Hong Kong' => 'HKG', 'Hungary' => 'HUN', 'Iceland' => 'ISL', 'India' => 'IND', 'Indonesia' => 'INA', 'Iran' => 'IRI', 'Iraq' => 'IRQ', 'Ireland' => 'IRL', 'Israel' => 'ISR', 'Italy' => 'ITA', 'Ivory Coast' => 'CIV', 'Jamaica' => 'JAM', 'Japan' => 'JPN', 'Jordan' => 'JOR', 'Kazakhstan' => 'KAZ', 'Kenya' => 'KEN', 'Kiribati' => 'KIR', 'Korea' => 'KOR', 'Kuwait' => 'KUW', 'Kyrgyzstan' => 'KGZ', 'Laos' => 'LAO', 'Latvia' => 'LAT', 'Lebanon' => 'LIB', 'Lesotho' => 'LES', 'Liberia' => 'LBR', 'Libya' => 'LBA', 'Liechtenstein' => 'LIE', 'Lithuania' => 'LTU', 'Luxembourg' => 'LUX', 'Macedonia' => 'MKD', 'Malawi' => 'MAW', 'Malaysia' => 'MAS', 'Mali' => 'MLI', 'Malta' => 'MLT', 'Mauritania' => 'MTN', 'Mauritius' => 'MRI', 'Mexico' => 'MEX', 'Moldova' => 'MDA', 'Monaco' => 'MON', 'Mongolia' => 'MGL', 'Montenegro' => 'MNE', 'Morocco' => 'MAR', 'Mozambique' => 'MOZ', 'Myanmar' => 'MYA', 'Namibia' => 'NAM', 'Nauru' => 'NRU', 'Nepal' => 'NEP', 'Netherlands' => 'NED', 'New Zealand' => 'NZL', 'Nicaragua' => 'NCA', 'Niger' => 'NIG', 'Nigeria' => 'NGR', 'Norway' => 'NOR', 'Oman' => 'OMA', 'Other Countries' => 'OTH', 'Pakistan' => 'PAK', 'Palau' => 'PLW', 'Palestine' => 'PLE', 'Panama' => 'PAN', 'Paraguay' => 'PAR', 'Peru' => 'PER', 'Philippines' => 'PHI', 'Poland' => 'POL', 'Portugal' => 'POR', 'Puerto Rico' => 'PUR', 'Qatar' => 'QAT', 'Romania' => 'ROM', // actually ROU
|
||||
'Russia' => 'RUS', 'Rwanda' => 'RWA', 'Samoa' => 'SAM', 'San Marino' => 'SMR', 'Saudi Arabia' => 'KSA', 'Senegal' => 'SEN', 'Serbia' => 'SCG', // actually SRB
|
||||
'Sierra Leone' => 'SLE', 'Singapore' => 'SIN', 'Slovakia' => 'SVK', 'Slovenia' => 'SLO', 'Somalia' => 'SOM', 'South Africa' => 'RSA', 'Spain' => 'ESP', 'Sri Lanka' => 'SRI', 'Sudan' => 'SUD', 'Suriname' => 'SUR', 'Swaziland' => 'SWZ', 'Sweden' => 'SWE', 'Switzerland' => 'SUI', 'Syria' => 'SYR', 'Taiwan' => 'TWN', 'Tajikistan' => 'TJK', 'Tanzania' => 'TAN', 'Thailand' => 'THA', 'Togo' => 'TOG', 'Tonga' => 'TGA', 'Trinidad and Tobago' => 'TRI', 'Tunisia' => 'TUN', 'Turkey' => 'TUR', 'Turkmenistan' => 'TKM', 'Tuvalu' => 'TUV', 'Uganda' => 'UGA', 'Ukraine' => 'UKR', 'United Arab Emirates' => 'UAE', 'United Kingdom' => 'GBR', 'United States of America' => 'USA', 'Uruguay' => 'URU', 'Uzbekistan' => 'UZB', 'Vanuatu' => 'VAN', 'Venezuela' => 'VEN', 'Vietnam' => 'VIE', 'Yemen' => 'YEM', 'Zambia' => 'ZAM', 'Zimbabwe' => 'ZIM');
|
||||
if(array_key_exists($country, $nations)) {
|
||||
return $nations[$country];
|
||||
}
|
||||
if ($country) {
|
||||
if($country) {
|
||||
trigger_error("Couldn't map Country: '{$country}'!");
|
||||
}
|
||||
return 'OTH';
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace ManiaControl\Maps;
|
||||
|
||||
use FML\Controls\Control;
|
||||
use FML\Controls\Entry;
|
||||
use FML\Controls\Frame;
|
||||
use FML\Controls\Gauge;
|
||||
use FML\Controls\Label;
|
||||
@ -33,14 +34,17 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
/**
|
||||
* Constants
|
||||
*/
|
||||
const ACTION_ADD_MAP = 'MapList.AddMap';
|
||||
const ACTION_ERASE_MAP = 'MapList.EraseMap';
|
||||
const ACTION_SWITCH_MAP = 'MapList.SwitchMap';
|
||||
const ACTION_QUEUED_MAP = 'MapList.QueueMap';
|
||||
const MAX_MAPS_PER_PAGE = 15;
|
||||
const SHOW_MX_LIST = 1;
|
||||
const SHOW_MAP_LIST = 2;
|
||||
const DEFAULT_KARMA_PLUGIN = 'KarmaPlugin';
|
||||
const ACTION_ADD_MAP = 'MapList.AddMap';
|
||||
const ACTION_SEARCH_MAPNAME = 'MapList.SearchMapName';
|
||||
const ACTION_SEARCH_AUTHOR = 'MapList.SearchAuthor';
|
||||
const ACTION_ERASE_MAP = 'MapList.EraseMap';
|
||||
const ACTION_SWITCH_MAP = 'MapList.SwitchMap';
|
||||
const ACTION_QUEUED_MAP = 'MapList.QueueMap';
|
||||
const MAX_MAPS_PER_PAGE = 15;
|
||||
const MAX_MX_MAPS_PER_PAGE = 14;
|
||||
const SHOW_MX_LIST = 1;
|
||||
const SHOW_MAP_LIST = 2;
|
||||
const DEFAULT_KARMA_PLUGIN = 'KarmaPlugin';
|
||||
|
||||
/**
|
||||
* Private Properties
|
||||
@ -64,8 +68,12 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
$this->maniaControl->callbackManager->registerCallbackListener(MapManager::CB_KARMA_UPDATED, $this, 'updateWidget');
|
||||
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_BEGINMAP, $this, 'updateWidget');
|
||||
// TODO not working yet
|
||||
|
||||
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_SEARCH_MAPNAME, $this, 'showManiaExchangeList');
|
||||
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_SEARCH_AUTHOR, $this, 'showManiaExchangeList');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Display the Mania Exchange List
|
||||
*
|
||||
@ -85,9 +93,13 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
if($param == '/xlist' || $param == MapCommands::ACTION_OPEN_XLIST) {
|
||||
continue;
|
||||
}
|
||||
if(strtolower(substr($param, 0, 5)) == 'auth:') {
|
||||
if($param == self::ACTION_SEARCH_MAPNAME) {
|
||||
$searchString = $chatCallback[1][3][0]['Value'];
|
||||
} else if($param == self::ACTION_SEARCH_AUTHOR) {
|
||||
$author = $chatCallback[1][3][0]['Value'];
|
||||
} else if(strtolower(substr($param, 0, 5)) == 'auth:') {
|
||||
$author = substr($param, 5);
|
||||
} elseif(strtolower(substr($param, 0, 4)) == 'env:') {
|
||||
} else if(strtolower(substr($param, 0, 4)) == 'env:') {
|
||||
$environment = substr($param, 4);
|
||||
} else {
|
||||
if($searchString == '') {
|
||||
@ -100,7 +112,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
}
|
||||
|
||||
// search for matching maps
|
||||
$maps = $this->maniaControl->mapManager->mxInfoSearcher->getMaps($searchString, $author, $environment, 15);
|
||||
$maps = $this->maniaControl->mapManager->mxInfoSearcher->getMaps($searchString, $author, $environment, self::MAX_MX_MAPS_PER_PAGE);
|
||||
|
||||
// check if there are any results
|
||||
if($maps == null) {
|
||||
@ -126,15 +138,19 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
$headFrame = new Frame();
|
||||
$frame->add($headFrame);
|
||||
$headFrame->setY($y - 5);
|
||||
$array = array('Id' => $x + 5, 'Name' => $x + 17, 'Author' => $x + 65, 'Mood' => $x + 100, 'Type' => $x + 115);
|
||||
$array = array('Id' => $x + 5, 'Name' => $x + 17, 'Author' => $x + 65, 'Type' => $x + 100, 'Mood' => $x + 115, 'Updated' => $x + 130);
|
||||
$this->maniaControl->manialinkManager->labelLine($headFrame, $array);
|
||||
|
||||
$i = 0;
|
||||
$y -= 10;
|
||||
foreach($maps as $map) { //TODO pagers, search entry, click on nickname...
|
||||
foreach($maps as $map) { //TODO pagers, click on nickname...
|
||||
/** @var MxMapInfo $map */
|
||||
|
||||
$time = Formatter::time_elapsed_string(strtotime($map->updated));
|
||||
|
||||
$mapFrame = new Frame();
|
||||
$frame->add($mapFrame);
|
||||
$array = array($map->id => $x + 5, $map->name => $x + 17, $map->author => $x + 65, $map->mood => $x + 100, $map->maptype => $x + 115);
|
||||
$array = array($map->id => $x + 5, $map->name => $x + 17, $map->author => $x + 65, str_replace("Arena", "", $map->maptype) => $x + 100, $map->mood => $x + 115, $time => $x + 130);
|
||||
$this->maniaControl->manialinkManager->labelLine($mapFrame, $array);
|
||||
$mapFrame->setY($y);
|
||||
|
||||
@ -162,11 +178,57 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
|
||||
$y -= 4;
|
||||
$i++;
|
||||
if($i == self::MAX_MAPS_PER_PAGE) {
|
||||
if($i == self::MAX_MX_MAPS_PER_PAGE) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$label = new Label_Text();
|
||||
$frame->add($label);
|
||||
$label->setPosition(-$width / 2 + 5, -$height / 2 + 10);
|
||||
$label->setHAlign(Control::LEFT);
|
||||
$label->setTextSize(1.3);
|
||||
$label->setText("Search:");
|
||||
|
||||
$entry = new Entry();
|
||||
$frame->add($entry);
|
||||
$entry->setStyle(Label_Text::STYLE_TextValueSmall);
|
||||
$entry->setHAlign(Control::LEFT);
|
||||
$entry->setPosition(-$width / 2 + 15, -$height / 2 + 10);
|
||||
$entry->setTextSize(1);
|
||||
$entry->setSize($width * 0.25, 4);
|
||||
$entry->setName('SearchString');
|
||||
|
||||
|
||||
//Search for Map-Name
|
||||
$label = new Label_Button();
|
||||
$frame->add($label);
|
||||
$label->setPosition(-$width / 2 + 63, -$height / 2 + 10);
|
||||
$label->setText("MapName");
|
||||
$label->setTextSize(1.3);
|
||||
|
||||
$quad = new Quad_BgsPlayerCard();
|
||||
$frame->add($quad);
|
||||
$quad->setPosition(-$width / 2 + 63, -$height / 2 + 10, 0.01);
|
||||
$quad->setSubStyle($quad::SUBSTYLE_BgPlayerCardBig);
|
||||
$quad->setSize(18, 5);
|
||||
$quad->setAction(self::ACTION_SEARCH_MAPNAME);
|
||||
|
||||
//Search for Author
|
||||
$label = new Label_Button();
|
||||
$frame->add($label);
|
||||
$label->setPosition(-$width / 2 + 85, -$height / 2 + 10);
|
||||
$label->setText("Author");
|
||||
$label->setTextSize(1.3);
|
||||
|
||||
$quad = new Quad_BgsPlayerCard();
|
||||
$frame->add($quad);
|
||||
$quad->setPosition(-$width / 2 + 85, -$height / 2 + 10, 0.01);
|
||||
$quad->setSubStyle($quad::SUBSTYLE_BgPlayerCardBig);
|
||||
$quad->setSize(18, 5);
|
||||
$quad->setAction(self::ACTION_SEARCH_AUTHOR);
|
||||
|
||||
|
||||
// TODO add MX info screen
|
||||
|
||||
// render and display xml
|
||||
|
Loading…
Reference in New Issue
Block a user