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.

main-gui.py 4.7KB

3 months ago
3 months ago
3 months ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. import arcade
  2. from cli import *
  3. from cli_test import *
  4. from ctx import *
  5. from ctx_test2 import *
  6. from desktop import *
  7. from desktop_Platform import *
  8. from desktop_SequentialTimer import *
  9. from desktop_Window import *
  10. from gui import *
  11. from gui_aux import *
  12. from gui_aux_test import *
  13. from gui_test import *
  14. from llm_test import *
  15. from llm_test_Python import *
  16. from memory_test import *
  17. import sys
  18. print(ctx_test_Controller_executeFunctions_registerFunction_set())
  19. print(ctx_test_Controller_processQueue())
  20. print(ctx_test_Controller_registerFieldCallback_match())
  21. print(ctx_test_Controller_registerFieldCallback_mismatch())
  22. print(ctx_test_memoryContext_field())
  23. print(ctx_test_memoryContext_setField())
  24. print(llm_test_Python_copyByValue())
  25. print(llm_test_isDigit_digit())
  26. print(llm_test_isDigit_notDigit())
  27. print(llm_test_strToInt())
  28. print(memory_test_detectMismatchedItems())
  29. print(memory_test_detectMismatchedItems_itemTwice())
  30. print(memory_test_detectVictory())
  31. print(memory_test_generateConstPlayfield())
  32. print(memory_test_hideMatchingItems())
  33. print(memory_test_selectItem_1x())
  34. print(memory_test_selectItem_2x())
  35. print(memory_test_selectItem_3x())
  36. print(cli_test_exit_e())
  37. print(cli_test_exit_exit())
  38. print(cli_test_exit_victory())
  39. print(cli_test_exit_q())
  40. print(cli_test_exit_quit())
  41. print(cli_test_goOn())
  42. print(cli_test_greetUser())
  43. print(cli_test_showHelp_h())
  44. print(cli_test_showHelp_help())
  45. print(cli_test_selectItem())
  46. print(cli_test_promptSecondItemSelection())
  47. print(cli_test_reportMatchedItems())
  48. print(cli_test_reportMismatchedItems())
  49. print(cli_test_reportVictory())
  50. print(test_gui_aux_cellGridPositions())
  51. print(test_gui_generateTextureDescriptions())
  52. print(test_gui_generateTilePositions())
  53. ctrl = ctx_Controller(memory_createContext())
  54. ctrl.registerFunctions([
  55. # cli_exit,
  56. # cli_goOn,
  57. # cli_greetUser,
  58. # cli_promptSecondItemSelection,
  59. # cli_reportMatchedItems,
  60. # cli_reportMismatchedItems,
  61. # cli_reportVictory,
  62. # cli_selectItem,
  63. # cli_showHelp,
  64. gui_generateDescTextureDescriptions,
  65. gui_generateSplashTextureDescriptions,
  66. gui_generateTextureDescriptions,
  67. gui_generateTilePositions,
  68. gui_generateTitleTextureDescriptions,
  69. memory_detectMismatchedItems,
  70. memory_detectVictory,
  71. memory_generateConstPlayfield,
  72. memory_hideMatchingItems,
  73. memory_selectItem,
  74. ])
  75. def printDbg(c):
  76. print(f"Dbg key/value: '{c.recentField}'/'{c.field(c.recentField)}'")
  77. #ctrl.registerCallback(printDbg)
  78. ctrl.registerFieldCallback("exit", lambda c: sys.exit(0))
  79. p = desktop_Platform()
  80. p.ctrl = ctrl
  81. p.sequentialTimer = desktop_SequentialTimer()
  82. p.sequentialTimer.callback = lambda key, value: ctrl.set(key, value)
  83. # Bind platform to context changes.
  84. def process(c):
  85. # Copy context to platform.
  86. p.c = c
  87. # Perform context dependent calls of desktop functions.
  88. # Similar to context functions, but no platform is returned.
  89. desktop_deselectMismatchedTiles(p)
  90. desktop_displayDesc(p)
  91. desktop_displayEndingSplashScreen(p)
  92. desktop_displaySelectedTile(p)
  93. desktop_displayTitle(p)
  94. desktop_hideBeginningSplashScreen(p)
  95. desktop_hideDesc(p)
  96. desktop_hideMatchingTiles(p)
  97. desktop_hideTitle(p)
  98. desktop_scheduleDisplayOfEndingSplashScreen(p)
  99. desktop_scheduleHidingOfBeginningSplashScreen(p)
  100. desktop_scheduleHidingOfMatchingTiles(p)
  101. desktop_scheduleDeselectionOfMismatchedTiles(p)
  102. ctrl.registerCallback(process)
  103. ctrl.set("didLaunch", True)
  104. ctrl.set("playfieldSize", 6)
  105. ctrl.set("cellPositions", gui_aux_cellHarmPositions())
  106. ctrl.set("cellSize", 25)
  107. ctrl.set("deselectMismatchedTilesDelay", 500)
  108. ctrl.set("descImage", "res/harm.png")
  109. ctrl.set("descImageCount", 6)
  110. ctrl.set("descImageHeight", 250)
  111. ctrl.set("descImageWidth", 375)
  112. ctrl.set("descPosition", [19, 12])
  113. ctrl.set("hideMatchingTilesDelay", 500)
  114. ctrl.set("splashBeginTimeout", 2000)
  115. ctrl.set("splashEndDelay", 100)
  116. ctrl.set("splashImage", "res/splash.png")
  117. ctrl.set("splashImageCount", 2)
  118. ctrl.set("splashImageHeight", 600)
  119. ctrl.set("splashImageWidth", 900)
  120. ctrl.set("tileImage", "res/harmful-tiles.png")
  121. ctrl.set("tileImageCount", 8)
  122. ctrl.set("tileImageHeight", 100)
  123. ctrl.set("tileImageWidth", 75)
  124. ctrl.set("titleImage", "res/harmful-titles.png")
  125. ctrl.set("titleImageCount", 6)
  126. ctrl.set("titleImageHeight", 100)
  127. ctrl.set("titleImageWidth", 700)
  128. ctrl.set("titlePosition", [4, 1])
  129. ctrl.set("windowWidth", 900)
  130. ctrl.set("windowHeight", 600)
  131. ctrl.set("windowAntialiasing", False)
  132. ctrl.set("windowBackgroundColor", "#ffffff")
  133. ctrl.set("windowTitle", "Вредные продукты")
  134. desktop_loadTextures(p)
  135. desktop_createDeselectedTiles(p)
  136. desktop_createSelectedTiles(p)
  137. desktop_loadTitleTextures(p)
  138. desktop_createTitle(p)
  139. desktop_loadDescTextures(p)
  140. desktop_createDesc(p)
  141. desktop_loadSplashTextures(p)
  142. desktop_createSplash(p)
  143. wnd = desktop_Window(p)
  144. arcade.run()