mirror of
https://github.com/MCLx86/xtreemtest.git
synced 2025-01-18 05:58:46 +01:00
Added a new server category (BEST SERVERS)
This commit is contained in:
parent
17c34f9eb6
commit
ea0fdd6bce
@ -113,7 +113,7 @@ local function init_globals()
|
||||
tv_main:set_fixed_size(false)
|
||||
|
||||
|
||||
tv_main:set_tab(tabs.beta)
|
||||
tv_main:set_tab(tabs.about)
|
||||
|
||||
|
||||
-- In case the folder of the last selected game has been deleted,
|
||||
@ -132,3 +132,5 @@ local function init_globals()
|
||||
end
|
||||
|
||||
init_globals()
|
||||
|
||||
|
||||
|
@ -31,7 +31,7 @@ return {
|
||||
"style[label_button;border=false]" ..
|
||||
"button[0.1,4;8.3,1.5;online_play;Play on-line (real people, not bots)]" ..
|
||||
"button[0.1,6;8.3,1.5;local_play;Play locally]" ..
|
||||
"button[0.1,8;8.3,1.5;xtreemcoins;Get XtreemCoins]"
|
||||
"button[0.1,8;8.3,1.5;xtreemcoins;Get XtreemCoins (Android only)]"
|
||||
|
||||
|
||||
return fs, "size[15.5,10.1,false]real_coordinates[true]"
|
||||
|
@ -17,16 +17,24 @@
|
||||
|
||||
local function get_sorted_servers()
|
||||
local servers = {
|
||||
best = {},
|
||||
fav = {},
|
||||
public = {},
|
||||
incompatible = {}
|
||||
}
|
||||
|
||||
|
||||
local favs = serverlistmgr.get_favorites()
|
||||
local taken_favs = {}
|
||||
local result = menudata.search_result or serverlistmgr.servers
|
||||
for _, server in ipairs(result) do
|
||||
server.is_favorite = false
|
||||
|
||||
if server.address == "testing.cubesoftware.xyz" then
|
||||
server.is_favorite = true
|
||||
table.insert(servers.best, server)
|
||||
end
|
||||
|
||||
for index, fav in ipairs(favs) do
|
||||
if server.address == fav.address and server.port == fav.port then
|
||||
taken_favs[index] = true
|
||||
@ -153,11 +161,12 @@ local function get_formspec(tabview, name, tabdata)
|
||||
local servers = get_sorted_servers()
|
||||
|
||||
local dividers = {
|
||||
best = "7,#ff0000," .. fgettext("BEST SERVERS") .. ",,,0,0,,",
|
||||
fav = "5,#ffff00," .. fgettext("Favorites") .. ",,,0,0,,",
|
||||
public = "6,#4bdd42," .. fgettext("Public Servers") .. ",,,0,0,,",
|
||||
incompatible = "7,"..mt_color_grey.."," .. fgettext("Incompatible Servers") .. ",,,0,0,,"
|
||||
}
|
||||
local order = {"fav", "public", "incompatible"}
|
||||
local order = {"best", "fav", "public", "incompatible"}
|
||||
|
||||
tabdata.lookup = {} -- maps row number to server
|
||||
local rows = {}
|
||||
@ -318,11 +327,14 @@ local function main_button_handler(tabview, fields, name, tabdata)
|
||||
local server = tabdata.lookup[idx]
|
||||
if not server then return end
|
||||
|
||||
if server.address == "testing.cubesoftware.xyz" then return
|
||||
else
|
||||
serverlistmgr.delete_favorite(server)
|
||||
-- the server at [idx+1] will be at idx once list is refreshed
|
||||
set_selected_server(tabdata, idx, tabdata.lookup[idx+1])
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
if fields.btn_mp_clear then
|
||||
tabdata.search_for = ""
|
||||
|
Loading…
Reference in New Issue
Block a user