Explorar o código

Merge pull request #1282 from migsmiku/dev

修复大富翁和斗技
huangrunheng hai 11 meses
pai
achega
029aa9ac53

+ 15 - 0
module/gui/qml/Component/SplitPanel.qml

@@ -37,6 +37,9 @@ Item {
         anchors.bottomMargin: 12
 
         onLoaded: {
+            if (!contentDefalut.item)
+                return
+
             if(typeof contentDefalut.item.splitPanel === "undefined"){
                 return
             }
@@ -113,6 +116,10 @@ Item {
 //    }
     //设置右边显示的参数项,输入的序列的字符串
     function setLoaderData(args, value){
+        if (!contentLoader.item) {
+            console.log("SplitPanel: contentLoader.item is null in setLoaderData")
+            return
+        }
         contentLoader.item.argsData = args
         contentLoader.item.valueData = value
         contentLoader.item.updataData()
@@ -120,12 +127,20 @@ Item {
 
     //设置上下文
     function setLoaderContext(configName, taskName){
+        if (!contentLoader.item) {
+            console.log("SplitPanel: contentLoader.item is null in setLoaderContext")
+            return
+        }
         contentLoader.item.configName = configName
         contentLoader.item.taskName = taskName
     }
 
     //设置配置的名称
     function setDefalutConfig(name){
+        if (!contentDefalut.item) {
+            console.log("SplitPanel: contentDefalut.item is null in setDefalutConfig")
+            return
+        }
         contentDefalut.item.configName = name
     }
 

+ 24 - 3
module/gui/qml/Content/TaskList.qml

@@ -143,8 +143,29 @@ Item{
 
     Component.onCompleted:{
 
-        const data = JSON.parse(process_manager.gui_task_list(MainEvent.scriptName))
-        const menu = JSON.parse(process_manager.gui_menu())
+        var rawTaskList = process_manager.gui_task_list(MainEvent.scriptName)
+        var rawMenu     = process_manager.gui_menu()
+
+        console.log("TaskList rawTaskList =", rawTaskList)
+        console.log("TaskList rawMenu =", rawMenu)
+
+        var data = {}
+        var menu = {}
+
+        try {
+            data = JSON.parse(rawTaskList)
+        } catch (e) {
+            console.error("TaskList: JSON.parse task_list error:", e, "raw =", rawTaskList)
+            return   // 解析失败就不要往下走了
+        }
+
+        try {
+            menu = JSON.parse(rawMenu)
+        } catch (e) {
+            console.error("TaskList: JSON.parse menu error:", e, "raw =", rawMenu)
+            return
+        }
+
         for(const key in menu){
             if(key === "Overview" || key === 'TaskList' || key === 'Script' || key === 'Tools'){
                 continue
@@ -152,9 +173,9 @@ Item{
             const groupData = classify(menu[key], data)
             create_group(key, groupData)
         }
-
     }
 
+
     // 分类对每一个任务组,
     // 第一个参数是这个菜单组的所有, 如["Script", "Restart", "GlobalGame"]
     // 第二个参数是整个的数据

+ 3 - 3
tasks/Duel/assets.py

@@ -61,9 +61,9 @@ class DuelAssets:
 	# 战斗带保护的 
 	I_D_BATTLE_PROTECT = RuleImage(roi_front=(1153,578,100,100), roi_back=(1118,553,155,149), threshold=0.8, method="Template matching", file="./tasks/Duel/duel/duel_d_battle_protect.png")
 	# 自动上阵 
-	I_D_AUTO_ENTRY = RuleImage(roi_front=(42,133,66,62), roi_back=(20,119,115,111), threshold=0.8, method="Template matching", file="./tasks/Duel/duel/duel_d_auto_entry.png")
+	I_D_AUTO_ENTRY = RuleImage(roi_front=(21,116,66,62), roi_back=(2,95,115,111), threshold=0.8, method="Template matching", file="./tasks/Duel/duel/duel_d_auto_entry.png")
 	# 主界面的感叹号 
-	I_D_HELP = RuleImage(roi_front=(719,434,32,30), roi_back=(708,397,49,78), threshold=0.8, method="Template matching", file="./tasks/Duel/duel/duel_d_help.png")
+	I_D_HELP = RuleImage(roi_front=(784,502,32,30), roi_back=(774,489,49,55), threshold=0.8, method="Template matching", file="./tasks/Duel/duel/duel_d_help.png")
 	# 准备 
 	I_D_PREPARE = RuleImage(roi_front=(1127,541,100,100), roi_back=(1127,541,100,100), threshold=0.8, method="Template matching", file="./tasks/Duel/duel/duel_d_prepare.png")
 	# 战斗数据 
@@ -89,7 +89,7 @@ class DuelAssets:
 	# 禁用 
 	I_BAN = RuleImage(roi_front=(1112,537,100,100), roi_back=(1112,537,100,100), threshold=0.8, method="Template matching", file="./tasks/Duel/duel/duel_ban.png")
 	# 左上角的退出 
-	I_DUEL_EXIT = RuleImage(roi_front=(14,12,43,41), roi_back=(14,12,43,41), threshold=0.8, method="Template matching", file="./tasks/Duel/duel/gb_exit.png")
+	I_DUEL_EXIT = RuleImage(roi_front=(14,12,43,41), roi_back=(14,12,43,41), threshold=0.8, method="Template matching", file="./tasks/Duel/duel/duel_duel_exit.png")
 
 
 	# Ocr Rule Assets

BIN=BIN
tasks/Duel/duel/duel_d_auto_entry.png


BIN=BIN
tasks/Duel/duel/duel_d_help.png


BIN=BIN
tasks/Duel/duel/duel_d_team.png


BIN=BIN
tasks/Duel/duel/duel_d_team_swtich.png


+ 5 - 5
tasks/Duel/duel/image.json

@@ -38,8 +38,8 @@
   {
     "itemName": "d_auto_entry",
     "imageName": "duel_d_auto_entry.png",
-    "roiFront": "42,133,66,62",
-    "roiBack": "20,119,115,111",
+    "roiFront": "21,116,66,62",
+    "roiBack": "2,95,115,111",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "自动上阵"
@@ -47,8 +47,8 @@
   {
     "itemName": "d_help",
     "imageName": "duel_d_help.png",
-    "roiFront": "719,434,32,30",
-    "roiBack": "708,397,49,78",
+    "roiFront": "784,502,32,30",
+    "roiBack": "774,489,49,55",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "主界面的感叹号"
@@ -163,7 +163,7 @@
   },
   {
     "itemName": "duel_exit",
-    "imageName": "gb_exit.png",
+    "imageName": "duel_duel_exit.png",
     "roiFront": "14,12,43,41",
     "roiBack": "14,12,43,41",
     "method": "Template matching",

+ 8 - 2
tasks/Duel/script_task.py

@@ -22,6 +22,7 @@ from tasks.Component.SwitchSoul.switch_soul import SwitchSoul
 from tasks.GameUi.page import page_main, page_team, page_shikigami_records
 import os
 from module.atom.image import RuleImage
+from tasks.GlobalGame.assets import GlobalGameAssets as GGA
 """ 斗技 """
 
 
@@ -88,6 +89,9 @@ class ScriptTask(GameUi, GeneralBattle, SwitchSoul, DuelAssets):
         duel_week_over = False
         while 1:
             self.screenshot()
+            # 关闭恭喜晋升段位页面
+            if self.appear_then_click(GGA.I_UI_BACK_RED):
+                continue
             if self.appear_then_click(self.I_REWARD, interval=0.6):
                 continue
             if not self.duel_main():
@@ -410,6 +414,9 @@ class ScriptTask(GameUi, GeneralBattle, SwitchSoul, DuelAssets):
         swipe_timer.start()
         while 1:
             self.screenshot()
+            # 收取奖励
+            if self.ui_reward_appear_click(True):
+                continue
             if self.appear_then_click(self.I_D_BATTLE_DATA, action=self.C_D_BATTLE_DATA, interval=0.6):
                 continue
             if self.appear(self.I_FALSE):
@@ -474,8 +481,7 @@ class ScriptTask(GameUi, GeneralBattle, SwitchSoul, DuelAssets):
 if __name__ == '__main__':
     from module.config.config import Config
     from module.device.device import Device
-
-    c = Config('mi')
+    c = Config('oas3')
     d = Device(c)
     t = ScriptTask(c, d)
 

+ 1 - 1
tasks/RichMan/assets.py

@@ -156,7 +156,7 @@ class RichManAssets:
 	# 寄售屋 
 	I_MALL_CONSIGNMENT_CHECK = RuleImage(roi_front=(12,166,100,390), roi_back=(12,166,100,390), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/navbar/navbar_mall_consignment_check.png")
 	# 密卷屋 
-	I_MALL_SCCALES = RuleImage(roi_front=(470,649,68,49), roi_back=(427,621,147,92), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/navbar/navbar_mall_sccales.png")
+	I_MALL_SCCALES = RuleImage(roi_front=(470,647,68,37), roi_back=(427,621,147,92), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/navbar/navbar_mall_sccales.png")
 	# 密卷屋 
 	I_MALL_SCCALES_CHECK = RuleImage(roi_front=(409,253,100,100), roi_back=(409,253,100,100), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/navbar/navbar_mall_sccales_check.png")
 	# description 

+ 1 - 1
tasks/RichMan/mall/navbar/image_bottom.json

@@ -20,7 +20,7 @@
   {
     "itemName": "mall_sccales",
     "imageName": "navbar_mall_sccales.png",
-    "roiFront": "470,649,68,49",
+    "roiFront": "470,647,68,37",
     "roiBack": "427,621,147,92",
     "method": "Template matching",
     "threshold": 0.8,

BIN=BIN
tasks/RichMan/mall/navbar/navbar_mall_sccales.png


BIN=BIN
tasks/RichMan/mall/navbar/navbar_mall_sccales_check.png