Shuvit game master repo. http://shuvit.org
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.

menuV3.py 28KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751
  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 == 'sun strength':
  344. b = cam['sun_strength']
  345. if motion == 'inc':
  346. b += .05
  347. else:
  348. b -= .05
  349. cam['sun_strength'] = round(b,2)
  350. dict['sun_strength'] = round(b,2)
  351. if 'sun33' in scene.objects:
  352. sun = scene.objects['sun33']
  353. sun.energy = b
  354. if funct == 'ambient strength':
  355. b = cam['ambient_strength']
  356. if motion == 'inc':
  357. b += .05
  358. else:
  359. b -= .05
  360. cam['ambient_strength'] = round(b,2)
  361. dict['ambient_strength'] = round(b,2)
  362. if 'sun33' in scene.objects:
  363. scene.world.envLightEnergy = b
  364. if funct == 'sun rot x':
  365. #b = cam['sun_rot_x']
  366. b=0
  367. if motion == 'inc':
  368. b += .05
  369. else:
  370. b -= .05
  371. if 'camposEmpty' in scene.objects:
  372. em = scene.objects['camposEmpty']
  373. rot = [ b, 0.0, 0]
  374. em.applyRotation(rot,True)
  375. cam['sun_rot_x'] = round(b,2)
  376. dict['sun_rot_x'] = round(b,2)
  377. if funct == 'sun rot y':
  378. #b = cam['sun_rot_y']
  379. b=0
  380. if motion == 'inc':
  381. b += .05
  382. else:
  383. b -= .05
  384. if 'camposEmpty' in scene.objects:
  385. em = scene.objects['camposEmpty']
  386. rot = [ 0, b, 0]
  387. em.applyRotation(rot,True)
  388. cam['sun_rot_y'] = round(b,2)
  389. dict['sun_rot_y'] = round(b,2)
  390. #levels
  391. if funct == 'Demo Scene':
  392. if motion == 'inc':
  393. level = "pats"
  394. main_empty["level"] = "pats"
  395. own["level"] = level
  396. Settings.writeSettings()
  397. Settings.readSettings()
  398. #cont.activate(own.actuators['restart'])
  399. #Settings.loadlevel()
  400. dict['load_timer'] = load_timer
  401. dict['reload_timer'] = 250
  402. dict['overlay_fadein'] = 1
  403. if funct == 'Park A':
  404. if motion == 'inc':
  405. level = "j_scene"
  406. main_empty["level"] = "j_scene"
  407. own["level"] = level
  408. Settings.writeSettings()
  409. Settings.readSettings()
  410. #cont.activate(own.actuators['restart'])
  411. #Settings.loadlevel()
  412. dict['load_timer'] = load_timer
  413. dict['reload_timer'] = 250
  414. dict['overlay_fadein'] = 1
  415. if funct == 'Empty Lot':
  416. if motion == 'inc':
  417. level = "lot"
  418. main_empty["level"] = "lot"
  419. own["level"] = level
  420. Settings.writeSettings()
  421. Settings.readSettings()
  422. #cont.activate(own.actuators['restart'])
  423. #Settings.loadlevel()
  424. dict['load_timer'] = load_timer
  425. dict['reload_timer'] = 250
  426. dict['overlay_fadein'] = 1
  427. if funct == 'Training':
  428. if motion == 'inc':
  429. level = "train"
  430. main_empty["level"] = "train"
  431. own["level"] = level
  432. Settings.writeSettings()
  433. Settings.readSettings()
  434. #cont.activate(own.actuators['restart'])
  435. #Settings.loadlevel()
  436. dict['load_timer'] = load_timer
  437. dict['reload_timer'] = 250
  438. dict['overlay_fadein'] = 1
  439. if funct == 'Spine':
  440. if motion == 'inc':
  441. level = "spine"
  442. main_empty["level"] = "spine"
  443. own["level"] = level
  444. Settings.writeSettings()
  445. Settings.readSettings()
  446. #cont.activate(own.actuators['restart'])
  447. #Settings.loadlevel()
  448. dict['load_timer'] = load_timer
  449. dict['reload_timer'] = 250
  450. dict['overlay_fadein'] = 1
  451. if funct == 'Warehouse':
  452. if motion == 'inc':
  453. level = "warehouse"
  454. main_empty["level"] = "warehouse"
  455. own["level"] = level
  456. Settings.writeSettings()
  457. Settings.readSettings()
  458. #cont.activate(own.actuators['restart'])
  459. #Settings.loadlevel()
  460. dict['load_timer'] = load_timer
  461. dict['reload_timer'] = 250
  462. dict['overlay_fadein'] = 1
  463. #=======
  464. #end exit functions
  465. def get_c_list(dict):
  466. #main menu
  467. if dict['mlevel'] == 0:
  468. dict['current_list'] = ['settings', 'level', 'replay', 'restart', 'exit']
  469. #opt = dict['current_list'][dict['current_index']]
  470. if dict['mlevel'] == 1:
  471. if dict['lv0_opt'] == 'settings':
  472. #if opt == 'settings':
  473. dict['current_list'] = ['graphics', 'player', 'level', 'camera', 'physics']
  474. if dict['lv0_opt'] == 'replay':
  475. dict['current_list'] = ['enter replay', 'recorder on', 'record length']
  476. if dict['lv0_opt'] == 'level':
  477. dict['current_list'] = ['Demo Scene', 'Empty Lot', 'Park A', 'Training', 'Spine', 'Warehouse']
  478. if dict['mlevel'] == 2:
  479. if dict['lv1_opt'] == 'graphics':
  480. #if opt == 'settings':
  481. dict['current_list'] = ['brightness / contrast', 'ao', 'hdr', 'dof']
  482. if dict['mlevel'] == 2:
  483. if dict['lv1_opt'] == 'player':
  484. #if opt == 'settings':
  485. 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']
  486. if dict['mlevel'] == 2:
  487. if dict['lv1_opt'] == 'level':
  488. #if opt == 'settings':
  489. dict['current_list'] = ['sun strength', 'ambient strength', 'sun rot x', 'sun rot y', 'shadow on']
  490. if dict['mlevel'] == 3:
  491. if dict['lv2_opt'] == 'ao':
  492. dict['current_list'] = ['ao on', 'ao radius', 'ao width', 'ao only']
  493. if dict['lv2_opt'] == 'brightness / contrast':
  494. dict['current_list'] = ['brightness / contrast on', 'brightness value', 'contrast value']
  495. if dict['lv2_opt'] == 'hdr':
  496. dict['current_list'] = ['hdr on', 'avgL', 'hdr strength']
  497. if dict['lv2_opt'] == 'dof':
  498. dict['current_list'] = ['dof on']
  499. def get_inputs(dict, cont):
  500. #opt = dict['current_list'][dict['current_index']]
  501. #b
  502. if keyboard.events[bge.events.LEFTARROWKEY] == JUST_ACTIVATED or (dict['bBut'] == False and dict['last_bBut'] == True):
  503. if dict['current_index'] not in dict['menu_end_points']:
  504. #print('lkey')
  505. if dict['mlevel'] == 2:
  506. dict['mlevel'] = 1
  507. dict['current_index'] = dict['lv1_index']
  508. elif dict['mlevel'] == 1:
  509. dict['mlevel'] = 0
  510. dict['current_index'] = dict['lv0_index']
  511. elif dict['mlevel'] == 3:
  512. dict['mlevel'] = 2
  513. dict['current_index'] = dict['lv2_index']
  514. else:
  515. pass
  516. # funct = dict['current_index']
  517. # motion = 'dec'
  518. # endpoint(funct, motion, dict)
  519. #a
  520. if (keyboard.events[bge.events.RIGHTARROWKEY] == JUST_ACTIVATED) or (dict['aBut'] == False and dict['last_aBut'] == True):
  521. if dict['current_opt'] not in dict['menu_end_points']:
  522. if dict['mlevel'] == 0:
  523. dict['lv0_opt'] = dict['current_list'][dict['current_index']]
  524. dict['lv0_index'] = dict['current_index']
  525. dict['mlevel'] = 1
  526. dict['lv1_index'] = 0
  527. dict['current_index'] = 0
  528. elif dict['mlevel'] == 1:
  529. dict['lv1_opt'] = dict['current_list'][dict['current_index']]
  530. dict['lv1_index'] = dict['current_index']
  531. dict['mlevel'] = 2
  532. dict['lv2_index'] = 0
  533. dict['current_index'] = 0
  534. elif dict['mlevel'] == 2:
  535. dict['lv2_opt'] = dict['current_list'][dict['current_index']]
  536. dict['lv2_index'] = dict['current_index']
  537. dict['mlevel'] = 3
  538. dict['lv3_index'] = 0
  539. dict['current_index'] = 0
  540. elif dict['mlevel'] == 3:
  541. dict['lv3_opt'] = dict['current_list'][dict['current_index']]
  542. dict['lv3_index'] = dict['current_index']
  543. #dict['mlevel'] = 3
  544. #dict['lv3_index'] = 0
  545. dict['current_index'] = 0
  546. else:
  547. pass
  548. funct = dict['current_opt']
  549. motion = 'inc'
  550. endpoint(funct, motion, dict, cont)
  551. #down
  552. if keyboard.events[bge.events.DOWNARROWKEY] == JUST_ACTIVATED or (dict['ddPad'] == False and dict['last_ddPad'] == True):
  553. if dict['current_index'] < (len(dict['current_list']) - 1):
  554. dict['current_index'] += 1
  555. if dict['mlevel'] == 0:
  556. dict['lv0_index'] = dict['current_index']
  557. if dict['mlevel'] == 1:
  558. dict['lv1_index'] = dict['current_index']
  559. if dict['mlevel'] == 2:
  560. dict['lv2_index'] = dict['current_index']
  561. if dict['mlevel'] == 3:
  562. dict['lv3_index'] = dict['current_index']
  563. #up
  564. if keyboard.events[bge.events.UPARROWKEY] == JUST_ACTIVATED or (dict['udPad'] == False and dict['last_udPad'] == True):
  565. if dict['current_index'] > 0:
  566. dict['current_index'] -= 1
  567. if dict['mlevel'] == 0:
  568. dict['lv0_index'] = dict['current_index']
  569. if dict['mlevel'] == 1:
  570. dict['lv1_index'] = dict['current_index']
  571. if dict['mlevel'] == 2:
  572. dict['lv2_index'] = dict['current_index']
  573. if dict['mlevel'] == 3:
  574. dict['lv3_index'] = dict['current_index']
  575. #left
  576. if dict['ldPad'] == False and dict['last_ldPad'] == True:
  577. if dict['current_opt'] in dict['menu_end_points']:
  578. funct = dict['current_opt']
  579. motion = 'dec'
  580. endpoint(funct, motion, dict, cont)
  581. #right
  582. if dict['rdPad'] == False and dict['last_rdPad'] == True:
  583. if dict['current_opt'] in dict['menu_end_points']:
  584. funct = dict['current_opt']
  585. motion = 'inc'
  586. endpoint(funct, motion, dict, cont)
  587. def init(own, dict):
  588. print('initing')
  589. own['inited'] = True
  590. dict['lv0_opt'] = 0
  591. dict['lv0_index'] = 0
  592. dict['lv1_opt'] = 0
  593. dict['lv1_index'] = 0
  594. dict['lv2_opt'] = 0
  595. dict['lv2_index'] = 0
  596. dict['lv3_opt'] = 0
  597. dict['lv3_index'] = 0
  598. dict['current_list'] = ['']
  599. dict['current_index'] = 0
  600. dict['mlevel'] = 0
  601. dict['current_opt'] = ''
  602. dict['pause_menu_text'] = ''
  603. 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']
  604. def output(dict):
  605. try:
  606. opt = dict['current_list'][dict['current_index']]
  607. except:
  608. print('broken!!', dict['current_list'], dict['current_index'])
  609. dict['current_opt'] = opt
  610. #print(dict['lv1_index'], 'level: ', dict['mlevel'], dict['lv0_opt'], dict['current_index'], dict['current_list'], dict['current_opt'])
  611. outp = 'menu > '
  612. if dict['mlevel'] == 0:
  613. outp = outp + dict['current_opt']
  614. if dict['mlevel'] == 1:
  615. outp = outp + dict['lv0_opt'] +' > ' + dict['current_opt']
  616. if dict['mlevel'] == 2:
  617. outp = outp + dict['lv0_opt'] +' > ' + dict['lv1_opt'] + ' > ' + dict['current_opt']
  618. if dict['mlevel'] == 3:
  619. outp = outp + dict['lv0_opt'] +' > ' + dict['lv1_opt'] + ' > ' + dict['lv2_opt'] + ' > ' + dict['current_opt']
  620. #print(outp)
  621. #print(dict['current_opt'])
  622. if dict['current_opt'] in dict['menu_end_points']:
  623. #print('adding end point value')
  624. if dict['current_opt'] == 'shirt color r':
  625. outp = outp + ': ' + str(dict['shirt_color_r'])
  626. print(outp + ': ' + str(dict['shirt_color_r']))
  627. if dict['current_opt'] == 'shirt color g':
  628. outp = outp + ': ' + str(dict['shirt_color_g'])
  629. if dict['current_opt'] == 'shirt color b':
  630. outp = outp + ': ' + str(dict['shirt_color_b'])
  631. if dict['current_opt'] == 'shoe color r':
  632. outp = outp + ': ' + str(dict['shoe_color_r'])
  633. print(outp + ': ' + str(dict['shoe_color_r']))
  634. if dict['current_opt'] == 'shoe color g':
  635. outp = outp + ': ' + str(dict['shoe_color_g'])
  636. if dict['current_opt'] == 'shoe color b':
  637. outp = outp + ': ' + str(dict['shoe_color_b'])
  638. if dict['current_opt'] == 'deck color r':
  639. outp = outp + ': ' + str(dict['deck_color_r'])
  640. print(outp + ': ' + str(dict['deck_color_r']))
  641. if dict['current_opt'] == 'deck color g':
  642. outp = outp + ': ' + str(dict['deck_color_g'])
  643. if dict['current_opt'] == 'deck color b':
  644. outp = outp + ': ' + str(dict['deck_color_b'])
  645. if dict['current_opt'] == 'shirt logo':
  646. outp = outp + ': ' + str(dict['shirt_logo'])
  647. if dict['current_opt'] == 'brightness / contrast on':
  648. outp = outp + ': ' + str(dict['bc'])
  649. if dict['current_opt'] == 'brightness value':
  650. outp = outp + ': ' + str(dict['BC_BRIGHTNESS'])
  651. if dict['current_opt'] == 'contrast value':
  652. outp = outp + ': ' + str(dict['BC_CONTRAST'])
  653. if dict['current_opt'] == 'hdr on':
  654. outp = outp + ': ' + str(dict['hdr'])
  655. if dict['current_opt'] == 'avgL':
  656. outp = outp + ': ' + str(dict['avgL'])
  657. if dict['current_opt'] == 'hdr strength':
  658. outp = outp + ': ' + str(dict['HDRamount'])
  659. if dict['current_opt'] == 'ao on':
  660. outp = outp + ': ' + str(dict['ao'])
  661. if dict['current_opt'] == 'ao width':
  662. outp = outp + ': ' + str(dict['aowidth'])
  663. if dict['current_opt'] == 'ao radius':
  664. outp = outp + ': ' + str(dict['aoradius'])
  665. if dict['current_opt'] == 'ao only':
  666. outp = outp + ': ' + str(dict['onlyAO'])
  667. if dict['current_opt'] == 'dof on':
  668. outp = outp + ': ' + str(dict['dof_on'])
  669. if dict['current_opt'] == 'sun strength':
  670. outp = outp + ': ' + str(dict['sun_strength'])
  671. if dict['current_opt'] == 'sun rot x':
  672. outp = outp + ': ' + str(dict['sun_rot_x'])
  673. if dict['current_opt'] == 'sun rot y':
  674. outp = outp + ': ' + str(dict['sun_rot_y'])
  675. if dict['current_opt'] == 'shadow on':
  676. outp = outp + ': ' + str(dict['shadow_on'])
  677. if dict['current_opt'] == 'ambient strength':
  678. outp = outp + ': ' + str(dict['ambient_strength'])
  679. dict['pause_menu_text'] = outp
  680. def main(cont):
  681. own = cont.owner
  682. dict = bge.logic.globalDict
  683. if 'inited' not in own:
  684. init(own, dict)
  685. get_c_list(dict)
  686. get_inputs(dict, cont)
  687. get_c_list(dict)
  688. output(dict)