page.py 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. import traceback
  2. from tasks.GameUi.assets import GameUiAssets as G
  3. from tasks.RyouToppa.assets import RyouToppaAssets
  4. class Page:
  5. parent = None
  6. def __init__(self, check_button):
  7. self.check_button = check_button
  8. self.links = {}
  9. self.additional: list = None # 附加按钮或者是ocr检测按钮
  10. (filename, line_number, function_name, text) = traceback.extract_stack()[-2]
  11. self.name = text[:text.find('=')].strip()
  12. def __eq__(self, other):
  13. return self.name == other.name
  14. def __hash__(self):
  15. return hash(self.name)
  16. def __str__(self):
  17. return self.name
  18. def link(self, button, destination):
  19. self.links[destination] = button
  20. # Main Home 主页
  21. page_main = Page(G.I_CHECK_MAIN)
  22. # 召唤summon
  23. page_summon = Page(G.I_CHECK_SUMMON)
  24. page_summon.link(button=G.I_SUMMON_GOTO_MAIN, destination=page_main)
  25. page_main.link(button=G.I_MAIN_GOTO_SUMMON, destination=page_summon)
  26. # 探索exploration
  27. page_exploration = Page(G.I_CHECK_EXPLORATION)
  28. page_exploration.link(button=G.I_BACK_BLUE, destination=page_main)
  29. page_main.link(button=G.I_MAIN_GOTO_EXPLORATION, destination=page_exploration)
  30. # 町中town
  31. page_town = Page(G.I_CHECK_TOWN)
  32. page_town.link(button=G.I_TOWN_GOTO_MAIN, destination=page_main)
  33. page_main.link(button=G.I_MAIN_GOTO_TOWN, destination=page_town)
  34. # Unknown
  35. # page_unknown = Page(None)
  36. # page_unknown.link(button=G.I_CHECK_MAIN, destination=page_main)
  37. # ************************************* 探索部分 *****************************************#
  38. # 觉醒 awake zones
  39. page_awake_zones = Page(G.I_CHECK_AWAKE)
  40. page_awake_zones.link(button=G.I_BACK_BLUE, destination=page_exploration)
  41. page_exploration.link(button=G.I_EXPLORATION_GOTO_AWAKE_ZONE, destination=page_awake_zones)
  42. # 御魂 soul zones
  43. page_soul_zones = Page(G.I_CHECK_SOUL_ZONES)
  44. page_soul_zones.link(button=G.I_BACK_BLUE, destination=page_exploration)
  45. page_exploration.link(button=G.I_EXPLORATION_GOTO_SOUL_ZONE, destination=page_soul_zones)
  46. # 结界突破 realm raid
  47. page_realm_raid = Page(G.I_CHECK_REALM_RAID)
  48. page_realm_raid.link(button=G.I_REALM_RAID_GOTO_EXPLORATION, destination=page_exploration)
  49. page_exploration.link(button=G.I_EXPLORATION_GOTO_REALM_RAID, destination=page_realm_raid)
  50. # 寮结界突破右上角 kekkai toppa
  51. page_kekkai_toppa = Page(G.I_KEKKAI_TOPPA)
  52. page_kekkai_toppa.link(button=G.I_REALM_RAID_GOTO_EXPLORATION, destination=page_exploration)
  53. page_realm_raid.link(button=RyouToppaAssets.I_RYOU_TOPPA, destination=page_kekkai_toppa)
  54. # 御灵 goryou realm
  55. page_goryou_realm = Page(G.I_CHECK_GORYOU)
  56. page_goryou_realm.link(button=G.I_BACK_BLUE, destination=page_exploration)
  57. page_exploration.link(button=G.I_EXPLORATION_GOTO_GORYOU_REALM, destination=page_goryou_realm)
  58. # 委派 delegation
  59. page_delegation = Page(G.I_CHECK_DELEGATION)
  60. page_delegation.link(button=G.I_BACK_BLUE, destination=page_exploration)
  61. page_exploration.link(button=G.I_EXPLORATION_GOTO_DELEGATION, destination=page_delegation)
  62. # 秘闻副本 SECRET zones
  63. page_secret_zones = Page(G.I_CHECK_SECRET_ZONES)
  64. page_secret_zones.link(button=G.I_BACK_BLUE, destination=page_exploration)
  65. page_exploration.link(button=G.I_EXPLORATION_GOTO_SECRET_ZONES, destination=page_secret_zones)
  66. # 地狱鬼王 area boss
  67. page_area_boss = Page(G.I_CHECK_AREA_BOSS)
  68. page_area_boss.link(button=G.I_BACK_BLUE, destination=page_exploration)
  69. page_exploration.link(button=G.I_EXPLORATION_GOTO_AREA_BOSS, destination=page_area_boss)
  70. # 平安奇谭
  71. page_heian_kitan = Page(G.I_CHECK_HEIAN_KITAN)
  72. page_heian_kitan.link(button=G.I_CHECK_HEIAN_KITAN, destination=page_exploration)
  73. page_exploration.link(button=G.I_EXPLORATION_GOTO_HEIAN_KITAN, destination=page_heian_kitan)
  74. # 六道之门 six gates
  75. page_six_gates = Page(G.I_CHECK_SIX_GATES)
  76. page_six_gates.link(button=G.I_SIX_GATES_GOTO_EXPLORATION, destination=page_exploration)
  77. page_exploration.link(button=G.I_EXPLORATION_GOTO_SIX_GATES, destination=page_six_gates)
  78. # 器灵 bondling_fairyland
  79. page_bondling_fairyland = Page(G.I_CHECK_BONDLING_FAIRYLAND)
  80. page_bondling_fairyland.link(button=G.I_BACK_YOLLOW, destination=page_exploration)
  81. page_exploration.link(button=G.I_EXPLORATION_GOTO_BONDLING_FAIRYLAND, destination=page_bondling_fairyland)
  82. # ************************************* 町中部分 *****************************************#
  83. # 斗鸡 duel
  84. page_duel = Page(G.I_CHECK_DUEL)
  85. page_duel.link(button=G.I_BACK_YOLLOW, destination=page_town)
  86. page_town.link(button=G.I_TOWN_GOTO_DUEL, destination=page_duel)
  87. # 封魔之时 demon_encounter
  88. page_demon_encounter = Page(G.I_CHECK_DEMON_ENCOUNTER)
  89. page_demon_encounter.link(button=G.I_DEMON_ENCOUNTER_GOTO_TOWN, destination=page_town)
  90. page_town.link(button=G.I_TOWN_GOTO_DEMON_ENCOUNTER, destination=page_demon_encounter)
  91. # 狩猎战 hunt
  92. page_hunt = Page(G.I_CHECK_HUNT)
  93. page_hunt.link(button=G.I_BACK_BL, destination=page_town)
  94. page_town.link(button=G.I_TOWN_GOTO_HUNT, destination=page_hunt)
  95. # 协同斗技 draft_duel
  96. page_draft_duel = Page(G.I_CHECK_DRAFT_DUEL)
  97. page_draft_duel.link(button=G.I_BACK_YOLLOW, destination=page_town)
  98. page_town.link(button=G.I_TOWN_GOTO_DRAFT_DUEL, destination=page_draft_duel)
  99. # 百鬼奕 hyakkisen
  100. page_hyakkisen = Page(G.I_CHECK_HYAKKISEN)
  101. page_hyakkisen.link(button=G.I_BACK_YOLLOW, destination=page_town)
  102. page_town.link(button=G.I_TOWN_GOTO_HYAKKISEN, destination=page_hyakkisen)
  103. # ************************************* 庭院部分 *****************************************#
  104. # 式神录 shikigami_records
  105. page_shikigami_records = Page(G.I_CHECK_RECORDS)
  106. page_shikigami_records.additional = [G.I_AD_DISAPPEAR, G.I_RECORDS_CLOSE]
  107. page_shikigami_records.link(button=G.I_BACK_Y, destination=page_main)
  108. page_main.link(button=G.I_MAIN_GOTO_SHIKIGAMI_RECORDS, destination=page_shikigami_records)
  109. # 阴阳术 onmyodo
  110. page_onmyodo = Page(G.I_CHECK_ONMYODO)
  111. page_onmyodo.link(button=G.I_BACK_Y, destination=page_main)
  112. page_main.link(button=G.I_MAIN_GOTO_ONMYODO, destination=page_onmyodo)
  113. # 好友 friends
  114. page_friends = Page(G.I_CHECK_FRIENDS)
  115. page_friends.link(button=G.I_BACK_Y, destination=page_main)
  116. page_main.link(button=G.I_MAIN_GOTO_FRIENDS, destination=page_friends)
  117. # 花合战 daily
  118. page_daily = Page(G.I_CHECK_DAILY)
  119. # page_daily.additional = [G.O_CLICK_CLOSE_1, G.O_CLICK_CLOSE_2]
  120. page_daily.link(button=G.I_BACK_Y, destination=page_main)
  121. page_main.link(button=G.I_MAIN_GOTO_DAILY, destination=page_daily)
  122. # 商店 mall
  123. page_mall = Page(G.I_CHECK_MALL)
  124. page_mall.additional = [G.I_AD_CLOSE_RED]
  125. page_mall.link(button=G.I_BACK_BLUE, destination=page_main)
  126. page_main.link(button=G.I_MAIN_GOTO_MALL, destination=page_mall)
  127. # 阴阳寮 guild
  128. page_guild = Page(G.I_CHECK_GUILD)
  129. page_guild.link(button=G.I_BACK_Y, destination=page_main)
  130. page_main.link(button=G.I_MAIN_GOTO_GUILD, destination=page_guild)
  131. # 组队 team
  132. page_team = Page(G.I_CHECK_TEAM)
  133. page_team.link(button=G.I_BACK_Y, destination=page_main)
  134. page_main.link(button=G.I_MAIN_GOTO_TEAM, destination=page_team)
  135. # 收集 collection
  136. page_collection = Page(G.I_CHECK_COLLECTION)
  137. page_collection.link(button=G.I_BACK_Y, destination=page_main)
  138. page_main.link(button=G.I_MAIN_GOTO_COLLECTION, destination=page_collection)
  139. # 珍旅居
  140. page_travel = Page(G.I_CHECK_TRAVEL)
  141. page_travel.link(button=G.I_BACK_Y, destination=page_main)
  142. page_main.link(button=G.I_MAIN_GOTO_TRAVEL, destination=page_travel)