diff --git a/JNFrame2/Assembly-CSharp-firstpass.csproj b/JNFrame2/Assembly-CSharp-firstpass.csproj index ec06bdcd..48a2158a 100644 --- a/JNFrame2/Assembly-CSharp-firstpass.csproj +++ b/JNFrame2/Assembly-CSharp-firstpass.csproj @@ -951,10 +951,6 @@ {7e65388c-f6a7-49e7-107c-67d307ad886b} AimingRig - - {17b58f54-5d7b-7430-a784-74a4540f4c68} - JNGame.Editor - {023a0336-4680-7ca2-9149-a72dd59bbaf2} UniTask.TextMeshPro @@ -979,10 +975,6 @@ {694241c5-b793-03a0-1887-6d1b1abd5716} UniTask.DOTween - - {f1698e1a-06a8-8d93-a550-db6e6cb60322} - Samples - {a37cd6bb-4243-4e53-0fb1-da1c51041fde} HotMain diff --git a/JNFrame2/Assembly-CSharp.csproj b/JNFrame2/Assembly-CSharp.csproj index d32773ec..7537c4bc 100644 --- a/JNFrame2/Assembly-CSharp.csproj +++ b/JNFrame2/Assembly-CSharp.csproj @@ -994,10 +994,6 @@ {7e65388c-f6a7-49e7-107c-67d307ad886b} AimingRig - - {17b58f54-5d7b-7430-a784-74a4540f4c68} - JNGame.Editor - {023a0336-4680-7ca2-9149-a72dd59bbaf2} UniTask.TextMeshPro @@ -1022,10 +1018,6 @@ {694241c5-b793-03a0-1887-6d1b1abd5716} UniTask.DOTween - - {f1698e1a-06a8-8d93-a550-db6e6cb60322} - Samples - {a37cd6bb-4243-4e53-0fb1-da1c51041fde} HotMain diff --git a/JNFrame2/Assets/HotScripts/JNGame/Runtime/JNGame.Runtime.asmdef b/JNFrame2/Assets/HotScripts/JNGame/Runtime/JNGame.Runtime.asmdef index 310c7fb8..30598f5e 100644 --- a/JNFrame2/Assets/HotScripts/JNGame/Runtime/JNGame.Runtime.asmdef +++ b/JNFrame2/Assets/HotScripts/JNGame/Runtime/JNGame.Runtime.asmdef @@ -7,7 +7,7 @@ ], "includePlatforms": [], "excludePlatforms": [], - "allowUnsafeCode": false, + "allowUnsafeCode": true, "overrideReferences": false, "precompiledReferences": [], "autoReferenced": true, diff --git a/JNFrame2/Assets/HotScripts/JNGame/Runtime/Network/JNClientBase.cs b/JNFrame2/Assets/HotScripts/JNGame/Runtime/Network/JNClientBase.cs index 6974def4..f6aae2ad 100644 --- a/JNFrame2/Assets/HotScripts/JNGame/Runtime/Network/JNClientBase.cs +++ b/JNFrame2/Assets/HotScripts/JNGame/Runtime/Network/JNClientBase.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Threading.Tasks; using Cysharp.Threading.Tasks; -using DotRecast.Core.Collections; using Google.Protobuf; using JNGame.Network.Entity; using JNGame.Network.Util; @@ -92,10 +91,10 @@ namespace JNGame.Network if (hId == 0) { int size = 0; - _byteSize.ForEach(child => + foreach (var child in _byteSize) { size += child.Value; - }); + } return size; } return _byteSize.GetValueOrDefault(hId, 0); diff --git a/JNFrame2/Assets/HotScripts/JNGame/Runtime/Network/JNServerBase.cs b/JNFrame2/Assets/HotScripts/JNGame/Runtime/Network/JNServerBase.cs index ae5e7995..bb244597 100644 --- a/JNFrame2/Assets/HotScripts/JNGame/Runtime/Network/JNServerBase.cs +++ b/JNFrame2/Assets/HotScripts/JNGame/Runtime/Network/JNServerBase.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using DotRecast.Core.Collections; using JNGame.Runtime.System; using JNGame.Util; @@ -61,10 +60,10 @@ namespace JNGame.Network int size = 0; try { - _byteSize.ForEach(child => + foreach (var child in _byteSize) { size += child.Value; - }); + } } catch (Exception e) { diff --git a/JNFrame2/Assets/HotScripts/JNGame/Runtime/Network/JNTCPServer.cs b/JNFrame2/Assets/HotScripts/JNGame/Runtime/Network/JNTCPServer.cs index c4e83f75..3a1b6e10 100644 --- a/JNFrame2/Assets/HotScripts/JNGame/Runtime/Network/JNTCPServer.cs +++ b/JNFrame2/Assets/HotScripts/JNGame/Runtime/Network/JNTCPServer.cs @@ -2,7 +2,6 @@ using System; using System.Threading.Tasks; using Cysharp.Threading.Tasks; -using DotRecast.Core.Collections; using Google.Protobuf; using JNGame.Network.Action; using JNGame.Network.Entity; @@ -142,13 +141,13 @@ namespace JNGame.Network public void AllSend(int hId,IMessage data = null,Func filter = null) { filter ??= (SocketClient client) => true; - service.GetClients().ForEach(client => + foreach (var client in service.GetClients()) { if (filter(client)) { Send(client, hId, data); } - }); + } } } diff --git a/JNFrame2/Assets/HotScripts/JNGame/Runtime/Sync/Debuger/JNTileServerDebuger.cs b/JNFrame2/Assets/HotScripts/JNGame/Runtime/Sync/Debuger/JNTileServerDebuger.cs index 844ae594..0da5d0f6 100644 --- a/JNFrame2/Assets/HotScripts/JNGame/Runtime/Sync/Debuger/JNTileServerDebuger.cs +++ b/JNFrame2/Assets/HotScripts/JNGame/Runtime/Sync/Debuger/JNTileServerDebuger.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using DotRecast.Core.Collections; using JNGame.Math; using JNGame.Runtime.Util; using JNGame.Sync.State.Tile; @@ -38,11 +37,11 @@ namespace JNGame.Sync.Debuger DrawContains(service.MaxContains,service.MinContains,Color.red); //绘制连接区域 - service.GetLinkTiles().ForEach(index => + foreach (var linkTile in service.GetLinkTiles()) { - (LVector2 max, LVector2 min) = service.GetTileContains(index); + (LVector2 max, LVector2 min) = service.GetTileContains(linkTile); DrawContains(max,min,Color.cyan); - }); + } } diff --git a/JNFrame2/Assets/HotScripts/JNGame/Runtime/Sync/Entity/JNContext.cs b/JNFrame2/Assets/HotScripts/JNGame/Runtime/Sync/Entity/JNContext.cs index 9caee2fa..20725e49 100644 --- a/JNFrame2/Assets/HotScripts/JNGame/Runtime/Sync/Entity/JNContext.cs +++ b/JNFrame2/Assets/HotScripts/JNGame/Runtime/Sync/Entity/JNContext.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using DotRecast.Core.Collections; using Entitas; using JNGame.Runtime.Sync; using JNGame.Sync.Entity; @@ -104,13 +103,13 @@ namespace JNGame.Sync.Frame.Entity //生效延迟销毁 public void DelayDestroy() { - GetEntities().ForEach(child => + foreach (var child in GetEntities()) { if (child.IsDelayDestroy) { child.Destroy(); } - }); + } } //生命周期 diff --git a/JNFrame2/Assets/HotScripts/JNGame/Runtime/Sync/Entity/JNEntity.cs b/JNFrame2/Assets/HotScripts/JNGame/Runtime/Sync/Entity/JNEntity.cs index a27c96f7..f4a29057 100644 --- a/JNFrame2/Assets/HotScripts/JNGame/Runtime/Sync/Entity/JNEntity.cs +++ b/JNFrame2/Assets/HotScripts/JNGame/Runtime/Sync/Entity/JNEntity.cs @@ -1,6 +1,4 @@ using System; -using System.Linq; -using DotRecast.Core.Collections; using JNGame.Math; using JNGame.Sync.Entity.Component; using JNGame.Sync.Frame.Entity; @@ -107,7 +105,10 @@ namespace JNGame.Sync.Entity public override void RemoveAllComponents() { - GetComponents().ForEach(child => (child as JNComponent)?.OnSyncDestroy()); + foreach (var child in GetComponents()) + { + (child as JNComponent)?.OnSyncDestroy(); + } base.RemoveAllComponents(); } diff --git a/JNFrame2/Assets/HotScripts/JNGame/Runtime/Sync/System/Data/SStateDataSystem.cs b/JNFrame2/Assets/HotScripts/JNGame/Runtime/Sync/System/Data/SStateDataSystem.cs index a3a2a0c8..82c13a77 100644 --- a/JNFrame2/Assets/HotScripts/JNGame/Runtime/Sync/System/Data/SStateDataSystem.cs +++ b/JNFrame2/Assets/HotScripts/JNGame/Runtime/Sync/System/Data/SStateDataSystem.cs @@ -1,7 +1,5 @@ using System.Collections.Generic; -using DotRecast.Core.Collections; using UnityEngine; -using NotImplementedException = System.NotImplementedException; namespace JNGame.Sync.System.Data { @@ -102,7 +100,7 @@ namespace JNGame.Sync.System.Data if (isServer) { var latest = GetLatest(); - latest.Keys.ForEach(key => + foreach (var key in latest.Keys) { if (Data.ContainsKey(key)) { @@ -114,12 +112,12 @@ namespace JNGame.Sync.System.Data //如果之前没有则添加 Add(latest[key]); } - }); - Data.ForEach(child => + } + foreach (var child in Data) { //没有则删除 if (!(latest.ContainsKey(child.Key))) Delete(child.Key); - }); + } if (UBytes.Count > 0) { OnUByteUpdate(UBytes); @@ -167,10 +165,10 @@ namespace JNGame.Sync.System.Data { var data = new Dictionary(); - Data.ForEach(child => + foreach (var child in Data) { data[child.Key] = child.Value.GetByte(); - }); + } return data; diff --git a/JNFrame2/Assets/HotScripts/JNGame/Runtime/Sync/System/Data/STileDataSystem.cs b/JNFrame2/Assets/HotScripts/JNGame/Runtime/Sync/System/Data/STileDataSystem.cs index c79488e0..1af6cf79 100644 --- a/JNFrame2/Assets/HotScripts/JNGame/Runtime/Sync/System/Data/STileDataSystem.cs +++ b/JNFrame2/Assets/HotScripts/JNGame/Runtime/Sync/System/Data/STileDataSystem.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; -using DotRecast.Core.Collections; using JNGame.Math; using JNGame.Sync.State.Tile; using JNGame.Sync.State.Tile.Entity; @@ -88,12 +87,12 @@ namespace JNGame.Sync.System.Data { entities = NodeContext.GetEntities(); } - entities.ForEach(child => + foreach (var child in entities) { var entity = new T(); entity.BindEntity(child); nodes[child.Id] = entity; - }); + } return nodes; } @@ -125,7 +124,7 @@ namespace JNGame.Sync.System.Data if (isServer) { var latest = GetLatest(); - latest.Keys.ForEach(key => + foreach (var key in latest.Keys) { if (Data.ContainsKey(key)) { @@ -137,8 +136,8 @@ namespace JNGame.Sync.System.Data //如果之前没有则添加 Add(latest[key]); } - }); - Data.ForEach(child => + } + foreach (var child in Data) { //没有则删除 if (NodeContext.Query(child.Key) is null) @@ -152,8 +151,7 @@ namespace JNGame.Sync.System.Data child.Value.IsActiveSyncOnce = false; UBytes[child.Key] = child.Value.GetByte(); } - - }); + } if (UBytes.Count > 0) { OnUByteUpdate(UBytes); @@ -170,7 +168,7 @@ namespace JNGame.Sync.System.Data Dictionary master = new Dictionary(); Dictionary slave = new Dictionary(); - all.ForEach(keyValue => + foreach (var keyValue in all) { var entity = NodeContext.Query(keyValue.Key); //给从服务器发送数据 @@ -178,7 +176,7 @@ namespace JNGame.Sync.System.Data { slave[keyValue.Key] = keyValue.Value; } - }); + } OnSendAllData(all); OnSendMasterData(master); @@ -220,7 +218,7 @@ namespace JNGame.Sync.System.Data } } - NodeContext.GetEntities().ForEach(child => + foreach (var child in NodeContext.GetEntities()) { //如果有则删除 if (lIsTileData.Remove(child.Id,out var data)) @@ -234,7 +232,7 @@ namespace JNGame.Sync.System.Data if (IsSlave) data.IsActiveSyncOnce = true; } } - }); + } //将数据同步到实体中 foreach (var keyValue in lIsTileData) @@ -308,10 +306,10 @@ namespace JNGame.Sync.System.Data //需要删除的数据Id var ids = new List(); - Data.ForEach(child => + foreach (var child in Data) { if (IsTileInside(index,child.Value)) ids.Add(child.Key); - }); + } //删除数据和实体 ids.ForEach(child => @@ -343,14 +341,14 @@ namespace JNGame.Sync.System.Data lock (Data) { - Data.ForEach(child => + foreach (var child in Data) { var entity = NodeContext.Query(child.Key); if (entity is not null && entity.IsHost && filter(entity)) { data[child.Key] = child.Value.GetByte(); } - }); + } } return data; @@ -366,14 +364,14 @@ namespace JNGame.Sync.System.Data lock (Data) { - Data.ForEach(child => + foreach (var child in Data) { var entity = NodeContext.Query(child.Key); if (IsTileInside(index,child.Value) && filter(entity)) { data[child.Key] = child.Value.GetByte(); } - }); + } } return data; diff --git a/JNFrame2/Assets/HybridCLRGenerate/link.xml b/JNFrame2/Assets/HybridCLRGenerate/link.xml index 6afa5095..b58acfd5 100644 --- a/JNFrame2/Assets/HybridCLRGenerate/link.xml +++ b/JNFrame2/Assets/HybridCLRGenerate/link.xml @@ -67,38 +67,18 @@ - - - - - - - - - - - - - - - - - - - - @@ -161,17 +141,9 @@ - - - - - - - - @@ -179,10 +151,6 @@ - - - - @@ -193,9 +161,6 @@ - - - @@ -210,10 +175,8 @@ - - @@ -222,12 +185,9 @@ - - - @@ -235,7 +195,6 @@ - @@ -247,8 +206,6 @@ - - @@ -267,44 +224,27 @@ - - - - - - - - - - - - - - - - - @@ -319,25 +259,21 @@ - - - - - + + + - - diff --git a/JNFrame2/JNFrame2.sln b/JNFrame2/JNFrame2.sln index e62870ea..1aa0d5e7 100644 --- a/JNFrame2/JNFrame2.sln +++ b/JNFrame2/JNFrame2.sln @@ -5,24 +5,20 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp", "Assembly EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StompyRobot.SRF", "StompyRobot.SRF.csproj", "{356a0975-52a0-edee-67e5-a8751d23d388}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JNGame", "JNGame.csproj", "{3a48b384-1ba1-8d63-b01a-1777c52cfdc1}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FairyGUI.Runtime", "FairyGUI.Runtime.csproj", "{65d6cac9-6d7d-4b93-ff92-1a5fc94f680c}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JNGame.Editor", "JNGame.Editor.csproj", "{17b58f54-5d7b-7430-a784-74a4540f4c68}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniTask.Linq", "UniTask.Linq.csproj", "{168b694c-7d58-d228-f9a3-02235c192fc5}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FairyGUI.Editor", "FairyGUI.Editor.csproj", "{44b47b38-a33f-7d44-f2e0-a6c5f272d235}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Samples", "Samples.csproj", "{f1698e1a-06a8-8d93-a550-db6e6cb60322}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniTask", "UniTask.csproj", "{bf8742e6-eee2-4cf6-3e82-d12e15802154}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StompyRobot.SRDebugger", "StompyRobot.SRDebugger.csproj", "{786227ef-f2d4-16aa-9b5e-f745e7520e98}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SHFrame", "SHFrame.csproj", "{56fe4698-9e38-f97f-0948-b4a412ec01fc}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JNGame", "JNGame.csproj", "{3a48b384-1ba1-8d63-b01a-1777c52cfdc1}" +EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GameScripts", "GameScripts.csproj", "{c0e4a2c6-f110-93aa-0a2f-48b1bf0890de}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HotMain", "HotMain.csproj", "{a37cd6bb-4243-4e53-0fb1-da1c51041fde}" @@ -58,24 +54,20 @@ Global {62753af3-1e0c-69e5-d3db-cf11598cd1b3}.Debug|Any CPU.Build.0 = Debug|Any CPU {356a0975-52a0-edee-67e5-a8751d23d388}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {356a0975-52a0-edee-67e5-a8751d23d388}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3a48b384-1ba1-8d63-b01a-1777c52cfdc1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3a48b384-1ba1-8d63-b01a-1777c52cfdc1}.Debug|Any CPU.Build.0 = Debug|Any CPU {65d6cac9-6d7d-4b93-ff92-1a5fc94f680c}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {65d6cac9-6d7d-4b93-ff92-1a5fc94f680c}.Debug|Any CPU.Build.0 = Debug|Any CPU - {17b58f54-5d7b-7430-a784-74a4540f4c68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {17b58f54-5d7b-7430-a784-74a4540f4c68}.Debug|Any CPU.Build.0 = Debug|Any CPU {168b694c-7d58-d228-f9a3-02235c192fc5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {168b694c-7d58-d228-f9a3-02235c192fc5}.Debug|Any CPU.Build.0 = Debug|Any CPU {44b47b38-a33f-7d44-f2e0-a6c5f272d235}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {44b47b38-a33f-7d44-f2e0-a6c5f272d235}.Debug|Any CPU.Build.0 = Debug|Any CPU - {f1698e1a-06a8-8d93-a550-db6e6cb60322}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {f1698e1a-06a8-8d93-a550-db6e6cb60322}.Debug|Any CPU.Build.0 = Debug|Any CPU {bf8742e6-eee2-4cf6-3e82-d12e15802154}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {bf8742e6-eee2-4cf6-3e82-d12e15802154}.Debug|Any CPU.Build.0 = Debug|Any CPU {786227ef-f2d4-16aa-9b5e-f745e7520e98}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {786227ef-f2d4-16aa-9b5e-f745e7520e98}.Debug|Any CPU.Build.0 = Debug|Any CPU {56fe4698-9e38-f97f-0948-b4a412ec01fc}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {56fe4698-9e38-f97f-0948-b4a412ec01fc}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3a48b384-1ba1-8d63-b01a-1777c52cfdc1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3a48b384-1ba1-8d63-b01a-1777c52cfdc1}.Debug|Any CPU.Build.0 = Debug|Any CPU {c0e4a2c6-f110-93aa-0a2f-48b1bf0890de}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {c0e4a2c6-f110-93aa-0a2f-48b1bf0890de}.Debug|Any CPU.Build.0 = Debug|Any CPU {a37cd6bb-4243-4e53-0fb1-da1c51041fde}.Debug|Any CPU.ActiveCfg = Debug|Any CPU diff --git a/JNFrame2/JNGame.Editor.csproj b/JNFrame2/JNGame.Editor.csproj index f928d792..e4a8afd9 100644 --- a/JNFrame2/JNGame.Editor.csproj +++ b/JNFrame2/JNGame.Editor.csproj @@ -74,50 +74,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - C:\APP\UnityEdit\2022.3.16f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.dll @@ -908,6 +864,9 @@ JNGame + + +