Advertisement
Vulajin

debug

Dec 19th, 2016
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.79 KB | None | 0 0
  1. // GSGE.Debug
  2. static Debug()
  3. {
  4. Debug.debugKeys = new Dictionary<Debug.KeyModifier, Dictionary<Keys, Debug.DebugKeyCallback>>(Debug.KeyModifierEqualityComparer.Default);
  5. Debug.s_framesSinceLastStep = 0;
  6. Debug.m_drawWeaponOrganization = false;
  7. Debug.m_logMessages = new Dictionary<Debug.DebugText, List<string>>();
  8. Debug.m_messageTypeDisplayIndex = 0;
  9. Debug.m_debugText = null;
  10. Debug.registerDebugKey(Debug.KeyModifier.Control, Keys.T, delegate
  11. {
  12. GameplayScreen.getInGameUI().UserVisible = false;
  13. ConfigOptions.ShroudMinTransparency = 0f;
  14. ConfigOptions.ShroudMaxTransparency = 0f;
  15. ConfigOptions.DebugMessages = false;
  16. ConfigOptions.DebugDraw = true;
  17. AnimationManager.hideTextAnimations();
  18. ConfigOptions.ShowUIAnimations = false;
  19. ConfigOptions.UseOcclusion = false;
  20. ConfigOptions.DropLoot = false;
  21. ConfigOptions.Invincibility = true;
  22. PlayerManager.getFirstPlayerUnit().healFraction(1f);
  23. ProgressHelper.depositMoney(872);
  24. ConfigOptions.EasyDebugKeys = true;
  25. });
  26. Debug.registerDebugKey(Debug.KeyModifier.None, Keys.P, new Debug.DebugKeyCallback(World.togglePause));
  27. Debug.registerDebugKey(Debug.KeyModifier.None, Keys.OemCloseBrackets, new Debug.DebugKeyCallback(World.stepFrame));
  28. Debug.registerDebugKey(Debug.KeyModifier.Control, Keys.Delete, delegate
  29. {
  30. Debug.m_messageTypeDisplayIndex = 0;
  31. });
  32. Debug.registerDebugKey(Debug.KeyModifier.Control, Keys.L, delegate
  33. {
  34. Debug.HotLoad();
  35. });
  36. Debug.registerDebugKey(Debug.KeyModifier.ControlShift, Keys.P, delegate
  37. {
  38. PerfTimerScreen screen = new PerfTimerScreen(App.getScreenManager());
  39. App.getScreenManager().AddScreen(screen);
  40. });
  41. }
  42.  
  43. // GSGE.Debug
  44. public static void handleInput(InputHandler input)
  45. {
  46. if (!ConfigOptions.DebugKeysEnabled)
  47. {
  48. return;
  49. }
  50. if (Debug.handleInputForMod(Debug.KeyModifier.ControlShift, input))
  51. {
  52. return;
  53. }
  54. if (Debug.handleInputForMod(Debug.KeyModifier.Control, input))
  55. {
  56. return;
  57. }
  58. if (Debug.handleInputForMod(Debug.KeyModifier.Shift, input))
  59. {
  60. return;
  61. }
  62. if (Debug.handleInputForMod(Debug.KeyModifier.None, input))
  63. {
  64. return;
  65. }
  66. Player player = PlayerManager.getPlayer();
  67. PlayerUnit unit = player.getUnit();
  68. if (input.isCtrlDown() && input.wasKeyPressed(Keys.D))
  69. {
  70. Debug.m_messageTypeDisplayIndex++;
  71. Debug.m_messageTypeDisplayIndex = Functions.wrap(Debug.m_messageTypeDisplayIndex, 0, Enum.GetValues(typeof(Debug.DebugText)).Length);
  72. }
  73. else if (input.isShiftDown() && input.wasKeyPressed(Keys.D))
  74. {
  75. ConfigOptions.DebugMessages = !ConfigOptions.DebugMessages;
  76. }
  77. else if (input.isCtrlDown() && input.wasKeyPressed(Keys.A))
  78. {
  79. ConfigOptions.Music = !ConfigOptions.Music;
  80. if (ConfigOptions.Music)
  81. {
  82. AudioManager.unmute();
  83. }
  84. else
  85. {
  86. AudioManager.mute();
  87. }
  88. if (!input.isShiftDown())
  89. {
  90. ConfigOptions.SoundFX = ConfigOptions.Music;
  91. }
  92. }
  93. else if (input.isCtrlDown() && input.wasKeyPressed(Keys.M))
  94. {
  95. ProgressHelper.depositMoney(9999);
  96. ConfigOptions.FlashUnspentMoney = false;
  97. ProgressHelper.pickUpGoalPiece();
  98. }
  99. else if (input.isCtrlDown() && input.wasKeyPressed(Keys.N))
  100. {
  101. World.getMap().debugEndWave();
  102. }
  103. else if (input.isCtrlDown() && input.wasKeyPressed(Keys.W))
  104. {
  105. World.getMap().debugWin();
  106. }
  107. else if (input.isShiftDown() && input.wasKeyPressed(Keys.W))
  108. {
  109. Debug.m_drawWeaponOrganization = !Debug.m_drawWeaponOrganization;
  110. }
  111. else if (!input.isCtrlDown() || !input.wasKeyPressed(Keys.R))
  112. {
  113. if (input.isShiftDown() && input.wasKeyPressed(Keys.R))
  114. {
  115. unit.refillAllWeaponAmmo();
  116. }
  117. else if (input.isCtrlDown() && input.wasKeyPressed(Keys.OemPlus))
  118. {
  119. BookAnimation.cycleNumAnglesForwards();
  120. }
  121. else if (input.isCtrlDown() && input.wasKeyPressed(Keys.OemMinus))
  122. {
  123. BookAnimation.cycleNumAnglesBackwards();
  124. }
  125. else if (input.isCtrlDown() && input.wasKeyPressed(Keys.G))
  126. {
  127. ConfigOptions.GodMode = !ConfigOptions.GodMode;
  128. if (ConfigOptions.GodMode)
  129. {
  130. PlayerManager.getFirstPlayerUnit().healFraction(1f);
  131. ConfigOptions.DamageMultiplier = 100f;
  132. }
  133. else
  134. {
  135. ConfigOptions.DamageMultiplier = 1f;
  136. }
  137. ConfigOptions.Invincibility = ConfigOptions.GodMode;
  138. }
  139. else if (input.isCtrlDown() && input.wasKeyPressed(Keys.K))
  140. {
  141. ConfigOptions.GuranteeCrit = !ConfigOptions.GuranteeCrit;
  142. }
  143. else if (input.isCtrlDown() && input.wasKeyPressed(Keys.O))
  144. {
  145. ConfigOptions.TutorialsOn = !ConfigOptions.TutorialsOn;
  146. }
  147. else if (input.isCtrlDown() && input.wasKeyPressed(Keys.A))
  148. {
  149. ConfigOptions.UseAnimations = !ConfigOptions.UseAnimations;
  150. }
  151. else if (input.isCtrlDown() && input.wasKeyPressed(Keys.E))
  152. {
  153. ConfigOptions.DrawExtents = !ConfigOptions.DrawExtents;
  154. }
  155. else if (!input.isCtrlDown() || !input.wasKeyPressed(Keys.X))
  156. {
  157. if (input.isShiftDown() && input.isKeyDown(Keys.E))
  158. {
  159. player.grantExperience(200, unit.getLocation());
  160. }
  161. else if (input.isShiftDown() && input.wasKeyPressed(Keys.N))
  162. {
  163. GeneratorManager.buildTick();
  164. GeneratorManager.UpgradeAvailable = true;
  165. }
  166. else if (unit != null && input.isCtrlDown() && input.wasKeyPressed(Keys.U))
  167. {
  168. Debug.equipRandomLoadout();
  169. }
  170. else if (unit != null && input.isShiftDown() && input.wasKeyPressed(Keys.U))
  171. {
  172. unit.pickupWeapon("Hammer");
  173. unit.pickupWeapon("Roll");
  174. unit.pickupWeapon("Repeater");
  175. unit.pickupWeapon("HealthPotion");
  176. unit.pickupWeapon("ShieldBash");
  177. unit.pickupWeapon("Longbow");
  178. IAssetManager instance = AssetManager.Instance;
  179. instance.loadPackage("Hammer", CMID.WEAPON_LOADOUT);
  180. instance.loadPackage("Roll", CMID.WEAPON_LOADOUT);
  181. instance.loadPackage("Repeater", CMID.WEAPON_LOADOUT);
  182. instance.loadPackage("HealthPotion", CMID.WEAPON_LOADOUT);
  183. instance.loadPackage("ShieldBash", CMID.WEAPON_LOADOUT);
  184. instance.loadPackage("Longbow", CMID.WEAPON_LOADOUT);
  185. PlayerTechManager.unlockWeapon("Hammer_Whirlwind");
  186. PlayerTechManager.unlockWeapon("Longbow_BouncingShot");
  187. unit.pickupWeapon("Repeater_TwirlShot");
  188. PlayerTechManager.pickupSchematic("Hammer_Seed");
  189. PlayerTechManager.pickupSchematic("Repeater_Seed");
  190. PlayerTechManager.pickupSchematic("Longbow_Seed");
  191. PlayerTechManager.pickupSchematic("City_Plant01");
  192. ProgressHelper.depositMoney(400);
  193. player.grantExperience(99999999, unit.getLocation());
  194. player.grantExperience(99999999, unit.getLocation());
  195. ProgressHelper.pickUpGoalPiece();
  196. ProgressManager.setFlag(ProgressManager.FlagSet.UPGRADES_UNLOCKED, "LifeSteal");
  197. ProgressManager.setFlag(ProgressManager.FlagSet.UPGRADES_UNLOCKED, "PlusHealth");
  198. ProgressManager.setFlag(ProgressManager.FlagSet.UPGRADES_UNLOCKED, "PlusAllCritMinusHealth");
  199. }
  200. else if (input.isCtrlDown() && input.wasKeyPressed(Keys.H))
  201. {
  202. unit.debugToggleMaxHealth(0.5f);
  203. }
  204. else if (input.isCtrlDown() && input.wasKeyPressed(Keys.Q))
  205. {
  206. Debug.resetMap(World.BeginRequest.NOLOAD);
  207. }
  208. else if (input.isCtrlDown() && input.wasKeyPressed(Keys.J))
  209. {
  210. ConfigOptions.FishEye = !ConfigOptions.FishEye;
  211. }
  212. }
  213. }
  214. if (input.isShiftDown() && input.isKeyDown(Keys.OemPlus))
  215. {
  216. App.getLightComponent().adjustBrightness(0.002f);
  217. }
  218. else if (input.isShiftDown() && input.isKeyDown(Keys.OemMinus))
  219. {
  220. App.getLightComponent().adjustBrightness(-0.002f);
  221. }
  222. if (input.isCtrlDown())
  223. {
  224. int scrollWheelChange = input.getScrollWheelChange();
  225. if (scrollWheelChange < 0)
  226. {
  227. Camera.zoom(0.9f);
  228. }
  229. else if (scrollWheelChange > 0)
  230. {
  231. Camera.zoom(1.1f);
  232. }
  233. else if (input.wasMouseButtonPressed(Controls.MouseButtons.Middle))
  234. {
  235. Camera.resetZoom();
  236. }
  237. }
  238. if (input.isShiftDown())
  239. {
  240. if (input.isKeyDown(Keys.Left))
  241. {
  242. Camera.move(new Vector2(-1f, 0f));
  243. }
  244. else if (input.isKeyDown(Keys.Right))
  245. {
  246. Camera.move(new Vector2(1f, 0f));
  247. }
  248. else if (input.isKeyDown(Keys.Up))
  249. {
  250. Camera.move(new Vector2(0f, -1f));
  251. }
  252. else if (input.isKeyDown(Keys.Down))
  253. {
  254. Camera.move(new Vector2(0f, 1f));
  255. }
  256. }
  257. if (input.wasKeyPressed(Keys.F1))
  258. {
  259. Debug.debugOpenArsenal();
  260. }
  261. else if (input.wasKeyPressed(Keys.F2))
  262. {
  263. Debug.debugOpenDistillery();
  264. }
  265. else if (input.wasKeyPressed(Keys.F3))
  266. {
  267. Debug.debugOpenForge();
  268. }
  269. else if (input.wasKeyPressed(Keys.F4))
  270. {
  271. Debug.debugOpenShrine();
  272. }
  273. else if (input.wasKeyPressed(Keys.F5))
  274. {
  275. Debug.debugOpenMemorial();
  276. }
  277. else if (input.wasKeyPressed(Keys.F6))
  278. {
  279. Debug.debugOpenLostAndFound();
  280. }
  281. if (input.isButtonDown(ConfigOptions.DebugKey))
  282. {
  283. if (input.wasButtonPressed(Buttons.DPadDown))
  284. {
  285. Debug.debugOpenShrine();
  286. }
  287. else if (input.wasButtonPressed(Buttons.DPadLeft))
  288. {
  289. Debug.debugOpenArsenal();
  290. }
  291. else if (input.wasButtonPressed(Buttons.DPadRight))
  292. {
  293. Debug.debugOpenDistillery();
  294. }
  295. else if (input.wasButtonPressed(Buttons.DPadUp))
  296. {
  297. Debug.debugOpenForge();
  298. }
  299. }
  300. if (ConfigOptions.EasyDebugKeys)
  301. {
  302. if (input.wasButtonPressed(Buttons.RightShoulder))
  303. {
  304. World.togglePause();
  305. }
  306. Debug.s_framesSinceLastStep++;
  307. if (input.wasButtonPressed(Buttons.LeftShoulder) || (input.isButtonDown(Buttons.LeftShoulder) && Debug.s_framesSinceLastStep > 4))
  308. {
  309. World.stepFrame();
  310. Debug.s_framesSinceLastStep = 0;
  311. }
  312. if (input.wasButtonPressed(Buttons.LeftStick))
  313. {
  314. Camera.toggleTrackPlayers();
  315. }
  316. if (input.wasButtonPressed(Buttons.RightStick))
  317. {
  318. App.TakeScreenshot();
  319. }
  320. if (input.isButtonDown(Buttons.DPadLeft))
  321. {
  322. Camera.move(new Vector2(-1f, 0f));
  323. return;
  324. }
  325. if (input.isButtonDown(Buttons.DPadRight))
  326. {
  327. Camera.move(new Vector2(1f, 0f));
  328. return;
  329. }
  330. if (input.isButtonDown(Buttons.DPadUp))
  331. {
  332. Camera.move(new Vector2(0f, -1f));
  333. return;
  334. }
  335. if (input.isButtonDown(Buttons.DPadDown))
  336. {
  337. Camera.move(new Vector2(0f, 1f));
  338. }
  339. }
  340. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement