Research portable Memory game | Исследовать портируемую игру Память
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

пре 6 месеци
пре 5 месеци
пре 6 месеци
пре 5 месеци
пре 5 месеци
пре 5 месеци
пре 5 месеци
пре 5 месеци
пре 5 месеци
пре 5 месеци
пре 5 месеци
пре 5 месеци
пре 5 месеци
пре 5 месеци
пре 5 месеци
пре 5 месеци
пре 5 месеци
пре 5 месеци
пре 5 месеци
пре 5 месеци
пре 5 месеци
пре 5 месеци
пре 5 месеци
пре 5 месеци
пре 5 месеци
пре 5 месеци
пре 5 месеци
пре 5 месеци
пре 5 месеци
пре 5 месеци
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. import arcade
  2. from gui_aux import *
  3. from desktop_Platform import *
  4. def desktop_createDesc(p):
  5. p.desc = arcade.Sprite()
  6. p.descSprites.append(p.desc)
  7. p.desc.texture = p.descTextures[0]
  8. # Position.
  9. pos = gui_aux_cellScreenPosition(p.c, p.c.descPosition)
  10. p.desc.left = pos[0]
  11. p.desc.top = pos[1]
  12. # Invisible by default.
  13. p.desc.visible = False
  14. #}
  15. def desktop_createDeselectedTiles(p):
  16. for (id, pos) in enumerate(p.c.tilePositions):
  17. tile = arcade.AnimatedTimeBasedSprite()
  18. p.deselectedTiles.append(tile)
  19. p.deselectedSprites.append(tile)
  20. tile.guid = id
  21. tile.texture = p.textures[0]
  22. # Animation between two textures.
  23. a1 = arcade.sprite.AnimationKeyframe(0, 700, p.textures[0])
  24. a2 = arcade.sprite.AnimationKeyframe(1, 700, p.textures[1])
  25. tile.frames.append(a1)
  26. tile.frames.append(a2)
  27. # Position.
  28. tile.left = pos[0]
  29. tile.top = pos[1]
  30. #}
  31. #}
  32. def desktop_createSelectedTiles(p):
  33. for (id, pos) in enumerate(p.c.tilePositions):
  34. tile = arcade.Sprite()
  35. p.selectedTiles.append(tile)
  36. p.selectedSprites.append(tile)
  37. tile.guid = id
  38. tile.texture = p.textures[2 + p.c.playfieldItems[id]]
  39. # Position.
  40. tile.left = pos[0]
  41. tile.top = pos[1]
  42. # Invisible by default.
  43. tile.visible = False
  44. #}
  45. #}
  46. def desktop_createTitle(p):
  47. p.title = arcade.Sprite()
  48. p.titleSprites.append(p.title)
  49. p.title.texture = p.titleTextures[0]
  50. # Position.
  51. pos = gui_aux_cellScreenPosition(p.c, p.c.titlePosition)
  52. p.title.left = pos[0]
  53. p.title.top = pos[1]
  54. # Invisible by default.
  55. p.title.visible = False
  56. #}
  57. # Deselect mismatched tiles
  58. #
  59. # Conditions:
  60. # 1. Time to deselect mismatched items
  61. def desktop_deselectMismatchedTiles(p):
  62. if (
  63. p.c.recentField == "deselectMismatchedTiles"
  64. ):
  65. for id in p.c.mismatchedItems:
  66. p.deselectedTiles[id].visible = True
  67. p.selectedTiles[id].visible = False
  68. #}
  69. #}
  70. #}
  71. # Hide deselected tile and show selected one
  72. #
  73. # Conditions:
  74. # 1. tile has just been selected
  75. def desktop_displaySelectedTile(p):
  76. if (
  77. p.c.recentField == "selectedId"
  78. ):
  79. id = p.c.selectedId
  80. p.deselectedTiles[id].visible = False
  81. p.selectedTiles[id].visible = True
  82. #}
  83. #}
  84. # Display title for the first selected tile
  85. #
  86. # Conditions:
  87. # 1. tile has just been selected and it's the first one in pair
  88. def desktop_displayTitle(p):
  89. if (
  90. p.c.recentField == "selectedId" and
  91. (
  92. len(p.c.selectedItems) == 0 or
  93. len(p.c.selectedItems) == 2
  94. )
  95. ):
  96. gid = p.c.playfieldItems[p.c.selectedId]
  97. p.title.texture = p.titleTextures[gid]
  98. p.title.visible = True
  99. #}
  100. #}
  101. # Hide matching tiles
  102. #
  103. # Conditions:
  104. # 1. Time to hide matching items
  105. def desktop_hideMatchingTiles(p):
  106. if (
  107. p.c.recentField == "hideMatchingTiles"
  108. ):
  109. for id in p.c.selectedItems:
  110. p.deselectedTiles[id].visible = False
  111. p.selectedTiles[id].visible = False
  112. #}
  113. #}
  114. #}
  115. # Hide title
  116. #
  117. # Conditions:
  118. # 1. tiles has been scheduled to hide after being matched or just mismatched
  119. def desktop_hideTitle(p):
  120. if (
  121. p.c.recentField == "hideMatchingTiles" or
  122. p.c.recentField == "mismatchedItems"
  123. ):
  124. p.title.visible = False
  125. #}
  126. #}
  127. # Load description textures
  128. def desktop_loadDescTextures(p):
  129. texs = []
  130. for (id, td) in enumerate(p.c.descTextureDescriptions):
  131. tex = arcade.load_texture(
  132. td.fileName,
  133. x = td.x,
  134. y = td.y,
  135. width = td.width,
  136. height = td.height
  137. )
  138. texs.append(tex)
  139. #}
  140. p.descTextures = texs
  141. #}
  142. # Load tile textures
  143. def desktop_loadTextures(p):
  144. texs = []
  145. for (id, td) in enumerate(p.c.textureDescriptions):
  146. tex = arcade.load_texture(
  147. td.fileName,
  148. x = td.x,
  149. y = td.y,
  150. width = td.width,
  151. height = td.height
  152. )
  153. texs.append(tex)
  154. #}
  155. p.textures = texs
  156. #}
  157. # Load tiTLe textures
  158. def desktop_loadTitleTextures(p):
  159. texs = []
  160. for (id, td) in enumerate(p.c.titleTextureDescriptions):
  161. tex = arcade.load_texture(
  162. td.fileName,
  163. x = td.x,
  164. y = td.y,
  165. width = td.width,
  166. height = td.height
  167. )
  168. texs.append(tex)
  169. #}
  170. p.titleTextures = texs
  171. #}
  172. # Postpone deselection of mismatched tiles for better UX
  173. #
  174. # Conditions:
  175. # 1. a pair of tiles has been mismatched
  176. def desktop_scheduleDeselectionOfMismatchedTiles(p):
  177. if (
  178. p.c.recentField == "mismatchedItems"
  179. ):
  180. p.sequentialTimer.schedule("deselectMismatchedTiles", True, p.c.deselectMismatchedTilesDelay)
  181. #}
  182. #}
  183. # Postpone hiding of matching tiles for better UX
  184. #
  185. # Conditions:
  186. # 1. a pair of tiles has been matched
  187. def desktop_scheduleHidingOfMatchingTiles(p):
  188. if (
  189. p.c.recentField == "hiddenItems"
  190. ):
  191. p.sequentialTimer.schedule("hideMatchingTiles", True, p.c.hideMatchingTilesDelay)
  192. #}
  193. #}