using System; using System.Collections.Generic; using System.Linq; using EntityStates; using RoR2.Skills; using UnityEngine; namespace RoR2.ContentManagement; [CreateAssetMenu(menuName = "RoR2/SerializableContentPack")] public class SerializableContentPack : ScriptableObject { public GameObject[] bodyPrefabs = Array.Empty(); public GameObject[] masterPrefabs = Array.Empty(); public GameObject[] projectilePrefabs = Array.Empty(); public GameObject[] gameModePrefabs = Array.Empty(); public GameObject[] networkedObjectPrefabs = Array.Empty(); public SkillDef[] skillDefs = Array.Empty(); public SkillFamily[] skillFamilies = Array.Empty(); public SceneDef[] sceneDefs = Array.Empty(); public ItemDef[] itemDefs = Array.Empty(); public EquipmentDef[] equipmentDefs = Array.Empty(); public BuffDef[] buffDefs = Array.Empty(); public EliteDef[] eliteDefs = Array.Empty(); public UnlockableDef[] unlockableDefs = Array.Empty(); public SurvivorDef[] survivorDefs = Array.Empty(); public ArtifactDef[] artifactDefs = Array.Empty(); public GameObject[] effectDefs = Array.Empty(); public SurfaceDef[] surfaceDefs = Array.Empty(); public NetworkSoundEventDef[] networkSoundEventDefs = Array.Empty(); public MusicTrackDef[] musicTrackDefs = Array.Empty(); public GameEndingDef[] gameEndingDefs = Array.Empty(); public EntityStateConfiguration[] entityStateConfigurations = Array.Empty(); public SerializableEntityStateType[] entityStateTypes = Array.Empty(); public ContentPack CreateV1_1_1_4_ContentPack() { ContentPack contentPack = new ContentPack(); contentPack.bodyPrefabs.Add(bodyPrefabs); contentPack.masterPrefabs.Add(masterPrefabs); contentPack.projectilePrefabs.Add(projectilePrefabs); contentPack.gameModePrefabs.Add(gameModePrefabs); contentPack.networkedObjectPrefabs.Add(networkedObjectPrefabs); contentPack.skillDefs.Add(skillDefs); contentPack.skillFamilies.Add(skillFamilies); contentPack.sceneDefs.Add(sceneDefs); contentPack.itemDefs.Add(itemDefs); contentPack.equipmentDefs.Add(equipmentDefs); contentPack.buffDefs.Add(buffDefs); contentPack.eliteDefs.Add(eliteDefs); contentPack.unlockableDefs.Add(unlockableDefs); contentPack.survivorDefs.Add(survivorDefs); contentPack.artifactDefs.Add(artifactDefs); contentPack.effectDefs.Add(effectDefs.Select((GameObject asset) => new EffectDef(asset)).ToArray()); contentPack.surfaceDefs.Add(surfaceDefs); contentPack.networkSoundEventDefs.Add(networkSoundEventDefs); contentPack.musicTrackDefs.Add(musicTrackDefs); contentPack.gameEndingDefs.Add(gameEndingDefs); contentPack.entityStateConfigurations.Add(entityStateConfigurations); List list = new List(); for (int i = 0; i < entityStateTypes.Length; i++) { Type stateType = entityStateTypes[i].stateType; if (stateType != null) { list.Add(stateType); continue; } Debug.LogWarning("SerializableContentPack \"" + base.name + "\" could not resolve type with name \"" + entityStateTypes[i].typeName + "\". The type will not be available in the content pack."); } contentPack.entityStateTypes.Add(list.ToArray()); return contentPack; } public virtual ContentPack CreateContentPack() { return CreateV1_1_1_4_ContentPack(); } }