改回场景先初始化再加载控件,修复之前调顺序致控件读错误scnTmp,chat场景使用task更改焦点
This commit is contained in:
@@ -56,7 +56,6 @@ end
|
|||||||
function SCN.init(s,org)
|
function SCN.init(s,org)
|
||||||
local S=scenes[s]
|
local S=scenes[s]
|
||||||
SCN.cur=s
|
SCN.cur=s
|
||||||
WIDGET.set(s)
|
|
||||||
|
|
||||||
SCN.sceneInit=S.sceneInit
|
SCN.sceneInit=S.sceneInit
|
||||||
SCN.sceneBack=S.sceneBack
|
SCN.sceneBack=S.sceneBack
|
||||||
@@ -76,8 +75,8 @@ function SCN.init(s,org)
|
|||||||
SCN.gamepadDown=S.gamepadDown
|
SCN.gamepadDown=S.gamepadDown
|
||||||
SCN.gamepadUp=S.gamepadUp
|
SCN.gamepadUp=S.gamepadUp
|
||||||
SCN.socketRead=S.socketRead
|
SCN.socketRead=S.socketRead
|
||||||
|
|
||||||
if S.sceneInit then S.sceneInit(org)end
|
if S.sceneInit then S.sceneInit(org)end
|
||||||
|
WIDGET.set(s)
|
||||||
end
|
end
|
||||||
function SCN.push(tar,style)
|
function SCN.push(tar,style)
|
||||||
if not SCN.swapping then
|
if not SCN.swapping then
|
||||||
|
|||||||
@@ -10,6 +10,10 @@ local scroll--Bottom message no.
|
|||||||
local newMessasge=false--If there is a new message
|
local newMessasge=false--If there is a new message
|
||||||
local heartBeatTimer
|
local heartBeatTimer
|
||||||
|
|
||||||
|
local function focusAtTextbox()
|
||||||
|
coroutine.yield()
|
||||||
|
WIDGET.sel=WIDGET.active.text
|
||||||
|
end
|
||||||
local function sendMessage()
|
local function sendMessage()
|
||||||
local W=WIDGET.active.text
|
local W=WIDGET.active.text
|
||||||
if #W.value>0 and wsWrite(W.value)then
|
if #W.value>0 and wsWrite(W.value)then
|
||||||
@@ -38,7 +42,7 @@ function scene.sceneInit()
|
|||||||
scroll=scroll+1
|
scroll=scroll+1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
WIDGET.sel=WIDGET.active.text
|
TASK.new(focusAtTextbox)--Widgets are not initialized, so active after 1 frame
|
||||||
BG.set("none")
|
BG.set("none")
|
||||||
wsConnect(
|
wsConnect(
|
||||||
TICK.wsCONN_connect,
|
TICK.wsCONN_connect,
|
||||||
|
|||||||
Reference in New Issue
Block a user