Feature:Asynchronous Operation & Formatting Code

- Now the async operation is enabled!
- Code formatted by Resharper plugin <3
This commit is contained in:
Somebody
2024-07-22 17:12:03 +08:00
parent e983375620
commit 87d228eb79
793 changed files with 34764 additions and 40190 deletions

View File

@@ -2,52 +2,47 @@
using EggLink.DanhengServer.Game.Battle;
using EggLink.DanhengServer.Proto;
using EggLink.DanhengServer.Util;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EggLink.DanhengServer.Game.Scene.Entity
namespace EggLink.DanhengServer.Game.Scene.Entity;
public class EntityNpc(SceneInstance scene, GroupInfo group, NpcInfo npcInfo) : IGameEntity
{
public class EntityNpc(SceneInstance scene, GroupInfo group, NpcInfo npcInfo) : IGameEntity
public SceneInstance Scene { get; set; } = scene;
public Position Position { get; set; } = npcInfo.ToPositionProto();
public Position Rotation { get; set; } = npcInfo.ToRotationProto();
public int NpcId { get; set; } = npcInfo.NPCID;
public int InstId { get; set; } = npcInfo.ID;
public int EntityID { get; set; }
public int GroupID { get; set; } = group.Id;
public async ValueTask AddBuff(SceneBuff buff)
{
public SceneInstance Scene { get; set; } = scene;
public int EntityID { get; set; }
public int GroupID { get; set; } = group.Id;
public Position Position { get; set; } = npcInfo.ToPositionProto();
public Position Rotation { get; set; } = npcInfo.ToRotationProto();
public int NpcId { get; set; } = npcInfo.NPCID;
public int InstId { get; set; } = npcInfo.ID;
public void AddBuff(SceneBuff buff)
{
}
public void ApplyBuff(BattleInstance instance)
{
}
public virtual SceneEntityInfo ToProto()
{
SceneNpcInfo npc = new()
{
NpcId = (uint)NpcId,
};
return new SceneEntityInfo()
{
EntityId = (uint)EntityID,
GroupId = (uint)GroupID,
Motion = new MotionInfo()
{
Pos = Position.ToProto(),
Rot = Rotation.ToProto(),
},
InstId = (uint)InstId,
Npc = npc,
};
}
await System.Threading.Tasks.Task.CompletedTask;
}
}
public async ValueTask ApplyBuff(BattleInstance instance)
{
await System.Threading.Tasks.Task.CompletedTask;
}
public virtual SceneEntityInfo ToProto()
{
SceneNpcInfo npc = new()
{
NpcId = (uint)NpcId
};
return new SceneEntityInfo
{
EntityId = (uint)EntityID,
GroupId = (uint)GroupID,
Motion = new MotionInfo
{
Pos = Position.ToProto(),
Rot = Rotation.ToProto()
},
InstId = (uint)InstId,
Npc = npc
};
}
}