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

gui.py 3.5KB

5ヶ月前
6ヶ月前
5ヶ月前
6ヶ月前
5ヶ月前
5ヶ月前
6ヶ月前
5ヶ月前
6ヶ月前
5ヶ月前
6ヶ月前
5ヶ月前
6ヶ月前
5ヶ月前
6ヶ月前
5ヶ月前
6ヶ月前
5ヶ月前
6ヶ月前
5ヶ月前
5ヶ月前
5ヶ月前
5ヶ月前
5ヶ月前
6ヶ月前
5ヶ月前
6ヶ月前
5ヶ月前
5ヶ月前
5ヶ月前
5ヶ月前
5ヶ月前
5ヶ月前
6ヶ月前
5ヶ月前
5ヶ月前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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 tiles
  37. #
  38. # Conditions:
  39. # 1. tileImage or tileImageCount or tileImageHeight or tileImageWidth has just changed
  40. @llm_by_value
  41. def gui_generateTextureDescriptions(
  42. c: memory_Context
  43. ) -> memory_Context:
  44. if (
  45. c.recentField == "tileImage" or
  46. c.recentField == "tileImageCount" or
  47. c.recentField == "tileImageHeight" or
  48. c.recentField == "tileImageWidth"
  49. ):
  50. tds: list[gui_TextureDescription] = []
  51. for id in range(0, c.tileImageCount):
  52. td = gui_createTextureDescription()
  53. td.fileName = c.tileImage
  54. td.height = c.tileImageHeight
  55. td.width = c.tileImageWidth
  56. td.x = id * c.tileImageWidth
  57. td.y = 0
  58. tds.append(td)
  59. #}
  60. c.textureDescriptions = tds
  61. c.recentField = "textureDescriptions"
  62. return c
  63. #}
  64. c.recentField = "none"
  65. return c
  66. #}
  67. # Generate tile positions
  68. #
  69. # Conditions:
  70. # 1. cellSize, playField, windowHeight, or windowWidth has changed and none of them is zero
  71. @llm_by_value
  72. def gui_generateTilePositions(
  73. c: memory_Context
  74. ) -> memory_Context:
  75. if (
  76. (
  77. c.recentField != "cellPositions" and
  78. c.recentField != "cellSize" and
  79. c.recentField != "playfieldSize" and
  80. c.recentField != "windowHeight" and
  81. c.recentField != "windowWidth"
  82. ) or
  83. (
  84. len(c.cellPositions) == 0 or
  85. c.cellSize == 0 or
  86. c.playfieldSize == 0 or
  87. c.windowHeight == 0 or
  88. c.windowWidth == 0
  89. )
  90. ):
  91. c.recentField = "none"
  92. return c
  93. #}
  94. ps = []
  95. for i in range(0, len(c.cellPositions)):
  96. p = gui_aux_cellScreenPosition(c, c.cellPositions[i])
  97. ps.append(p)
  98. #}
  99. c.tilePositions = ps
  100. c.recentField = "tilePositions"
  101. return c
  102. #}
  103. # Generate texture descriptions for tiTLes
  104. #
  105. # Conditions:
  106. # 1. titleImage, titleImageCount, titleImageHeight, or titleImageWidth has just changed
  107. @llm_by_value
  108. def gui_generateTitleTextureDescriptions(
  109. c: memory_Context
  110. ) -> memory_Context:
  111. if (
  112. c.recentField == "titleImage" or
  113. c.recentField == "titleImageCount" or
  114. c.recentField == "titleImageHeight" or
  115. c.recentField == "titleImageWidth"
  116. ):
  117. tds: list[gui_TextureDescription] = []
  118. for id in range(0, c.titleImageCount):
  119. td = gui_createTextureDescription()
  120. td.fileName = c.titleImage
  121. td.height = c.titleImageHeight
  122. td.width = c.titleImageWidth
  123. td.x = id * c.titleImageWidth
  124. td.y = 0
  125. tds.append(td)
  126. #}
  127. c.titleTextureDescriptions = tds
  128. c.recentField = "titleTextureDescriptions"
  129. return c
  130. #}
  131. c.recentField = "none"
  132. return c
  133. #}