mirror of
https://github.com/MCLx86/xtreemtest.git
synced 2025-01-18 14:08:48 +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_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,
|
-- In case the folder of the last selected game has been deleted,
|
||||||
@ -132,3 +132,5 @@ local function init_globals()
|
|||||||
end
|
end
|
||||||
|
|
||||||
init_globals()
|
init_globals()
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ return {
|
|||||||
"style[label_button;border=false]" ..
|
"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,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,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]"
|
return fs, "size[15.5,10.1,false]real_coordinates[true]"
|
||||||
|
@ -17,16 +17,24 @@
|
|||||||
|
|
||||||
local function get_sorted_servers()
|
local function get_sorted_servers()
|
||||||
local servers = {
|
local servers = {
|
||||||
|
best = {},
|
||||||
fav = {},
|
fav = {},
|
||||||
public = {},
|
public = {},
|
||||||
incompatible = {}
|
incompatible = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
local favs = serverlistmgr.get_favorites()
|
local favs = serverlistmgr.get_favorites()
|
||||||
local taken_favs = {}
|
local taken_favs = {}
|
||||||
local result = menudata.search_result or serverlistmgr.servers
|
local result = menudata.search_result or serverlistmgr.servers
|
||||||
for _, server in ipairs(result) do
|
for _, server in ipairs(result) do
|
||||||
server.is_favorite = false
|
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
|
for index, fav in ipairs(favs) do
|
||||||
if server.address == fav.address and server.port == fav.port then
|
if server.address == fav.address and server.port == fav.port then
|
||||||
taken_favs[index] = true
|
taken_favs[index] = true
|
||||||
@ -153,11 +161,12 @@ local function get_formspec(tabview, name, tabdata)
|
|||||||
local servers = get_sorted_servers()
|
local servers = get_sorted_servers()
|
||||||
|
|
||||||
local dividers = {
|
local dividers = {
|
||||||
|
best = "7,#ff0000," .. fgettext("BEST SERVERS") .. ",,,0,0,,",
|
||||||
fav = "5,#ffff00," .. fgettext("Favorites") .. ",,,0,0,,",
|
fav = "5,#ffff00," .. fgettext("Favorites") .. ",,,0,0,,",
|
||||||
public = "6,#4bdd42," .. fgettext("Public Servers") .. ",,,0,0,,",
|
public = "6,#4bdd42," .. fgettext("Public Servers") .. ",,,0,0,,",
|
||||||
incompatible = "7,"..mt_color_grey.."," .. fgettext("Incompatible 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
|
tabdata.lookup = {} -- maps row number to server
|
||||||
local rows = {}
|
local rows = {}
|
||||||
@ -318,10 +327,13 @@ local function main_button_handler(tabview, fields, name, tabdata)
|
|||||||
local server = tabdata.lookup[idx]
|
local server = tabdata.lookup[idx]
|
||||||
if not server then return end
|
if not server then return end
|
||||||
|
|
||||||
serverlistmgr.delete_favorite(server)
|
if server.address == "testing.cubesoftware.xyz" then return
|
||||||
-- the server at [idx+1] will be at idx once list is refreshed
|
else
|
||||||
set_selected_server(tabdata, idx, tabdata.lookup[idx+1])
|
serverlistmgr.delete_favorite(server)
|
||||||
return true
|
-- 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
|
end
|
||||||
|
|
||||||
if fields.btn_mp_clear then
|
if fields.btn_mp_clear then
|
||||||
|
Loading…
Reference in New Issue
Block a user