コード例 #1
0
        public static void AddPlaceableToRoom(PrototypeDungeonRoom room, Vector2 location, string assetPath)
        {
            try
            {
                GameObject asset = GetGameObjectFromBundles(assetPath);
                if (asset)
                {
                    DungeonPrerequisite[] emptyReqs = new DungeonPrerequisite[0];
                    room.placedObjectPositions.Add(location);

                    var placeableContents = ScriptableObject.CreateInstance <DungeonPlaceable>();
                    placeableContents.width  = 2;
                    placeableContents.height = 2;
                    placeableContents.respectsEncounterableDifferentiator = true;
                    placeableContents.variantTiers = new List <DungeonPlaceableVariant>()
                    {
                        new DungeonPlaceableVariant()
                        {
                            percentChance        = 1,
                            nonDatabasePlaceable = asset,
                            prerequisites        = emptyReqs,
                            materialRequirements = new DungeonPlaceableRoomMaterialRequirement[0]
                        }
                    };

                    room.placedObjects.Add(new PrototypePlacedObjectData()
                    {
                        contentsBasePosition  = location,
                        fieldData             = new List <PrototypePlacedObjectFieldData>(),
                        instancePrerequisites = emptyReqs,
                        linkedTriggerAreaIDs  = new List <int>(),
                        placeableContents     = placeableContents
                    });
                    //Tools.Print($"Added {asset.name} to room.");
                    return;
                }
                DungeonPlaceable placeable = GetPlaceableFromBundles(assetPath);
                if (placeable)
                {
                    DungeonPrerequisite[] emptyReqs = new DungeonPrerequisite[0];
                    room.placedObjectPositions.Add(location);
                    room.placedObjects.Add(new PrototypePlacedObjectData()
                    {
                        contentsBasePosition  = location,
                        fieldData             = new List <PrototypePlacedObjectFieldData>(),
                        instancePrerequisites = emptyReqs,
                        linkedTriggerAreaIDs  = new List <int>(),
                        placeableContents     = placeable
                    });
                    return;
                }

                Tools.PrintError($"Unable to find asset in asset bundles: {assetPath}");
            }
            catch (Exception e)
            {
                Tools.PrintException(e);
            }
        }
コード例 #2
0
        public static void Init()
        {
            AssetBundles = new Dictionary <string, AssetBundle>();
            foreach (var name in assetBundleNames)
            {
                try
                {
                    var bundle = ResourceManager.LoadAssetBundle(name);
                    if (bundle == null)
                    {
                        Tools.PrintError($"Failed to load asset bundle: {name}");
                        continue;
                    }
                    AssetBundles.Add(name, ResourceManager.LoadAssetBundle(name));
                }
                catch (Exception e)
                {
                    Tools.PrintError($"Failed to load asset bundle: {name}");
                    Tools.PrintException(e);
                }
            }

            RoomTables = new Dictionary <string, GenericRoomTable>();
            foreach (var entry in roomTableMap)
            {
                try
                {
                    var table = DungeonDatabase.GetOrLoadByName($"base_{entry.Key}").PatternSettings.flows[0].fallbackRoomTable;
                    RoomTables.Add(entry.Key, table);
                }
                catch (Exception e)
                {
                    Tools.PrintError($"Failed to load room table: {entry.Key}:{entry.Value}");
                    Tools.PrintException(e);
                }
            }

            foreach (var entry in specialRoomTableMap)
            {
                try
                {
                    var table = GetAsset <GenericRoomTable>(entry.Value);
                    RoomTables.Add(entry.Key, table);
                }
                catch (Exception e)
                {
                    Tools.PrintError($"Failed to load special room table: {entry.Key}:{entry.Value}");
                    Tools.PrintException(e);
                }
            }

            subShopTable = AssetBundles["shared_auto_001"].LoadAsset <SharedInjectionData>("_global injected subshop table");
            //foreach(var data in subShopTable.InjectionData)
            //{
            //    Tools.LogPropertiesAndFields(data, data.annotation);
            //}

            Tools.Print("Static references initialized.");
        }
コード例 #3
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);
            }
        }
コード例 #4
0
ファイル: RoomFactory2.cs プロジェクト: Lichton/Fallen-Items
 public static void AddPlaceableToRoom(PrototypeDungeonRoom room, Vector2 location, string assetPath)
 {
     try
     {
         if (GetGameObjectFromBundles(assetPath) != null)
         {
             DungeonPrerequisite[] array = new DungeonPrerequisite[0];
             room.placedObjectPositions.Add(location);
             DungeonPlaceable dungeonPlaceable = ScriptableObject.CreateInstance <DungeonPlaceable>();
             dungeonPlaceable.width  = 2;
             dungeonPlaceable.height = 2;
             dungeonPlaceable.respectsEncounterableDifferentiator = true;
             dungeonPlaceable.variantTiers = new List <DungeonPlaceableVariant> {
                 new DungeonPlaceableVariant {
                     percentChance        = 1f,
                     nonDatabasePlaceable = GetGameObjectFromBundles(assetPath),
                     prerequisites        = array,
                     materialRequirements = new DungeonPlaceableRoomMaterialRequirement[0]
                 }
             };
             room.placedObjects.Add(new PrototypePlacedObjectData
             {
                 contentsBasePosition  = location,
                 fieldData             = new List <PrototypePlacedObjectFieldData>(),
                 instancePrerequisites = array,
                 linkedTriggerAreaIDs  = new List <int>(),
                 placeableContents     = dungeonPlaceable
             });
             return;
         }
         else if (GetPlaceableFromBundles(assetPath) != null)
         {
             DungeonPrerequisite[] instancePrerequisites = new DungeonPrerequisite[0];
             room.placedObjectPositions.Add(location);
             room.placedObjects.Add(new PrototypePlacedObjectData
             {
                 contentsBasePosition  = location,
                 fieldData             = new List <PrototypePlacedObjectFieldData>(),
                 instancePrerequisites = instancePrerequisites,
                 linkedTriggerAreaIDs  = new List <int>(),
                 placeableContents     = GetPlaceableFromBundles(assetPath)
             });
             return;
         }
         else
         {
             Tools.PrintError("Unable to find asset in asset bundles: " + assetPath, "FF0000");
         }
     }
     catch (Exception e)
     {
         Tools.PrintException(e);
     }
 }
コード例 #5
0
 public static void CollectDataForAnalysis(DungeonFlow flow, Dungeon dungeon)
 {
     try
     {
         foreach (var room in flow.fallbackRoomTable.includedRooms.elements)
         {
             Tools.Print("Fallback table: " + room?.room?.name);
         }
     }
     catch (Exception e)
     {
         Tools.PrintException(e);
     }
     dungeon = null;
 }
コード例 #6
0
 // Token: 0x0600003D RID: 61 RVA: 0x00003B08 File Offset: 0x00001D08
 public static PrototypeDungeonRoom Build(Texture2D texture, RoomFactory.RoomData roomData)
 {
     try
     {
         PrototypeDungeonRoom prototypeDungeonRoom = RoomFactory.CreateRoomFromTexture(texture);
         RoomFactory.ApplyRoomData(prototypeDungeonRoom, roomData);
         prototypeDungeonRoom.UpdatePrecalculatedData();
         return(prototypeDungeonRoom);
     }
     catch (Exception e)
     {
         Tools.PrintError <string>("Failed to build room!", "FF0000");
         Tools.PrintException(e, "FF0000");
     }
     return(RoomFactory.CreateEmptyRoom(12, 12));
 }
コード例 #7
0
        public static PrototypeDungeonRoom Build(Texture2D texture, RoomData roomData)
        {
            try
            {
                var room = CreateRoomFromTexture(texture);
                ApplyRoomData(room, roomData);
                room.UpdatePrecalculatedData();
                return(room);
            }
            catch (Exception e)
            {
                Tools.PrintError("Failed to build room!");
                Tools.PrintException(e);
            }

            return(CreateEmptyRoom(12, 12));
        }
コード例 #8
0
        // Token: 0x06000019 RID: 25 RVA: 0x00003ADC File Offset: 0x00001CDC
        private static void PlaceBreachShrines()
        {
            bool flag  = OldShrineFactory.m_builtShrines;
            bool flag2 = !flag;

            if (flag2)
            {
                foreach (GameObject gameObject in OldShrineFactory.builtShrines.Values)
                {
                    try
                    {
                        OldShrineFactory.CustomShrineController component = gameObject.GetComponent <OldShrineFactory.CustomShrineController>();
                        bool flag3 = !component.isBreachShrine;
                        bool flag4 = !flag3;
                        if (flag4)
                        {
                            OldShrineFactory.CustomShrineController component2 = UnityEngine.Object.Instantiate <GameObject>(gameObject).GetComponent <OldShrineFactory.CustomShrineController>();
                            component2.Copy(component);
                            component2.gameObject.SetActive(true);
                            component2.sprite.PlaceAtPositionByAnchor(component2.offset, tk2dBaseSprite.Anchor.LowerCenter);
                            IPlayerInteractable component3 = component2.GetComponent <IPlayerInteractable>();
                            bool flag5 = component3 is SimpleInteractable;
                            bool flag6 = flag5;
                            if (flag6)
                            {
                                ((SimpleInteractable)component3).OnAccept  = component2.OnAccept;
                                ((SimpleInteractable)component3).OnDecline = component2.OnDecline;
                                ((SimpleInteractable)component3).CanUse    = component2.CanUse;
                            }
                            bool flag7 = !RoomHandler.unassignedInteractableObjects.Contains(component3);
                            bool flag8 = flag7;
                            if (flag8)
                            {
                                RoomHandler.unassignedInteractableObjects.Add(component3);
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        Tools.PrintException(e, "FF0000");
                    }
                }
                OldShrineFactory.m_builtShrines = true;
            }
        }
コード例 #9
0
 // Token: 0x0600004A RID: 74 RVA: 0x00004D5C File Offset: 0x00002F5C
 public static void AddPlaceableToRoom(PrototypeDungeonRoom room, Vector2 location, string assetPath)
 {
     try
     {
         GameObject placeableFromBundles = RoomFactory.GetPlaceableFromBundles(assetPath);
         bool       flag  = placeableFromBundles;
         bool       flag2 = flag;
         if (flag2)
         {
             DungeonPrerequisite[] array = new DungeonPrerequisite[0];
             room.placedObjectPositions.Add(location);
             room.placedObjects.Add(new PrototypePlacedObjectData
             {
                 contentsBasePosition  = location,
                 fieldData             = new List <PrototypePlacedObjectFieldData>(),
                 instancePrerequisites = array,
                 linkedTriggerAreaIDs  = new List <int>(),
                 placeableContents     = new DungeonPlaceable
                 {
                     width  = 2,
                     height = 2,
                     respectsEncounterableDifferentiator = true,
                     variantTiers = new List <DungeonPlaceableVariant>
                     {
                         new DungeonPlaceableVariant
                         {
                             percentChance        = 1f,
                             nonDatabasePlaceable = placeableFromBundles,
                             prerequisites        = array,
                             materialRequirements = new DungeonPlaceableRoomMaterialRequirement[0]
                         }
                     }
                 }
             });
         }
         else
         {
             Tools.PrintError <string>("Unable to find asset in asset bundles: " + assetPath, "FF0000");
         }
     }
     catch (Exception e)
     {
         Tools.PrintException(e, "FF0000");
     }
 }
コード例 #10
0
ファイル: RoomFactory2.cs プロジェクト: Lichton/Fallen-Items
 public static PrototypeDungeonRoom Build(Texture2D texture, RoomData roomData, bool SetRoomCategory, bool AutoAssignToFloor, bool AssignDecorationProperties, float?Weight)
 {
     try
     {
         PrototypeDungeonRoom room = CreateRoomFromTexture(texture);
         ApplyRoomData(room, roomData, SetRoomCategory, AutoAssignToFloor, AssignDecorationProperties, Weight);
         room.OnBeforeSerialize();
         room.OnAfterDeserialize();
         room.UpdatePrecalculatedData();
         return(room);
     }
     catch (Exception e)
     {
         Tools.PrintError("Failed to build room!");
         Tools.PrintException(e);
     }
     return(CreateEmptyRoom(12, 12));
 }
コード例 #11
0
ファイル: DungeonHooks.cs プロジェクト: Lichton/Fallen-Items
        public static List <BuilderFlowNode> NewGetNodeChildrenToBuild(Func <DungeonFlow, BuilderFlowNode, LoopFlowBuilder, List <BuilderFlowNode> > orig, DungeonFlow self, BuilderFlowNode parentBuilderNode, LoopFlowBuilder builder)
        {
            var list = orig(self, parentBuilderNode, builder);

            try
            {
                foreach (var node in list)
                {
                }
            }
            catch (Exception e)
            {
                Tools.PrintException(e);
            }


            return(list);
        }
コード例 #12
0
ファイル: DungeonHooks.cs プロジェクト: Lichton/Fallen-Items
 public static WeightedRoom SelectByWeight(Func <WeightedRoomCollection, WeightedRoom> orig, WeightedRoomCollection self)
 {
     try
     {
         if (!seenTables.Contains(self))
         {
             //Tools.Log(self.name, "RoomTables/" + self.name + ".txt");
             foreach (var wroom in self.elements)
             {
                 Tools.Log(wroom.room.name, "RoomTables/" + seenTables.Count + ".txt");
             }
             seenTables.Add(self);
         }
     }catch (Exception e)
     {
         Tools.PrintException(e);
     }
     return(orig(self));
 }
コード例 #13
0
 // Token: 0x0600009C RID: 156 RVA: 0x000084D0 File Offset: 0x000066D0
 public static void PlaceBreachShrines()
 {
     ShrineFactory.CleanupBreachShrines();
     foreach (GameObject gameObject in ShrineFactory.registeredShrines.Values)
     {
         try
         {
             ShrineFactory.CustomShrineController component = gameObject.GetComponent <ShrineFactory.CustomShrineController>();
             bool flag  = !component.isBreachShrine;
             bool flag2 = !flag;
             bool flag3 = flag2;
             if (flag3)
             {
                 ShrineFactory.CustomShrineController component2 = UnityEngine.Object.Instantiate <GameObject>(gameObject).GetComponent <ShrineFactory.CustomShrineController>();
                 component2.Copy(component);
                 component2.gameObject.SetActive(true);
                 component2.sprite.PlaceAtPositionByAnchor(component2.offset, tk2dBaseSprite.Anchor.LowerCenter);
                 SpriteOutlineManager.AddOutlineToSprite(component2.sprite, Color.black);
                 IPlayerInteractable component3 = component2.GetComponent <IPlayerInteractable>();
                 bool flag4 = component3 is SimpleInteractable;
                 bool flag5 = flag4;
                 bool flag6 = flag5;
                 if (flag6)
                 {
                     ((SimpleInteractable)component3).OnAccept  = component2.OnAccept;
                     ((SimpleInteractable)component3).OnDecline = component2.OnDecline;
                     ((SimpleInteractable)component3).CanUse    = component2.CanUse;
                 }
                 bool flag7 = !RoomHandler.unassignedInteractableObjects.Contains(component3);
                 bool flag8 = flag7;
                 bool flag9 = flag8;
                 if (flag9)
                 {
                     RoomHandler.unassignedInteractableObjects.Add(component3);
                 }
             }
         }
         catch (Exception e)
         {
             Tools.PrintException(e, "FF0000");
         }
     }
 }
コード例 #14
0
        public static void StraightLine()
        {
            try
            {
                Vector2[] enemyPositions = new Vector2[100];
                string[]  enemyGuids     = new string[100];
                int[]     enemyLayers    = new int[100];
                for (int i = 0; i < enemyGuids.Length; i++)
                {
                    var db = EnemyDatabase.Instance.Entries;
                    int r  = Random.Range(0, db.Count);
                    enemyGuids[i]     = db[r].encounterGuid;
                    enemyPositions[i] = new Vector2(i * 2, 10);
                    enemyLayers[i]    = 0;
                }

                Vector2[] exits = new Vector2[]
                {
                    new Vector2(0, 9),
                    new Vector2(200, 9),
                };

                string[] dirs = new string[]
                {
                    "WEST", "EAST"
                };

                RoomData data = new RoomData()
                {
                    enemyPositions           = enemyPositions,
                    enemyGUIDs               = enemyGuids,
                    enemyReinforcementLayers = enemyLayers,
                    exitPositions            = exits,
                    exitDirections           = dirs,
                };
                Tools.Log("Data to JSON: " + JsonUtility.ToJson(data));
            }
            catch (Exception e)
            {
                Tools.PrintException(e);
            }
        }
コード例 #15
0
        private static void PlaceBreachShrines()
        {
            if (m_builtShrines)
            {
                return;
            }
            Tools.Print("Placing breach shrines: ");
            foreach (var prefab in builtShrines.Values)
            {
                try
                {
                    var prefabShrineData = prefab.GetComponent <CustomShrineController>();
                    if (!prefabShrineData.isBreachShrine)
                    {
                        continue;
                    }

                    Tools.Print($"    {prefab.name}");
                    var shrine = GameObject.Instantiate(prefab).GetComponent <CustomShrineController>();
                    shrine.Copy(prefabShrineData);
                    shrine.gameObject.SetActive(true);
                    shrine.sprite.PlaceAtPositionByAnchor(shrine.offset, tk2dBaseSprite.Anchor.LowerCenter);
                    var interactable = shrine.GetComponent <IPlayerInteractable>();
                    if (interactable is SimpleInteractable)
                    {
                        ((SimpleInteractable)interactable).OnAccept  = shrine.OnAccept;
                        ((SimpleInteractable)interactable).OnDecline = shrine.OnDecline;
                        ((SimpleInteractable)interactable).CanUse    = shrine.CanUse;
                    }
                    if (!RoomHandler.unassignedInteractableObjects.Contains(interactable))
                    {
                        RoomHandler.unassignedInteractableObjects.Add(interactable);
                    }
                }
                catch (Exception e)
                {
                    Tools.PrintException(e);
                }
            }
            m_builtShrines = true;
        }
コード例 #16
0
 // Token: 0x06000050 RID: 80 RVA: 0x00004840 File Offset: 0x00002A40
 public static void StraightLine()
 {
     try
     {
         Vector2[] array  = new Vector2[100];
         string[]  array2 = new string[100];
         int[]     array3 = new int[100];
         for (int i = 0; i < array2.Length; i++)
         {
             List <EnemyDatabaseEntry> entries = EnemyDatabase.Instance.Entries;
             int index = UnityEngine.Random.Range(0, entries.Count);
             array2[i] = entries[index].encounterGuid;
             array[i]  = new Vector2((float)(i * 2), 10f);
             array3[i] = 0;
         }
         Vector2[] exitPositions = new Vector2[]
         {
             new Vector2(0f, 9f),
             new Vector2(200f, 9f)
         };
         string[] exitDirections = new string[]
         {
             "WEST",
             "EAST"
         };
         RoomFactory.RoomData roomData = new RoomFactory.RoomData
         {
             enemyPositions           = array,
             enemyGUIDs               = array2,
             enemyReinforcementLayers = array3,
             exitPositions            = exitPositions,
             exitDirections           = exitDirections
         };
         Tools.Log <string>("Data to JSON: " + JsonUtility.ToJson(roomData));
     }
     catch (Exception e)
     {
         Tools.PrintException(e, "FF0000");
     }
 }
コード例 #17
0
        public static void Init()
        {
            AssetBundles = new Dictionary <string, AssetBundle>();
            foreach (var name in assetBundleNames)
            {
                try
                {
                    var bundle = ResourceManager.LoadAssetBundle(name);
                    AssetBundles.Add(name, ResourceManager.LoadAssetBundle(name));
                }
                catch (Exception e)
                {
                    Tools.PrintError($"Failed to load asset bundle: {name}");
                    Tools.PrintException(e);
                }
            }


            RoomTables = new Dictionary <string, GenericRoomTable>();
            foreach (var entry in roomTableMap)
            {
                try
                {
                    var table = GetAsset <GenericRoomTable>(entry.Value);
                    if (table == null)
                    {
                        table = DungeonDatabase.GetOrLoadByName($"base_{entry.Key}").PatternSettings.flows[0].fallbackRoomTable;
                    }
                    RoomTables.Add(entry.Key, table);
                    //Tools.Log(table.name);
                }
                catch (Exception e)
                {
                    Tools.PrintError($"Failed to load room table: {entry.Key}:{entry.Value}");
                    Tools.PrintException(e);
                }
            }
            Tools.Print("Static references initialized.");
        }
コード例 #18
0
 // Token: 0x06000068 RID: 104 RVA: 0x00006300 File Offset: 0x00004500
 public static void Init()
 {
     try
     {
         Hook hook = new Hook(typeof(UnityEngine.Object).GetMethod("Instantiate", new Type[]
         {
             typeof(UnityEngine.Object),
             typeof(Transform),
             typeof(bool)
         }), typeof(ShrineFakePrefabHooks).GetMethod("InstantiateOPI"));
         Hook hook2 = new Hook(typeof(UnityEngine.Object).GetMethod("Instantiate", new Type[]
         {
             typeof(UnityEngine.Object),
             typeof(Transform)
         }), typeof(ShrineFakePrefabHooks).GetMethod("InstantiateOP"));
         Hook hook3 = new Hook(typeof(UnityEngine.Object).GetMethod("Instantiate", new Type[]
         {
             typeof(UnityEngine.Object)
         }), typeof(ShrineFakePrefabHooks).GetMethod("InstantiateO"));
         Hook hook4 = new Hook(typeof(UnityEngine.Object).GetMethod("Instantiate", new Type[]
         {
             typeof(UnityEngine.Object),
             typeof(Vector3),
             typeof(Quaternion)
         }), typeof(ShrineFakePrefabHooks).GetMethod("InstantiateOPR"));
         Hook hook5 = new Hook(typeof(UnityEngine.Object).GetMethod("Instantiate", new Type[]
         {
             typeof(UnityEngine.Object),
             typeof(Vector3),
             typeof(Quaternion),
             typeof(Transform)
         }), typeof(ShrineFakePrefabHooks).GetMethod("InstantiateOPRP"));
     }
     catch (Exception e)
     {
         Tools.PrintException(e, "FF0000");
     }
 }
コード例 #19
0
ファイル: RoomFactory2.cs プロジェクト: Lichton/Fallen-Items
        public static PrototypeDungeonRoom CreateEmptyRoom(int width = 12, int height = 12)
        {
            try
            {
                Tools.Print("  Create Empty Room...", "5599FF");
                PrototypeDungeonRoom room = GetNewPrototypeDungeonRoom(width, height);
                AddExit(room, new Vector2(width / 2, height), DungeonData.Direction.NORTH);
                AddExit(room, new Vector2(width / 2, 0), DungeonData.Direction.SOUTH);
                AddExit(room, new Vector2(width, height / 2), DungeonData.Direction.EAST);
                AddExit(room, new Vector2(0, height / 2), DungeonData.Direction.WEST);

                room.FullCellData = new PrototypeDungeonRoomCellData[width * height];
                for (int x = 0; x < width; x++)
                {
                    for (int y = 0; y < height; y++)
                    {
                        room.FullCellData[x + y * width] = new PrototypeDungeonRoomCellData()
                        {
                            state      = CellType.FLOOR,
                            appearance = new PrototypeDungeonRoomCellAppearance()
                            {
                                OverrideFloorType = CellVisualData.CellFloorType.Stone,
                            },
                        };
                    }
                }

                room.OnBeforeSerialize();
                room.OnAfterDeserialize();
                room.UpdatePrecalculatedData();
                return(room);
            }
            catch (Exception e)
            {
                Tools.PrintException(e);
                return(null);
            }
        }
コード例 #20
0
        // Token: 0x06000047 RID: 71 RVA: 0x0000407C File Offset: 0x0000227C
        public static PrototypeDungeonRoom CreateEmptyRoom(int width = 12, int height = 12)
        {
            PrototypeDungeonRoom result;

            try
            {
                PrototypeDungeonRoom newPrototypeDungeonRoom = RoomFactory.GetNewPrototypeDungeonRoom(width, height);
                RoomFactory.AddExit(newPrototypeDungeonRoom, new Vector2((float)(width / 2), (float)height), DungeonData.Direction.NORTH);
                RoomFactory.AddExit(newPrototypeDungeonRoom, new Vector2((float)(width / 2), 0f), DungeonData.Direction.SOUTH);
                RoomFactory.AddExit(newPrototypeDungeonRoom, new Vector2((float)width, (float)(height / 2)), DungeonData.Direction.EAST);
                RoomFactory.AddExit(newPrototypeDungeonRoom, new Vector2(0f, (float)(height / 2)), DungeonData.Direction.WEST);
                PrototypeDungeonRoomCellData[] array = RoomFactory.m_cellData.GetValue(newPrototypeDungeonRoom) as PrototypeDungeonRoomCellData[];
                array = new PrototypeDungeonRoomCellData[width * height];
                for (int i = 0; i < width; i++)
                {
                    for (int j = 0; j < height; j++)
                    {
                        array[i + j * width] = new PrototypeDungeonRoomCellData
                        {
                            state      = CellType.FLOOR,
                            appearance = new PrototypeDungeonRoomCellAppearance
                            {
                                OverrideFloorType = CellVisualData.CellFloorType.Stone
                            }
                        };
                    }
                }
                RoomFactory.m_cellData.SetValue(newPrototypeDungeonRoom, array);
                newPrototypeDungeonRoom.UpdatePrecalculatedData();
                result = newPrototypeDungeonRoom;
            }
            catch (Exception e)
            {
                Tools.PrintException(e, "FF0000");
                result = null;
            }
            return(result);
        }
コード例 #21
0
 // Token: 0x06000079 RID: 121 RVA: 0x00006768 File Offset: 0x00004968
 public static void Init()
 {
     StaticReferences.AssetBundles = new Dictionary <string, AssetBundle>();
     foreach (string text in StaticReferences.assetBundleNames)
     {
         try
         {
             AssetBundle assetBundle = ResourceManager.LoadAssetBundle(text);
             StaticReferences.AssetBundles.Add(text, ResourceManager.LoadAssetBundle(text));
         }
         catch (Exception e)
         {
             Tools.PrintError <string>("Failed to load asset bundle: " + text, "FF0000");
             Tools.PrintException(e, "FF0000");
         }
     }
     StaticReferences.RoomTables = new Dictionary <string, GenericRoomTable>();
     foreach (KeyValuePair <string, string> keyValuePair in StaticReferences.roomTableMap)
     {
         try
         {
             GenericRoomTable genericRoomTable = StaticReferences.GetAsset <GenericRoomTable>(keyValuePair.Value);
             bool             flag             = genericRoomTable == null;
             bool             flag2            = flag;
             if (flag2)
             {
                 genericRoomTable = DungeonDatabase.GetOrLoadByName("base_" + keyValuePair.Key).PatternSettings.flows[0].fallbackRoomTable;
             }
             StaticReferences.RoomTables.Add(keyValuePair.Key, genericRoomTable);
         }
         catch (Exception e2)
         {
             Tools.PrintError <string>("Failed to load room table: " + keyValuePair.Key + ":" + keyValuePair.Value, "FF0000");
             Tools.PrintException(e2, "FF0000");
         }
     }
     Tools.Print <string>("Static references initialized.", "FFFFFF", false);
 }
コード例 #22
0
        public static void Init()
        {
            try
            {
                /*
                 * MethodInfo genericInstantiate = typeof(Object).GetMethods()
                 *           .Where(m => m.Name == "Instantiate")
                 *           .Select(m => new
                 *           {
                 *               Method = m,
                 *               Params = m.GetParameters(),
                 *               Args = m.GetGenericArguments()
                 *           })
                 *           .Where(x => x.Params.Length == 1
                 *                       && x.Args.Length == 1
                 *                       && x.Params[0].ParameterType == x.Args[0])
                 *           .Select(x => x.Method)
                 *           .First();
                 * Hook genericInstantiateHook = new Hook(
                 *  genericInstantiate,
                 *  typeof(FakePrefabHooks).GetMethod("InstantiateGeneric")
                 * );
                 */
                Hook instantiateOPI = new Hook(
                    typeof(Object).GetMethod("Instantiate", new Type[] {
                    typeof(Object),
                    typeof(Transform),
                    typeof(bool),
                }),
                    typeof(ShrineFakePrefabHooks).GetMethod("InstantiateOPI")
                    );

                Hook instantiateOP = new Hook(
                    typeof(Object).GetMethod("Instantiate", new Type[] {
                    typeof(Object),
                    typeof(Transform),
                }),
                    typeof(ShrineFakePrefabHooks).GetMethod("InstantiateOP")
                    );

                Hook instantiateO = new Hook(
                    typeof(Object).GetMethod("Instantiate", new Type[] {
                    typeof(Object),
                }),
                    typeof(ShrineFakePrefabHooks).GetMethod("InstantiateO")
                    );

                Hook instantiateOPR = new Hook(
                    typeof(Object).GetMethod("Instantiate", new Type[] {
                    typeof(Object),
                    typeof(Vector3),
                    typeof(Quaternion),
                }),
                    typeof(ShrineFakePrefabHooks).GetMethod("InstantiateOPR")
                    );

                Hook instantiateOPRP = new Hook(
                    typeof(Object).GetMethod("Instantiate", new Type[] {
                    typeof(Object),
                    typeof(Vector3),
                    typeof(Quaternion),
                    typeof(Transform),
                }),
                    typeof(ShrineFakePrefabHooks).GetMethod("InstantiateOPRP")
                    );
            }
            catch (Exception e)
            {
                Tools.PrintException(e);
            }
        }
コード例 #23
0
        ///maybe add some value proofing here (name != null, collider != IntVector2.Zero)
        public GameObject Build()
        {
            try
            {
                //Get texture and create sprite
                Texture2D tex    = ResourceExtractor.GetTextureFromResource(spritePath);
                var       shrine = SpecialItemPack.ItemAPI.SpriteBuilder.SpriteFromResource(spritePath, null, false);

                //Add (hopefully) unique ID to shrine for tracking
                string ID = $"{modID}:{name}".ToLower().Replace(" ", "_");
                shrine.name = ID;

                //Position sprite
                var sprite = shrine.GetComponent <tk2dSprite>();
                sprite.IsPerpendicular = true;
                sprite.PlaceAtPositionByAnchor(offset, tk2dBaseSprite.Anchor.LowerCenter);

                //Add speech bubble origin
                var talkPoint = new GameObject("talkpoint").transform;
                talkPoint.position = shrine.transform.position + talkPointOffset;
                talkPoint.SetParent(shrine.transform);

                //Set up collider
                if (!usesCustomColliderOffsetAndSize)
                {
                    IntVector2 spriteDimensions = new IntVector2(tex.width, tex.height);
                    colliderOffset = new IntVector2(0, 0);
                    colliderSize   = new IntVector2(spriteDimensions.x, spriteDimensions.y / 2);
                }
                var body = ItemAPI.SpriteBuilder.SetUpSpeculativeRigidbody(sprite, colliderOffset, colliderSize);

                var data = shrine.AddComponent <CustomShrineController>();
                data.ID             = ID;
                data.roomStyles     = roomStyles;
                data.isBreachShrine = true;
                data.offset         = offset;
                data.pixelColliders = body.specRigidbody.PixelColliders;
                data.factory        = this;
                data.OnAccept       = OnAccept;
                data.OnDecline      = OnDecline;
                data.CanUse         = CanUse;

                IPlayerInteractable interactable;
                //Register as interactable
                if (interactableComponent != null)
                {
                    interactable = shrine.AddComponent(interactableComponent) as IPlayerInteractable;
                }
                else
                {
                    var simpInt = shrine.AddComponent <SimpleInteractable>();
                    simpInt.isToggle    = this.isToggle;
                    simpInt.OnAccept    = this.OnAccept;
                    simpInt.OnDecline   = this.OnDecline;
                    simpInt.CanUse      = CanUse;
                    simpInt.text        = this.text;
                    simpInt.acceptText  = this.acceptText;
                    simpInt.declineText = this.declineText;
                    simpInt.talkPoint   = talkPoint;
                    interactable        = simpInt as IPlayerInteractable;
                }


                var prefab = FakePrefab.Clone(shrine);
                prefab.GetComponent <CustomShrineController>().Copy(data);
                prefab.name = ID;
                if (isBreachShrine)
                {
                    if (!RoomHandler.unassignedInteractableObjects.Contains(interactable))
                    {
                        RoomHandler.unassignedInteractableObjects.Add(interactable);
                    }
                }
                else
                {
                    if (!room)
                    {
                        room = RoomFactory.CreateEmptyRoom();
                    }
                    RegisterShrineRoom(prefab, room, ID, offset);
                }


                builtShrines.Add(ID, prefab);
                Tools.Print("Added shrine: " + ID);
                return(shrine);
            }
            catch (Exception e)
            {
                Tools.PrintException(e);
                return(null);
            }
        }
コード例 #24
0
        ///maybe add some value proofing here (name != null, collider != IntVector2.Zero)
        public GameObject Build()
        {
            try
            {
                //Get texture and create sprite
                Texture2D tex    = ResourceExtractor.GetTextureFromResource(spritePath);
                var       shrine = GungeonAPI.SpriteBuilder.SpriteFromResource(spritePath, null, false);

                //Add (hopefully) unique ID to shrine for tracking
                string ID = $"{modID}:{name}".ToLower().Replace(" ", "_");
                shrine.name = ID;

                //Position sprite
                var shrineSprite = shrine.GetComponent <tk2dSprite>();
                shrineSprite.IsPerpendicular = true;
                shrineSprite.PlaceAtPositionByAnchor(offset, tk2dBaseSprite.Anchor.LowerCenter);

                //Add speech bubble origin
                var talkPoint = new GameObject("talkpoint").transform;
                talkPoint.position = shrine.transform.position + talkPointOffset;
                talkPoint.SetParent(shrine.transform);

                //Set up collider
                if (!usesCustomColliderOffsetAndSize)
                {
                    IntVector2 spriteDimensions = new IntVector2(tex.width, tex.height);
                    colliderOffset = new IntVector2(0, 0);
                    colliderSize   = new IntVector2(spriteDimensions.x, spriteDimensions.y / 2);
                }
                var body = ItemAPI.SpriteBuilder.SetUpSpeculativeRigidbody(shrineSprite, colliderOffset, colliderSize);

                //if (!string.IsNullOrEmpty(shadowSpritePath))
                //{
                //    var shadow = ((GameObject)UnityEngine.Object.Instantiate(ResourceCache.Acquire("DefaultShadowSprite"))).GetComponent<tk2dSprite>();
                //    var shadowSprite = ItemAPI.SpriteBuilder.SpriteFromResource(shadowSpritePath, null, false).GetComponent<tk2dSprite>();
                //    Tools.Print($"Shadow material: {shadow.renderer.material.name}");
                //    Tools.Print($"\tShadow color: {shadow.color}");
                //    Tools.Print($"\tShadow material: {shadowSprite.renderer.material.name}");
                //    Tools.Print($"\tShadow color: {shadowSprite.color}");
                //    Tools.ExportTexture(shadow.renderer.material.mainTexture.GetReadable());
                //    //Tools.ExportTexture(shadowSprite.renderer.material.mainTexture.GetReadable());

                //    shrineSprite.AttachRenderer(shadow);
                //    shadow.PlaceAtPositionByAnchor(shrineSprite.WorldBottomCenter, tk2dBaseSprite.Anchor.UpperCenter);
                //    //shadow.color = new Color(1, 1, 1, .5f);
                //    //shadow.HeightOffGround = -0.1f;
                //    //shadow.renderer.material = defaultSprite.renderer.material;
                //    DepthLookupManager.ProcessRenderer(shadow.GetComponent<Renderer>(), DepthLookupManager.GungeonSortingLayer.BACKGROUND);

                //    //Tools.LogPropertiesAndFields(defaultSprite);

                //}

                var data = shrine.AddComponent <CustomShrineController>();
                data.ID             = ID;
                data.roomStyles     = roomStyles;
                data.isBreachShrine = true;
                data.offset         = offset;
                data.pixelColliders = body.specRigidbody.PixelColliders;
                data.factory        = this;
                data.OnAccept       = OnAccept;
                data.OnDecline      = OnDecline;
                data.CanUse         = CanUse;
                data.text           = text;
                data.acceptText     = acceptText;
                data.declineText    = declineText;

                if (interactableComponent == null)
                {
                    var simpInt = shrine.AddComponent <SimpleShrine>();
                    simpInt.isToggle    = this.isToggle;
                    simpInt.OnAccept    = this.OnAccept;
                    simpInt.OnDecline   = this.OnDecline;
                    simpInt.CanUse      = CanUse;
                    simpInt.text        = this.text;
                    simpInt.acceptText  = this.acceptText;
                    simpInt.declineText = this.declineText;
                    simpInt.talkPoint   = talkPoint;
                }
                else
                {
                    shrine.AddComponent(interactableComponent);
                }


                shrine.name = ID;
                if (!isBreachShrine)
                {
                    if (!room)
                    {
                        room = RoomFactory.CreateEmptyRoom();
                    }
                    RegisterShrineRoom(shrine, room, ID, offset);
                }
                registeredShrines.Add(ID, shrine);
                FakePrefab.MarkAsFakePrefab(shrine);
                Tools.Print("Added shrine: " + ID);
                return(shrine);
            }
            catch (Exception e)
            {
                Tools.PrintException(e);
                return(null);
            }
        }
コード例 #25
0
        // Token: 0x0600009A RID: 154 RVA: 0x00008084 File Offset: 0x00006284
        public GameObject Build()
        {
            GameObject result;

            try
            {
                Texture2D  textureFromResource = ResourceExtractor.GetTextureFromResource(this.spritePath);
                GameObject gameObject          = SpriteBuilder.SpriteFromResource(this.spritePath, null);
                string     text = (this.modID + ":" + this.name).ToLower().Replace(" ", "_");
                gameObject.name = text;
                tk2dSprite component = gameObject.GetComponent <tk2dSprite>();
                component.IsPerpendicular = true;
                component.PlaceAtPositionByAnchor(this.offset, tk2dBaseSprite.Anchor.LowerCenter);
                Transform transform = new GameObject("talkpoint").transform;
                transform.position = gameObject.transform.position + this.talkPointOffset;
                transform.SetParent(gameObject.transform);
                bool flag  = !this.usesCustomColliderOffsetAndSize;
                bool flag2 = flag;
                bool flag3 = flag2;
                if (flag3)
                {
                    IntVector2 intVector = new IntVector2(textureFromResource.width, textureFromResource.height);
                    this.colliderOffset = new IntVector2(0, 0);
                    this.colliderSize   = new IntVector2(intVector.x, intVector.y / 2);
                }
                SpeculativeRigidbody speculativeRigidbody = component.SetUpSpeculativeRigidbody(this.colliderOffset, this.colliderSize);
                ShrineFactory.CustomShrineController customShrineController = gameObject.AddComponent <ShrineFactory.CustomShrineController>();
                customShrineController.ID             = text;
                customShrineController.roomStyles     = this.roomStyles;
                customShrineController.isBreachShrine = true;
                customShrineController.offset         = this.offset;
                customShrineController.pixelColliders = speculativeRigidbody.specRigidbody.PixelColliders;
                customShrineController.factory        = this;
                customShrineController.OnAccept       = this.OnAccept;
                customShrineController.OnDecline      = this.OnDecline;
                customShrineController.CanUse         = this.CanUse;
                customShrineController.text           = this.text;
                customShrineController.acceptText     = this.acceptText;
                customShrineController.declineText    = this.declineText;
                bool flag4 = this.interactableComponent == null;
                bool flag5 = flag4;
                bool flag6 = flag5;
                if (flag6)
                {
                    SimpleShrine simpleShrine = gameObject.AddComponent <SimpleShrine>();
                    simpleShrine.isToggle    = this.isToggle;
                    simpleShrine.OnAccept    = this.OnAccept;
                    simpleShrine.OnDecline   = this.OnDecline;
                    simpleShrine.CanUse      = this.CanUse;
                    simpleShrine.text        = this.text;
                    simpleShrine.acceptText  = this.acceptText;
                    simpleShrine.declineText = this.declineText;
                    simpleShrine.talkPoint   = transform;
                }
                else
                {
                    gameObject.AddComponent(this.interactableComponent);
                }
                gameObject.name = text;
                bool flag7 = !this.isBreachShrine;
                bool flag8 = flag7;
                bool flag9 = flag8;
                if (flag9)
                {
                    bool flag10 = !this.room;
                    bool flag11 = flag10;
                    bool flag12 = flag11;
                    if (flag12)
                    {
                        this.room = RoomFactory.CreateEmptyRoom(12, 12);
                    }
                    ShrineFactory.RegisterShrineRoom(gameObject, this.room, text, this.offset, this.RoomWeight);
                }
                ShrineFactory.registeredShrines.Add(text, gameObject);
                FakePrefab.MarkAsFakePrefab(gameObject);
                result = gameObject;
            }
            catch (Exception e)
            {
                Tools.PrintException(e, "FF0000");
                result = null;
            }
            return(result);
        }
コード例 #26
0
        // Token: 0x06000017 RID: 23 RVA: 0x00003680 File Offset: 0x00001880
        public GameObject Build()
        {
            GameObject result;

            try
            {
                Texture2D  textureFromResource = ResourceExtractor.GetTextureFromResource(this.spritePath);
                GameObject gameObject          = SpriteBuilder.SpriteFromResource(this.spritePath, null);
                string     text = (this.modID + ":" + this.name).ToLower().Replace(" ", "_");
                //string roomPath = this.roomPath;
                gameObject.name = text;
                tk2dSprite component = gameObject.GetComponent <tk2dSprite>();
                component.IsPerpendicular = true;
                component.PlaceAtPositionByAnchor(this.offset, tk2dBaseSprite.Anchor.LowerCenter);
                Transform transform = new GameObject("talkpoint").transform;
                transform.position = gameObject.transform.position + this.talkPointOffset;
                transform.SetParent(gameObject.transform);
                bool flag  = !this.usesCustomColliderOffsetAndSize;
                bool flag2 = flag;
                if (flag2)
                {
                    IntVector2 intVector = new IntVector2(textureFromResource.width, textureFromResource.height);
                    this.colliderOffset = new IntVector2(0, 0);
                    this.colliderSize   = new IntVector2(intVector.x, intVector.y / 2);
                }
                SpeculativeRigidbody speculativeRigidbody = component.SetUpSpeculativeRigidbody(this.colliderOffset, this.colliderSize);

                speculativeRigidbody.PixelColliders.Add(new PixelCollider
                {
                    ColliderGenerationMode = PixelCollider.PixelColliderGeneration.Manual,
                    CollisionLayer         = CollisionLayer.PlayerBlocker,
                    IsTrigger = false,
                    BagleUseFirstFrameOnly = false,
                    SpecifyBagelFrame      = string.Empty,
                    BagelColliderNumber    = 0,
                    ManualOffsetX          = this.colliderOffset.x,
                    ManualOffsetY          = this.colliderOffset.y,
                    ManualWidth            = this.colliderSize.x,
                    ManualHeight           = this.colliderSize.y,
                    ManualDiameter         = 0,
                    ManualLeftX            = 0,
                    ManualLeftY            = 0,
                    ManualRightX           = 0,
                    ManualRightY           = 0,
                });
                speculativeRigidbody.PixelColliders.Add(new PixelCollider
                {
                    ColliderGenerationMode = PixelCollider.PixelColliderGeneration.Manual,
                    CollisionLayer         = CollisionLayer.EnemyBlocker,
                    IsTrigger = false,
                    BagleUseFirstFrameOnly = false,
                    SpecifyBagelFrame      = string.Empty,
                    BagelColliderNumber    = 0,
                    ManualOffsetX          = this.colliderOffset.x,
                    ManualOffsetY          = this.colliderOffset.y,
                    ManualWidth            = this.colliderSize.x,
                    ManualHeight           = this.colliderSize.y,
                    ManualDiameter         = 0,
                    ManualLeftX            = 0,
                    ManualLeftY            = 0,
                    ManualRightX           = 0,
                    ManualRightY           = 0,
                });
                speculativeRigidbody.PixelColliders.Add(new PixelCollider
                {
                    ColliderGenerationMode = PixelCollider.PixelColliderGeneration.Manual,
                    CollisionLayer         = CollisionLayer.BulletBlocker,
                    IsTrigger = false,
                    BagleUseFirstFrameOnly = false,
                    SpecifyBagelFrame      = string.Empty,
                    BagelColliderNumber    = 0,
                    ManualOffsetX          = this.colliderOffset.x,
                    ManualOffsetY          = this.colliderOffset.y,
                    ManualWidth            = this.colliderSize.x,
                    ManualHeight           = this.colliderSize.y,
                    ManualDiameter         = 0,
                    ManualLeftX            = 0,
                    ManualLeftY            = 0,
                    ManualRightX           = 0,
                    ManualRightY           = 0,
                });
                speculativeRigidbody.PixelColliders.Add(new PixelCollider
                {
                    ColliderGenerationMode = PixelCollider.PixelColliderGeneration.Manual,
                    CollisionLayer         = CollisionLayer.EnemyBulletBlocker,
                    IsTrigger = false,
                    BagleUseFirstFrameOnly = false,
                    SpecifyBagelFrame      = string.Empty,
                    BagelColliderNumber    = 0,
                    ManualOffsetX          = this.colliderOffset.x,
                    ManualOffsetY          = this.colliderOffset.y,
                    ManualWidth            = this.colliderSize.x,
                    ManualHeight           = this.colliderSize.y,
                    ManualDiameter         = 0,
                    ManualLeftX            = 0,
                    ManualLeftY            = 0,
                    ManualRightX           = 0,
                    ManualRightY           = 0,
                });
                speculativeRigidbody.PixelColliders.Add(new PixelCollider
                {
                    ColliderGenerationMode = PixelCollider.PixelColliderGeneration.Manual,
                    CollisionLayer         = CollisionLayer.BeamBlocker,
                    IsTrigger = false,
                    BagleUseFirstFrameOnly = false,
                    SpecifyBagelFrame      = string.Empty,
                    BagelColliderNumber    = 0,
                    ManualOffsetX          = this.colliderOffset.x,
                    ManualOffsetY          = this.colliderOffset.y,
                    ManualWidth            = this.colliderSize.x,
                    ManualHeight           = this.colliderSize.y,
                    ManualDiameter         = 0,
                    ManualLeftX            = 0,
                    ManualLeftY            = 0,
                    ManualRightX           = 0,
                    ManualRightY           = 0,
                });

                OldShrineFactory.CustomShrineController customShrineController = gameObject.AddComponent <OldShrineFactory.CustomShrineController>();
                customShrineController.ID             = text;
                customShrineController.roomStyles     = this.roomStyles;
                customShrineController.isBreachShrine = true;
                customShrineController.offset         = this.offset;
                customShrineController.pixelColliders = speculativeRigidbody.specRigidbody.PixelColliders;
                customShrineController.factory        = this;
                customShrineController.OnAccept       = this.OnAccept;
                customShrineController.OnDecline      = this.OnDecline;
                customShrineController.CanUse         = this.CanUse;
                bool flag3 = this.interactableComponent != null;
                bool flag4 = flag3;
                IPlayerInteractable item;
                if (flag4)
                {
                    item = (gameObject.AddComponent(this.interactableComponent) as IPlayerInteractable);
                }
                else
                {
                    SimpleShrine simpleShrine = gameObject.AddComponent <SimpleShrine>();
                    simpleShrine.isToggle    = this.isToggle;
                    simpleShrine.OnAccept    = this.OnAccept;
                    simpleShrine.OnDecline   = this.OnDecline;
                    simpleShrine.CanUse      = this.CanUse;
                    simpleShrine.text        = this.text;
                    simpleShrine.acceptText  = this.acceptText;
                    simpleShrine.declineText = this.declineText;
                    simpleShrine.talkPoint   = transform;
                    item = simpleShrine;
                }
                GameObject gameObject2 = ShrineFakePrefab.Clone(gameObject);
                gameObject2.GetComponent <OldShrineFactory.CustomShrineController>().Copy(customShrineController);
                gameObject2.name = text;
                bool flag5 = this.isBreachShrine;
                bool flag6 = flag5;
                if (flag6)
                {
                    bool flag7 = !RoomHandler.unassignedInteractableObjects.Contains(item);
                    bool flag8 = flag7;
                    if (flag8)
                    {
                        RoomHandler.unassignedInteractableObjects.Add(item);
                    }
                }
                else
                {
                    bool flag9  = !this.room;
                    bool flag10 = flag9;
                    if (flag10)
                    {
                        this.room = RoomFactory.CreateEmptyRoom(12, 12);
                    }
                    OldShrineFactory.RegisterShrineRoom(gameObject2, this.room, text, this.offset, this.RoomWeight);
                }
                OldShrineFactory.builtShrines.Add(text, gameObject2);
                result = gameObject;
            }
            catch (Exception e)
            {
                Tools.PrintException(e, "FF0000");
                result = null;
            }
            return(result);
        }