Просмотр исходного кода

feat(xyj/login): 西游记登录优化

dzp 3 лет назад
Родитель
Сommit
2ccf95afae

+ 6 - 5
mud/thuxyj/plugins/basic/login.tin

@@ -33,23 +33,24 @@
         };
 
         #line oneshot #action {^%sWelcome to Xi You Ji! Select GB or BIG5 (gb/big5):$} {
-            #send gb;
+            #line oneshot #event {CATCH VT100 ERASE SCREEN ALL} {#0};
+            xtt.Answer gb;
         };
 
         #line oneshot #action {^您是否是中小学学生或年龄更小?(yes/no)$} {
-            #delay 0 {#echo {\n}; #send no};
+            #delay 0 #send no;
         };
 
         #line oneshot #action {^您的英文名字:(新玩家请键入 new 注册)$} {
-            #delay 0 {#echo {\n}; #send $login[user][id]};
+            xtt.Answer $login[user][id];
         };
 
         #action {^请输入相应密码:$} {
-            #delay  0 {#echo {\n}; #send {$user[passwd]}};
+            xtt.Answer {$login[user][passwd]};
         };
 
         #line oneshot #action {^您要将另一个连线中的相同人物赶出去,取而代之吗?(y/n)$} {
-            #delay 0 {#echo {\n}; #send y};
+            xtt.Answer y;
         };
 
         #line oneshot #action {^重新连线完毕。$} {

+ 2 - 1
plugins/lib/xtintin/__init__.tin

@@ -6,9 +6,10 @@ PaoTin++ © 2020~2022 的所有版权均由担子炮(dzp <danzipao@gmail.com>) 
 你可以在遵照 GPLv3 协议的基础之上使用、修改及重新分发本程序。
 */
 
-#nop xtintin: 为了方便 TinTin++ 使用而增加的一些语法扩展。;
+#nop xtintin 为了方便 TinTin++ 使用而增加的一些语法扩展。;
 
 load-file plugins/lib/xtintin/funcs.tin;
 load-file plugins/lib/xtintin/cmds.tin;
 load-file plugins/lib/xtintin/debug.tin;
 load-file plugins/lib/xtintin/fp.tin;
+load-file plugins/lib/xtintin/answer.tin;

+ 12 - 0
plugins/lib/xtintin/answer.tin

@@ -0,0 +1,12 @@
+#nop 回答服务器提出的问题(妥善处理不带换行符的文本。);
+
+/*
+   TinTin++ 的光标控制有点问题,问题和回答的显示有重叠,必须手动 #buffer end 才行。
+*/
+#alias {xtt.Answer} {
+    #delay 0 {
+        #echo {};
+        #buffer end;
+        #send {%1};
+    };
+};