Shuvit game master repo. http://shuvit.org
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

menuV3.py 31KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842
  1. import bge
  2. keyboard = bge.logic.keyboard
  3. JUST_ACTIVATED = bge.logic.KX_INPUT_JUST_ACTIVATED
  4. #exit functions
  5. #=======
  6. def endpoint(funct, motion, dict, cont):
  7. #print('endpoint', funct,motion)
  8. scene = bge.logic.getCurrentScene()
  9. scenes = bge.logic.getSceneList()
  10. main_scene = [scene for scene in scenes if scene.name=="main"][0]
  11. main_empty = main_scene.objects['Empty']
  12. own = cont.owner
  13. import Settings
  14. load_timer = 100
  15. shirt = scene.objects["Char4:Zshirtt1"]
  16. shoeR = scene.objects['Char4:Shoes02.R']
  17. shoeL = scene.objects['Char4:Shoes02.L']
  18. deck = scene.objects["deck"]
  19. throw_deck = scene.objectsInactive["throw_deck"]
  20. cam = scene.objects['Camera.003']
  21. c_move = .025 #color move amount
  22. if funct == 'exit':
  23. #print("exit function", motion)
  24. bge.logic.endGame()
  25. if funct == 'restart':
  26. #print("restart function", motion)
  27. bge.logic.restartGame()
  28. if funct == 'shirt color r':
  29. s_color = shirt.color
  30. s_color_r = s_color[0]
  31. if motion == 'inc':
  32. if s_color_r < 1:
  33. s_color_r += c_move
  34. s_color_r = round(s_color_r, 2)
  35. else:
  36. s_color_r = 1
  37. if motion == 'dec':
  38. if s_color_r > c_move:
  39. s_color_r -= c_move
  40. s_color_r = round(s_color_r, 2)
  41. else:
  42. s_color_r = 0
  43. new_col = [s_color_r, s_color[1], s_color[2], s_color[3]]
  44. shirt.color = new_col
  45. dict['shirt_color_r'] = new_col[0]
  46. if funct == 'shirt color g':
  47. s_color = shirt.color
  48. s_color_g = s_color[1]
  49. if motion == 'inc':
  50. if s_color_g < 1:
  51. s_color_g += c_move
  52. s_color_g = round(s_color_g, 2)
  53. else:
  54. s_color_rg = 1
  55. if motion == 'dec':
  56. if s_color_g > c_move:
  57. s_color_g -= c_move
  58. s_color_g = round(s_color_g, 2)
  59. else:
  60. s_color_g = 0
  61. new_col = [s_color[0], s_color_g, s_color[2], s_color[3]]
  62. shirt.color = new_col
  63. dict['shirt_color_g'] = new_col[1]
  64. if funct == 'shirt color b':
  65. s_color = shirt.color
  66. s_color_b = s_color[2]
  67. if motion == 'inc':
  68. if s_color_b < 1:
  69. s_color_b += c_move
  70. s_color_b = round(s_color_b, 2)
  71. else:
  72. s_color_b = 1
  73. if motion == 'dec':
  74. if s_color_b > c_move:
  75. s_color_b -= c_move
  76. s_color_b = round(s_color_b, 2)
  77. else:
  78. s_color_b = 0
  79. new_col = [s_color[0], s_color[1], s_color_b, s_color[3]]
  80. shirt.color = new_col
  81. #print(new_col)
  82. dict['shirt_color_b'] = new_col[2]
  83. if funct == 'shoe color r':
  84. s_color = shoeL.color
  85. s_color_r = s_color[0]
  86. if motion == 'inc':
  87. if s_color_r < 1:
  88. s_color_r += c_move
  89. s_color_r = round(s_color_r, 2)
  90. else:
  91. s_color_r = 1
  92. if motion == 'dec':
  93. if s_color_r > c_move:
  94. s_color_r -= c_move
  95. s_color_r = round(s_color_r, 2)
  96. else:
  97. s_color_r = 0
  98. new_col = [s_color_r, s_color[1], s_color[2], s_color[3]]
  99. shoeL.color = new_col
  100. shoeR.color = new_col
  101. dict['shoe_color_r'] = new_col[0]
  102. if funct == 'shoe color g':
  103. s_color = shoeL.color
  104. s_color_g = s_color[1]
  105. if motion == 'inc':
  106. if s_color_g < 1:
  107. s_color_g += c_move
  108. s_color_g = round(s_color_g, 2)
  109. else:
  110. s_color_rg = 1
  111. if motion == 'dec':
  112. if s_color_g > c_move:
  113. s_color_g -= c_move
  114. s_color_g = round(s_color_g, 2)
  115. else:
  116. s_color_g = 0
  117. new_col = [s_color[0], s_color_g, s_color[2], s_color[3]]
  118. shoeL.color = new_col
  119. shoeR.color = new_col
  120. dict['shoe_color_g'] = new_col[1]
  121. if funct == 'shoe color b':
  122. s_color = shoeL.color
  123. s_color_b = s_color[2]
  124. if motion == 'inc':
  125. if s_color_b < 1:
  126. s_color_b += c_move
  127. s_color_b = round(s_color_b, 2)
  128. else:
  129. s_color_b = 1
  130. if motion == 'dec':
  131. if s_color_b > c_move:
  132. s_color_b -= c_move
  133. s_color_b = round(s_color_b, 2)
  134. else:
  135. s_color_b = 0
  136. new_col = [s_color[0], s_color[1], s_color_b, s_color[3]]
  137. shoeL.color = new_col
  138. shoeR.color = new_col
  139. #print(new_col)
  140. dict['shoe_color_b'] = new_col[2]
  141. if funct == 'deck color r':
  142. s_color = deck.color
  143. s_color_r = s_color[0]
  144. if motion == 'inc':
  145. if s_color_r < 1:
  146. s_color_r += c_move
  147. s_color_r = round(s_color_r, 2)
  148. else:
  149. s_color_r = 1
  150. if motion == 'dec':
  151. if s_color_r > c_move:
  152. s_color_r -= c_move
  153. s_color_r = round(s_color_r, 2)
  154. else:
  155. s_color_r = 0
  156. new_col = [s_color_r, s_color[1], s_color[2], s_color[3]]
  157. deck.color = new_col
  158. throw_deck.color = new_col
  159. dict['deck_color_r'] = new_col[0]
  160. if funct == 'deck color g':
  161. s_color = deck.color
  162. s_color_g = s_color[1]
  163. if motion == 'inc':
  164. if s_color_g < 1:
  165. s_color_g += c_move
  166. s_color_g = round(s_color_g, 2)
  167. else:
  168. s_color_rg = 1
  169. if motion == 'dec':
  170. if s_color_g > c_move:
  171. s_color_g -= c_move
  172. s_color_g = round(s_color_g, 2)
  173. else:
  174. s_color_g = 0
  175. new_col = [s_color[0], s_color_g, s_color[2], s_color[3]]
  176. deck.color = new_col
  177. throw_deck.color = new_col
  178. dict['deck_color_g'] = new_col[1]
  179. if funct == 'deck color b':
  180. s_color = deck.color
  181. s_color_b = s_color[2]
  182. if motion == 'inc':
  183. if s_color_b < 1:
  184. s_color_b += c_move
  185. s_color_b = round(s_color_b, 2)
  186. else:
  187. s_color_b = 1
  188. if motion == 'dec':
  189. if s_color_b > c_move:
  190. s_color_b -= c_move
  191. s_color_b = round(s_color_b, 2)
  192. else:
  193. s_color_b = 0
  194. new_col = [s_color[0], s_color[1], s_color_b, s_color[3]]
  195. deck.color = new_col
  196. throw_deck.color = new_col
  197. #print(new_col)
  198. dict['deck_color_b'] = new_col[2]
  199. if funct == 'shirt logo':
  200. logo = dict['shirt_logo']
  201. logo1 = shirt.meshes[0].materials[0].textures[6]
  202. logo2 = shirt.meshes[0].materials[0].textures[7]
  203. logo3 = shirt.meshes[0].materials[0].textures[5]
  204. if motion == 'inc':
  205. if logo == 0:
  206. logo = 1
  207. elif logo == 1:
  208. logo = 2
  209. elif logo == 2:
  210. logo = 3
  211. elif logo == 3:
  212. logo = 0
  213. if motion == 'dec':
  214. if logo == 0:
  215. logo = 3
  216. elif logo == 1:
  217. logo = 0
  218. elif logo == 2:
  219. logo = 1
  220. elif logo == 3:
  221. logo = 2
  222. if logo == 1:
  223. logo1.diffuseIntensity = 1
  224. logo2.diffuseIntensity = 0
  225. logo1.diffuseFactor = 1
  226. logo2.diffuseFactor = 0
  227. logo3.diffuseIntensity = 0
  228. logo3.diffuseFactor = 0
  229. if logo == 2:
  230. logo1.diffuseIntensity = 0
  231. logo1.diffuseFactor = 0
  232. logo2.diffuseIntensity = 1
  233. logo2.diffuseFactor = 1
  234. logo3.diffuseIntensity = 0
  235. logo3.diffuseFactor = 0
  236. if logo == 3:
  237. logo1.diffuseIntensity = 0
  238. logo1.diffuseFactor = 0
  239. logo2.diffuseIntensity = 0
  240. logo2.diffuseFactor = 0
  241. logo3.diffuseIntensity = 1
  242. logo3.diffuseFactor = 1
  243. if logo == 0:
  244. logo1.diffuseIntensity = 0
  245. logo2.diffuseIntensity = 0
  246. logo1.diffuseFactor = 0
  247. logo2.diffuseFactor = 0
  248. logo3.diffuseIntensity = 0
  249. logo3.diffuseFactor = 0
  250. dict['shirt_logo'] = logo
  251. if funct == 'brightness / contrast on':
  252. if motion == 'inc':
  253. cont.activate(cam.actuators["bc"])
  254. cam['bc'] = 1
  255. dict['bc'] = 1
  256. else:
  257. cont.activate(cam.actuators["bc_off"])
  258. cam['bc'] = 0
  259. dict['bc'] = 0
  260. if funct == 'brightness value':
  261. b = cam['BC_BRIGHTNESS']
  262. if motion == 'inc':
  263. b += .05
  264. else:
  265. b -= .05
  266. cam['BC_BRIGHTNESS'] = round(b,2)
  267. dict['BC_BRIGHTNESS'] = round(b,2)
  268. if funct == 'contrast value':
  269. b = cam['BC_CONTRAST']
  270. if motion == 'inc':
  271. b += .05
  272. else:
  273. b -= .05
  274. cam['BC_CONTRAST'] = round(b,2)
  275. dict['BC_CONTRAST'] = round(b,2)
  276. if funct == 'hdr on':
  277. if motion == 'inc':
  278. cont.activate(cam.actuators["hdr"])
  279. cam['hdr'] = 1
  280. dict['hdr'] = 1
  281. else:
  282. cont.activate(cam.actuators["hdr_off"])
  283. cam['hdr'] = 0
  284. dict['hdr'] = 0
  285. if funct == 'avgL':
  286. b = cam['avgL']
  287. if motion == 'inc':
  288. b += .05
  289. else:
  290. b -= .05
  291. cam['avgL'] = round(b,2)
  292. dict['avgL'] = round(b,2)
  293. if funct == 'hdr strength':
  294. b = cam['HDRamount']
  295. if motion == 'inc':
  296. b += .05
  297. else:
  298. b -= .05
  299. cam['HDRamount'] = round(b,2)
  300. dict['HDRamount'] = round(b,2)
  301. if funct == 'ao on':
  302. if motion == 'inc':
  303. cont.activate(cam.actuators["ao"])
  304. cam['ao'] = 1
  305. dict['ao'] = 1
  306. else:
  307. cont.activate(cam.actuators["ao_off"])
  308. cam['ao'] = 0
  309. dict['ao'] = 0
  310. if funct == 'ao width':
  311. b = cam['aowidth']
  312. if motion == 'inc':
  313. b += 1
  314. else:
  315. b -= 1
  316. cam['aowidth'] = round(b,2)
  317. dict['aowidth'] = round(b,2)
  318. if funct == 'ao radius':
  319. b = cam['aoradius']
  320. if motion == 'inc':
  321. b += 1
  322. else:
  323. b -= 1
  324. cam['aoradius'] = round(b,2)
  325. dict['aoradius'] = round(b,2)
  326. if funct == 'ao only':
  327. b = cam['onlyAO']
  328. if motion == 'inc':
  329. b = 1
  330. else:
  331. b = 0
  332. cam['onlyAO'] = b
  333. dict['onlyAO'] = b
  334. if funct == 'dof on':
  335. if motion == 'inc':
  336. cont.activate(cam.actuators["DOF"])
  337. cam['dof_on'] = 1
  338. dict['dof_on'] = 1
  339. else:
  340. cont.activate(cam.actuators["DOF_off"])
  341. cam['dof_on'] = 0
  342. dict['dof_on'] = 0
  343. if funct == 'bloom on':
  344. if motion == 'inc':
  345. cont.activate(cam.actuators["Bloom"])
  346. cam['bloom_on'] = 1
  347. dict['bloom_on'] = 1
  348. else:
  349. cont.activate(cam.actuators["bloom_off"])
  350. cam['bloom_on'] = 0
  351. dict['bloom_on'] = 0
  352. if funct == 'shadow on':
  353. if motion == 'inc':
  354. cam['shadow_on'] = 1
  355. dict['shadow_on'] = 1
  356. #bge.render.setGLSLMaterialSetting("shadows", 1)
  357. else:
  358. #cont.activate(cam.actuators["bloom_off"])
  359. cam['shadow_on'] = 0
  360. dict['shadow_on'] = 0
  361. #bge.render.setGLSLMaterialSetting("shadows", 0)
  362. if funct == 'sun strength':
  363. b = cam['sun_strength']
  364. if motion == 'inc':
  365. b += .05
  366. else:
  367. b -= .05
  368. cam['sun_strength'] = round(b,2)
  369. dict['sun_strength'] = round(b,2)
  370. if 'sun33' in scene.objects:
  371. sun = scene.objects['sun33']
  372. sun.energy = b
  373. if funct == 'ambient strength':
  374. b = cam['ambient_strength']
  375. if motion == 'inc':
  376. b += .05
  377. else:
  378. b -= .05
  379. cam['ambient_strength'] = round(b,2)
  380. dict['ambient_strength'] = round(b,2)
  381. if 'sun33' in scene.objects:
  382. scene.world.envLightEnergy = b
  383. if funct == 'sun rot x':
  384. #b = cam['sun_rot_x']
  385. b=0
  386. if motion == 'inc':
  387. b += .05
  388. else:
  389. b -= .05
  390. if 'camposEmpty' in scene.objects:
  391. em = scene.objects['camposEmpty']
  392. rot = [ b, 0.0, 0]
  393. em.applyRotation(rot,True)
  394. cam['sun_rot_x'] = round(b,2)
  395. dict['sun_rot_x'] = round(b,2)
  396. if funct == 'sun rot y':
  397. #b = cam['sun_rot_y']
  398. b=0
  399. if motion == 'inc':
  400. b += .05
  401. else:
  402. b -= .05
  403. if 'camposEmpty' in scene.objects:
  404. em = scene.objects['camposEmpty']
  405. rot = [ 0, b, 0]
  406. em.applyRotation(rot,True)
  407. cam['sun_rot_y'] = round(b,2)
  408. dict['sun_rot_y'] = round(b,2)
  409. #levels
  410. if funct == 'Demo Scene':
  411. if motion == 'inc':
  412. level = "pats"
  413. main_empty["level"] = "pats"
  414. own["level"] = level
  415. Settings.writeSettings()
  416. Settings.readSettings()
  417. #cont.activate(own.actuators['restart'])
  418. #Settings.loadlevel()
  419. dict['load_timer'] = load_timer
  420. dict['reload_timer'] = 250
  421. dict['overlay_fadein'] = 1
  422. if funct == 'Slavonski Brod (WIP)':
  423. if motion == 'inc':
  424. level = "j_scene"
  425. main_empty["level"] = "j_scene"
  426. own["level"] = level
  427. Settings.writeSettings()
  428. Settings.readSettings()
  429. #cont.activate(own.actuators['restart'])
  430. #Settings.loadlevel()
  431. dict['load_timer'] = load_timer
  432. dict['reload_timer'] = 250
  433. dict['overlay_fadein'] = 1
  434. if funct == 'Empty Lot':
  435. if motion == 'inc':
  436. level = "lot"
  437. main_empty["level"] = "lot"
  438. own["level"] = level
  439. Settings.writeSettings()
  440. Settings.readSettings()
  441. #cont.activate(own.actuators['restart'])
  442. #Settings.loadlevel()
  443. dict['load_timer'] = load_timer
  444. dict['reload_timer'] = 250
  445. dict['overlay_fadein'] = 1
  446. if funct == 'Training':
  447. if motion == 'inc':
  448. level = "train"
  449. main_empty["level"] = "train"
  450. own["level"] = level
  451. Settings.writeSettings()
  452. Settings.readSettings()
  453. #cont.activate(own.actuators['restart'])
  454. #Settings.loadlevel()
  455. dict['load_timer'] = load_timer
  456. dict['reload_timer'] = 250
  457. dict['overlay_fadein'] = 1
  458. if funct == 'Spine':
  459. if motion == 'inc':
  460. level = "spine"
  461. main_empty["level"] = "spine"
  462. own["level"] = level
  463. Settings.writeSettings()
  464. Settings.readSettings()
  465. #cont.activate(own.actuators['restart'])
  466. #Settings.loadlevel()
  467. dict['load_timer'] = load_timer
  468. dict['reload_timer'] = 250
  469. dict['overlay_fadein'] = 1
  470. if funct == 'Warehouse':
  471. if motion == 'inc':
  472. level = "warehouse"
  473. main_empty["level"] = "warehouse"
  474. own["level"] = level
  475. Settings.writeSettings()
  476. Settings.readSettings()
  477. #cont.activate(own.actuators['restart'])
  478. #Settings.loadlevel()
  479. dict['load_timer'] = load_timer
  480. dict['reload_timer'] = 250
  481. dict['overlay_fadein'] = 1
  482. #'1920x1080', '1280x720', '1024x768', '800x600', 'fullscreen'
  483. if funct == '1920x1080':
  484. #pass
  485. if motion == 'inc':
  486. dict['resx'] = 1920
  487. dict['resy'] = 1080
  488. Settings.writeSettings()
  489. bge.render.setWindowSize(1920, 1080)
  490. # if dict['fullscreen_on'] == 1:
  491. # bge.render.setFullScreen(True)
  492. # else:
  493. # bge.render.setFullScreen(False)
  494. if funct == '1280x720':
  495. if motion == 'inc':
  496. dict['resx'] = 1280
  497. dict['resy'] = 720
  498. Settings.writeSettings()
  499. bge.render.setWindowSize(1280, 720)
  500. # if dict['fullscreen_on'] == 1:
  501. # bge.render.setFullScreen(True)
  502. # else:
  503. # bge.render.setFullScreen(False)
  504. if funct == '1024x768':
  505. if motion == 'inc':
  506. dict['resx'] = 1024
  507. dict['resy'] = 768
  508. Settings.writeSettings()
  509. bge.render.setWindowSize(1024, 768)
  510. # if dict['fullscreen_on'] == 1:
  511. # bge.render.setFullScreen(True)
  512. # else:
  513. # bge.render.setFullScreen(False)
  514. if funct == '800x600':
  515. if motion == 'inc':
  516. dict['resx'] = 800
  517. dict['resy'] = 600
  518. Settings.writeSettings()
  519. bge.render.setWindowSize(800, 600)
  520. # if dict['fullscreen_on'] == 1:
  521. # bge.render.setFullScreen(True)
  522. # else:
  523. # bge.render.setFullScreen(False)
  524. if funct == 'fullscreen':
  525. if motion == 'inc':
  526. dict['fullscreen_on'] = 1
  527. bge.render.setFullScreen(True)
  528. Settings.writeSettings()
  529. else:
  530. dict['fullscreen_on'] = 0
  531. bge.render.setFullScreen(False)
  532. Settings.writeSettings()
  533. #=======
  534. #end exit functions
  535. def get_c_list(dict):
  536. #main menu
  537. if dict['mlevel'] == 0:
  538. dict['current_list'] = ['settings', 'level', 'replay', 'restart', 'exit']
  539. #opt = dict['current_list'][dict['current_index']]
  540. if dict['mlevel'] == 1:
  541. if dict['lv0_opt'] == 'settings':
  542. #if opt == 'settings':
  543. dict['current_list'] = ['resolution', 'graphics', 'player', 'level', 'camera', 'physics']
  544. if dict['lv0_opt'] == 'replay':
  545. dict['current_list'] = ['enter replay', 'recorder on', 'record length']
  546. if dict['lv0_opt'] == 'level':
  547. dict['current_list'] = ['Demo Scene', 'Empty Lot', 'Training', 'Spine', 'Warehouse', 'Slavonski Brod (WIP)']
  548. if dict['mlevel'] == 2:
  549. if dict['lv1_opt'] == 'resolution':
  550. #if opt == 'settings':
  551. dict['current_list'] = ['1920x1080', '1280x720', '1024x768', '800x600', 'fullscreen']
  552. if dict['mlevel'] == 2:
  553. if dict['lv1_opt'] == 'graphics':
  554. #if opt == 'settings':
  555. dict['current_list'] = ['brightness / contrast', 'ao', 'hdr', 'dof', 'bloom']
  556. if dict['mlevel'] == 2:
  557. if dict['lv1_opt'] == 'player':
  558. #if opt == 'settings':
  559. dict['current_list'] = ['shirt color r', 'shirt color g', 'shirt color b', 'shoe color r', 'shoe color g', 'shoe color b','deck color r', 'deck color g', 'deck color b', 'shirt logo']
  560. if dict['mlevel'] == 2:
  561. if dict['lv1_opt'] == 'level':
  562. #if opt == 'settings':
  563. dict['current_list'] = ['sun strength', 'ambient strength', 'sun rot x', 'sun rot y', 'shadow on']
  564. if dict['mlevel'] == 3:
  565. if dict['lv2_opt'] == 'ao':
  566. dict['current_list'] = ['ao on', 'ao radius', 'ao width', 'ao only']
  567. if dict['lv2_opt'] == 'brightness / contrast':
  568. dict['current_list'] = ['brightness / contrast on', 'brightness value', 'contrast value']
  569. if dict['lv2_opt'] == 'hdr':
  570. dict['current_list'] = ['hdr on', 'avgL', 'hdr strength']
  571. if dict['lv2_opt'] == 'dof':
  572. dict['current_list'] = ['dof on']
  573. if dict['lv2_opt'] == 'bloom':
  574. dict['current_list'] = ['bloom on']
  575. def get_inputs(dict, cont):
  576. #opt = dict['current_list'][dict['current_index']]
  577. #b
  578. if keyboard.events[bge.events.LEFTARROWKEY] == JUST_ACTIVATED or (dict['bBut'] == False and dict['last_bBut'] == True):
  579. if dict['current_index'] not in dict['menu_end_points']:
  580. #print('lkey')
  581. if dict['mlevel'] == 2:
  582. dict['mlevel'] = 1
  583. dict['current_index'] = dict['lv1_index']
  584. elif dict['mlevel'] == 1:
  585. dict['mlevel'] = 0
  586. dict['current_index'] = dict['lv0_index']
  587. elif dict['mlevel'] == 3:
  588. dict['mlevel'] = 2
  589. dict['current_index'] = dict['lv2_index']
  590. else:
  591. pass
  592. # funct = dict['current_index']
  593. # motion = 'dec'
  594. # endpoint(funct, motion, dict)
  595. #a
  596. if (keyboard.events[bge.events.RIGHTARROWKEY] == JUST_ACTIVATED) or (dict['aBut'] == False and dict['last_aBut'] == True):
  597. if dict['current_opt'] not in dict['menu_end_points']:
  598. if dict['mlevel'] == 0:
  599. dict['lv0_opt'] = dict['current_list'][dict['current_index']]
  600. dict['lv0_index'] = dict['current_index']
  601. dict['mlevel'] = 1
  602. dict['lv1_index'] = 0
  603. dict['current_index'] = 0
  604. elif dict['mlevel'] == 1:
  605. dict['lv1_opt'] = dict['current_list'][dict['current_index']]
  606. dict['lv1_index'] = dict['current_index']
  607. dict['mlevel'] = 2
  608. dict['lv2_index'] = 0
  609. dict['current_index'] = 0
  610. elif dict['mlevel'] == 2:
  611. dict['lv2_opt'] = dict['current_list'][dict['current_index']]
  612. dict['lv2_index'] = dict['current_index']
  613. dict['mlevel'] = 3
  614. dict['lv3_index'] = 0
  615. dict['current_index'] = 0
  616. elif dict['mlevel'] == 3:
  617. dict['lv3_opt'] = dict['current_list'][dict['current_index']]
  618. dict['lv3_index'] = dict['current_index']
  619. #dict['mlevel'] = 3
  620. #dict['lv3_index'] = 0
  621. dict['current_index'] = 0
  622. else:
  623. pass
  624. funct = dict['current_opt']
  625. motion = 'inc'
  626. endpoint(funct, motion, dict, cont)
  627. #down
  628. if keyboard.events[bge.events.DOWNARROWKEY] == JUST_ACTIVATED or (dict['ddPad'] == False and dict['last_ddPad'] == True):
  629. if dict['current_index'] < (len(dict['current_list']) - 1):
  630. dict['current_index'] += 1
  631. if dict['mlevel'] == 0:
  632. dict['lv0_index'] = dict['current_index']
  633. if dict['mlevel'] == 1:
  634. dict['lv1_index'] = dict['current_index']
  635. if dict['mlevel'] == 2:
  636. dict['lv2_index'] = dict['current_index']
  637. if dict['mlevel'] == 3:
  638. dict['lv3_index'] = dict['current_index']
  639. #up
  640. if keyboard.events[bge.events.UPARROWKEY] == JUST_ACTIVATED or (dict['udPad'] == False and dict['last_udPad'] == True):
  641. if dict['current_index'] > 0:
  642. dict['current_index'] -= 1
  643. if dict['mlevel'] == 0:
  644. dict['lv0_index'] = dict['current_index']
  645. if dict['mlevel'] == 1:
  646. dict['lv1_index'] = dict['current_index']
  647. if dict['mlevel'] == 2:
  648. dict['lv2_index'] = dict['current_index']
  649. if dict['mlevel'] == 3:
  650. dict['lv3_index'] = dict['current_index']
  651. #left
  652. if dict['ldPad'] == False and dict['last_ldPad'] == True:
  653. if dict['current_opt'] in dict['menu_end_points']:
  654. funct = dict['current_opt']
  655. motion = 'dec'
  656. endpoint(funct, motion, dict, cont)
  657. #right
  658. if dict['rdPad'] == False and dict['last_rdPad'] == True:
  659. if dict['current_opt'] in dict['menu_end_points']:
  660. funct = dict['current_opt']
  661. motion = 'inc'
  662. endpoint(funct, motion, dict, cont)
  663. def init(own, dict):
  664. #print('initing')
  665. own['inited'] = True
  666. dict['lv0_opt'] = 0
  667. dict['lv0_index'] = 0
  668. dict['lv1_opt'] = 0
  669. dict['lv1_index'] = 0
  670. dict['lv2_opt'] = 0
  671. dict['lv2_index'] = 0
  672. dict['lv3_opt'] = 0
  673. dict['lv3_index'] = 0
  674. dict['current_list'] = ['']
  675. dict['current_index'] = 0
  676. dict['mlevel'] = 0
  677. dict['current_opt'] = ''
  678. dict['pause_menu_text'] = ''
  679. dict['menu_end_points'] = ['exit', 'restart', 'shirt color r', 'shirt color g', 'shirt color b', 'shoe color r', 'shoe color g', 'shoe color b','deck color r', 'deck color g', 'deck color b', 'shirt logo', 'brightness / contrast on', 'brightness value', 'contrast value', 'hdr on', 'avgL', 'hdr strength', 'ao on', 'ao radius', 'ao width', 'ao only', 'dof on', 'sun strength', 'sun rot x', 'sun rot y', 'shadow on', 'ambient strength', 'Demo Scene', 'Empty Lot', 'Park A', 'Training', 'Spine', 'Warehouse', '1920x1080', '1280x720', '1024x768', '800x600', 'fullscreen', 'bloom on']
  680. def output(dict):
  681. try:
  682. opt = dict['current_list'][dict['current_index']]
  683. except:
  684. pass
  685. #print('broken!!', dict['current_list'], dict['current_index'])
  686. dict['current_opt'] = opt
  687. #print(dict['lv1_index'], 'level: ', dict['mlevel'], dict['lv0_opt'], dict['current_index'], dict['current_list'], dict['current_opt'])
  688. outp = 'menu > '
  689. if dict['mlevel'] == 0:
  690. outp = outp + dict['current_opt']
  691. if dict['mlevel'] == 1:
  692. outp = outp + dict['lv0_opt'] +' > ' + dict['current_opt']
  693. if dict['mlevel'] == 2:
  694. outp = outp + dict['lv0_opt'] +' > ' + dict['lv1_opt'] + ' > ' + dict['current_opt']
  695. if dict['mlevel'] == 3:
  696. outp = outp + dict['lv0_opt'] +' > ' + dict['lv1_opt'] + ' > ' + dict['lv2_opt'] + ' > ' + dict['current_opt']
  697. #print(outp)
  698. #print(dict['current_opt'])
  699. if dict['current_opt'] in dict['menu_end_points']:
  700. #print('adding end point value')
  701. if dict['current_opt'] == 'shirt color r':
  702. outp = outp + ': ' + str(dict['shirt_color_r'])
  703. #print(outp + ': ' + str(dict['shirt_color_r']))
  704. if dict['current_opt'] == 'shirt color g':
  705. outp = outp + ': ' + str(dict['shirt_color_g'])
  706. if dict['current_opt'] == 'shirt color b':
  707. outp = outp + ': ' + str(dict['shirt_color_b'])
  708. if dict['current_opt'] == 'shoe color r':
  709. outp = outp + ': ' + str(dict['shoe_color_r'])
  710. #print(outp + ': ' + str(dict['shoe_color_r']))
  711. if dict['current_opt'] == 'shoe color g':
  712. outp = outp + ': ' + str(dict['shoe_color_g'])
  713. if dict['current_opt'] == 'shoe color b':
  714. outp = outp + ': ' + str(dict['shoe_color_b'])
  715. if dict['current_opt'] == 'deck color r':
  716. outp = outp + ': ' + str(dict['deck_color_r'])
  717. #print(outp + ': ' + str(dict['deck_color_r']))
  718. if dict['current_opt'] == 'deck color g':
  719. outp = outp + ': ' + str(dict['deck_color_g'])
  720. if dict['current_opt'] == 'deck color b':
  721. outp = outp + ': ' + str(dict['deck_color_b'])
  722. if dict['current_opt'] == 'shirt logo':
  723. outp = outp + ': ' + str(dict['shirt_logo'])
  724. if dict['current_opt'] == 'brightness / contrast on':
  725. outp = outp + ': ' + str(dict['bc'])
  726. if dict['current_opt'] == 'brightness value':
  727. outp = outp + ': ' + str(dict['BC_BRIGHTNESS'])
  728. if dict['current_opt'] == 'contrast value':
  729. outp = outp + ': ' + str(dict['BC_CONTRAST'])
  730. if dict['current_opt'] == 'hdr on':
  731. outp = outp + ': ' + str(dict['hdr'])
  732. if dict['current_opt'] == 'avgL':
  733. outp = outp + ': ' + str(dict['avgL'])
  734. if dict['current_opt'] == 'hdr strength':
  735. outp = outp + ': ' + str(dict['HDRamount'])
  736. if dict['current_opt'] == 'ao on':
  737. outp = outp + ': ' + str(dict['ao'])
  738. if dict['current_opt'] == 'ao width':
  739. outp = outp + ': ' + str(dict['aowidth'])
  740. if dict['current_opt'] == 'ao radius':
  741. outp = outp + ': ' + str(dict['aoradius'])
  742. if dict['current_opt'] == 'ao only':
  743. outp = outp + ': ' + str(dict['onlyAO'])
  744. if dict['current_opt'] == 'dof on':
  745. outp = outp + ': ' + str(dict['dof_on'])
  746. if dict['current_opt'] == 'sun strength':
  747. outp = outp + ': ' + str(dict['sun_strength'])
  748. if dict['current_opt'] == 'sun rot x':
  749. outp = outp + ': ' + str(dict['sun_rot_x'])
  750. if dict['current_opt'] == 'sun rot y':
  751. outp = outp + ': ' + str(dict['sun_rot_y'])
  752. if dict['current_opt'] == 'shadow on':
  753. #outp = outp + ': ' + str(dict['shadow_on'])
  754. outp = outp + ': (not available)'
  755. if dict['current_opt'] == 'ambient strength':
  756. outp = outp + ': ' + str(dict['ambient_strength'])
  757. if dict['current_opt'] == 'fullscreen':
  758. outp = outp + ': ' + str(dict['fullscreen_on'])
  759. if dict['current_opt'] == 'bloom on':
  760. outp = outp + ': ' + str(dict['bloom_on'])
  761. dict['pause_menu_text'] = outp
  762. def main(cont):
  763. own = cont.owner
  764. dict = bge.logic.globalDict
  765. if 'inited' not in own:
  766. init(own, dict)
  767. get_c_list(dict)
  768. get_inputs(dict, cont)
  769. get_c_list(dict)
  770. output(dict)