Shuvit game master repo. http://shuvit.org
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886
  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. if funct == 'cam height':
  410. b = dict['cam_height']
  411. if motion == 'inc':
  412. b += .1
  413. else:
  414. b -= .1
  415. dict['cam_height'] = round(b,2)
  416. if funct == 'focal length':
  417. b = dict['focal_length']
  418. if motion == 'inc':
  419. b += 2
  420. else:
  421. b -= 2
  422. dict['focal_length'] = b
  423. #levels
  424. if funct == 'Demo Scene':
  425. if motion == 'inc':
  426. level = "pats"
  427. main_empty["level"] = "pats"
  428. own["level"] = level
  429. Settings.writeSettings()
  430. Settings.readSettings()
  431. #cont.activate(own.actuators['restart'])
  432. #Settings.loadlevel()
  433. dict['load_timer'] = load_timer
  434. dict['reload_timer'] = 250
  435. dict['overlay_fadein'] = 1
  436. if funct == 'Slavonski Brod (WIP)':
  437. if motion == 'inc':
  438. level = "j_scene"
  439. main_empty["level"] = "j_scene"
  440. own["level"] = level
  441. Settings.writeSettings()
  442. Settings.readSettings()
  443. #cont.activate(own.actuators['restart'])
  444. #Settings.loadlevel()
  445. dict['load_timer'] = load_timer
  446. dict['reload_timer'] = 250
  447. dict['overlay_fadein'] = 1
  448. if funct == 'Empty Lot':
  449. if motion == 'inc':
  450. level = "lot"
  451. main_empty["level"] = "lot"
  452. own["level"] = level
  453. Settings.writeSettings()
  454. Settings.readSettings()
  455. #cont.activate(own.actuators['restart'])
  456. #Settings.loadlevel()
  457. dict['load_timer'] = load_timer
  458. dict['reload_timer'] = 250
  459. dict['overlay_fadein'] = 1
  460. if funct == 'Training':
  461. if motion == 'inc':
  462. level = "train"
  463. main_empty["level"] = "train"
  464. own["level"] = level
  465. Settings.writeSettings()
  466. Settings.readSettings()
  467. #cont.activate(own.actuators['restart'])
  468. #Settings.loadlevel()
  469. dict['load_timer'] = load_timer
  470. dict['reload_timer'] = 250
  471. dict['overlay_fadein'] = 1
  472. if funct == 'Spine':
  473. if motion == 'inc':
  474. level = "spine"
  475. main_empty["level"] = "spine"
  476. own["level"] = level
  477. Settings.writeSettings()
  478. Settings.readSettings()
  479. #cont.activate(own.actuators['restart'])
  480. #Settings.loadlevel()
  481. dict['load_timer'] = load_timer
  482. dict['reload_timer'] = 250
  483. dict['overlay_fadein'] = 1
  484. if funct == 'Warehouse':
  485. if motion == 'inc':
  486. level = "warehouse"
  487. main_empty["level"] = "warehouse"
  488. own["level"] = level
  489. Settings.writeSettings()
  490. Settings.readSettings()
  491. #cont.activate(own.actuators['restart'])
  492. #Settings.loadlevel()
  493. dict['load_timer'] = load_timer
  494. dict['reload_timer'] = 250
  495. dict['overlay_fadein'] = 1
  496. #'1920x1080', '1280x720', '1024x768', '800x600', 'fullscreen'
  497. if funct == '1920x1080':
  498. #pass
  499. if motion == 'inc':
  500. dict['resx'] = 1920
  501. dict['resy'] = 1080
  502. Settings.writeSettings()
  503. bge.render.setWindowSize(1920, 1080)
  504. # if dict['fullscreen_on'] == 1:
  505. # bge.render.setFullScreen(True)
  506. # else:
  507. # bge.render.setFullScreen(False)
  508. if funct == '1280x720':
  509. if motion == 'inc':
  510. dict['resx'] = 1280
  511. dict['resy'] = 720
  512. Settings.writeSettings()
  513. bge.render.setWindowSize(1280, 720)
  514. # if dict['fullscreen_on'] == 1:
  515. # bge.render.setFullScreen(True)
  516. # else:
  517. # bge.render.setFullScreen(False)
  518. if funct == '1024x768':
  519. if motion == 'inc':
  520. dict['resx'] = 1024
  521. dict['resy'] = 768
  522. Settings.writeSettings()
  523. bge.render.setWindowSize(1024, 768)
  524. # if dict['fullscreen_on'] == 1:
  525. # bge.render.setFullScreen(True)
  526. # else:
  527. # bge.render.setFullScreen(False)
  528. if funct == '800x600':
  529. if motion == 'inc':
  530. dict['resx'] = 800
  531. dict['resy'] = 600
  532. Settings.writeSettings()
  533. bge.render.setWindowSize(800, 600)
  534. # if dict['fullscreen_on'] == 1:
  535. # bge.render.setFullScreen(True)
  536. # else:
  537. # bge.render.setFullScreen(False)
  538. if funct == 'fullscreen':
  539. if motion == 'inc':
  540. dict['fullscreen_on'] = 1
  541. bge.render.setFullScreen(True)
  542. Settings.writeSettings()
  543. else:
  544. dict['fullscreen_on'] = 0
  545. bge.render.setFullScreen(False)
  546. Settings.writeSettings()
  547. #=======
  548. #end exit functions
  549. def get_c_list(dict):
  550. #main menu
  551. if dict['mlevel'] == 0:
  552. dict['current_list'] = ['settings', 'level', 'replay', 'restart', 'exit']
  553. #opt = dict['current_list'][dict['current_index']]
  554. if dict['mlevel'] == 1:
  555. if dict['lv0_opt'] == 'settings':
  556. #if opt == 'settings':
  557. dict['current_list'] = ['resolution', 'graphics', 'player', 'level', 'camera', 'physics']
  558. if dict['lv0_opt'] == 'replay':
  559. dict['current_list'] = ['enter replay', 'recorder on', 'record length']
  560. if dict['lv0_opt'] == 'level':
  561. dict['current_list'] = ['Demo Scene', 'Empty Lot', 'Training', 'Spine', 'Warehouse', 'Slavonski Brod (WIP)']
  562. if dict['mlevel'] == 2:
  563. if dict['lv1_opt'] == 'resolution':
  564. #if opt == 'settings':
  565. dict['current_list'] = ['1920x1080', '1280x720', '1024x768', '800x600', 'fullscreen']
  566. if dict['mlevel'] == 2:
  567. if dict['lv1_opt'] == 'graphics':
  568. #if opt == 'settings':
  569. dict['current_list'] = ['brightness / contrast', 'ao', 'hdr', 'dof', 'bloom']
  570. if dict['mlevel'] == 2:
  571. if dict['lv1_opt'] == 'player':
  572. #if opt == 'settings':
  573. 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']
  574. if dict['mlevel'] == 2:
  575. if dict['lv1_opt'] == 'level':
  576. #if opt == 'settings':
  577. dict['current_list'] = ['sun strength', 'ambient strength', 'sun rot x', 'sun rot y', 'shadow on']
  578. if dict['mlevel'] == 2:
  579. if dict['lv1_opt'] == 'camera':
  580. #if opt == 'settings':
  581. dict['current_list'] = ['cam height', 'focal length', 'min dist', 'max dist']
  582. if dict['mlevel'] == 3:
  583. if dict['lv2_opt'] == 'ao':
  584. dict['current_list'] = ['ao on', 'ao radius', 'ao width', 'ao only']
  585. if dict['lv2_opt'] == 'brightness / contrast':
  586. dict['current_list'] = ['brightness / contrast on', 'brightness value', 'contrast value']
  587. if dict['lv2_opt'] == 'hdr':
  588. dict['current_list'] = ['hdr on', 'avgL', 'hdr strength']
  589. if dict['lv2_opt'] == 'dof':
  590. dict['current_list'] = ['dof on']
  591. if dict['lv2_opt'] == 'bloom':
  592. dict['current_list'] = ['bloom on']
  593. def get_inputs(dict, cont):
  594. import aud
  595. obj = cont.owner
  596. #opt = dict['current_list'][dict['current_index']]
  597. #b
  598. obj['sound'] = aud.Factory(bge.logic.expandPath('//sounds/select.wav'))
  599. obj['sound_a'] = aud.Factory(bge.logic.expandPath('//sounds/a.wav'))
  600. obj['sound_b'] = aud.Factory(bge.logic.expandPath('//sounds/b.wav'))
  601. if keyboard.events[bge.events.LEFTARROWKEY] == JUST_ACTIVATED or (dict['bBut'] == False and dict['last_bBut'] == True):
  602. aud.device().play(obj['sound_b'])
  603. if dict['current_index'] not in dict['menu_end_points']:
  604. #print('lkey')
  605. if dict['mlevel'] == 2:
  606. dict['mlevel'] = 1
  607. dict['current_index'] = dict['lv1_index']
  608. elif dict['mlevel'] == 1:
  609. dict['mlevel'] = 0
  610. dict['current_index'] = dict['lv0_index']
  611. elif dict['mlevel'] == 3:
  612. dict['mlevel'] = 2
  613. dict['current_index'] = dict['lv2_index']
  614. else:
  615. pass
  616. # funct = dict['current_index']
  617. # motion = 'dec'
  618. # endpoint(funct, motion, dict)
  619. #a
  620. if (keyboard.events[bge.events.RIGHTARROWKEY] == JUST_ACTIVATED) or (dict['aBut'] == False and dict['last_aBut'] == True):
  621. aud.device().play(obj['sound_a'])
  622. if dict['current_opt'] not in dict['menu_end_points']:
  623. if dict['mlevel'] == 0:
  624. dict['lv0_opt'] = dict['current_list'][dict['current_index']]
  625. dict['lv0_index'] = dict['current_index']
  626. dict['mlevel'] = 1
  627. dict['lv1_index'] = 0
  628. dict['current_index'] = 0
  629. elif dict['mlevel'] == 1:
  630. dict['lv1_opt'] = dict['current_list'][dict['current_index']]
  631. dict['lv1_index'] = dict['current_index']
  632. dict['mlevel'] = 2
  633. dict['lv2_index'] = 0
  634. dict['current_index'] = 0
  635. elif dict['mlevel'] == 2:
  636. dict['lv2_opt'] = dict['current_list'][dict['current_index']]
  637. dict['lv2_index'] = dict['current_index']
  638. dict['mlevel'] = 3
  639. dict['lv3_index'] = 0
  640. dict['current_index'] = 0
  641. elif dict['mlevel'] == 3:
  642. dict['lv3_opt'] = dict['current_list'][dict['current_index']]
  643. dict['lv3_index'] = dict['current_index']
  644. #dict['mlevel'] = 3
  645. #dict['lv3_index'] = 0
  646. dict['current_index'] = 0
  647. else:
  648. pass
  649. funct = dict['current_opt']
  650. motion = 'inc'
  651. endpoint(funct, motion, dict, cont)
  652. #down
  653. if keyboard.events[bge.events.DOWNARROWKEY] == JUST_ACTIVATED or (dict['ddPad'] == False and dict['last_ddPad'] == True):
  654. aud.device().play(obj['sound'])
  655. if dict['current_index'] < (len(dict['current_list']) - 1):
  656. dict['current_index'] += 1
  657. if dict['mlevel'] == 0:
  658. dict['lv0_index'] = dict['current_index']
  659. if dict['mlevel'] == 1:
  660. dict['lv1_index'] = dict['current_index']
  661. if dict['mlevel'] == 2:
  662. dict['lv2_index'] = dict['current_index']
  663. if dict['mlevel'] == 3:
  664. dict['lv3_index'] = dict['current_index']
  665. #up
  666. if keyboard.events[bge.events.UPARROWKEY] == JUST_ACTIVATED or (dict['udPad'] == False and dict['last_udPad'] == True):
  667. aud.device().play(obj['sound'])
  668. if dict['current_index'] > 0:
  669. dict['current_index'] -= 1
  670. if dict['mlevel'] == 0:
  671. dict['lv0_index'] = dict['current_index']
  672. if dict['mlevel'] == 1:
  673. dict['lv1_index'] = dict['current_index']
  674. if dict['mlevel'] == 2:
  675. dict['lv2_index'] = dict['current_index']
  676. if dict['mlevel'] == 3:
  677. dict['lv3_index'] = dict['current_index']
  678. #left
  679. if dict['ldPad'] == False and dict['last_ldPad'] == True:
  680. aud.device().play(obj['sound_a'])
  681. if dict['current_opt'] in dict['menu_end_points']:
  682. funct = dict['current_opt']
  683. motion = 'dec'
  684. endpoint(funct, motion, dict, cont)
  685. #right
  686. if dict['rdPad'] == False and dict['last_rdPad'] == True:
  687. aud.device().play(obj['sound_b'])
  688. if dict['current_opt'] in dict['menu_end_points']:
  689. funct = dict['current_opt']
  690. motion = 'inc'
  691. endpoint(funct, motion, dict, cont)
  692. def init(own, dict):
  693. #print('initing')
  694. own['inited'] = True
  695. dict['lv0_opt'] = 0
  696. dict['lv0_index'] = 0
  697. dict['lv1_opt'] = 0
  698. dict['lv1_index'] = 0
  699. dict['lv2_opt'] = 0
  700. dict['lv2_index'] = 0
  701. dict['lv3_opt'] = 0
  702. dict['lv3_index'] = 0
  703. dict['current_list'] = ['']
  704. dict['current_index'] = 0
  705. dict['mlevel'] = 0
  706. dict['current_opt'] = ''
  707. dict['pause_menu_text'] = ''
  708. 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', 'cam height', 'focal length', 'min dist', 'max dist']
  709. def output(dict):
  710. try:
  711. opt = dict['current_list'][dict['current_index']]
  712. except:
  713. pass
  714. #print('broken!!', dict['current_list'], dict['current_index'])
  715. dict['current_opt'] = opt
  716. #print(dict['lv1_index'], 'level: ', dict['mlevel'], dict['lv0_opt'], dict['current_index'], dict['current_list'], dict['current_opt'])
  717. outp = 'menu > '
  718. if dict['mlevel'] == 0:
  719. outp = outp + dict['current_opt']
  720. if dict['mlevel'] == 1:
  721. outp = outp + dict['lv0_opt'] +' > ' + dict['current_opt']
  722. if dict['mlevel'] == 2:
  723. outp = outp + dict['lv0_opt'] +' > ' + dict['lv1_opt'] + ' > ' + dict['current_opt']
  724. if dict['mlevel'] == 3:
  725. outp = outp + dict['lv0_opt'] +' > ' + dict['lv1_opt'] + ' > ' + dict['lv2_opt'] + ' > ' + dict['current_opt']
  726. #print(outp)
  727. #print(dict['current_opt'])
  728. if dict['current_opt'] in dict['menu_end_points']:
  729. #print('adding end point value')
  730. if dict['current_opt'] == 'shirt color r':
  731. outp = outp + ': ' + str(dict['shirt_color_r'])
  732. #print(outp + ': ' + str(dict['shirt_color_r']))
  733. if dict['current_opt'] == 'shirt color g':
  734. outp = outp + ': ' + str(dict['shirt_color_g'])
  735. if dict['current_opt'] == 'shirt color b':
  736. outp = outp + ': ' + str(dict['shirt_color_b'])
  737. if dict['current_opt'] == 'shoe color r':
  738. outp = outp + ': ' + str(dict['shoe_color_r'])
  739. #print(outp + ': ' + str(dict['shoe_color_r']))
  740. if dict['current_opt'] == 'shoe color g':
  741. outp = outp + ': ' + str(dict['shoe_color_g'])
  742. if dict['current_opt'] == 'shoe color b':
  743. outp = outp + ': ' + str(dict['shoe_color_b'])
  744. if dict['current_opt'] == 'deck color r':
  745. outp = outp + ': ' + str(dict['deck_color_r'])
  746. #print(outp + ': ' + str(dict['deck_color_r']))
  747. if dict['current_opt'] == 'deck color g':
  748. outp = outp + ': ' + str(dict['deck_color_g'])
  749. if dict['current_opt'] == 'deck color b':
  750. outp = outp + ': ' + str(dict['deck_color_b'])
  751. if dict['current_opt'] == 'shirt logo':
  752. outp = outp + ': ' + str(dict['shirt_logo'])
  753. if dict['current_opt'] == 'brightness / contrast on':
  754. outp = outp + ': ' + str(dict['bc'])
  755. if dict['current_opt'] == 'brightness value':
  756. outp = outp + ': ' + str(dict['BC_BRIGHTNESS'])
  757. if dict['current_opt'] == 'contrast value':
  758. outp = outp + ': ' + str(dict['BC_CONTRAST'])
  759. if dict['current_opt'] == 'hdr on':
  760. outp = outp + ': ' + str(dict['hdr'])
  761. if dict['current_opt'] == 'avgL':
  762. outp = outp + ': ' + str(dict['avgL'])
  763. if dict['current_opt'] == 'hdr strength':
  764. outp = outp + ': ' + str(dict['HDRamount'])
  765. if dict['current_opt'] == 'ao on':
  766. outp = outp + ': ' + str(dict['ao'])
  767. if dict['current_opt'] == 'ao width':
  768. outp = outp + ': ' + str(dict['aowidth'])
  769. if dict['current_opt'] == 'ao radius':
  770. outp = outp + ': ' + str(dict['aoradius'])
  771. if dict['current_opt'] == 'ao only':
  772. outp = outp + ': ' + str(dict['onlyAO'])
  773. if dict['current_opt'] == 'dof on':
  774. outp = outp + ': ' + str(dict['dof_on'])
  775. if dict['current_opt'] == 'sun strength':
  776. outp = outp + ': ' + str(dict['sun_strength'])
  777. if dict['current_opt'] == 'sun rot x':
  778. outp = outp + ': ' + str(dict['sun_rot_x'])
  779. if dict['current_opt'] == 'sun rot y':
  780. outp = outp + ': ' + str(dict['sun_rot_y'])
  781. if dict['current_opt'] == 'shadow on':
  782. #outp = outp + ': ' + str(dict['shadow_on'])
  783. outp = outp + ': (not available)'
  784. if dict['current_opt'] == 'ambient strength':
  785. outp = outp + ': ' + str(dict['ambient_strength'])
  786. if dict['current_opt'] == 'fullscreen':
  787. outp = outp + ': ' + str(dict['fullscreen_on'])
  788. if dict['current_opt'] == 'bloom on':
  789. outp = outp + ': ' + str(dict['bloom_on'])
  790. if dict['current_opt'] == 'cam height':
  791. outp = outp + ': ' + str(dict['cam_height'])
  792. if dict['current_opt'] == 'focal length':
  793. outp = outp + ': ' + str(dict['focal_length'])
  794. dict['pause_menu_text'] = outp
  795. def main(cont):
  796. own = cont.owner
  797. dict = bge.logic.globalDict
  798. if 'inited' not in own:
  799. init(own, dict)
  800. get_c_list(dict)
  801. get_inputs(dict, cont)
  802. get_c_list(dict)
  803. output(dict)