From ebd2cce1dbb8036e8005aba46b22c0c2b6d7cb08 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Sun, 6 Dec 2020 02:26:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=9B=9E=E5=9C=BA=E6=99=AF=E5=85=88?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E5=86=8D=E5=8A=A0=E8=BD=BD=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6=EF=BC=8C=E4=BF=AE=E5=A4=8D=E4=B9=8B=E5=89=8D=E8=B0=83?= =?UTF-8?q?=E9=A1=BA=E5=BA=8F=E8=87=B4=E6=8E=A7=E4=BB=B6=E8=AF=BB=E9=94=99?= =?UTF-8?q?=E8=AF=AFscnTmp=EF=BC=8Cchat=E5=9C=BA=E6=99=AF=E4=BD=BF?= =?UTF-8?q?=E7=94=A8task=E6=9B=B4=E6=94=B9=E7=84=A6=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zframework/scene.lua | 3 +-- parts/scenes/chat.lua | 6 +++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Zframework/scene.lua b/Zframework/scene.lua index b0d8be06..3bcd2e4e 100644 --- a/Zframework/scene.lua +++ b/Zframework/scene.lua @@ -56,7 +56,6 @@ end function SCN.init(s,org) local S=scenes[s] SCN.cur=s - WIDGET.set(s) SCN.sceneInit=S.sceneInit SCN.sceneBack=S.sceneBack @@ -76,8 +75,8 @@ function SCN.init(s,org) SCN.gamepadDown=S.gamepadDown SCN.gamepadUp=S.gamepadUp SCN.socketRead=S.socketRead - if S.sceneInit then S.sceneInit(org)end + WIDGET.set(s) end function SCN.push(tar,style) if not SCN.swapping then diff --git a/parts/scenes/chat.lua b/parts/scenes/chat.lua index 19405a5d..67ac8d05 100644 --- a/parts/scenes/chat.lua +++ b/parts/scenes/chat.lua @@ -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,