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 34KB

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