调整部分数据表配置,优化 SpriteCache 功能

This commit is contained in:
2026-09-13 20:36:21 +08:00
parent de53890de6
commit 7dc529a840
520 changed files with 24231 additions and 967 deletions
@@ -5,7 +5,6 @@ using Cysharp.Threading.Tasks;
using SepCore.CustomUtility;
using SepCore.Definition;
using SepCore.Entity;
using SepCore.Entity.Weapon;
using UnityGameFramework.Runtime;
using HideEntityCompleteEventArgs = UnityGameFramework.Runtime.HideEntityCompleteEventArgs;
using ShowEntityFailureEventArgs = UnityGameFramework.Runtime.ShowEntityFailureEventArgs;
@@ -162,22 +161,11 @@ namespace SepCore.AsyncTask
float timeout = 30f,
CancellationToken cancellationToken = default)
{
if (data == null)
{
Log.Warning("Enemy data is invalid.");
return UniTask.FromResult<EnemyBase>(null);
}
Type enemyType = TryGetType(data.EnemyType.ToString());
Type enemyType = GetLogicType(data.LogicType);
EntityConfig entityConfig = GameEntry.Luban.Get<EntityConfig>(data.AssetName);
if (enemyType == null || entityConfig == null)
{
Log.Warning("Can not load enemy logic type or entity config for assetName '{0}'.", data.AssetName);
return UniTask.FromResult<EnemyBase>(null);
}
return entityComponent
.ShowEntityAsync(data.Id, enemyType, AssetUtility.GetEntityAsset(entityConfig.PrefabPath), "Enemy",
return entityComponent.ShowEntityAsync(
data.Id, enemyType, AssetUtility.GetEntityAsset(entityConfig.PrefabPath), "Enemy",
Constant.AssetPriority.EnemyAsset, data, timeout, cancellationToken)
.ContinueWith(entity => entity?.Logic as EnemyBase);
}
@@ -190,22 +178,11 @@ namespace SepCore.AsyncTask
float timeout = 30f,
CancellationToken cancellationToken = default)
{
if (data == null)
{
Log.Warning("Weapon data is invalid.");
return UniTask.FromResult<WeaponBase>(null);
}
Type weaponType = TryGetType("Weapon." + data.WeaponType);
Type weaponType = GetLogicType(data.LogicType);
EntityConfig entityConfig = GameEntry.Luban.Get<EntityConfig>(data.AssetName);
if (weaponType == null || entityConfig == null)
{
Log.Warning("Can not load weapon logic type or entity config for assetName '{0}'.", data.AssetName);
return UniTask.FromResult<WeaponBase>(null);
}
return entityComponent
.ShowEntityAsync(data.Id, weaponType, AssetUtility.GetEntityAsset(entityConfig.PrefabPath), "Weapon",
return entityComponent.ShowEntityAsync(
data.Id, weaponType, AssetUtility.GetEntityAsset(entityConfig.PrefabPath), "Weapon",
Constant.AssetPriority.WeaponAsset, data, timeout, cancellationToken)
.ContinueWith(entity => entity?.Logic as WeaponBase);
}
@@ -298,24 +275,13 @@ namespace SepCore.AsyncTask
float timeout,
CancellationToken cancellationToken) where T : EntityLogic
{
if (data == null)
{
Log.Warning("Data is invalid.");
return UniTask.FromResult<T>(null);
}
EntityConfig entityConfig = GameEntry.Luban.Get<EntityConfig>(data.AssetName);
if (entityConfig == null)
{
Log.Warning("Can not load entity assetName '{0}' from data table.", data.AssetName);
return UniTask.FromResult<T>(null);
}
return entityComponent.ShowEntityAsync<T>(data.Id, AssetUtility.GetEntityAsset(entityConfig.PrefabPath),
entityGroupName, priority, data, timeout, cancellationToken);
}
private static Type TryGetType(string rawTypeName)
private static Type GetLogicType(string rawTypeName)
{
string typeName = EntityNamespace + rawTypeName;
if (!_typeDict.TryGetValue(typeName, out Type type))
@@ -323,8 +289,7 @@ namespace SepCore.AsyncTask
type = Type.GetType(typeName);
if (type == null)
{
Log.Warning("Can not load entity type '{0}'.", typeName);
return null;
throw new InvalidOperationException($"Can not load entity type '{typeName}'.");
}
_typeDict.Add(typeName, type);