改回场景先初始化再加载控件,修复之前调顺序致控件读错误scnTmp,chat场景使用task更改焦点

This commit is contained in:
MrZ626
2020-12-06 02:26:48 +08:00
parent f72a287ab5
commit ebd2cce1db
2 changed files with 6 additions and 3 deletions

View File

@@ -10,6 +10,10 @@ local scroll--Bottom message no.
local newMessasge=false--If there is a new message
local heartBeatTimer
local function focusAtTextbox()
coroutine.yield()
WIDGET.sel=WIDGET.active.text
end
local function sendMessage()
local W=WIDGET.active.text
if #W.value>0 and wsWrite(W.value)then
@@ -38,7 +42,7 @@ function scene.sceneInit()
scroll=scroll+1
end
end
WIDGET.sel=WIDGET.active.text
TASK.new(focusAtTextbox)--Widgets are not initialized, so active after 1 frame
BG.set("none")
wsConnect(
TICK.wsCONN_connect,