迁移数据表到 Luban,移除 JsonNet、EnumUtility
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
using GameFramework;
|
||||
using GameFramework;
|
||||
using GameFramework.Event;
|
||||
using GameFramework.Resource;
|
||||
using System.Collections.Generic;
|
||||
using SepCore.DataTable;
|
||||
using SepCore.Definition;
|
||||
using SepCore.CustomUtility;
|
||||
using TMPro;
|
||||
@@ -15,23 +14,7 @@ namespace SepCore.Procedure
|
||||
{
|
||||
public class ProcedurePreload : ProcedureBase
|
||||
{
|
||||
public static readonly string[] DataTableNames = new string[]
|
||||
{
|
||||
"Entity",
|
||||
"Enemy",
|
||||
"Weapon",
|
||||
"Music",
|
||||
"Scene",
|
||||
"Sound",
|
||||
"UIForm",
|
||||
"UISound",
|
||||
"Goods",
|
||||
"Prop",
|
||||
"Role",
|
||||
"Level",
|
||||
"LevelUpReward",
|
||||
"LevelRarity",
|
||||
};
|
||||
private const string LubanTablesFlag = "LubanTables";
|
||||
|
||||
private Dictionary<string, bool> _loadedFlag = new Dictionary<string, bool>();
|
||||
|
||||
@@ -43,8 +26,6 @@ namespace SepCore.Procedure
|
||||
|
||||
GameEntry.Event.Subscribe(LoadConfigSuccessEventArgs.EventId, OnLoadConfigSuccess);
|
||||
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);
|
||||
|
||||
@@ -59,8 +40,6 @@ namespace SepCore.Procedure
|
||||
{
|
||||
GameEntry.Event.Unsubscribe(LoadConfigSuccessEventArgs.EventId, OnLoadConfigSuccess);
|
||||
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);
|
||||
|
||||
@@ -79,7 +58,7 @@ namespace SepCore.Procedure
|
||||
}
|
||||
}
|
||||
|
||||
procedureOwner.SetData<VarInt32>("NextSceneId", (int)SceneId.Menu);
|
||||
procedureOwner.SetData<VarInt32>("NextSceneType", (int)SceneType.Menu);
|
||||
ChangeState<ProcedureChangeScene>(procedureOwner);
|
||||
}
|
||||
|
||||
@@ -88,11 +67,18 @@ namespace SepCore.Procedure
|
||||
// Preload configs
|
||||
LoadConfig("DefaultConfig");
|
||||
|
||||
// Preload data tables
|
||||
foreach (string dataTableName in DataTableNames)
|
||||
{
|
||||
LoadDataTable(dataTableName);
|
||||
}
|
||||
// Preload Luban data tables
|
||||
_loadedFlag.Add(LubanTablesFlag, false);
|
||||
GameEntry.Luban.LoadTables(
|
||||
() =>
|
||||
{
|
||||
_loadedFlag[LubanTablesFlag] = true;
|
||||
Log.Info("Load Luban data tables OK.");
|
||||
},
|
||||
errorMessage =>
|
||||
{
|
||||
Log.Error("Load Luban data tables failure with error message '{0}'.", errorMessage);
|
||||
});
|
||||
|
||||
// Preload fonts
|
||||
LoadFont("MainFont");
|
||||
@@ -106,13 +92,6 @@ namespace SepCore.Procedure
|
||||
GameEntry.Config.ReadData(configAssetName, this);
|
||||
}
|
||||
|
||||
private void LoadDataTable(string dataTableName)
|
||||
{
|
||||
string dataTableAssetName = AssetUtility.GetDataTableAsset(dataTableName, false);
|
||||
_loadedFlag.Add(dataTableAssetName, false);
|
||||
GameEntry.DataTable.LoadDataTable(dataTableName, dataTableAssetName, this);
|
||||
}
|
||||
|
||||
private void LoadFont(string fontName)
|
||||
{
|
||||
_loadedFlag.Add(Utility.Text.Format("Font.{0}", fontName), false);
|
||||
@@ -173,29 +152,7 @@ namespace SepCore.Procedure
|
||||
ne.ConfigAssetName, ne.ErrorMessage);
|
||||
}
|
||||
|
||||
private void OnLoadDataTableSuccess(object sender, GameEventArgs e)
|
||||
{
|
||||
LoadDataTableSuccessEventArgs ne = (LoadDataTableSuccessEventArgs)e;
|
||||
if (ne.UserData != this)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_loadedFlag[ne.DataTableAssetName] = true;
|
||||
Log.Info("Load data table '{0}' OK.", ne.DataTableAssetName);
|
||||
}
|
||||
|
||||
private void OnLoadDataTableFailure(object sender, GameEventArgs e)
|
||||
{
|
||||
LoadDataTableFailureEventArgs ne = (LoadDataTableFailureEventArgs)e;
|
||||
if (ne.UserData != this)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user