移动同步相关
This commit is contained in:
@@ -4,7 +4,7 @@ namespace NB.Map;
|
|||||||
|
|
||||||
public class RoomManageComponent : Entity
|
public class RoomManageComponent : Entity
|
||||||
{
|
{
|
||||||
public readonly Dictionary<long, MapRoom> Rooms = new();
|
public readonly Dictionary<int, MapRoom> Rooms = new();
|
||||||
|
|
||||||
public readonly PriorityQueue<int, int> FreeIds = new();
|
public readonly PriorityQueue<int, int> FreeIds = new();
|
||||||
public readonly HashSet<int> InUseID = new();
|
public readonly HashSet<int> InUseID = new();
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public class MapUnit : Entity
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 当前所在的房间id
|
/// 当前所在的房间id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public long RoomId;
|
public int RoomId;
|
||||||
|
|
||||||
public long GateRouteId;
|
public long GateRouteId;
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,13 @@ public class C2Map_LookHandler : Route<MapUnit, C2Map_Look>
|
|||||||
protected override async FTask Run(MapUnit entity, C2Map_Look message)
|
protected override async FTask Run(MapUnit entity, C2Map_Look message)
|
||||||
{
|
{
|
||||||
var roomManageComponent = entity.Scene.GetComponent<RoomManageComponent>();
|
var roomManageComponent = entity.Scene.GetComponent<RoomManageComponent>();
|
||||||
|
var roomId = entity.RoomId;
|
||||||
|
var room = roomManageComponent.Get(roomId);
|
||||||
|
if (room == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var notifyMessage = new Map2C_LookeNotify()
|
var notifyMessage = new Map2C_LookeNotify()
|
||||||
{
|
{
|
||||||
Id = entity.Id,
|
Id = entity.Id,
|
||||||
@@ -19,14 +26,11 @@ public class C2Map_LookHandler : Route<MapUnit, C2Map_Look>
|
|||||||
entity.Rotation.x = message.Rotation.x;
|
entity.Rotation.x = message.Rotation.x;
|
||||||
entity.Rotation.y = message.Rotation.y;
|
entity.Rotation.y = message.Rotation.y;
|
||||||
entity.Rotation.z = message.Rotation.z;
|
entity.Rotation.z = message.Rotation.z;
|
||||||
|
|
||||||
var room = roomManageComponent.Get(entity.MapId);
|
|
||||||
|
|
||||||
|
foreach (var (_, unit) in room.Units)
|
||||||
// foreach (var (_, unit) in mapUnitManageComponent.Units)
|
{
|
||||||
// {
|
entity.Scene.NetworkMessagingComponent.SendInnerRoute(unit.GateRouteId, notifyMessage);
|
||||||
// entity.Scene.NetworkMessagingComponent.SendInnerRoute(unit.GateRouteId, notifyMessage);
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
await FTask.CompletedTask;
|
await FTask.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,14 @@ public class C2Map_MoveHandler : Route<MapUnit, C2Map_Move>
|
|||||||
{
|
{
|
||||||
protected override async FTask Run(MapUnit entity, C2Map_Move message)
|
protected override async FTask Run(MapUnit entity, C2Map_Move message)
|
||||||
{
|
{
|
||||||
var mapUnitManageComponent = entity.Scene.GetComponent<MapUnitManageComponent>();
|
var roomManageComponent = entity.Scene.GetComponent<RoomManageComponent>();
|
||||||
|
var roomId = entity.RoomId;
|
||||||
|
var room = roomManageComponent.Get(roomId);
|
||||||
|
if (room == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// var mapUnitManageComponent = entity.Scene.GetComponent<MapUnitManageComponent>();
|
||||||
var notifyMessage = new Map2C_MoveNotify()
|
var notifyMessage = new Map2C_MoveNotify()
|
||||||
{
|
{
|
||||||
Id = entity.Id,
|
Id = entity.Id,
|
||||||
@@ -28,10 +35,11 @@ public class C2Map_MoveHandler : Route<MapUnit, C2Map_Move>
|
|||||||
entity.Rotation.y = message.Rotation.y;
|
entity.Rotation.y = message.Rotation.y;
|
||||||
entity.Rotation.z = message.Rotation.z;
|
entity.Rotation.z = message.Rotation.z;
|
||||||
|
|
||||||
foreach (var (_, unit) in mapUnitManageComponent.Units)
|
foreach (var (_, unit) in room.Units)
|
||||||
{
|
{
|
||||||
entity.Scene.NetworkMessagingComponent.SendInnerRoute(unit.GateRouteId, notifyMessage);
|
entity.Scene.NetworkMessagingComponent.SendInnerRoute(unit.GateRouteId, notifyMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
await FTask.CompletedTask;
|
await FTask.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public class G2Map_EnterMapRequestHandler : RouteRPC<Scene, G2Map_EnterMapReques
|
|||||||
response.RoomCode = room.Code;
|
response.RoomCode = room.Code;
|
||||||
if (response.ErrorCode == ErrorCode.Successful)
|
if (response.ErrorCode == ErrorCode.Successful)
|
||||||
{
|
{
|
||||||
mapUnit.RoomId = room.Id;
|
mapUnit.RoomId = room.RoomId;
|
||||||
response.Units = room.ToMapUnitInfo();
|
response.Units = room.ToMapUnitInfo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,6 +70,11 @@ public static class RoomManageComponentSystem
|
|||||||
{
|
{
|
||||||
return self.Rooms.GetValueOrDefault(roomId);
|
return self.Rooms.GetValueOrDefault(roomId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public static MapRoom? Get(this RoomManageComponent self, long roomId)
|
||||||
|
// {
|
||||||
|
// return self.Rooms.GetValueOrDefault(roomId);
|
||||||
|
// }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
"profiles": {
|
"profiles": {
|
||||||
"Main": {
|
"Main": {
|
||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
// "workingDirectory": "$(OutputPath)",
|
"workingDirectory": "$(OutputPath)",
|
||||||
"environmentVariables": {},
|
"environmentVariables": {},
|
||||||
"commandLineArgs": "--m Develop"
|
"commandLineArgs": "--m Develop"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ABsonClassMap_002Ecs_002Fl_003AC_0021_003FUsers_003Fbob_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FSourcesCache_003F2eb023375b7879b26d41bf37f27d5d84cf356cf593d71659a9d432322829914c_003FBsonClassMap_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ABsonClassMap_002Ecs_002Fl_003AC_0021_003FUsers_003Fbob_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FSourcesCache_003F2eb023375b7879b26d41bf37f27d5d84cf356cf593d71659a9d432322829914c_003FBsonClassMap_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ABsonElementAttribute_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003FLibrary_003FApplication_0020Support_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F3be33698cf8a4c6ea48ef124c9ddacad81800_003Ff5_003F5d71aba0_003FBsonElementAttribute_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ABsonElementAttribute_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003FLibrary_003FApplication_0020Support_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F3be33698cf8a4c6ea48ef124c9ddacad81800_003Ff5_003F5d71aba0_003FBsonElementAttribute_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ABsonIgnoreAttribute_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003FLibrary_003FApplication_0020Support_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F39988e239fb94b73b8bdb00ab8b87d1f82400_003F63_003Fca262714_003FBsonIgnoreAttribute_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ABsonIgnoreAttribute_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003FLibrary_003FApplication_0020Support_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F39988e239fb94b73b8bdb00ab8b87d1f82400_003F63_003Fca262714_003FBsonIgnoreAttribute_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ACollectionExtensions_002Ecs_002Fl_003AC_0021_003FUsers_003FFIREBAT_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FSourcesCache_003Fe399fc861c188bd19ebde14346e2f5f2c1a54c1c0d6fbd5cbe05227afe6d_003FCollectionExtensions_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AControllerBase_002Ecs_002Fl_003AC_0021_003FUsers_003Fbob_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F0207e94f3a3e4dca931382ccf94981471de930_003Fd2_003Fe3b49283_003FControllerBase_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AControllerBase_002Ecs_002Fl_003AC_0021_003FUsers_003Fbob_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F0207e94f3a3e4dca931382ccf94981471de930_003Fd2_003Fe3b49283_003FControllerBase_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ADeserializeSystem_00601_002Ecs_002Fl_003AC_0021_003FUsers_003F60527_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fff8cbe4b3c6c469b86633ea0c41accd783200_003Fba_003Fb30c4cb2_003FDeserializeSystem_00601_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ADeserializeSystem_00601_002Ecs_002Fl_003AC_0021_003FUsers_003F60527_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fff8cbe4b3c6c469b86633ea0c41accd783200_003Fba_003Fb30c4cb2_003FDeserializeSystem_00601_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ADestroySystem_00601_002Ecs_002Fl_003AC_0021_003FUsers_003F60527_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fff8cbe4b3c6c469b86633ea0c41accd783200_003F41_003F9b0e4a72_003FDestroySystem_00601_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ADestroySystem_00601_002Ecs_002Fl_003AC_0021_003FUsers_003F60527_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fff8cbe4b3c6c469b86633ea0c41accd783200_003F41_003F9b0e4a72_003FDestroySystem_00601_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
|
|||||||
Reference in New Issue
Block a user