public static void BuildMenu(GameObject canvas) { panel = new CanvasPanel(canvas, GUIController.Instance.images["HelpBG"], new Vector2(1123, 456), Vector2.zero, new Rect(0, 0, GUIController.Instance.images["HelpBG"].width, GUIController.Instance.images["HelpBG"].height)); panel.AddText("Label", "Binds", new Vector2(130f, -25f), Vector2.zero, GUIController.Instance.trajanBold, 30); panel.AddText("Category", "", new Vector2(25f, 25f), Vector2.zero, GUIController.Instance.trajanNormal, 20); panel.AddText("Help", "", new Vector2(25f, 50f), Vector2.zero, GUIController.Instance.arial, 15); panel.AddButton("Next", GUIController.Instance.images["ButtonRect"], new Vector2(125, 250), Vector2.zero, NextClicked, new Rect(0, 0, GUIController.Instance.images["ButtonRect"].width, GUIController.Instance.images["ButtonRect"].height), GUIController.Instance.trajanBold, "# / #"); for (int i = 0; i < 11; i++) { panel.AddButton(i.ToString(), GUIController.Instance.images["Scrollbar_point"], new Vector2(300f, 45f + 17.5f * i), Vector2.zero, ChangeBind, new Rect(0, 0, GUIController.Instance.images["Scrollbar_point"].width, GUIController.Instance.images["Scrollbar_point"].height)); } //Build pages based on categories foreach (KeyValuePair <string, Pair> bindable in DebugMod.bindMethods) { string name = bindable.Key; string cat = (string)bindable.Value.First; if (!bindPages.ContainsKey(cat)) { bindPages.Add(cat, new List <string>()); } bindPages[cat].Add(name); } pageKeys = bindPages.Keys.ToList(); panel.GetText("Category").UpdateText(pageKeys[page]); panel.GetButton("Next").UpdateText((page + 1) + " / " + pageKeys.Count); UpdateHelpText(); }
public static void Update() { if (statePanel == null) { return; } if (DebugMod.GM.IsNonGameplayScene()) { if (statePanel.active) { statePanel.SetActive(false, true); } return; } if (DebugMod.settings.SaveStatePanelVisible && !statePanel.active) { statePanel.SetActive(true, false); } else if (!DebugMod.settings.SaveStatePanelVisible && statePanel.active) { statePanel.SetActive(false, true); } if (statePanel.active) { statePanel.GetText("currentmode").UpdateText(SaveStateManager.currentStateOperation); for (int i = 0; i < SaveStateManager.maxSaveStates; i++) { statePanel.GetText(i.ToString()).UpdateText("open"); } foreach (KeyValuePair <int, string[]> entry in SaveStateManager.GetSaveStatesInfo()) { statePanel.GetText(entry.Key.ToString()).UpdateText(string.Format("{0} - {1}", entry.Value[0], entry.Value[1])); } } }
public static void UpdateHelpText() { if (page < 0 || page >= pageKeys.Count) { return; } string cat = pageKeys[page]; List <string> helpPage = bindPages[cat]; string updatedText = ""; foreach (string bindStr in helpPage) { updatedText += bindStr + " - "; if (DebugMod.settings.binds.ContainsKey(bindStr)) { KeyCode code = ((KeyCode)DebugMod.settings.binds[bindStr]); if (code != KeyCode.None) { updatedText += ((KeyCode)DebugMod.settings.binds[bindStr]).ToString(); } else { updatedText += "WAITING"; } } else { updatedText += "UNBOUND"; } updatedText += "\n"; } panel.GetText("Help").UpdateText(updatedText); }
public static void Update() { if (panel == null) { return; } if (DebugMod.GM.IsNonGameplayScene()) { if (panel.active) { panel.SetActive(false, true); } return; } if (DebugMod.settings.ConsoleVisible && !panel.active) { panel.SetActive(true, false); } else if (!DebugMod.settings.ConsoleVisible && panel.active) { panel.SetActive(false, true); } if (panel.active) { string consoleString = ""; int lineCount = 0; for (int i = history.Count - 1; i >= 0; i--) { if (lineCount >= 8) { break; } consoleString = history[i] + "\n" + consoleString; lineCount++; } panel.GetText("Console").UpdateText(consoleString); } }
public static void Update() { if (panel == null) { return; } if (DebugMod.GM == null) { return; } if (DebugMod.GM.IsNonGameplayScene()) { if (panel.active) { panel.SetActive(false, true); } return; } if (DebugMod.settings.InfoPanelVisible && !panel.active) { panel.SetActive(true, false); } else if (!DebugMod.settings.InfoPanelVisible && panel.active) { panel.SetActive(false, true); } if (panel.active) { PlayerData.instance.CountGameCompletion(); panel.GetText("Hero State").UpdateText(HeroController.instance.hero_state.ToString()); panel.GetText("Velocity").UpdateText(HeroController.instance.current_velocity.ToString()); panel.GetText("Nail Damage").UpdateText(DebugMod.RefKnightSlash.FsmVariables.GetFsmInt("damageDealt").Value + " (Flat " + PlayerData.instance.nailDamage + ", x" + DebugMod.RefKnightSlash.FsmVariables.GetFsmFloat("Multiplier").Value + ")"); panel.GetText("HP").UpdateText(PlayerData.instance.health + " / " + PlayerData.instance.maxHealth); panel.GetText("MP").UpdateText((PlayerData.instance.MPCharge + PlayerData.instance.MPReserve).ToString()); panel.GetText("Completion").UpdateText(PlayerData.instance.completionPercentage.ToString()); panel.GetText("Grubs").UpdateText(PlayerData.instance.grubsCollected + " / 46"); panel.GetText("isInvuln").UpdateText(GetStringForBool(HeroController.instance.cState.invulnerable)); panel.GetText("Invincible").UpdateText(GetStringForBool(PlayerData.instance.isInvincible)); panel.GetText("Invincitest").UpdateText(GetStringForBool(PlayerData.instance.invinciTest)); panel.GetText("Damage State").UpdateText(HeroController.instance.damageMode.ToString()); panel.GetText("Dead State").UpdateText(GetStringForBool(HeroController.instance.cState.dead)); panel.GetText("Hazard Death").UpdateText(HeroController.instance.cState.hazardDeath.ToString()); panel.GetText("Scene Name").UpdateText(DebugMod.GetSceneName()); panel.GetText("Transition").UpdateText(GetStringForBool(HeroController.instance.cState.transitioning)); string transState = HeroController.instance.transitionState.ToString(); if (transState == "WAITING_TO_ENTER_LEVEL") { transState = "LOADING"; } if (transState == "WAITING_TO_TRANSITION") { transState = "WAITING"; } panel.GetText("Trans State").UpdateText(transState); panel.GetText("is Gameplay").UpdateText(GetStringForBool(DebugMod.GM.IsGameplayScene())); panel.GetText("Game State").UpdateText(GameManager.instance.gameState.ToString()); panel.GetText("UI State").UpdateText(UIManager.instance.uiState.ToString()); panel.GetText("Hero Paused").UpdateText(GetStringForBool(HeroController.instance.cState.isPaused)); panel.GetText("Camera Mode").UpdateText(DebugMod.RefCamera.mode.ToString()); panel.GetText("Accept Input").UpdateText(GetStringForBool(HeroController.instance.acceptingInput)); panel.GetText("Relinquished").UpdateText(GetStringForBool(HeroController.instance.controlReqlinquished)); panel.GetText("atBench").UpdateText(GetStringForBool(PlayerData.instance.atBench)); panel.GetText("Dashing").UpdateText(GetStringForBool(HeroController.instance.cState.dashing)); panel.GetText("Jumping").UpdateText(GetStringForBool((HeroController.instance.cState.jumping || HeroController.instance.cState.doubleJumping))); panel.GetText("Superdashing").UpdateText(GetStringForBool(HeroController.instance.cState.superDashing)); panel.GetText("Falling").UpdateText(GetStringForBool(HeroController.instance.cState.falling)); panel.GetText("Hardland").UpdateText(GetStringForBool(HeroController.instance.cState.willHardLand)); panel.GetText("Swimming").UpdateText(GetStringForBool(HeroController.instance.cState.swimming)); panel.GetText("Recoiling").UpdateText(GetStringForBool(HeroController.instance.cState.recoiling)); panel.GetText("Wall lock").UpdateText(GetStringForBool(HeroController.instance.wallLocked)); panel.GetText("Wall jumping").UpdateText(GetStringForBool(HeroController.instance.cState.wallJumping)); panel.GetText("Wall touching").UpdateText(GetStringForBool(HeroController.instance.cState.touchingWall)); panel.GetText("Wall sliding").UpdateText(GetStringForBool(HeroController.instance.cState.wallSliding)); panel.GetText("Wall left").UpdateText(GetStringForBool(HeroController.instance.touchingWallL)); panel.GetText("Wall right").UpdateText(GetStringForBool(HeroController.instance.touchingWallR)); panel.GetText("Attacking").UpdateText(GetStringForBool(HeroController.instance.cState.attacking)); panel.GetText("canCast").UpdateText(GetStringForBool(HeroController.instance.CanCast())); panel.GetText("canSuperdash").UpdateText(GetStringForBool(HeroController.instance.CanSuperDash())); panel.GetText("canQuickmap").UpdateText(GetStringForBool(HeroController.instance.CanQuickMap())); panel.GetText("canInventory").UpdateText(GetStringForBool(HeroController.instance.CanOpenInventory())); panel.GetText("canWarp").UpdateText(GetStringForBool(DebugMod.RefDreamNail.FsmVariables.GetFsmBool("Dream Warp Allowed").Value)); panel.GetText("canDGate").UpdateText(GetStringForBool(DebugMod.RefDreamNail.FsmVariables.GetFsmBool("Can Dream Gate").Value)); panel.GetText("gateAllow").UpdateText(GetStringForBool(DebugMod.RefDreamNail.FsmVariables.GetFsmBool("Dream Gate Allowed").Value)); int time1 = Mathf.FloorToInt(Time.realtimeSinceStartup / 60f); int time2 = Mathf.FloorToInt(Time.realtimeSinceStartup - (float)(time1 * 60)); panel.GetText("Right1").UpdateText(string.Format("{0:00}:{1:00}", time1, time2) + "\n" + DebugMod.GetLoadTime() + "s\n" + (Vector2)DebugMod.RefKnight.transform.position + "\n" + string.Format("L: {0} R: {1}", DebugMod.IH.inputActions.left.RawValue, DebugMod.IH.inputActions.right.RawValue)); panel.GetText("Right2").UpdateText(DebugMod.IH.inputActions.moveVector.Vector.x + ", " + DebugMod.IH.inputActions.moveVector.Vector.y + "\n" + GetStringForBool(InputManager.AnyKeyIsPressed) + "\n" + GetStringForBool(DebugMod.IH.inputActions.left.IsPressed || DebugMod.IH.inputActions.right.IsPressed) + "\n" + DebugMod.IH.inputX); } }
public static void Update() { if (panel == null) { return; } if (DebugMod.GM.IsNonGameplayScene()) { if (panel.active) { panel.SetActive(false, true); } return; } if (DebugMod.settings.EnemiesPanelVisible && !panel.active) { panel.SetActive(true, false); } else if (!DebugMod.settings.EnemiesPanelVisible && panel.active) { panel.SetActive(false, true); } if (DebugMod.settings.EnemiesPanelVisible && UIManager.instance.uiState == UIState.PLAYING && (panel.GetPanel("Pause").active || !panel.GetPanel("Play").active)) { panel.GetPanel("Pause").SetActive(false, true); panel.GetPanel("Play").SetActive(true, false); } else if (DebugMod.settings.EnemiesPanelVisible && UIManager.instance.uiState == UIState.PAUSED && (!panel.GetPanel("Pause").active || panel.GetPanel("Play").active)) { panel.GetPanel("Pause").SetActive(true, false); panel.GetPanel("Play").SetActive(false, true); } if (!panel.active && enemyPool.Count > 0) { Reset(); } if (panel.active) { CheckForAutoUpdate(); string enemyNames = ""; string enemyHP = ""; int enemyCount = 0; for (int i = 0; i < enemyPool.Count; i++) { EnemyData dat = enemyPool[i]; GameObject obj = dat.gameObject; if (obj == null || !obj.activeSelf) { if (obj == null) { dat.hpBar.Destroy(); dat.hitbox.Destroy(); enemyPool.RemoveAt(i); i--; } else { dat.hpBar.SetPosition(new Vector2(-1000f, -1000f)); } } else { int hp = dat.HM.hp; if (hp != dat.HP) { dat.SetHP(hp); if (hpBars) { Texture2D tex = new Texture2D(120, 40); for (int x = 0; x < 120; x++) { for (int y = 0; y < 40; y++) { if (x < 3 || x > 116 || y < 3 || y > 36) { tex.SetPixel(x, y, Color.black); } else { if ((float)hp / (float)dat.maxHP >= (x - 2f) / 117f) { tex.SetPixel(x, y, Color.red); } else { tex.SetPixel(x, y, new Color(255f, 255f, 255f, 0f)); } } } } tex.Apply(); dat.hpBar.UpdateBackground(tex, new Rect(0, 0, 120, 40)); } } if (hitboxes) { if ((dat.Spr as tk2dSprite).boxCollider2D != null) { BoxCollider2D boxCollider2D = (dat.Spr as tk2dSprite).boxCollider2D; Bounds bounds2 = boxCollider2D.bounds; float width = Math.Abs(bounds2.max.x - bounds2.min.x); float height = Math.Abs(bounds2.max.y - bounds2.min.y); Vector2 position = Camera.main.WorldToScreenPoint(boxCollider2D.transform.position + new Vector3(boxCollider2D.offset.x, boxCollider2D.offset.y, 0f)); Vector2 size = Camera.main.WorldToScreenPoint(boxCollider2D.transform.position + new Vector3(width, height, 0)); size -= position; Quaternion rot = boxCollider2D.transform.rotation; rot.eulerAngles = new Vector3(Mathf.Round(rot.eulerAngles.x / 90) * 90, Mathf.Round(rot.eulerAngles.y / 90) * 90, Mathf.Round(rot.eulerAngles.z / 90) * 90); Vector2 pivot = Camera.main.WorldToScreenPoint(boxCollider2D.transform.position); Vector2 pointA = Camera.main.WorldToScreenPoint((Vector2)boxCollider2D.transform.position + boxCollider2D.offset); pointA.x -= size.x / 2f; pointA.y -= size.y / 2f; Vector2 pointB = pointA + size; pointA = (Vector2)(rot * (pointA - pivot)) + pivot; pointB = (Vector2)(rot * (pointB - pivot)) + pivot; position = new Vector2(pointA.x <pointB.x?pointA.x : pointB.x, pointA.y> pointB.y ? pointA.y : pointB.y); size = new Vector2(Math.Abs(pointA.x - pointB.x), Math.Abs(pointA.y - pointB.y)); size.x *= 1920f / Screen.width; size.y *= 1080f / Screen.height; position.x *= 1920f / Screen.width; position.y *= 1080f / Screen.height; position.y = 1080f - position.y; dat.hitbox.SetPosition(position); dat.hitbox.ResizeBG(size); } if (!dat.hitbox.active) { dat.hitbox.SetActive(true, true); } } if (hpBars) { Vector2 enemyPos = Camera.main.WorldToScreenPoint(obj.transform.position); enemyPos.x *= 1920f / Screen.width; enemyPos.y *= 1080f / Screen.height; enemyPos.y = 1080f - enemyPos.y; Bounds bounds = (dat.Spr as tk2dSprite).GetBounds(); enemyPos.y -= (Camera.main.WorldToScreenPoint(bounds.max).y *(1080f / Screen.height) - Camera.main.WorldToScreenPoint(bounds.min).y *(1080f / Screen.height)) / 2f; enemyPos.x -= 60; dat.hpBar.SetPosition(enemyPos); dat.hpBar.GetText("HP").UpdateText(dat.HM.hp + "/" + dat.maxHP); if (!dat.hpBar.active) { dat.hpBar.SetActive(true, true); } } if (!hpBars && dat.hpBar.active) { dat.hpBar.SetActive(false, true); } if (!hitboxes && dat.hitbox.active) { dat.hitbox.SetActive(false, true); } if (++enemyCount <= 14) { enemyNames += obj.name + "\n"; enemyHP += dat.HM.hp + "/" + dat.maxHP + "\n"; } } } if (panel.GetPanel("Pause").active) { for (int i = 1; i <= 14; i++) { if (i <= enemyCount) { panel.GetPanel("Pause").GetButton("Del" + i).SetActive(true); panel.GetPanel("Pause").GetButton("Clone" + i).SetActive(true); panel.GetPanel("Pause").GetButton("Inf" + i).SetActive(true); } else { panel.GetPanel("Pause").GetButton("Del" + i).SetActive(false); panel.GetPanel("Pause").GetButton("Clone" + i).SetActive(false); panel.GetPanel("Pause").GetButton("Inf" + i).SetActive(false); } } panel.GetPanel("Pause").GetButton("Collision").SetTextColor(hitboxes ? new Color(244f / 255f, 127f / 255f, 32f / 255f) : Color.white); panel.GetPanel("Pause").GetButton("HP Bars").SetTextColor(hpBars ? new Color(244f / 255f, 127f / 255f, 32f / 255f) : Color.white); panel.GetPanel("Pause").GetButton("Auto").SetTextColor(autoUpdate ? new Color(244f / 255f, 127f / 255f, 32f / 255f) : Color.white); } if (enemyCount > 14) { enemyNames += "And " + (enemyCount - 14) + " more"; } panel.GetText("Enemy Names").UpdateText(enemyNames); panel.GetText("Enemy HP").UpdateText(enemyHP); } }
public static void Update() { if (altPanel == null) { return; } if (DebugMod.GM.IsNonGameplayScene()) { if (altPanel.active) { altPanel.SetActive(false, true); } return; } // Not intended min/full info panel logic, but should show the two panels one at a time if (DebugMod.settings.MinInfoPanelVisible && !altPanel.active) { altPanel.SetActive(true, false); } else if (!DebugMod.settings.MinInfoPanelVisible && altPanel.active) { altPanel.SetActive(false, true); } if (altPanel.active) { PlayerData.instance.CountGameCompletion(); altPanel.GetText("Vel").UpdateText(HeroController.instance.current_velocity.ToString()); altPanel.GetText("Pos").UpdateText(GetHeroPos()); altPanel.GetText("MP").UpdateText((PlayerData.instance.MPCharge + PlayerData.instance.MPReserve).ToString()); altPanel.GetText("NailDmg").UpdateText(DebugMod.RefKnightSlash.FsmVariables.GetFsmInt("damageDealt").Value + " (Flat " + PlayerData.instance.nailDamage + ", x" + DebugMod.RefKnightSlash.FsmVariables.GetFsmFloat("Multiplier").Value + ")"); altPanel.GetText("CanCdash").UpdateText(GetStringForBool(HeroController.instance.CanSuperDash())); altPanel.GetText("Completion").UpdateText(PlayerData.instance.completionPercentage.ToString() + "%"); altPanel.GetText("Grubs").UpdateText(PlayerData.instance.grubsCollected + " / 46"); altPanel.GetText("Scene Name").UpdateText(DebugMod.GetSceneName()); if (SaveStateManager.quickState.IsSet()) { //string[] temp = ; //altPanel.GetText("Current SaveState").UpdateText(string.Format("{0}\n{1}", temp[2], temp[1])); altPanel.GetText("Current SaveState").UpdateText(SaveStateManager.quickState.GetSaveStateID()); } else { altPanel.GetText("Current SaveState").UpdateText("No savestate"); } string slotSet = SaveStateManager.GetCurrentSlot().ToString(); if (slotSet == "-1") { slotSet = "unset"; } //altPanel.GetText("Autoslot").UpdateText(string.Format("{0}", // GetStringForBool(SaveStateManager.GetAutoSlot()))); altPanel.GetText("Current slot").UpdateText(string.Format("{0}", slotSet)); altPanel.GetText("Hardfall").UpdateText(GetStringForBool(HeroController.instance.cState.willHardLand)); } }