mirror of
https://github.com/EggLinks/DanhengServer-OpenSource.git
synced 2026-01-03 04:36:03 +08:00
Feature:Asynchronous Operation & Formatting Code
- Now the async operation is enabled! - Code formatted by Resharper plugin <3
This commit is contained in:
@@ -1,64 +1,56 @@
|
||||
using EggLink.DanhengServer.Game.Scene.Entity;
|
||||
using EggLink.DanhengServer.Proto;
|
||||
|
||||
namespace EggLink.DanhengServer.Server.Packet.Send.Scene
|
||||
namespace EggLink.DanhengServer.Server.Packet.Send.Scene;
|
||||
|
||||
public class PacketSceneGroupRefreshScNotify : BasePacket
|
||||
{
|
||||
public class PacketSceneGroupRefreshScNotify : BasePacket
|
||||
public PacketSceneGroupRefreshScNotify(List<IGameEntity>? addEntity = null, List<IGameEntity>? removeEntity = null)
|
||||
: base(CmdIds.SceneGroupRefreshScNotify)
|
||||
{
|
||||
public PacketSceneGroupRefreshScNotify(List<IGameEntity>? addEntity = null, List<IGameEntity>? removeEntity = null) : base(CmdIds.SceneGroupRefreshScNotify)
|
||||
var proto = new SceneGroupRefreshScNotify();
|
||||
Dictionary<int, GroupRefreshInfo> refreshInfo = [];
|
||||
foreach (var e in addEntity ?? [])
|
||||
{
|
||||
var proto = new SceneGroupRefreshScNotify();
|
||||
Dictionary<int, GroupRefreshInfo> refreshInfo = [];
|
||||
foreach (var e in addEntity ?? [])
|
||||
var group = new GroupRefreshInfo
|
||||
{
|
||||
var group = new GroupRefreshInfo()
|
||||
{
|
||||
GroupId = (uint)e.GroupID,
|
||||
};
|
||||
group.RefreshEntity.Add(new SceneEntityRefreshInfo()
|
||||
{
|
||||
AddEntity = e.ToProto()
|
||||
});
|
||||
|
||||
if (refreshInfo.TryGetValue(e.GroupID, out GroupRefreshInfo? value))
|
||||
{
|
||||
value.RefreshEntity.AddRange(group.RefreshEntity);
|
||||
}
|
||||
else
|
||||
{
|
||||
refreshInfo[e.GroupID] = group;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var e in removeEntity ?? [])
|
||||
GroupId = (uint)e.GroupID
|
||||
};
|
||||
group.RefreshEntity.Add(new SceneEntityRefreshInfo
|
||||
{
|
||||
var group = new GroupRefreshInfo()
|
||||
{
|
||||
GroupId = (uint)e.GroupID,
|
||||
};
|
||||
group.RefreshEntity.Add(new SceneEntityRefreshInfo()
|
||||
{
|
||||
DeleteEntity = (uint)e.EntityID
|
||||
});
|
||||
AddEntity = e.ToProto()
|
||||
});
|
||||
|
||||
if (refreshInfo.TryGetValue(e.GroupID, out GroupRefreshInfo? value))
|
||||
{
|
||||
value.RefreshEntity.AddRange(group.RefreshEntity);
|
||||
}
|
||||
else
|
||||
{
|
||||
refreshInfo[e.GroupID] = group;
|
||||
}
|
||||
}
|
||||
|
||||
proto.GroupRefreshList.AddRange(refreshInfo.Values);
|
||||
|
||||
SetData(proto);
|
||||
if (refreshInfo.TryGetValue(e.GroupID, out var value))
|
||||
value.RefreshEntity.AddRange(group.RefreshEntity);
|
||||
else
|
||||
refreshInfo[e.GroupID] = group;
|
||||
}
|
||||
|
||||
public PacketSceneGroupRefreshScNotify(IGameEntity? addEntity = null, IGameEntity? removeEntity = null) :
|
||||
this(addEntity == null ? [] : [addEntity], removeEntity == null ? [] : [removeEntity])
|
||||
foreach (var e in removeEntity ?? [])
|
||||
{
|
||||
var group = new GroupRefreshInfo
|
||||
{
|
||||
GroupId = (uint)e.GroupID
|
||||
};
|
||||
group.RefreshEntity.Add(new SceneEntityRefreshInfo
|
||||
{
|
||||
DeleteEntity = (uint)e.EntityID
|
||||
});
|
||||
|
||||
if (refreshInfo.TryGetValue(e.GroupID, out var value))
|
||||
value.RefreshEntity.AddRange(group.RefreshEntity);
|
||||
else
|
||||
refreshInfo[e.GroupID] = group;
|
||||
}
|
||||
|
||||
proto.GroupRefreshList.AddRange(refreshInfo.Values);
|
||||
|
||||
SetData(proto);
|
||||
}
|
||||
}
|
||||
|
||||
public PacketSceneGroupRefreshScNotify(IGameEntity? addEntity = null, IGameEntity? removeEntity = null) :
|
||||
this(addEntity == null ? [] : [addEntity], removeEntity == null ? [] : [removeEntity])
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user