Research portable Memory game | Исследовать портируемую игру Память
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

gui.py 4.3KB

3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
3ヶ月前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. from gui_aux import *
  2. from gui_TextureDescription import *
  3. from llm import *
  4. from memory_Context import *
  5. # Generate texture descriptions for harm description
  6. #
  7. # Conditions:
  8. # 1.descImage, descImageCount, descImageHeight, or descImageWidth has just changed
  9. @llm_by_value
  10. def gui_generateDescTextureDescriptions(
  11. c: memory_Context
  12. ) -> memory_Context:
  13. if (
  14. c.recentField == "descImage" or
  15. c.recentField == "descImageCount" or
  16. c.recentField == "descImageHeight" or
  17. c.recentField == "descImageWidth"
  18. ):
  19. tds: list[gui_TextureDescription] = []
  20. for id in range(0, c.descImageCount):
  21. td = gui_createTextureDescription()
  22. td.fileName = c.descImage
  23. td.height = c.descImageHeight
  24. td.width = c.descImageWidth
  25. td.x = id * c.descImageWidth
  26. td.y = 0
  27. tds.append(td)
  28. #}
  29. c.descTextureDescriptions = tds
  30. c.recentField = "descTextureDescriptions"
  31. return c
  32. #}
  33. c.recentField = "none"
  34. return c
  35. #}
  36. # Generate texture descriptions for splash screens
  37. #
  38. # Conditions:
  39. # 1.splashImage, splashImageCount, splashImageHeight, or splashImageWidth has just changed
  40. @llm_by_value
  41. def gui_generateSplashTextureDescriptions(
  42. c: memory_Context
  43. ) -> memory_Context:
  44. if (
  45. c.recentField == "splashImage" or
  46. c.recentField == "splashImageCount" or
  47. c.recentField == "splashImageHeight" or
  48. c.recentField == "splashImageWidth"
  49. ):
  50. tds: list[gui_TextureDescription] = []
  51. for id in range(0, c.splashImageCount):
  52. td = gui_createTextureDescription()
  53. td.fileName = c.splashImage
  54. td.height = c.splashImageHeight
  55. td.width = c.splashImageWidth
  56. td.x = id * c.splashImageWidth
  57. td.y = 0
  58. tds.append(td)
  59. #}
  60. c.splashTextureDescriptions = tds
  61. c.recentField = "splashTextureDescriptions"
  62. return c
  63. #}
  64. c.recentField = "none"
  65. return c
  66. #}
  67. # Generate texture descriptions for tiles
  68. #
  69. # Conditions:
  70. # 1. tileImage or tileImageCount or tileImageHeight or tileImageWidth has just changed
  71. @llm_by_value
  72. def gui_generateTextureDescriptions(
  73. c: memory_Context
  74. ) -> memory_Context:
  75. if (
  76. c.recentField == "tileImage" or
  77. c.recentField == "tileImageCount" or
  78. c.recentField == "tileImageHeight" or
  79. c.recentField == "tileImageWidth"
  80. ):
  81. tds: list[gui_TextureDescription] = []
  82. for id in range(0, c.tileImageCount):
  83. td = gui_createTextureDescription()
  84. td.fileName = c.tileImage
  85. td.height = c.tileImageHeight
  86. td.width = c.tileImageWidth
  87. td.x = id * c.tileImageWidth
  88. td.y = 0
  89. tds.append(td)
  90. #}
  91. c.textureDescriptions = tds
  92. c.recentField = "textureDescriptions"
  93. return c
  94. #}
  95. c.recentField = "none"
  96. return c
  97. #}
  98. # Generate tile positions
  99. #
  100. # Conditions:
  101. # 1. cellSize, playField, windowHeight, or windowWidth has changed and none of them is zero
  102. @llm_by_value
  103. def gui_generateTilePositions(
  104. c: memory_Context
  105. ) -> memory_Context:
  106. if (
  107. (
  108. c.recentField != "cellPositions" and
  109. c.recentField != "cellSize" and
  110. c.recentField != "playfieldSize" and
  111. c.recentField != "windowHeight" and
  112. c.recentField != "windowWidth"
  113. ) or
  114. (
  115. len(c.cellPositions) == 0 or
  116. c.cellSize == 0 or
  117. c.playfieldSize == 0 or
  118. c.windowHeight == 0 or
  119. c.windowWidth == 0
  120. )
  121. ):
  122. c.recentField = "none"
  123. return c
  124. #}
  125. ps = []
  126. for i in range(0, len(c.cellPositions)):
  127. p = gui_aux_cellScreenPosition(c, c.cellPositions[i])
  128. ps.append(p)
  129. #}
  130. c.tilePositions = ps
  131. c.recentField = "tilePositions"
  132. return c
  133. #}
  134. # Generate texture descriptions for tiTLes
  135. #
  136. # Conditions:
  137. # 1. titleImage, titleImageCount, titleImageHeight, or titleImageWidth has just changed
  138. @llm_by_value
  139. def gui_generateTitleTextureDescriptions(
  140. c: memory_Context
  141. ) -> memory_Context:
  142. if (
  143. c.recentField == "titleImage" or
  144. c.recentField == "titleImageCount" or
  145. c.recentField == "titleImageHeight" or
  146. c.recentField == "titleImageWidth"
  147. ):
  148. tds: list[gui_TextureDescription] = []
  149. for id in range(0, c.titleImageCount):
  150. td = gui_createTextureDescription()
  151. td.fileName = c.titleImage
  152. td.height = c.titleImageHeight
  153. td.width = c.titleImageWidth
  154. td.x = id * c.titleImageWidth
  155. td.y = 0
  156. tds.append(td)
  157. #}
  158. c.titleTextureDescriptions = tds
  159. c.recentField = "titleTextureDescriptions"
  160. return c
  161. #}
  162. c.recentField = "none"
  163. return c
  164. #}