From 1ddea8e2cc92e6997b4ea1076b9efc0353d385a3 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Tue, 20 Oct 2020 13:41:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=B3=BB=E7=BB=9F=E8=BF=9B?= =?UTF-8?q?=E5=85=A5=E6=96=87=E6=9C=AC=E8=BE=93=E5=85=A5=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E6=97=B6=E6=9C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zframework/widget.lua | 10 +++++++--- Zframework/widgetList.lua | 7 ++++++- main.lua | 6 ++++-- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/Zframework/widget.lua b/Zframework/widget.lua index 8f3ca28a..36936734 100644 --- a/Zframework/widget.lua +++ b/Zframework/widget.lua @@ -590,6 +590,9 @@ local textBox={ } function textBox:reset() self.ATV=0 + if not MOBILE then + kb.setTextInput(true) + end end function textBox:isAbove(x,y) return @@ -665,13 +668,14 @@ end WIDGET.active={}--Table contains all active widgets WIDGET.sel=nil--Selected widget function WIDGET.set(L) + kb.setTextInput(false) WIDGET.sel=nil WIDGET.active=L or{} --Reset all widgets if L then - for _,W in next,L do - if W.reset then W:reset()end + for i=1,#L do + L[i]:reset() end end end @@ -724,7 +728,7 @@ function WIDGET.press(x,y) end end elseif W.type=="textBox"then - if SYSTEM=="Android"then + if MOBILE then local _,y=xOy:transformPoint(0,W.y+W.h) kb.setTextInput(true,0,y,1,1) end diff --git a/Zframework/widgetList.lua b/Zframework/widgetList.lua index 6f306089..33a47dd8 100644 --- a/Zframework/widgetList.lua +++ b/Zframework/widgetList.lua @@ -1,5 +1,10 @@ local rnd=math.random -local mobileHide=(SYSTEM=="Android"or SYSTEM=="iOS")and function()return true end +local mobileHide,mobileShow +if MOBILE then + function mobileHide()return true end +else + function mobileShow()return true end +end local function BACK()SCN.back()end local virtualkeySet={ { diff --git a/main.lua b/main.lua index 08b96ff9..20466017 100644 --- a/main.lua +++ b/main.lua @@ -12,6 +12,7 @@ NULL=function()end DBP=print--use this if need debugging print SYSTEM=love.system.getOS() +MOBILE=SYSTEM=="Android"or SYSTEM=="iOS" MARKING=true LOADED=false NOGAME=false @@ -20,6 +21,7 @@ LOGIN=false --Global Setting & Vars math.randomseed(os.time()*626) love.keyboard.setKeyRepeat(true) +love.keyboard.setTextInput(false) love.mouse.setVisible(false) SCR={ @@ -132,7 +134,7 @@ if fs.getInfo("settings.dat")then FILE.loadSetting() else -- firstRun=true - if SYSTEM=="Android"or SYSTEM=="iOS" then + if MOBILE then SETTING.VKSwitch=true SETTING.swap=false SETTING.vib=2 @@ -210,7 +212,7 @@ do FILE.saveData() FILE.saveSetting() end - if SYSTEM=="Android"and not SETTING.fullscreen then + if MOBILE and not SETTING.fullscreen then LOG.print("如果手机上方状态栏不消失,请到设置界面开启全屏",300,color.yellow) LOG.print("Switch fullscreen on if titleBar don't disappear",300,color.yellow) end