Beispiel #1
0
        public static PrototypeDungeonRoom RoomFromAssetName(string name)
        {
            if (string.IsNullOrEmpty(name))
            {
                return(null);
            }

            string asset = name;

            if (name.Contains('/'))
            {
                asset = name.Substring(name.LastIndexOf('/') + 1).Replace(".asset", "").Trim();
            }

            var room = StaticReferences.GetAsset <PrototypeDungeonRoom>(asset); //check both assetbundles

            return(room);
        }
Beispiel #2
0
        // Token: 0x06000059 RID: 89 RVA: 0x00005954 File Offset: 0x00003B54
        public static PrototypeDungeonRoom RoomFromAssetName(string name)
        {
            bool flag = string.IsNullOrEmpty(name);
            PrototypeDungeonRoom result;

            if (flag)
            {
                result = null;
            }
            else
            {
                string assetName = name;
                bool   flag2     = name.Contains('/');
                if (flag2)
                {
                    assetName = name.Substring(name.LastIndexOf('/') + 1).Replace(".asset", "").Trim();
                }
                PrototypeDungeonRoom asset = StaticReferences.GetAsset <PrototypeDungeonRoom>(assetName);
                result = asset;
            }
            return(result);
        }
 // 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);
 }