缓存模块

This commit is contained in:
bob
2025-08-15 18:12:04 +08:00
parent d5689258fc
commit 34b25273a7
19 changed files with 275 additions and 79 deletions

View File

@@ -4,6 +4,7 @@ using Fantasy.Entitas;
using Fantasy.Event;
using Fantasy.Helper;
using Fantasy.Serialize;
using NB.Game;
using ProtoBuf;
namespace NB;
@@ -28,7 +29,6 @@ public sealed class OnCreateSceneEvent : AsyncEventSystem<OnCreateScene>
/// <returns>A task representing the asynchronous operation.</returns>
protected override async FTask Handler(OnCreateScene self)
{
// var epoch1970 = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).Ticks / 10000;
//
// {
@@ -44,16 +44,16 @@ public sealed class OnCreateSceneEvent : AsyncEventSystem<OnCreateScene>
// var time = (uint)((now - epochThisYear) / 1000);
// Log.Debug($"time = {time} now = {now} epochThisYear = {epochThisYear}");
// }
var scene = self.Scene;
switch (scene.SceneType)
{
case 6666:
{
var subSceneTestComponent = scene.AddComponent<SubSceneTestComponent>();
Log.Debug("增加了SubSceneTestComponent");
scene.EntityComponent.CustomSystem(subSceneTestComponent,CustomSystemType.RunSystem);
scene.EntityComponent.CustomSystem(subSceneTestComponent, CustomSystemType.RunSystem);
break;
}
case SceneType.Addressable:
@@ -71,6 +71,23 @@ public sealed class OnCreateSceneEvent : AsyncEventSystem<OnCreateScene>
{
break;
}
case SceneType.Game:
{
// for (int i = 0; i < 100; i++)
// {
// var accountId = scene.EntityIdFactory.Create;
// var account = PlayerFactory.Create(scene, accountId);
//
// account.Level = 99;
// account.NickName = $"测试号{i + 1}";
// account.Country = "cn";
// account.Exp = 999;
// account.Head = "xxx.png";
// await account.Save();
// }
//
break;
}
case SceneType.Gate:
{
// var tasks = new List<FTask>(2000);
@@ -92,7 +109,7 @@ public sealed class OnCreateSceneEvent : AsyncEventSystem<OnCreateScene>
// }
// await FTask.WaitAll(tasks);
// }
// 执行自定义系统
var testCustomSystemComponent = scene.AddComponent<TestCustomSystemComponent>();
scene.EntityComponent.CustomSystem(testCustomSystemComponent, CustomSystemType.RunSystem);