|
|
@@ -228,12 +228,7 @@ def handle_restart_game():
|
|
|
|
|
|
sys.exit(0) # 终止当前进程
|
|
|
|
|
|
-@app.route('/restart_game', methods=['POST'])
|
|
|
-def http_restart_game():
|
|
|
- print("HTTP 触发 restart_game")
|
|
|
- restartTask = threading.Thread(target=handle_restart_game, daemon=True)#启动线程往里面添加任务
|
|
|
- restartTask.start()
|
|
|
- return jsonify({"status": "success", "message": "已重启"})
|
|
|
+
|
|
|
|
|
|
@socketio.on('close_game')
|
|
|
def handle_close_game():
|
|
|
@@ -241,6 +236,13 @@ def handle_close_game():
|
|
|
send_status("结束2")
|
|
|
GlobalState.event.clear()
|
|
|
|
|
|
+@app.route('/restart_game', methods=['POST'])
|
|
|
+def http_restart_game():
|
|
|
+ print("HTTP 触发 restart_game")
|
|
|
+ restartTask = threading.Thread(target=handle_restart_game, daemon=True)#启动线程往里面添加任务
|
|
|
+ restartTask.start()
|
|
|
+ return jsonify({"status": "success", "message": "已重启"})
|
|
|
+
|
|
|
@app.route('/close_game', methods=['POST'])
|
|
|
def http_close_game():
|
|
|
print("HTTP 触发 close_game")
|
|
|
@@ -707,13 +709,12 @@ if __name__ == '__main__':
|
|
|
time.sleep(2)
|
|
|
GlobalState.isReset = True
|
|
|
print("需要重启游戏")
|
|
|
- runTask = threading.Thread(target=thread_runTask)#启动线程往里面添加任务
|
|
|
- runTask.daemon = True
|
|
|
- runTask.start()
|
|
|
-
|
|
|
monitor_thread = threading.Thread(target=monitor_game_runtime, daemon=True)
|
|
|
monitor_thread.start()
|
|
|
|
|
|
+ runTask = threading.Thread(target=thread_runTask, daemon=True)#启动线程往里面添加任务
|
|
|
+ runTask.start()
|
|
|
+
|
|
|
threading.Thread(target=startup_frpc, daemon=False).start()
|
|
|
print("FRPC已启动,主程序继续运行...")
|
|
|
|