forked from Mirrorlandia_minetest/minetest
Disable game bar and header on Android (#7940)
This commit is contained in:
parent
08884d258b
commit
0c6933bdf7
@ -15,14 +15,18 @@
|
|||||||
--with this program; if not, write to the Free Software Foundation, Inc.,
|
--with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
local function current_game()
|
|
||||||
|
local enable_gamebar = PLATFORM ~= "Android"
|
||||||
|
local current_game, singleplayer_refresh_gamebar
|
||||||
|
if enable_gamebar then
|
||||||
|
function current_game()
|
||||||
local last_game_id = core.settings:get("menu_last_game")
|
local last_game_id = core.settings:get("menu_last_game")
|
||||||
local game, index = pkgmgr.find_by_gameid(last_game_id)
|
local game, index = pkgmgr.find_by_gameid(last_game_id)
|
||||||
|
|
||||||
return game
|
return game
|
||||||
end
|
end
|
||||||
|
|
||||||
local function singleplayer_refresh_gamebar()
|
function singleplayer_refresh_gamebar()
|
||||||
|
|
||||||
local old_bar = ui.find_by_name("game_button_bar")
|
local old_bar = ui.find_by_name("game_button_bar")
|
||||||
|
|
||||||
@ -83,6 +87,11 @@ local function singleplayer_refresh_gamebar()
|
|||||||
end
|
end
|
||||||
btnbar:add_button(btn_name, text, image, tooltip)
|
btnbar:add_button(btn_name, text, image, tooltip)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
function current_game()
|
||||||
|
return nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function get_formspec(tabview, name, tabdata)
|
local function get_formspec(tabview, name, tabdata)
|
||||||
@ -239,7 +248,7 @@ local function main_button_handler(this, fields, name, tabdata)
|
|||||||
create_world_dlg:set_parent(this)
|
create_world_dlg:set_parent(this)
|
||||||
this:hide()
|
this:hide()
|
||||||
create_world_dlg:show()
|
create_world_dlg:show()
|
||||||
mm_texture.update("singleplayer",current_game())
|
mm_texture.update("singleplayer", current_game())
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -282,7 +291,9 @@ local function main_button_handler(this, fields, name, tabdata)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function on_change(type, old_tab, new_tab)
|
local on_change
|
||||||
|
if enable_gamebar then
|
||||||
|
function on_change(type, old_tab, new_tab)
|
||||||
local buttonbar = ui.find_by_name("game_button_bar")
|
local buttonbar = ui.find_by_name("game_button_bar")
|
||||||
|
|
||||||
if ( buttonbar == nil ) then
|
if ( buttonbar == nil ) then
|
||||||
@ -305,6 +316,7 @@ local function on_change(type, old_tab, new_tab)
|
|||||||
core.set_topleft_text("")
|
core.set_topleft_text("")
|
||||||
mm_texture.update(new_tab,nil)
|
mm_texture.update(new_tab,nil)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user