using UnityEngine;
|
using System;
|
|
#if UNITY_EDITOR
|
using UnityEditor;
|
#endif
|
|
public class ScriptableObjectLoader
|
{
|
|
// public const string bundleName = "config/scriptableobjects";
|
// public const string SoActor_Suffix = "SoActor_";
|
// public const string SoSkill_Suffix = "SoSkill_";
|
// public const string SoFlyObject_Suffix = "SoFlyObject_";
|
// public const string SoBodyControl_Suffix = "SoBodyControl_";
|
// public const string SoSweepHit_Suffix = "SoSweepHit_";
|
// public const string SoCameraSFX_Suffix = "SoCameraSFX_";
|
// public const string SoDeadFly_Suffix = "SoDeadFly_";
|
// public const string SoGhostShadow_Suffix = "SoGhostShadow_";
|
// public const string SoNewBieGuide_Suffix = "NewBieGuideStep_";
|
// public const string SoFunctionalGuide_Suffix = "FunctionalGuideStep_";
|
// public const string SoMapObjectGenerate_Suffix = "SoMapObjectGenerate_";
|
// public const string SoTreasureMeridian_Suffix = "SoTreasureMeridian_";
|
// public const string SoTreasure3D_Suffix = "SoTreasure3D_";
|
// public const string SoDemonDungeon_Suffix = "SoDemonDungeon_";
|
// public const string SoHazyMapNpc_Suffix = "SoHazyMapNpc_";
|
|
// public static SoMap LoadSoMapObjectGenerate(int mapID)
|
// {
|
// SoMap _config = null;
|
// if (AssetSource.refdataFromEditor)
|
// {
|
// #if UNITY_EDITOR
|
// string _resourcePath = StringUtility.Contact(ResourcesPath.ResourcesOutAssetPath,
|
// "Refdata/ScriptableObject/SoMapObjectGenerate/",
|
// SoMapObjectGenerate_Suffix,
|
// mapID,
|
// ".asset");
|
|
// _config = AssetDatabase.LoadAssetAtPath<SoMap>(_resourcePath);
|
// #endif
|
// }
|
// else
|
// {
|
// string _assetName = StringUtility.Contact(SoMapObjectGenerate_Suffix, mapID);
|
// AssetInfo _assetInfo = new AssetInfo(bundleName, _assetName);
|
// _config = AssetBundleUtility.Instance.Sync_LoadAsset(_assetInfo) as SoMap;
|
// }
|
|
// if (_config == null)
|
// {
|
// DebugEx.LogErrorFormat("ScriptableObjectLoader.LoadSoActor() => 加载不到资源: {0}.", mapID);
|
// }
|
|
// return _config;
|
|
// }
|
|
// public static SoActor LoadSoActor(int raceId)
|
// {
|
// SoActor _config = null;
|
// if (AssetSource.refdataFromEditor)
|
// {
|
// #if UNITY_EDITOR
|
// string _resourcePath = StringUtility.Contact(ResourcesPath.ResourcesOutAssetPath,
|
// "Refdata/ScriptableObject/SoActor/",
|
// SoActor_Suffix,
|
// raceId,
|
// ".asset");
|
|
// _config = AssetDatabase.LoadAssetAtPath<SoActor>(_resourcePath);
|
// #endif
|
// }
|
// else
|
// {
|
// string _assetName = StringUtility.Contact(SoActor_Suffix, raceId);
|
// AssetInfo _assetInfo = new AssetInfo(bundleName, _assetName);
|
|
// _config = AssetBundleUtility.Instance.Sync_LoadAsset(_assetInfo) as SoActor;
|
// }
|
|
// if (_config == null)
|
// {
|
// DebugEx.LogErrorFormat("ScriptableObjectLoader.LoadSoActor() => 加载不到资源: {0}.", raceId);
|
// }
|
|
// return _config;
|
|
// }
|
|
// public static SoSkill LoadSoSkill(int skillId)
|
// {
|
// SoSkill _config = null;
|
|
// if (AssetSource.refdataFromEditor)
|
// {
|
// #if UNITY_EDITOR
|
// string _resourcePath = StringUtility.Contact(ResourcesPath.ResourcesOutAssetPath,
|
// "Refdata/ScriptableObject/SoSkill/",
|
// SoSkill_Suffix,
|
// skillId,
|
// ".asset");
|
|
// _config = AssetDatabase.LoadAssetAtPath<SoSkill>(_resourcePath);
|
// #endif
|
// }
|
// else
|
// {
|
// string _assetName = StringUtility.Contact(SoSkill_Suffix, skillId);
|
// AssetInfo _assetInfo = new AssetInfo(bundleName, _assetName);
|
|
// _config = AssetBundleUtility.Instance.Sync_LoadAsset(_assetInfo) as SoSkill;
|
// }
|
|
// if (_config == null)
|
// {
|
// //Debug.LogErrorFormat("ScriptableObjectLoader.LoadSoSkill() => 加载不到资源: {0}.", skillId);
|
// }
|
|
// return _config;
|
|
// }
|
|
// public static SoFlyObject LoadSoFlyObject(int id)
|
// {
|
// SoFlyObject _config = null;
|
// if (AssetSource.refdataFromEditor)
|
// {
|
// #if UNITY_EDITOR
|
// string _resourcePath = StringUtility.Contact(ResourcesPath.ResourcesOutAssetPath,
|
// "Refdata/ScriptableObject/SoFlyObject/",
|
// SoFlyObject_Suffix,
|
// id,
|
// ".asset");
|
|
// _config = AssetDatabase.LoadAssetAtPath<SoFlyObject>(_resourcePath);
|
// #endif
|
// }
|
// else
|
// {
|
// string _assetName = StringUtility.Contact(SoFlyObject_Suffix, id);
|
// AssetInfo _assetInfo = new AssetInfo(bundleName, _assetName);
|
|
// _config = AssetBundleUtility.Instance.Sync_LoadAsset(_assetInfo) as SoFlyObject;
|
// }
|
|
// if (_config == null)
|
// {
|
// Debug.LogErrorFormat("ScriptableObjectLoader.LoadSoFlyObject() => 加载不到资源: {0}.", id);
|
// }
|
|
// return _config;
|
|
// }
|
|
// public static SoSweepHit LoadSoSweepHit(int id)
|
// {
|
// SoSweepHit _config = null;
|
// if (AssetSource.refdataFromEditor)
|
// {
|
// #if UNITY_EDITOR
|
// string _resourcePath = StringUtility.Contact(ResourcesPath.ResourcesOutAssetPath,
|
// "Refdata/ScriptableObject/SoSweepHit/",
|
// SoSweepHit_Suffix,
|
// id,
|
// ".asset");
|
|
// _config = AssetDatabase.LoadAssetAtPath<SoSweepHit>(_resourcePath);
|
// #endif
|
// }
|
// else
|
// {
|
// string _assetName = StringUtility.Contact(SoSweepHit_Suffix, id);
|
// AssetInfo _assetInfo = new AssetInfo(bundleName, _assetName);
|
|
// _config = AssetBundleUtility.Instance.Sync_LoadAsset(_assetInfo) as SoSweepHit;
|
// }
|
|
// if (_config == null)
|
// {
|
// Debug.LogErrorFormat("ScriptableObjectLoader.LoadSoSweepHit() => 加载不到资源: {0}.", id);
|
// }
|
|
// return _config;
|
|
// }
|
|
// public static SoBodyControl LoadSoBodyControl(int id)
|
// {
|
// SoBodyControl _config = null;
|
// if (AssetSource.refdataFromEditor)
|
// {
|
// #if UNITY_EDITOR
|
|
// string _resourcePath = StringUtility.Contact(ResourcesPath.ResourcesOutAssetPath,
|
// "Refdata/ScriptableObject/SoBodyControl/",
|
// SoBodyControl_Suffix,
|
// id,
|
// ".asset");
|
|
// _config = AssetDatabase.LoadAssetAtPath<SoBodyControl>(_resourcePath);
|
// #endif
|
// }
|
// else
|
// {
|
// string _assetName = StringUtility.Contact(SoBodyControl_Suffix, id);
|
// AssetInfo _assetInfo = new AssetInfo(bundleName, _assetName);
|
// _config = AssetBundleUtility.Instance.Sync_LoadAsset(_assetInfo) as SoBodyControl;
|
// }
|
|
// if (_config == null)
|
// {
|
// Debug.LogErrorFormat("ScriptableObjectLoader.LoadSoBodyControl() => 加载不到资源: {0}.", id);
|
// }
|
|
// return _config;
|
// }
|
|
// public static SoCameraSFX LoadSoCameraSFX(int id)
|
// {
|
// SoCameraSFX _config = null;
|
// if (AssetSource.refdataFromEditor)
|
// {
|
// #if UNITY_EDITOR
|
|
// string _resourcePath = StringUtility.Contact(ResourcesPath.ResourcesOutAssetPath,
|
// "Refdata/ScriptableObject/SoCameraSFX/",
|
// SoCameraSFX_Suffix,
|
// id,
|
// ".asset");
|
|
// _config = AssetDatabase.LoadAssetAtPath<SoCameraSFX>(_resourcePath);
|
// #endif
|
// }
|
// else
|
// {
|
// string _assetName = StringUtility.Contact(SoCameraSFX_Suffix, id);
|
// AssetInfo _assetInfo = new AssetInfo(bundleName, _assetName);
|
|
// _config = AssetBundleUtility.Instance.Sync_LoadAsset(_assetInfo) as SoCameraSFX;
|
// }
|
|
// if (_config == null)
|
// {
|
// Debug.LogErrorFormat("ScriptableObjectLoader.LoadSoCameraSFX() => 加载不到资源: {0}.", id);
|
// }
|
|
// return _config;
|
// }
|
|
// public static SoDeadFly LoadSoDeadFly(int id)
|
// {
|
// SoDeadFly _config = null;
|
// if (AssetSource.refdataFromEditor)
|
// {
|
// #if UNITY_EDITOR
|
// string _resourcePath = StringUtility.Contact(ResourcesPath.ResourcesOutAssetPath,
|
// "Refdata/ScriptableObject/SoDeadFly/",
|
// SoDeadFly_Suffix,
|
// id,
|
// ".asset");
|
|
// _config = AssetDatabase.LoadAssetAtPath<SoDeadFly>(_resourcePath);
|
// #endif
|
// }
|
// else
|
// {
|
// string _assetName = StringUtility.Contact(SoDeadFly_Suffix, id);
|
// AssetInfo _assetInfo = new AssetInfo(bundleName, _assetName);
|
// _config = AssetBundleUtility.Instance.Sync_LoadAsset(_assetInfo) as SoDeadFly;
|
// }
|
|
// if (_config == null)
|
// {
|
// Debug.LogErrorFormat("ScriptableObjectLoader.LoadSoCameraSFX() => 加载不到资源: {0}.", id);
|
// }
|
|
// return _config;
|
|
// }
|
|
// public static SoGhostShadow LoadSoGhostShadow(int id)
|
// {
|
// SoGhostShadow _config = null;
|
// if (AssetSource.refdataFromEditor)
|
// {
|
// #if UNITY_EDITOR
|
// string _resourcePath = StringUtility.Contact(ResourcesPath.ResourcesOutAssetPath,
|
// "Refdata/ScriptableObject/SoGhostShadow/",
|
// SoGhostShadow_Suffix,
|
// id,
|
// ".asset");
|
|
// _config = AssetDatabase.LoadAssetAtPath<SoGhostShadow>(_resourcePath);
|
// #endif
|
// }
|
// else
|
// {
|
// string _assetName = StringUtility.Contact(SoGhostShadow_Suffix, id);
|
// AssetInfo _assetInfo = new AssetInfo(bundleName, _assetName);
|
// _config = AssetBundleUtility.Instance.Sync_LoadAsset(_assetInfo) as SoGhostShadow;
|
// }
|
|
// if (_config == null)
|
// {
|
// Debug.LogErrorFormat("ScriptableObjectLoader.LoadSoGhostShadow() => 加载不到资源: {0}.", id);
|
// }
|
|
// return _config;
|
// }
|
|
// public static NewBieGuideScriptableObject LoadSoNewBieGuideStep(int _id)
|
// {
|
// NewBieGuideScriptableObject config = null;
|
// if (AssetSource.refdataFromEditor)
|
// {
|
// #if UNITY_EDITOR
|
// var resourcePath = StringUtility.Contact(ResourcesPath.ResourcesOutAssetPath,
|
// "Refdata/ScriptableObject/SoNewBieGuide/",
|
// SoNewBieGuide_Suffix,
|
// _id,
|
// ".asset");
|
|
// config = AssetDatabase.LoadAssetAtPath<NewBieGuideScriptableObject>(resourcePath);
|
// #endif
|
// }
|
// else
|
// {
|
// var assetName = StringUtility.Contact(SoNewBieGuide_Suffix, _id);
|
// var assetInfo = new AssetInfo(bundleName, assetName);
|
// config = AssetBundleUtility.Instance.Sync_LoadAsset(assetInfo) as NewBieGuideScriptableObject;
|
// }
|
|
// if (config == null)
|
// {
|
// Debug.LogErrorFormat("ScriptableObjectLoader.LoadSoNewBieGuideStep() => 加载不到资源: {0}.", _id);
|
// }
|
|
// return config;
|
// }
|
|
// public static NewBieGuideScriptableObject LoadSoFunctionalGuideStep(int _id)
|
// {
|
// NewBieGuideScriptableObject config = null;
|
// if (AssetSource.refdataFromEditor)
|
// {
|
// #if UNITY_EDITOR
|
// var resourcePath = StringUtility.Contact(ResourcesPath.ResourcesOutAssetPath,
|
// "Refdata/ScriptableObject/SoNewBieGuide/",
|
// SoFunctionalGuide_Suffix,
|
// _id,
|
// ".asset");
|
|
// config = AssetDatabase.LoadAssetAtPath<NewBieGuideScriptableObject>(resourcePath);
|
// #endif
|
// }
|
// else
|
// {
|
// var assetName = StringUtility.Contact(SoFunctionalGuide_Suffix, _id);
|
// var assetInfo = new AssetInfo(bundleName, assetName);
|
// config = AssetBundleUtility.Instance.Sync_LoadAsset(assetInfo) as NewBieGuideScriptableObject;
|
// }
|
|
// if (config == null)
|
// {
|
// Debug.LogErrorFormat("ScriptableObjectLoader.LoadSoFunctionalGuideStep() => 加载不到资源: {0}.", _id);
|
// }
|
|
// return config;
|
// }
|
|
// public static TreasureMeridianConfig LoadSoTreasureMeridian(int _id)
|
// {
|
// TreasureMeridianConfig config = null;
|
// if (AssetSource.refdataFromEditor)
|
// {
|
// #if UNITY_EDITOR
|
// var resourcePath = StringUtility.Contact(ResourcesPath.ResourcesOutAssetPath,
|
// "Refdata/ScriptableObject/SoTreasureMeridian/",
|
// SoTreasureMeridian_Suffix,
|
// _id,
|
// ".asset");
|
|
// config = AssetDatabase.LoadAssetAtPath<TreasureMeridianConfig>(resourcePath);
|
// #endif
|
// }
|
// else
|
// {
|
// var assetName = StringUtility.Contact(SoTreasureMeridian_Suffix, _id);
|
// var assetInfo = new AssetInfo(bundleName, assetName);
|
// config = AssetBundleUtility.Instance.Sync_LoadAsset(assetInfo) as TreasureMeridianConfig;
|
// }
|
|
// if (config == null)
|
// {
|
// Debug.LogErrorFormat("ScriptableObjectLoader.TreasureMeridianConfig() => 加载不到资源: {0}.", _id);
|
// }
|
|
// return config;
|
// }
|
|
// public static Treasure3DConfig LoadSoTreasure3DConfig(int _id)
|
// {
|
// Treasure3DConfig config = null;
|
// if (AssetSource.refdataFromEditor)
|
// {
|
// #if UNITY_EDITOR
|
// var resourcePath = StringUtility.Contact(ResourcesPath.ResourcesOutAssetPath,
|
// "Refdata/ScriptableObject/SoTreasure3D/",
|
// SoTreasure3D_Suffix,
|
// _id,
|
// ".asset");
|
|
// config = AssetDatabase.LoadAssetAtPath<Treasure3DConfig>(resourcePath);
|
// #endif
|
// }
|
// else
|
// {
|
// var assetName = StringUtility.Contact(SoTreasure3D_Suffix, _id);
|
// var assetInfo = new AssetInfo(bundleName, assetName);
|
// config = AssetBundleUtility.Instance.Sync_LoadAsset(assetInfo) as Treasure3DConfig;
|
// }
|
|
// if (config == null)
|
// {
|
// //Debug.LogErrorFormat("ScriptableObjectLoader.TreasureMeridianConfig() => 加载不到资源: {0}.", _id);
|
// }
|
|
// return config;
|
// }
|
|
// public static DemonDungeonScriptable LoadSoDemonDungeon(int _id)
|
// {
|
// DemonDungeonScriptable config = null;
|
// if (AssetSource.refdataFromEditor)
|
// {
|
// #if UNITY_EDITOR
|
// var resourcePath = StringUtility.Contact(ResourcesPath.ResourcesOutAssetPath,
|
// "Refdata/ScriptableObject/SoDemonDungeon/",
|
// SoDemonDungeon_Suffix,
|
// _id,
|
// ".asset");
|
|
// config = AssetDatabase.LoadAssetAtPath<DemonDungeonScriptable>(resourcePath);
|
// #endif
|
// }
|
// else
|
// {
|
// var assetName = StringUtility.Contact(SoDemonDungeon_Suffix, _id);
|
// var assetInfo = new AssetInfo(bundleName, assetName);
|
// config = AssetBundleUtility.Instance.Sync_LoadAsset(assetInfo) as DemonDungeonScriptable;
|
// }
|
|
// if (config == null)
|
// {
|
// //Debug.LogErrorFormat("ScriptableObjectLoader.TreasureMeridianConfig() => 加载不到资源: {0}.", _id);
|
// }
|
|
// return config;
|
// }
|
|
// public static HazyMapNpcScriptableObject LoadSoHazyMapNpc(int _mapId)
|
// {
|
// HazyMapNpcScriptableObject config = null;
|
// if (AssetSource.refdataFromEditor)
|
// {
|
// #if UNITY_EDITOR
|
// var resourcePath = StringUtility.Contact(ResourcesPath.ResourcesOutAssetPath,
|
// "Refdata/ScriptableObject/SoHazyMapNpc/",
|
// SoHazyMapNpc_Suffix,
|
// _mapId,
|
// ".asset");
|
|
// config = AssetDatabase.LoadAssetAtPath<HazyMapNpcScriptableObject>(resourcePath);
|
// #endif
|
// }
|
// else
|
// {
|
// var assetName = StringUtility.Contact(SoHazyMapNpc_Suffix, _mapId);
|
// var assetInfo = new AssetInfo(bundleName, assetName);
|
// config = AssetBundleUtility.Instance.Sync_LoadAsset(assetInfo) as HazyMapNpcScriptableObject;
|
// }
|
|
// if (config == null)
|
// {
|
// }
|
|
// return config;
|
// }
|
}
|