Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Reflection;
- using System.Text;
- using System.Threading.Tasks;
- using TombsMadnessMod.ItemScript;
- using TombsMadnessMod.Tags;
- using Unity.Netcode;
- using UnityEngine;
- namespace TombsMadnessMod.Component
- {
- public class AssetLoader : MonoBehaviour
- {
- public StartOfRound SoR;
- public Dictionary<string, UnityEngine.Object> assetsDictionary = new Dictionary<string, UnityEngine.Object>();
- public void Awake()
- {
- var bundle = AssetBundle.LoadFromMemory(TombsMadnessMod.Properties.Resources.tombsmadnessmodbundle);
- foreach (var assetName in bundle.GetAllAssetNames())
- {
- GameObject asset = bundle.LoadAsset<GameObject>(assetName);
- if (asset != null)
- {
- assetsDictionary[assetName] = asset;
- if(asset.GetComponent<ShopItem>() is ShopItem i && i != null)
- {
- LethalLib.Modules.Items.RegisterShopItem(i.itemRef, null, null, null, i.cost);
- Destroy(i);
- }
- if (asset.GetComponent<ShipItem>() is ShipItem u && u != null)
- {
- LethalLib.Modules.Unlockables.RegisterUnlockable(u.unlockableRef, u.cost);
- }
- if (asset.GetComponent<NetworkObject>() is NetworkObject obj && obj != null)
- {
- LethalLib.Modules.NetworkPrefabs.RegisterNetworkPrefab(asset);
- }
- }
- }
- foreach (KeyValuePair<string, UnityEngine.Object> kvp in assetsDictionary)
- {
- TombsMadnessModBase.mls.LogFatal($"Key = {kvp.Key}, Value = {kvp.Value}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment