コード例 #1
0
        public override void Start()
        {
            try
            {
                GungeonAPI.Init();
                KeyShrine.Add();

                //Enable the debug flow
                ETGModConsole.Commands.AddUnit("debugflow", (args) =>
                {
                    DungeonHandler.debugFlow = !DungeonHandler.debugFlow;
                    string status            = DungeonHandler.debugFlow ? "enabled" : "disabled";
                    string color             = DungeonHandler.debugFlow ? "00FF00" : "FF0000";
                    Tools.Print($"Debug flow {status}", color, true);
                });

                //This is useful for figuring out where you want your shrine to go in the breach
                ETGModConsole.Commands.AddUnit("getpos", (args) =>
                {
                    ETGModConsole.Log("Player position: " + GameManager.Instance.PrimaryPlayer.transform.position);
                    ETGModConsole.Log("Player center: " + GameManager.Instance.PrimaryPlayer.sprite.WorldCenter);
                });

                ETGModConsole.Commands.AddUnit("dissectshrine", (args) =>
                {
                    var c = GetClosestCustomShrineObject();
                    Tools.BreakdownComponents(c);
                    Tools.LogPropertiesAndFields(c.GetComponent <SimpleInteractable>());
                });

                ETGModConsole.Commands.AddUnit("roomname", (args) =>
                {
                    var room = GameManager.Instance.PrimaryPlayer.CurrentRoom;
                    Tools.Print(room.GetRoomName());
                });

                ETGModConsole.Commands.AddUnit("hidehitboxes", (args) => HitboxMonitor.DeleteHitboxDisplays());
                ETGModConsole.Commands.AddUnit("showhitboxes", (args) =>
                {
                    foreach (var obj in GameObject.FindObjectsOfType <SpeculativeRigidbody>())
                    {
                        if (obj && obj.sprite && Vector2.Distance(obj.sprite.WorldCenter, GameManager.Instance.PrimaryPlayer.sprite.WorldCenter) < 8)
                        {
                            Tools.Log(obj?.name);
                            HitboxMonitor.DisplayHitbox(obj);
                        }
                    }
                });

                Tools.Print($"Custom Rooms {VERSION} loaded.", "FF00FF", true);
            }
            catch (Exception e)
            {
                Tools.Print("Failed to load Custom Rooms Mod", "FF0000", true);
                Tools.PrintException(e);
            }
        }