diff --git a/client.cs b/client.cs index f11ba0a..d42ead6 100644 --- a/client.cs +++ b/client.cs @@ -31,6 +31,7 @@ $RPGClient::HelloLast = ""; $RPGClient::TopDownWatchSched = 0; $RPGClient::CamSched = 0; $RPGClient::LastClickTime = 0; +$RPGClient::ChatOpen = 0; function RPGClient_NormPos(%ctrl, %pos) { @@ -258,19 +259,16 @@ function RPGClient_InPlay() function RPGClient_TextTyping() { - if (isObject(Canvas)) + return $RPGClient::ChatOpen; +} + +function RPGClient_SetChatOpen(%open) +{ + $RPGClient::ChatOpen = %open ? 1 : 0; + if ($RPGClient::Active) { - %fg = Canvas.getFirstResponder(); - if (isObject(%fg)) - { - %cn = %fg.getClassName(); - if (%cn $= "GuiTextEditCtrl" || %cn $= "GuiMLTextEditCtrl") - { - return 1; - } - } + schedule(0, 0, RPGClient_SyncInputStack); } - return 0; } function RPGClient_RpgKeys() @@ -1220,6 +1218,10 @@ package RPGClient_Cursor return; } Canvas.pushDialog(%this); + if ($RPGClient::Active) + { + RPGClient_SetChatOpen(0); + } } }; activatePackage(RPGClient_Cursor); @@ -1291,22 +1293,32 @@ package RPGClient_ChatKeys function GlobalChat(%val) { Parent::GlobalChat(%val); - if ($RPGClient::Active) + if ($RPGClient::Active && %val) { - schedule(0, 0, RPGClient_SyncInputStack); - schedule(50, 0, RPGClient_SyncInputStack); + RPGClient_SetChatOpen(1); } } function TeamChat(%val) { Parent::TeamChat(%val); - if ($RPGClient::Active) + if ($RPGClient::Active && %val) { - schedule(0, 0, RPGClient_SyncInputStack); - schedule(50, 0, RPGClient_SyncInputStack); + RPGClient_SetChatOpen(1); } } + + function newChatText::onWake(%this) + { + Parent::onWake(%this); + RPGClient_SetChatOpen(1); + } + + function newChatText::onSleep(%this) + { + Parent::onSleep(%this); + RPGClient_SetChatOpen(0); + } }; activatePackage(RPGClient_ChatKeys);