CheatMenu.cs 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using Fungus;
  5. using UnityEngine;
  6. using UnityEngine.SceneManagement;
  7. using System.Globalization;
  8. public class CheatMenu : MonoBehaviour
  9. {
  10. //Using an integer to represent which tab is shown
  11. //tabState
  12. //0 = none expanded
  13. //1 = state expanded
  14. //2 = commands expanded
  15. //3 = advanced expanded
  16. public CheatMenu()
  17. {
  18. //Do i really need to idiot proof this...
  19. string expectedVersionDefault = "v0.29 Final|v0.29 VeryFinal";
  20. int minButtonHeightDefault = 15;
  21. int proposedItemCountDefault = 40;
  22. Color buttonNormalBackColorDefault = new Color(1f, 1f, 1f, 1f);
  23. Color buttonSelectedBackColorDefault = new Color(1f, 0f, 0f, 1f);
  24. bool shouldWriteConfig = false;
  25. string settingsPath = Path.Combine(Application.dataPath, "CheatMenu.json");
  26. Dictionary<string, string> settingsDict;
  27. if (!File.Exists(settingsPath))
  28. {
  29. settingsDict = new Dictionary<string, string>();
  30. settingsDict["ExpectedVersion"] = expectedVersionDefault;
  31. settingsDict["MinButtonHeight"] = minButtonHeightDefault.ToString();
  32. settingsDict["ProposedItemCount"] = proposedItemCountDefault.ToString();
  33. settingsDict["ButtonNormalBackColor"] = "#" + ColorUtility.ToHtmlStringRGB(buttonNormalBackColorDefault);
  34. settingsDict["ButtonSelectedBackColor"] = "#" + ColorUtility.ToHtmlStringRGB(buttonSelectedBackColorDefault);
  35. shouldWriteConfig = true;
  36. }
  37. else
  38. {
  39. settingsDict = JSONObject.Create(File.ReadAllText(settingsPath)).ToDictionary();
  40. if(!(settingsDict.ContainsKey("ExpectedVersion") && !string.IsNullOrEmpty(settingsDict["ExpectedVersion"])))
  41. {
  42. settingsDict["ExpectedVersion"] = expectedVersionDefault;
  43. shouldWriteConfig = true;
  44. }
  45. if(!(settingsDict.ContainsKey("MinButtonHeight") && int.TryParse(settingsDict["MinButtonHeight"], out int ignoreMinButtonHeight)))
  46. {
  47. settingsDict["MinButtonHeight"] = minButtonHeightDefault.ToString();
  48. shouldWriteConfig = true;
  49. }
  50. if(!(settingsDict.ContainsKey("ProposedItemCount") && int.TryParse(settingsDict["ProposedItemCount"], out int ignoreProposedItemCount)))
  51. {
  52. settingsDict["ProposedItemCount"] = proposedItemCountDefault.ToString();
  53. shouldWriteConfig = true;
  54. }
  55. if(!(settingsDict.ContainsKey("ButtonNormalBackColor") && ColorUtility.TryParseHtmlString(settingsDict["ButtonNormalBackColor"], out Color ignoreButtonNormalBackColor)))
  56. {
  57. settingsDict["ButtonNormalBackColor"] = "#" + ColorUtility.ToHtmlStringRGB(buttonNormalBackColorDefault);
  58. shouldWriteConfig = true;
  59. }
  60. if(!(settingsDict.ContainsKey("ButtonSelectedBackColor") && ColorUtility.TryParseHtmlString(settingsDict["ButtonSelectedBackColor"], out Color ignoreButtonSelectedBackColor)))
  61. {
  62. settingsDict["ButtonSelectedBackColor"] = "#" + ColorUtility.ToHtmlStringRGB(buttonSelectedBackColorDefault);
  63. shouldWriteConfig = true;
  64. }
  65. }
  66. this.ExpectedVersion = settingsDict["ExpectedVersion"];
  67. this.minButtonHeight = (float)int.Parse(settingsDict["MinButtonHeight"]);
  68. this.proposedItemCount = int.Parse(settingsDict["ProposedItemCount"]);
  69. if(ColorUtility.TryParseHtmlString(settingsDict["ButtonNormalBackColor"], out Color outButtonNormalBackColor))
  70. this.buttonNormalBackColor = outButtonNormalBackColor;
  71. if(ColorUtility.TryParseHtmlString(settingsDict["ButtonSelectedBackColor"], out Color outButtonSelectedBackColor))
  72. this.buttonSelectedBackColor = outButtonSelectedBackColor;
  73. if(shouldWriteConfig)
  74. File.WriteAllText(settingsPath, JSONObject.Create(settingsDict).Print(true));
  75. }
  76. public bool MatchVersion()
  77. {
  78. if(!this.versionCheck)
  79. {
  80. this.versionCheck = true;
  81. string[] expectedSplit = this.ExpectedVersion.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
  82. for (int i = 0; i < expectedSplit.Length; i++)
  83. {
  84. if(this.DetectedVersion.Equals(expectedSplit[i], StringComparison.InvariantCultureIgnoreCase))
  85. {
  86. this.versionMatched = true;
  87. break;
  88. }
  89. }
  90. }
  91. return this.versionMatched;
  92. }
  93. public void Start()
  94. {
  95. //Magic values, these are set by Unity and are just for reference
  96. this.scrollbarWidth = 16f;
  97. float titleBarHeight = 10f;
  98. float paddingSize = 5f;
  99. float proposedButtonHeight = (float)Screen.height / this.proposedItemCount;
  100. proposedButtonHeight = Math.Max(this.minButtonHeight, proposedButtonHeight);
  101. this.defaultControlHeight = (int)proposedButtonHeight;
  102. this.defaultControlWidth = (int)(proposedButtonHeight * 6f);
  103. this.defaultControlFontSize = (int)(proposedButtonHeight * 0.75f);
  104. this.menuYOffset = Screen.height * 0.075f;
  105. this.debugMenu = true;
  106. this.autoSceneDump = false;
  107. this.autoSceneDumpPromt = false;
  108. this.sceneDumpDict = new Dictionary<string, bool>();
  109. this.blackListScenes = new HashSet<string>(new string[]
  110. {
  111. "Start",
  112. "start_day"
  113. });
  114. this.tabState = 1;
  115. float debugWidth = defaultControlWidth * 1.25f;
  116. float debugHeight = (this.defaultControlHeight * 7f) + (6f * paddingSize) + titleBarHeight;
  117. this.debugWindowRect = new Rect(Screen.width - debugWidth, this.menuYOffset, debugWidth, debugHeight);
  118. float debugConformWidth = (defaultControlWidth * 4f) + (2f * paddingSize);
  119. float debugConformHeight = (defaultControlHeight * 7f) + (6f * paddingSize) + titleBarHeight;
  120. this.dumpConfirmWindowRect = new Rect((Screen.width - debugConformWidth) * 0.5f, this.menuYOffset, debugConformWidth, debugConformHeight);
  121. this.commandsList = new List<KeyValuePair<string, Action>[]>();
  122. this.commandsList.Add(new KeyValuePair<string, Action>[] {new KeyValuePair<string, Action>("+$100", () => AddInt("money", 100))});
  123. this.commandsList.Add(new KeyValuePair<string, Action>[] {new KeyValuePair<string, Action>("Full Energy", () => SetInt("energ", GetInt("total_energ")))});
  124. this.commandsList.Add(new KeyValuePair<string, Action>[] {new KeyValuePair<string, Action>("Full Lube", () => SetInt("lube", 3))});
  125. this.commandsList.Add(new KeyValuePair<string, Action>[] {new KeyValuePair<string, Action>("Full Condoms", () => SetInt("condoms", 3))});
  126. this.commandsList.Add(new KeyValuePair<string, Action>[] {new KeyValuePair<string, Action>("Full Suncream", () => SetInt("suncream", 3))});
  127. this.commandsList.Add(new KeyValuePair<string, Action>[] {new KeyValuePair<string, Action>("Full VitaminX", () => SetInt("drugs", 20))});
  128. this.commandsList.Add(new KeyValuePair<string, Action>[] {new KeyValuePair<string, Action>("Full PlanB", () => SetInt("mpills", 20))});
  129. this.commandsList.Add(new KeyValuePair<string, Action>[] {new KeyValuePair<string, Action>("Full Sleeping", () => SetInt("spills", 20))});
  130. this.commandsList.Add(new KeyValuePair<string, Action>[] {new KeyValuePair<string, Action>("Full Lactation", () => SetInt("lpills", 20))});
  131. this.commandsList.Add(new KeyValuePair<string, Action>[] {new KeyValuePair<string, Action>("Time-1", () => AddInt("time", -1)),
  132. new KeyValuePair<string, Action>("Time+1", () => AddInt("time", 1))});
  133. this.advancedList = new List<KeyValuePair<string, Action>[]>();
  134. this.advancedList.Add(new KeyValuePair<string, Action>[] {new KeyValuePair<string, Action>("LoadScene", () =>
  135. {
  136. this.autoSceneDumpPromt = false;
  137. this.sceneNameInput = "";
  138. this.loadScenePrompt = !this.loadScenePrompt;
  139. })});
  140. //TODO
  141. //this.advancedList.Add({new KeyValuePair<string, Action>("Exec Block", () =>
  142. //{
  143. //})});
  144. }
  145. public void OnGUI()
  146. {
  147. Scene activeScene = SceneManager.GetActiveScene();
  148. if (activeScene.name != this.lastScene)
  149. {
  150. this.lastScene = activeScene.name;
  151. this.initFlowChart = false;
  152. this.initGuiStyle = false;
  153. this.flowcharts = null;
  154. this.foundCharts = 0;
  155. this.initCounter = 0;
  156. }
  157. if(!MatchVersion())
  158. {
  159. this.InitGuiStyles();
  160. GUILayout.Label(string.Format("Version mismatch, Expected: {0}, Detected: {1}", this.ExpectedVersion, this.DetectedVersion), this.labelHeaderStyle);
  161. return;
  162. }
  163. if (!this.blackListScenes.Contains(activeScene.name) || this.autoSceneDump)
  164. {
  165. this.InitFlowCharts();
  166. this.InitGuiStyles();
  167. if (this.initFlowChart)
  168. {
  169. if (this.autoSceneDump)
  170. {
  171. if(DoAutoSceneDump(out string nextScene, activeScene))
  172. {
  173. SceneManager.LoadScene(nextScene);
  174. }
  175. else
  176. {
  177. this.autoSceneDump = false;
  178. this.sceneDumpDict.Clear();
  179. SceneManager.LoadScene("Start");
  180. }
  181. }
  182. this.DisplayCheatMenu();
  183. }
  184. if (this.debugMenu)
  185. {
  186. this.DrawDebugMenu();
  187. }
  188. }
  189. }
  190. public void InitFlowCharts()
  191. {
  192. if (!this.initFlowChart && this.initCounter < 10)
  193. {
  194. this.initCounter++;
  195. this.flowcharts = UnityEngine.Object.FindObjectsOfType<Flowchart>();
  196. if (this.flowcharts != null && this.flowcharts.Length != 0)
  197. {
  198. this.initFlowChart = true;
  199. this.foundCharts = this.flowcharts.Length;
  200. }
  201. }
  202. }
  203. public void InitGuiStyles()
  204. {
  205. if (!this.initGuiStyle)
  206. {
  207. this.initGuiStyle = true;
  208. this.scrollStateViewVector = Vector2.zero;
  209. this.scrollCommandsViewVector = Vector2.zero;
  210. this.scrollAdvancedViewVector = Vector2.zero;
  211. this.defaultButtonStyle = new GUIStyle("button");
  212. this.defaultButtonStyle.fontSize = this.defaultControlFontSize;
  213. this.defaultButtonStyle.margin = new RectOffset(0, 0, 0, 0);
  214. this.defaultButtonStyle.padding = new RectOffset(0, 0, 0, 0);
  215. this.intButtonStyle = new GUIStyle("button");
  216. this.intButtonStyle.fixedHeight = this.defaultControlHeight;
  217. this.intButtonStyle.fixedWidth = this.defaultControlHeight;
  218. this.intButtonStyle.margin = new RectOffset(0, 0, 0, 0);
  219. this.intButtonStyle.padding = new RectOffset(0, 0, 0, 0);
  220. this.intButtonStyle.fontSize = this.defaultControlFontSize;
  221. this.boolButtonStyle = new GUIStyle("button");
  222. this.boolButtonStyle.fixedHeight = this.defaultControlHeight;
  223. this.boolButtonStyle.fixedWidth = this.defaultControlHeight * 2;
  224. this.boolButtonStyle.margin = new RectOffset(0, 0, 0, 0);
  225. this.boolButtonStyle.padding = new RectOffset(0, 0, 0, 0);
  226. this.boolButtonStyle.fontSize = this.defaultControlFontSize;
  227. this.buttonLayoutOptions = new GUILayoutOption[] {GUILayout.Width(this.defaultControlWidth - this.scrollbarWidth), GUILayout.Height(this.defaultControlHeight)};
  228. this.buttonHalfLayoutOptions = new GUILayoutOption[] {GUILayout.Width((this.defaultControlWidth - this.scrollbarWidth) * 0.5f), GUILayout.Height(this.defaultControlHeight)};
  229. this.labelStyle = new GUIStyle
  230. {
  231. fixedHeight = this.defaultControlHeight,
  232. margin = new RectOffset(0, 0, 0, 0),
  233. padding = new RectOffset(0, 0, 0, 0),
  234. normal = new GUIStyleState
  235. {
  236. textColor = Color.white
  237. }
  238. };
  239. this.labelStyle.fontSize = this.defaultControlFontSize;
  240. this.labelHeaderStyle = new GUIStyle("label");
  241. this.labelHeaderStyle.fixedHeight = this.defaultControlHeight;
  242. this.labelHeaderStyle.margin = new RectOffset(0, 0, 0, 0);
  243. this.labelHeaderStyle.padding = new RectOffset(0, 0, 0, 0);
  244. this.labelHeaderStyle.fontStyle = FontStyle.Bold;
  245. this.labelHeaderStyle.fontSize = this.defaultControlFontSize;
  246. this.labelHeaderStyle.normal = new GUIStyleState
  247. {
  248. textColor = new Color(0.9f, 0.3f, 0.23f)
  249. };
  250. this.scrollBackground = new Texture2D(1, 1);
  251. this.scrollBackground.SetPixel(0, 0, new Color(0f, 0f, 0f, 0.8f));
  252. this.scrollBackground.Apply();
  253. this.scrollViewStyle = new GUIStyle("scrollView");
  254. this.scrollViewStyle.normal.background = this.scrollBackground;
  255. this.scrollViewStyle.margin = new RectOffset(0, 0, 0, 0);
  256. this.scrollViewStyle.padding = new RectOffset(0, 0, 0, 0);
  257. }
  258. }
  259. public void DisplayCheatMenu()
  260. {
  261. DrawWithSelectedBackColor(false);
  262. if (GUI.Button(new Rect(0f, this.menuYOffset, this.defaultControlWidth, this.defaultControlHeight), this.displayCheats ? "Hide Cheats" : "Show Cheats", this.defaultButtonStyle))
  263. {
  264. this.displayCheats = !this.displayCheats;
  265. }
  266. if (this.displayCheats)
  267. {
  268. bool displayState = this.tabState == 1;
  269. bool displayCommands = this.tabState == 2;
  270. bool displayAdvanced = this.tabState == 3;
  271. DrawWithSelectedBackColor(displayState);
  272. if (GUI.Button(new Rect(0f, this.menuYOffset + this.defaultControlHeight, this.defaultControlWidth, this.defaultControlHeight), "State", this.defaultButtonStyle))
  273. {
  274. displayState = SetSelectedTab(1);
  275. }
  276. DrawWithSelectedBackColor(displayCommands);
  277. if (GUI.Button(new Rect(0f, this.menuYOffset + (this.defaultControlHeight * 2), this.defaultControlWidth, this.defaultControlHeight), "Commands", this.defaultButtonStyle))
  278. {
  279. displayCommands = SetSelectedTab(2);
  280. }
  281. DrawWithSelectedBackColor(displayAdvanced);
  282. if (GUI.Button(new Rect(0f, this.menuYOffset + (this.defaultControlHeight * 3), this.defaultControlWidth, this.defaultControlHeight), "Advanced", this.defaultButtonStyle))
  283. {
  284. displayAdvanced = SetSelectedTab(3);
  285. }
  286. DrawWithSelectedBackColor(false);
  287. if (displayState)
  288. {
  289. DrawStateTab();
  290. }
  291. else if (displayCommands)
  292. {
  293. DrawCommandsTab();
  294. }
  295. else if (displayAdvanced)
  296. {
  297. DrawAdvancedTab();
  298. }
  299. if(this.loadScenePrompt)
  300. {
  301. GUI.Window(-66, this.dumpConfirmWindowRect, new GUI.WindowFunction(this.LoadSceneFunc), "Load Scene");
  302. }
  303. }
  304. }
  305. public void DrawStateTab()
  306. {
  307. float scrollHeight = (float)Screen.height - (this.menuYOffset + this.defaultControlHeight) * 2f;
  308. int scrollItemCount = this.flowcharts.Length;
  309. for (int i = 0; i < this.flowcharts.Length; i++)
  310. {
  311. scrollItemCount += this.flowcharts[i].Variables.Count;
  312. }
  313. float scrollInternalHeight = (float)scrollItemCount * this.defaultControlHeight;
  314. scrollHeight = Math.Min(scrollInternalHeight, scrollHeight);
  315. Rect scrollRect = new Rect(this.defaultControlWidth, this.menuYOffset + this.defaultControlHeight, this.defaultControlWidth * 2f, scrollHeight);
  316. Rect scrollInternalRect = new Rect(0f, 0f, (this.defaultControlWidth * 2f) - this.scrollbarWidth, scrollInternalHeight);
  317. this.scrollStateViewVector = GUI.BeginScrollView(scrollRect, this.scrollStateViewVector, scrollInternalRect, false, true, GUI.skin.horizontalScrollbar, GUI.skin.verticalScrollbar, this.scrollViewStyle);
  318. for (int j = 0; j < this.flowcharts.Length; j++)
  319. {
  320. this.DrawStateChart(this.flowcharts[j]);
  321. }
  322. GUI.EndScrollView();
  323. //Hacky workaround for the ScrollView not taking mouse scrollwheel focus
  324. if (scrollRect.Contains(Input.mousePosition))
  325. {
  326. Input.ResetInputAxes();
  327. }
  328. }
  329. public void DrawCommandsTab()
  330. {
  331. float scrollHeight = (float)Screen.height - (this.menuYOffset + this.defaultControlHeight) * 2f;
  332. float scrollInternalHeight = (float)this.commandsList.Count * this.defaultControlHeight;
  333. scrollHeight = Math.Min(scrollInternalHeight, scrollHeight);
  334. Rect scrollRect = new Rect(this.defaultControlWidth, this.menuYOffset + this.defaultControlHeight, this.defaultControlWidth, scrollHeight);
  335. Rect scrollInternalRect = new Rect(0f, 0f, this.defaultControlWidth - this.scrollbarWidth, scrollInternalHeight);
  336. this.scrollCommandsViewVector = GUI.BeginScrollView(scrollRect, this.scrollCommandsViewVector, scrollInternalRect, false, true, GUI.skin.horizontalScrollbar, GUI.skin.verticalScrollbar, this.scrollViewStyle);
  337. for (int i = 0; i < this.commandsList.Count; i++)
  338. {
  339. GUILayoutOption[] layoutOption = this.commandsList[i].Length == 2 ? this.buttonHalfLayoutOptions : this.buttonLayoutOptions;
  340. GUILayout.BeginHorizontal();
  341. for (int j = 0; j < this.commandsList[i].Length; j++)
  342. {
  343. if(GUILayout.Button(this.commandsList[i][j].Key, this.defaultButtonStyle, layoutOption))
  344. {
  345. this.commandsList[i][j].Value();
  346. }
  347. }
  348. GUILayout.EndHorizontal();
  349. }
  350. GUI.EndScrollView();
  351. }
  352. public void DrawAdvancedTab()
  353. {
  354. float scrollHeight = (float)Screen.height - (this.menuYOffset + this.defaultControlHeight) * 2f;
  355. float scrollInternalHeight = (float)this.advancedList.Count * this.defaultControlHeight;
  356. scrollHeight = Math.Min(scrollInternalHeight, scrollHeight);
  357. Rect scrollRect = new Rect(this.defaultControlWidth, this.menuYOffset + this.defaultControlHeight, this.defaultControlWidth, scrollHeight);
  358. Rect scrollInternalRect = new Rect(0f, 0f, this.defaultControlWidth - this.scrollbarWidth, scrollInternalHeight);
  359. this.scrollAdvancedViewVector = GUI.BeginScrollView(scrollRect, this.scrollAdvancedViewVector, scrollInternalRect, false, true, GUI.skin.horizontalScrollbar, GUI.skin.verticalScrollbar, this.scrollViewStyle);
  360. for (int i = 0; i < this.advancedList.Count; i++)
  361. {
  362. GUILayoutOption[] layoutOption = this.commandsList[i].Length == 2 ? this.buttonHalfLayoutOptions : this.buttonLayoutOptions;
  363. GUILayout.BeginHorizontal();
  364. for (int j = 0; j < this.advancedList[i].Length; j++)
  365. {
  366. if(GUILayout.Button(this.advancedList[i][j].Key, this.defaultButtonStyle, layoutOption))
  367. {
  368. this.advancedList[i][j].Value();
  369. }
  370. }
  371. GUILayout.EndHorizontal();
  372. }
  373. GUI.EndScrollView();
  374. }
  375. public void DrawDebugMenu()
  376. {
  377. DrawWithSelectedBackColor(false);
  378. if (this.displayCheats && GUI.Button(new Rect(this.defaultControlWidth, this.menuYOffset, this.defaultControlWidth, this.defaultControlHeight), this.displayDebug ? "Hide Debug" : "Show Debug", this.defaultButtonStyle))
  379. {
  380. this.displayDebug = !this.displayDebug;
  381. }
  382. if (this.displayDebug)
  383. {
  384. if(this.autoSceneDumpPromt)
  385. {
  386. GUI.Window(-67, this.dumpConfirmWindowRect, new GUI.WindowFunction(this.DumpAllWindowFunc), "Dump All");
  387. }
  388. else
  389. {
  390. this.debugWindowRect = GUI.Window(-69, this.debugWindowRect, new GUI.WindowFunction(this.DebugWindowFunc), "Debug");
  391. }
  392. }
  393. }
  394. public void DrawWithSelectedBackColor(bool selected)
  395. {
  396. if(selected)
  397. {
  398. GUI.backgroundColor = this.buttonSelectedBackColor;
  399. }
  400. else
  401. {
  402. GUI.backgroundColor = this.buttonNormalBackColor;
  403. }
  404. }
  405. public void DrawStateChart(Flowchart chart)
  406. {
  407. GUILayout.Label(string.Format("FC:{0}", chart.name), this.labelHeaderStyle, new GUILayoutOption[0]);
  408. for (int i = 0; i < chart.Variables.Count; i++)
  409. {
  410. Variable variable = chart.Variables[i];
  411. this.DrawStateEntry(chart, variable);
  412. }
  413. }
  414. public void DrawStateEntry(Flowchart chart, Variable variable)
  415. {
  416. Type type = variable.GetType();
  417. if (type == typeof(BooleanVariable))
  418. {
  419. BooleanVariable booleanVariable = (BooleanVariable)variable;
  420. GUILayout.BeginHorizontal(new GUILayoutOption[0]);
  421. GUILayout.Label("(Bool)", this.labelStyle, new GUILayoutOption[0]);
  422. if (GUILayout.Button(booleanVariable.Value.ToString(), this.boolButtonStyle, new GUILayoutOption[0]))
  423. {
  424. chart.SetBooleanVariable(variable.Key, !booleanVariable.Value);
  425. }
  426. GUILayout.Label(variable.Key, this.labelStyle, new GUILayoutOption[0]);
  427. GUILayout.FlexibleSpace();
  428. GUILayout.EndHorizontal();
  429. return;
  430. }
  431. if (type == typeof(IntegerVariable))
  432. {
  433. IntegerVariable integerVariable = (IntegerVariable)variable;
  434. GUILayout.BeginHorizontal(new GUILayoutOption[0]);
  435. GUILayout.Label("(Int)", this.labelStyle, new GUILayoutOption[0]);
  436. bool hitPlus = GUILayout.Button("+", this.intButtonStyle, new GUILayoutOption[0]);
  437. bool hitMinus = GUILayout.Button("-", this.intButtonStyle, new GUILayoutOption[0]);
  438. if(hitPlus || hitMinus)
  439. {
  440. int addValue = hitPlus ? GetIntFromModifierKeys() : -GetIntFromModifierKeys();
  441. integerVariable.Value += addValue;
  442. PlayerPrefs.SetInt(SetSaveProfile.SaveProfile + "_" + chart.SubstituteVariables(variable.Key), integerVariable.Value);
  443. }
  444. GUILayout.Label(string.Format("{0} - {1}", variable.Key, variable), this.labelStyle, new GUILayoutOption[0]);
  445. GUILayout.FlexibleSpace();
  446. GUILayout.EndHorizontal();
  447. return;
  448. }
  449. if (type == typeof(StringVariable))
  450. {
  451. GUILayout.BeginHorizontal(new GUILayoutOption[0]);
  452. GUILayout.Label(string.Format("({0}){1} - {2}", "String", variable.Key, variable), this.labelStyle, new GUILayoutOption[0]);
  453. GUILayout.FlexibleSpace();
  454. GUILayout.EndHorizontal();
  455. return;
  456. }
  457. if (type == typeof(FloatVariable))
  458. {
  459. FloatVariable floatVariable = (FloatVariable)variable;
  460. GUILayout.BeginHorizontal(new GUILayoutOption[0]);
  461. GUILayout.Label("(Float)", this.labelStyle, new GUILayoutOption[0]);
  462. bool hitPlus = GUILayout.Button("+", this.intButtonStyle, new GUILayoutOption[0]);
  463. bool hitMinus = GUILayout.Button("-", this.intButtonStyle, new GUILayoutOption[0]);
  464. if(hitPlus || hitMinus)
  465. {
  466. float addValue = hitPlus ? GetFloatFromModifierKeys() : -GetFloatFromModifierKeys();
  467. floatVariable.Value += addValue;
  468. PlayerPrefs.SetFloat(SetSaveProfile.SaveProfile + "_" + chart.SubstituteVariables(variable.Key), floatVariable.Value);
  469. }
  470. GUILayout.Label(string.Format("{0} - {1:0.00}", variable.Key, floatVariable.Value), this.labelStyle, new GUILayoutOption[0]);
  471. GUILayout.FlexibleSpace();
  472. GUILayout.EndHorizontal();
  473. return;
  474. }
  475. GUILayout.BeginHorizontal(new GUILayoutOption[0]);
  476. GUILayout.Label(string.Format("({0}){1} - {2}", type.Name.Replace("Variable", ""), variable.Key, variable), this.labelStyle, new GUILayoutOption[0]);
  477. GUILayout.FlexibleSpace();
  478. GUILayout.EndHorizontal();
  479. }
  480. public int GetIntFromModifierKeys()
  481. {
  482. bool shiftDown = Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift);
  483. bool ctrlDown = Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl);
  484. int result = shiftDown ? (ctrlDown ? 100 : 10) : 1;
  485. return result;
  486. }
  487. public float GetFloatFromModifierKeys()
  488. {
  489. bool shiftDown = Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift);
  490. bool ctrlDown = Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl);
  491. float result = shiftDown ? (ctrlDown ? 1f : 0.1f) : 0.05f;
  492. return result;
  493. }
  494. public bool SetSelectedTab(int index)
  495. {
  496. bool result = false;
  497. if(this.tabState == index)
  498. {
  499. this.tabState = 0;
  500. }
  501. else
  502. {
  503. this.tabState = index;
  504. result = true;
  505. }
  506. return result;
  507. }
  508. public void AddInt(string name, int value)
  509. {
  510. bool breakOut = false;
  511. for (int j = 0; j < this.flowcharts.Length; j++)
  512. {
  513. if(breakOut) break;
  514. for (int i = 0; i < this.flowcharts[j].Variables.Count; i++)
  515. {
  516. if(breakOut) break;
  517. if(this.flowcharts[j].Variables[i].Key == name)
  518. {
  519. IntegerVariable variable = (IntegerVariable)this.flowcharts[j].Variables[i];
  520. variable.Value += value;
  521. PlayerPrefs.SetInt(SetSaveProfile.SaveProfile + "_" + this.flowcharts[j].SubstituteVariables(variable.Key), variable.Value);
  522. breakOut = true;
  523. }
  524. }
  525. }
  526. }
  527. public void SetInt(string name, int value)
  528. {
  529. bool breakOut = false;
  530. for (int j = 0; j < this.flowcharts.Length; j++)
  531. {
  532. if(breakOut) break;
  533. for (int i = 0; i < this.flowcharts[j].Variables.Count; i++)
  534. {
  535. if(breakOut) break;
  536. if(this.flowcharts[j].Variables[i].Key == name)
  537. {
  538. IntegerVariable variable = (IntegerVariable)this.flowcharts[j].Variables[i];
  539. variable.Value = value;
  540. PlayerPrefs.SetInt(SetSaveProfile.SaveProfile + "_" + this.flowcharts[j].SubstituteVariables(variable.Key), variable.Value);
  541. breakOut = true;
  542. }
  543. }
  544. }
  545. }
  546. public int GetInt(string name)
  547. {
  548. int result = 0;
  549. bool breakOut = false;
  550. for (int j = 0; j < this.flowcharts.Length; j++)
  551. {
  552. if(breakOut) break;
  553. for (int i = 0; i < this.flowcharts[j].Variables.Count; i++)
  554. {
  555. if(breakOut) break;
  556. if(this.flowcharts[j].Variables[i].Key == name)
  557. {
  558. IntegerVariable variable = (IntegerVariable)this.flowcharts[j].Variables[i];
  559. result = variable.Value;
  560. breakOut = true;
  561. }
  562. }
  563. }
  564. return result;
  565. }
  566. public void DebugWindowFunc(int id)
  567. {
  568. GUILayout.Label("Dump Scene:", this.labelHeaderStyle, new GUILayoutOption[0]);
  569. if (GUILayout.Button("Dump Current", defaultButtonStyle, new GUILayoutOption[0]))
  570. {
  571. this.DumpScene();
  572. }
  573. if (GUILayout.Button("Dump All", defaultButtonStyle, new GUILayoutOption[0]))
  574. {
  575. this.loadScenePrompt = false;
  576. this.autoSceneDumpPromt = true;
  577. }
  578. GUILayout.Label("Scene", this.labelHeaderStyle, new GUILayoutOption[0]);
  579. GUILayout.Label(this.lastScene, this.labelStyle, new GUILayoutOption[0]);
  580. GUILayout.BeginHorizontal(new GUILayoutOption[0]);
  581. GUILayout.Label("Charts", this.labelHeaderStyle, new GUILayoutOption[0]);
  582. GUILayout.FlexibleSpace();
  583. GUILayout.Label(this.foundCharts.ToString(), this.labelStyle, new GUILayoutOption[0]);
  584. GUILayout.EndHorizontal();
  585. GUILayout.BeginHorizontal(new GUILayoutOption[0]);
  586. GUILayout.Label("Init", this.labelHeaderStyle, new GUILayoutOption[0]);
  587. GUILayout.FlexibleSpace();
  588. GUILayout.Label(this.initCounter.ToString(), this.labelStyle, new GUILayoutOption[0]);
  589. GUILayout.EndHorizontal();
  590. GUI.DragWindow(new Rect(0f, 0f, 10000f, 10000f));
  591. }
  592. public void DumpAllWindowFunc(int id)
  593. {
  594. GUILayout.Label("This will load and dump every scene in the game", this.labelStyle, new GUILayoutOption[0]);
  595. GUILayout.Label("This might take awhile, especially on slower machines", this.labelStyle, new GUILayoutOption[0]);
  596. GUILayout.Label("The screen will appear black during this process", this.labelStyle, new GUILayoutOption[0]);
  597. GUILayout.Label("Make sure to keep the game in focus or the progress will be paused!", this.labelStyle, new GUILayoutOption[0]);
  598. GUILayout.Label("", this.labelHeaderStyle, new GUILayoutOption[0]);
  599. GUILayout.Label("Are you sure?", this.labelHeaderStyle, new GUILayoutOption[0]);
  600. GUILayout.BeginHorizontal(new GUILayoutOption[0]);
  601. bool yesPressed = GUILayout.Button("Yes", defaultButtonStyle, new GUILayoutOption[0]);
  602. bool noPressed = GUILayout.Button("No", defaultButtonStyle, new GUILayoutOption[0]);
  603. if(yesPressed || noPressed)
  604. {
  605. this.autoSceneDump = yesPressed;
  606. this.displayDebug = !yesPressed;
  607. this.displayCheats = !yesPressed;
  608. this.autoSceneDumpPromt = false;
  609. }
  610. GUILayout.EndHorizontal();
  611. }
  612. public void LoadSceneFunc(int id)
  613. {
  614. GUILayout.Label("Beware, Here be Dragons -EXPERIMENTAL-", this.labelHeaderStyle, new GUILayoutOption[0]);
  615. GUILayout.Label("Could break saves and cause softlocks use at own risk!", this.labelHeaderStyle, new GUILayoutOption[0]);
  616. GUILayout.Label("You can find a list of scenenames by dumping all scenes", this.labelStyle, new GUILayoutOption[0]);
  617. GUILayout.Label("with the debug menu", this.labelStyle, new GUILayoutOption[0]);
  618. GUILayout.BeginHorizontal(new GUILayoutOption[0]);
  619. GUILayout.Label("Scene Name", this.labelStyle, new GUILayoutOption[0]);
  620. GUILayout.FlexibleSpace();
  621. this.sceneNameInput = GUILayout.TextField(this.sceneNameInput, GUILayout.Width(this.dumpConfirmWindowRect.width - this.defaultControlWidth));
  622. GUILayout.EndHorizontal();
  623. GUILayout.Label("Are you sure?", this.labelHeaderStyle, new GUILayoutOption[0]);
  624. GUILayout.BeginHorizontal(new GUILayoutOption[0]);
  625. bool yesPressed = GUILayout.Button("Yes", defaultButtonStyle, new GUILayoutOption[0]);
  626. bool noPressed = GUILayout.Button("No", defaultButtonStyle, new GUILayoutOption[0]);
  627. if(yesPressed || noPressed)
  628. {
  629. this.displayCheats = !yesPressed;
  630. this.loadScenePrompt = false;
  631. if(yesPressed)
  632. {
  633. SceneManager.LoadScene(this.sceneNameInput);
  634. }
  635. }
  636. GUILayout.EndHorizontal();
  637. }
  638. public void DumpScene()
  639. {
  640. Scene activeScene = SceneManager.GetActiveScene();
  641. GameObject[] rootGameObjects = activeScene.GetRootGameObjects();
  642. using (FileStream fileStream = File.Create(Path.Combine(Application.dataPath, activeScene.name + ".dmp")))
  643. {
  644. using (StreamWriter streamWriter = new StreamWriter(fileStream))
  645. {
  646. try
  647. {
  648. foreach (GameObject gameObject in rootGameObjects)
  649. {
  650. streamWriter.WriteLine("{0}", gameObject.name);
  651. Dictionary<Block, List<Command>> dictionary = new Dictionary<Block, List<Command>>();
  652. foreach (Block key in gameObject.GetComponents<Block>())
  653. {
  654. dictionary.Add(key, new List<Command>());
  655. }
  656. foreach (Command command in gameObject.GetComponents<Command>())
  657. {
  658. dictionary[command.ParentBlock].Add(command);
  659. }
  660. foreach (KeyValuePair<Block, List<Command>> keyValuePair in dictionary)
  661. {
  662. keyValuePair.Value.Sort((Command s1, Command s2) => s1.CommandIndex.CompareTo(s2.CommandIndex));
  663. streamWriter.WriteLine("\t(Block){0}", keyValuePair.Key.BlockName);
  664. foreach (Command command2 in keyValuePair.Value)
  665. {
  666. Type type = command2.GetType();
  667. string text = this.FormatIndent(2, command2);
  668. if (type == typeof(SaveVariable))
  669. {
  670. text += string.Format("(SaveVariable) {0}", ((SaveVariable)command2).key);
  671. }
  672. else if (type == typeof(LoadVariable))
  673. {
  674. LoadVariable loadVariable = (LoadVariable)command2;
  675. text += string.Format("(LoadVariable) {0}", loadVariable.key);
  676. }
  677. else if (type == typeof(Call))
  678. {
  679. Call call = (Call)command2;
  680. text += string.Format("(Call) {0} - {1}", (call.targetBlock != null) ? call.targetBlock.blockName : "null", (call.targetFlowchart != null) ? call.targetFlowchart.name : "null");
  681. }
  682. else if (type == typeof(SetVariable))
  683. {
  684. string arg = this.FormatSetVariable((SetVariable)command2);
  685. text += string.Format("(SetVariable) {0}", arg);
  686. }
  687. else if (type == typeof(Say))
  688. {
  689. Say say = (Say)command2;
  690. text += string.Format("(Say) {0} - {1}", (say.character != null) ? say.character.NameText : "null", (say.storyText != null) ? say.storyText.Replace("\r", "").Replace("\n", "") : "null");
  691. }
  692. else if (type == typeof(LoadScene))
  693. {
  694. string value = ((LoadScene)command2)._sceneName.Value;
  695. text += string.Format("(LoadScene) {0}", value);
  696. }
  697. else if (type == typeof(If))
  698. {
  699. If condition = (If)command2;
  700. string arg2 = this.FormatVariable(condition);
  701. text += string.Format("(If) {0}", arg2);
  702. }
  703. else if (type == typeof(ElseIf))
  704. {
  705. string arg3 = this.FormatVariable((ElseIf)command2);
  706. text += string.Format("(ElseIf) {0}", arg3);
  707. }
  708. else if (type == typeof(Menu))
  709. {
  710. Menu menu = (Menu)command2;
  711. string arg4 = string.Format("{0} - {1}", menu.text, (menu.targetBlock != null) ? menu.targetBlock.BlockName : "null");
  712. text += string.Format("(Menu) {0}", arg4);
  713. }
  714. else if (type == typeof(SetActive))
  715. {
  716. SetActive setActive = (SetActive)command2;
  717. string arg5 = "null";
  718. if (setActive._targetGameObject.Value != null)
  719. {
  720. arg5 = setActive._targetGameObject.Value.name;
  721. }
  722. text += string.Format("(SetActive) {0} {1}", arg5, setActive.activeState.Value);
  723. }
  724. else if (type == typeof(SetText))
  725. {
  726. SetText setText = (SetText)command2;
  727. string arg6 = "null";
  728. if (setText.text.Value != null)
  729. {
  730. arg6 = setText.text.Value.Replace("\r", "").Replace("\n", "");
  731. }
  732. text += string.Format("(SetText) {0}", arg6);
  733. }
  734. else if (type == typeof(RandomInteger))
  735. {
  736. RandomInteger ranInteger = (RandomInteger)command2;
  737. string arg7 = "null";
  738. if (ranInteger.variable != null)
  739. {
  740. arg7 = ranInteger.variable.Key;
  741. }
  742. text += string.Format("(RandomInteger) Min:{0} Max:{1} - {2}", ranInteger.minValue.Value, ranInteger.maxValue.Value, arg7);
  743. }
  744. else if(type == typeof(InvokeEvent))
  745. {
  746. InvokeEvent invokeEvent = (InvokeEvent)command2;
  747. UnityEngine.Events.UnityEventBase unityEvent = null;
  748. switch (invokeEvent.invokeType)
  749. {
  750. case InvokeType.Static:
  751. unityEvent = invokeEvent.staticEvent;
  752. break;
  753. case InvokeType.DynamicBoolean:
  754. unityEvent = invokeEvent.booleanEvent;
  755. break;
  756. case InvokeType.DynamicInteger:
  757. unityEvent = invokeEvent.integerEvent;
  758. break;
  759. case InvokeType.DynamicFloat:
  760. unityEvent = invokeEvent.floatEvent;
  761. break;
  762. case InvokeType.DynamicString:
  763. unityEvent = invokeEvent.stringEvent;
  764. break;
  765. }
  766. int eventCount = unityEvent.GetPersistentEventCount();
  767. string arg8 = eventCount == 0 ? "null" : "";
  768. for (int i = 0; i < eventCount; i++)
  769. {
  770. arg8 += string.Format(" {0}",unityEvent.GetPersistentMethodName(i));
  771. }
  772. text += string.Format("(InvokeEvent) Type: {0} -{1}", invokeEvent.invokeType, arg8);
  773. }
  774. else if (type == typeof(Else) || type == typeof(End) || type == typeof(FadeScreen) || type == typeof(Wait) || type == typeof(SetMenuDialog))
  775. {
  776. text += string.Format("({0})", type.Name);
  777. }
  778. else
  779. {
  780. string arg6 = command2.ToString().Replace("(" + type.FullName + ")", "");
  781. text += string.Format("({0}) - {1}", type.Name, arg6);
  782. }
  783. streamWriter.WriteLine(text);
  784. }
  785. }
  786. }
  787. }
  788. catch(Exception ex)
  789. {
  790. string failedDump = string.Format("ERROR; REPORT THIS, Exception: {0}", ex);
  791. streamWriter.WriteLine(failedDump);
  792. }
  793. }
  794. }
  795. }
  796. public string FormatIndent(int baseCount, Command command)
  797. {
  798. int num = command.IndentLevel + baseCount;
  799. string text = "";
  800. for (int i = 0; i < num; i++)
  801. {
  802. text += "\t";
  803. }
  804. return text;
  805. }
  806. public string FormatVariable(VariableCondition condition)
  807. {
  808. Variable variable = condition.variable;
  809. string result = "-variable null-";
  810. if (variable != null)
  811. {
  812. Type type = variable.GetType();
  813. if (type == typeof(IntegerVariable))
  814. {
  815. result = string.Format("(int){0} {1} {2}", variable.key, this.FormatCompareOperator(condition.compareOperator), condition.integerData.Value);
  816. }
  817. else if (type == typeof(BooleanVariable))
  818. {
  819. result = string.Format("(bool){0} {1} {2}", variable.key, this.FormatCompareOperator(condition.compareOperator), condition.booleanData.Value);
  820. }
  821. else if (type == typeof(StringVariable))
  822. {
  823. result = string.Format("(string){0} {1} {2}", variable.key, this.FormatCompareOperator(condition.compareOperator), condition.stringData.Value);
  824. }
  825. else if (type == typeof(FloatVariable))
  826. {
  827. result = string.Format("(float){0} {1} {2}", variable.key, this.FormatCompareOperator(condition.compareOperator), condition.floatData.Value);
  828. }
  829. else
  830. {
  831. result = string.Format("{0} {1} Unknown", variable.key, this.FormatCompareOperator(condition.compareOperator));
  832. }
  833. }
  834. return result;
  835. }
  836. public string FormatSetVariable(SetVariable setVariable)
  837. {
  838. Variable variable = setVariable.variable;
  839. string result = "null";
  840. if (variable != null)
  841. {
  842. Type type = variable.GetType();
  843. if (type == typeof(IntegerVariable))
  844. {
  845. result = string.Format("(int){0} {1} {2}", variable.key, this.FormatSetOperator(setVariable.setOperator), setVariable.integerData.Value);
  846. }
  847. else if (type == typeof(BooleanVariable))
  848. {
  849. result = string.Format("(bool){0} {1} {2}", variable.key, this.FormatSetOperator(setVariable.setOperator), setVariable.booleanData.Value);
  850. }
  851. else if (type == typeof(StringVariable))
  852. {
  853. result = string.Format("(string){0} {1} {2}", variable.key, this.FormatSetOperator(setVariable.setOperator), setVariable.stringData.Value);
  854. }
  855. else if (type == typeof(FloatVariable))
  856. {
  857. result = string.Format("(float){0} {1} {2}", variable.key, this.FormatSetOperator(setVariable.setOperator), setVariable.floatData.Value);
  858. }
  859. else
  860. {
  861. result = string.Format("{0} {1} Unknown", variable.key, this.FormatSetOperator(setVariable.setOperator));
  862. }
  863. }
  864. return result;
  865. }
  866. public string FormatSetOperator(SetOperator setOperator)
  867. {
  868. string result = null;
  869. if (setOperator == SetOperator.Add)
  870. {
  871. result = "+";
  872. }
  873. else if (setOperator == SetOperator.Assign)
  874. {
  875. result = "=";
  876. }
  877. else if (setOperator == SetOperator.Divide)
  878. {
  879. result = "/";
  880. }
  881. else if (setOperator == SetOperator.Multiply)
  882. {
  883. result = "*";
  884. }
  885. else if (setOperator == SetOperator.Negate)
  886. {
  887. result = "=!";
  888. }
  889. else if (setOperator == SetOperator.Subtract)
  890. {
  891. result = "-";
  892. }
  893. return result;
  894. }
  895. public string FormatCompareOperator(CompareOperator compareOperator)
  896. {
  897. string result = null;
  898. if (compareOperator == CompareOperator.Equals)
  899. {
  900. result = "==";
  901. }
  902. else if (compareOperator == CompareOperator.GreaterThan)
  903. {
  904. result = ">";
  905. }
  906. else if (compareOperator == CompareOperator.GreaterThanOrEquals)
  907. {
  908. result = ">=";
  909. }
  910. else if (compareOperator == CompareOperator.LessThan)
  911. {
  912. result = "<";
  913. }
  914. else if (compareOperator == CompareOperator.LessThanOrEquals)
  915. {
  916. result = "<=";
  917. }
  918. else if (compareOperator == CompareOperator.NotEquals)
  919. {
  920. result = "!=";
  921. }
  922. return result;
  923. }
  924. public bool DoAutoSceneDump(out string nextSceneOut, Scene activeScene)
  925. {
  926. bool result;
  927. if (!this.sceneDumpDict.ContainsKey(activeScene.name) || !this.sceneDumpDict[activeScene.name])
  928. {
  929. this.sceneDumpDict[activeScene.name] = true;
  930. this.DumpScene();
  931. }
  932. GameObject[] rootGameObjects = activeScene.GetRootGameObjects();
  933. for (int i = 0; i < rootGameObjects.Length; i++)
  934. {
  935. foreach (LoadScene loadScene in rootGameObjects[i].GetComponents<LoadScene>())
  936. {
  937. if (!this.sceneDumpDict.ContainsKey(loadScene._sceneName.Value))
  938. {
  939. this.sceneDumpDict.Add(loadScene._sceneName.Value, false);
  940. }
  941. }
  942. }
  943. string nextScene = null;
  944. foreach (KeyValuePair<string, bool> keyValuePair in this.sceneDumpDict)
  945. {
  946. if (!keyValuePair.value)
  947. {
  948. nextScene = keyValuePair.key;
  949. break;
  950. }
  951. }
  952. if (nextScene != null)
  953. {
  954. result = true;
  955. nextSceneOut = nextScene;
  956. }
  957. else
  958. {
  959. result = false;
  960. nextSceneOut = null;
  961. }
  962. return result;
  963. }
  964. public static CheatMenu Instance;
  965. public string DetectedVersion;
  966. public string ExpectedVersion;
  967. public bool versionCheck;
  968. public bool versionMatched;
  969. public bool initFlowChart;
  970. public bool initGuiStyle;
  971. public bool displayCheats;
  972. public int tabState;
  973. public float scrollbarWidth;
  974. public string lastScene;
  975. public int foundCharts;
  976. public int initCounter;
  977. public bool displayDebug;
  978. public Vector2 scrollStateViewVector;
  979. public Vector2 scrollCommandsViewVector;
  980. public Vector2 scrollAdvancedViewVector;
  981. public GUIStyle labelStyle;
  982. public GUIStyle intButtonStyle;
  983. public GUIStyle boolButtonStyle;
  984. public GUIStyle scrollViewStyle;
  985. public GUIStyle defaultButtonStyle;
  986. public GUIStyle labelHeaderStyle;
  987. public GUILayoutOption[] buttonLayoutOptions;
  988. public GUILayoutOption[] buttonHalfLayoutOptions;
  989. public Color buttonNormalBackColor;
  990. public Color buttonSelectedBackColor;
  991. public float minButtonHeight;
  992. public int proposedItemCount;
  993. public int defaultControlHeight;
  994. public int defaultControlWidth;
  995. public int defaultControlFontSize;
  996. public Texture2D scrollBackground;
  997. public float menuYOffset;
  998. public bool debugMenu;
  999. public bool autoSceneDump;
  1000. public bool autoSceneDumpPromt;
  1001. public bool loadScenePrompt;
  1002. public Rect debugWindowRect;
  1003. public Flowchart[] flowcharts;
  1004. public HashSet<string> blackListScenes;
  1005. public Rect dumpConfirmWindowRect;
  1006. public string sceneNameInput;
  1007. public Dictionary<string, bool> sceneDumpDict;
  1008. public List<KeyValuePair<string, Action>[]> commandsList;
  1009. public List<KeyValuePair<string, Action>[]> advancedList;
  1010. }