Browse Source

!2 add function closeGame

pcacc 5 months ago
parent
commit
1cdc3ebd70
2 changed files with 13 additions and 0 deletions
  1. 7 0
      app_dongri.py
  2. 6 0
      templates/index_dongri.html

+ 7 - 0
app_dongri.py

@@ -152,6 +152,13 @@ def handle_restart_game():
     python = sys.executable
     os.execl(python, python, *sys.argv, '--reset')
 
+@socketio.on('close_game')
+def handle_close_game():
+    task_close_game()
+    send_status("结束2")
+    event.clear()
+
+
 @socketio.on('read_cfg')
 def handle_read_cfg():
     cfg = read_cfg()

+ 6 - 0
templates/index_dongri.html

@@ -74,6 +74,7 @@
         <div class="operate-container">
             <button class="custom-button" id="atuo_btn" onclick="begin_paticipate()">自动打熊</button>
             <button class="custom-button" id="resetScript_btn" onclick="reset_script()">重置脚本</button>
+            <button class="custom-button" id="closegame_btn" onclick="close_game()">关闭游戏</button>
             <button class="custom-button" id="restartgame_btn" onclick="restart_game()">重新关闭并自动游戏</button>
             <button class="custom-button" id="atuo_btn" onclick="begin_auto()">自动模式</button>
         </div>
@@ -197,6 +198,11 @@
         {
             socket.emit('restart_game');
         }
+
+        function close_game()
+        {
+            socket.emit('close_game');
+        }
         function get_title()
         {
             socket.emit('get_title');