feat: Introduce new services and refactor existing code for better structure

- Added ISpriteCacheService, IStaticDataService, and ITextService interfaces for improved service management.
- Implemented RunContracts for managing run states and node execution contexts.
- Created EnemyTagStatusRuntime to handle enemy status effects and their application.
- Refactored ShopPriceRuleService to utilize static data service for shop prices.
- Enhanced InventoryTowerEnduranceUtility to manage tower endurance reduction.
- Updated EventFormUseCase to work with new EventOptionExecutionContext.
- Removed unused dictionary loading code from ProcedurePreload.
- Cleaned up various utility classes and ensured consistent naming conventions.
- Updated tests to reflect changes in context and service usage.
This commit is contained in:
2026-05-13 22:18:47 +08:00
parent 9fc0ef2216
commit 7106e0adbe
45 changed files with 590 additions and 426 deletions
@@ -50,8 +50,6 @@ namespace GeometryTD.Procedure
GameEntry.Event.Subscribe(LoadConfigFailureEventArgs.EventId, OnLoadConfigFailure);
GameEntry.Event.Subscribe(LoadDataTableSuccessEventArgs.EventId, OnLoadDataTableSuccess);
GameEntry.Event.Subscribe(LoadDataTableFailureEventArgs.EventId, OnLoadDataTableFailure);
GameEntry.Event.Subscribe(LoadDictionarySuccessEventArgs.EventId, OnLoadDictionarySuccess);
GameEntry.Event.Subscribe(LoadDictionaryFailureEventArgs.EventId, OnLoadDictionaryFailure);
_loadedFlag.Clear();
@@ -64,8 +62,6 @@ namespace GeometryTD.Procedure
GameEntry.Event.Unsubscribe(LoadConfigFailureEventArgs.EventId, OnLoadConfigFailure);
GameEntry.Event.Unsubscribe(LoadDataTableSuccessEventArgs.EventId, OnLoadDataTableSuccess);
GameEntry.Event.Unsubscribe(LoadDataTableFailureEventArgs.EventId, OnLoadDataTableFailure);
GameEntry.Event.Unsubscribe(LoadDictionarySuccessEventArgs.EventId, OnLoadDictionarySuccess);
GameEntry.Event.Unsubscribe(LoadDictionaryFailureEventArgs.EventId, OnLoadDictionaryFailure);
base.OnLeave(procedureOwner, isShutdown);
}
@@ -97,9 +93,6 @@ namespace GeometryTD.Procedure
LoadDataTable(dataTableName);
}
// Preload dictionaries
//LoadDictionary("Default");
// Preload fonts
LoadFont("MainFont");
LoadTMPFont("MainTMPFont");
@@ -119,13 +112,6 @@ namespace GeometryTD.Procedure
GameEntry.DataTable.LoadDataTable(dataTableName, dataTableAssetName, this);
}
private void LoadDictionary(string dictionaryName)
{
string dictionaryAssetName = AssetUtility.GetDictionaryAsset(dictionaryName, false);
_loadedFlag.Add(dictionaryAssetName, false);
GameEntry.Localization.ReadData(dictionaryAssetName, this);
}
private void LoadFont(string fontName)
{
_loadedFlag.Add(Utility.Text.Format("Font.{0}", fontName), false);
@@ -209,29 +195,5 @@ namespace GeometryTD.Procedure
Log.Error("Can not load data table '{0}' from '{1}' with error message '{2}'.", ne.DataTableAssetName,
ne.DataTableAssetName, ne.ErrorMessage);
}
private void OnLoadDictionarySuccess(object sender, GameEventArgs e)
{
LoadDictionarySuccessEventArgs ne = (LoadDictionarySuccessEventArgs)e;
if (ne.UserData != this)
{
return;
}
_loadedFlag[ne.DictionaryAssetName] = true;
Log.Info("Load dictionary '{0}' OK.", ne.DictionaryAssetName);
}
private void OnLoadDictionaryFailure(object sender, GameEventArgs e)
{
LoadDictionaryFailureEventArgs ne = (LoadDictionaryFailureEventArgs)e;
if (ne.UserData != this)
{
return;
}
Log.Error("Can not load dictionary '{0}' from '{1}' with error message '{2}'.", ne.DictionaryAssetName,
ne.DictionaryAssetName, ne.ErrorMessage);
}
}
}