添加transport库

master
sunqinzhe 20 hours ago
parent e3f449f183
commit 3fe3366e75
  1. 16
      LocalPackages/com.nimin.lowlevel/Runtime/LowLevelUtility.cs
  2. 0
      LocalPackages/com.nimin.lowlevel/Runtime/LowLevelUtility.cs.meta
  3. 8
      LocalPackages/com.nimin.network/Runtime.meta
  4. 21
      LocalPackages/com.nimin.network/Runtime/NetworkDriverAsset.cs
  5. 11
      LocalPackages/com.nimin.network/Runtime/NetworkDriverAsset.cs.meta
  6. 32
      LocalPackages/com.nimin.network/Runtime/nimin.network.asmdef
  7. 7
      LocalPackages/com.nimin.network/Runtime/nimin.network.asmdef.meta
  8. 14
      LocalPackages/com.nimin.network/package.json
  9. 7
      LocalPackages/com.nimin.network/package.json.meta
  10. 3
      LocalPackages/com.nimin.tinyecs/Runtime/Entity.cs
  11. 4
      LocalPackages/com.nimin.tinyecs/Runtime/EntityDataBlock.gen.cs
  12. 3
      Packages/manifest.json
  13. 111
      Packages/packages-lock.json
  14. 9
      ProjectSettings/PackageManagerSettings.asset
  15. 0
      ProjectSettings/Packages/com.unity.services.core/Settings.json
  16. 2
      ProjectSettings/Packages/com.unity.testtools.codecoverage/Settings.json
  17. 4
      ProjectSettings/ProjectVersion.txt
  18. 2
      UnityECS.sln.DotSettings.user

@ -2,11 +2,21 @@ using Unity.Collections.LowLevel.Unsafe;
namespace GameCore.LowLevel namespace GameCore.LowLevel
{ {
public static class StructUtility public static class LowLevelUtility
{ {
public static int HashCombine(int h1, int h2)
{
var hash = h1;
hash = (hash * 397) ^ h2;
return hash;
}
public static int HashCombine(int h1, int h2, int h3)
{
return HashCombine(HashCombine(h1, h2), h3);
}
public static int OffsetOf<T, F>() public static int OffsetOf<T, F>()
where T : struct
where F : struct
{ {
var fields = typeof(T).GetFields(); var fields = typeof(T).GetFields();
foreach (var f in fields) foreach (var f in fields)

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 601e75d3d590e6d46a9e4dcc626bc18a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,21 @@
using System.Collections;
using System.Collections.Generic;
using Unity.Collections;
using Unity.Networking.Transport;
using Unity.Networking.Transport.Utilities;
using UnityEngine;
namespace GameCore.Network
{
public class NewBehaviourScript : ScriptableObject
{
// private NetworkDriver CreateNetworkDriver()
// {
// var settings = new NetworkSettings(Allocator.Temp);
// settings.WithNetworkConfigParameters(disconnectTimeoutMS: 5000);
// settings.WithReliableStageParameters(32);
//
// }
}
}

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b79190dcfae6a2f4fbdfc9deccf00ef7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,32 @@
{
"name": "nimin.network",
"rootNamespace": "",
"references": [
"Unity.Networking.Transport"
],
"includePlatforms": [
"Android",
"Editor",
"iOS",
"LinuxStandalone64",
"Lumin",
"macOSStandalone",
"PS4",
"Stadia",
"Switch",
"tvOS",
"WSA",
"WebGL",
"WindowsStandalone32",
"WindowsStandalone64",
"XboxOne"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 91141161d71157d48bf0b89f0037a92c
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,14 @@
{
"name": "com.nimin.network",
"displayName": "GameCore Network",
"version": "0.1.0",
"unity": "2021.3",
"description": "Network based on Unity Transport",
"dependencies": {
"com.unity.transport": "1.0.0"
},
"keywords": [
"Network",
"JobSystem"
]
}

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 0d7dbfe60d6acb342bf4cf03c23adb14
PackageManifestImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -1,4 +1,5 @@
using System; using System;
using GameCore.LowLevel;
namespace GameCore.TinyECS namespace GameCore.TinyECS
{ {
@ -18,7 +19,7 @@ namespace GameCore.TinyECS
public override string ToString() => $"Entity<{type}>({index},{generation})"; public override string ToString() => $"Entity<{type}>({index},{generation})";
public bool Equals(Entity<TEnum> other) => type.Equals(other.type) && index == other.index && generation == other.generation; public bool Equals(Entity<TEnum> other) => type.Equals(other.type) && index == other.index && generation == other.generation;
public override bool Equals(object obj) => obj is Entity<TEnum> other && Equals(other); public override bool Equals(object obj) => obj is Entity<TEnum> other && Equals(other);
public override int GetHashCode() => HashCode.Combine(type, index, generation); public override int GetHashCode() => LowLevelUtility.HashCombine(type.GetHashCode(), index, generation);
public static bool operator ==(Entity<TEnum> lhs, Entity<TEnum> rhs) => lhs.Equals(rhs); public static bool operator ==(Entity<TEnum> lhs, Entity<TEnum> rhs) => lhs.Equals(rhs);
public static bool operator !=(Entity<TEnum> lhs, Entity<TEnum> rhs) => !(lhs == rhs); public static bool operator !=(Entity<TEnum> lhs, Entity<TEnum> rhs) => !(lhs == rhs);

@ -35,8 +35,8 @@ namespace GameCore.TinyECS
var id2 = ComponentId.Get<T2>(); var id2 = ComponentId.Get<T2>();
meta.componentIdToIndex[id1] = 1; meta.componentIdToIndex[id1] = 1;
meta.componentIdToIndex[id2] = 2; meta.componentIdToIndex[id2] = 2;
meta.componentIdToOffset[id1] = (short)StructUtility.OffsetOf<(T1, T2), T1>(); meta.componentIdToOffset[id1] = (short)LowLevelUtility.OffsetOf<(T1, T2), T1>();
meta.componentIdToOffset[id2] = (short)StructUtility.OffsetOf<(T1, T2), T2>(); meta.componentIdToOffset[id2] = (short)LowLevelUtility.OffsetOf<(T1, T2), T2>();
meta.elementSize = UnsafeUtility.SizeOf<(T1, T2)>(); meta.elementSize = UnsafeUtility.SizeOf<(T1, T2)>();
meta.elementAlign = UnsafeUtility.AlignOf<(T2, T2)>(); meta.elementAlign = UnsafeUtility.AlignOf<(T2, T2)>();
return meta; return meta;

@ -42,6 +42,7 @@
"com.unity.modules.wind": "1.0.0", "com.unity.modules.wind": "1.0.0",
"com.unity.modules.xr": "1.0.0", "com.unity.modules.xr": "1.0.0",
"com.nimin.lowlevel": "file:../LocalPackages/com.nimin.lowlevel", "com.nimin.lowlevel": "file:../LocalPackages/com.nimin.lowlevel",
"com.nimin.tinyecs": "file:../LocalPackages/com.nimin.tinyecs" "com.nimin.tinyecs": "file:../LocalPackages/com.nimin.tinyecs",
"com.nimin.network": "file:../LocalPackages/com.nimin.network"
} }
} }

@ -9,6 +9,14 @@
"com.unity.burst": "1.8.1" "com.unity.burst": "1.8.1"
} }
}, },
"com.nimin.network": {
"version": "file:../LocalPackages/com.nimin.network",
"depth": 0,
"source": "local",
"dependencies": {
"com.unity.transport": "1.0.0"
}
},
"com.nimin.tinyecs": { "com.nimin.tinyecs": {
"version": "file:../LocalPackages/com.nimin.tinyecs", "version": "file:../LocalPackages/com.nimin.tinyecs",
"depth": 0, "depth": 0,
@ -18,13 +26,14 @@
} }
}, },
"com.unity.burst": { "com.unity.burst": {
"version": "1.8.1", "version": "1.8.21",
"depth": 1, "depth": 1,
"source": "registry", "source": "registry",
"dependencies": { "dependencies": {
"com.unity.mathematics": "1.2.1" "com.unity.mathematics": "1.2.1",
"com.unity.modules.jsonserialize": "1.0.0"
}, },
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.collab-proxy": { "com.unity.collab-proxy": {
"version": "1.17.1", "version": "1.17.1",
@ -33,7 +42,7 @@
"dependencies": { "dependencies": {
"com.unity.services.core": "1.0.1" "com.unity.services.core": "1.0.1"
}, },
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.collections": { "com.unity.collections": {
"version": "1.2.4", "version": "1.2.4",
@ -43,120 +52,120 @@
"com.unity.burst": "1.6.6", "com.unity.burst": "1.6.6",
"com.unity.test-framework": "1.1.31" "com.unity.test-framework": "1.1.31"
}, },
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.editorcoroutines": { "com.unity.editorcoroutines": {
"version": "1.0.0", "version": "1.0.0",
"depth": 1, "depth": 1,
"source": "registry", "source": "registry",
"dependencies": {}, "dependencies": {},
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.ext.nunit": { "com.unity.ext.nunit": {
"version": "1.0.6", "version": "1.0.6",
"depth": 1, "depth": 1,
"source": "registry", "source": "registry",
"dependencies": {}, "dependencies": {},
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.feature.development": { "com.unity.feature.development": {
"version": "1.0.1", "version": "1.0.1",
"depth": 0, "depth": 0,
"source": "builtin", "source": "builtin",
"dependencies": { "dependencies": {
"com.unity.ide.visualstudio": "2.0.16", "com.unity.ide.visualstudio": "2.0.22",
"com.unity.ide.rider": "3.0.15", "com.unity.ide.rider": "3.0.36",
"com.unity.ide.vscode": "1.2.5", "com.unity.ide.vscode": "1.2.5",
"com.unity.editorcoroutines": "1.0.0", "com.unity.editorcoroutines": "1.0.0",
"com.unity.performance.profile-analyzer": "1.1.1", "com.unity.performance.profile-analyzer": "1.2.3",
"com.unity.test-framework": "1.1.31", "com.unity.test-framework": "1.1.33",
"com.unity.testtools.codecoverage": "1.0.1" "com.unity.testtools.codecoverage": "1.2.6"
} }
}, },
"com.unity.ide.rider": { "com.unity.ide.rider": {
"version": "3.0.15", "version": "3.0.36",
"depth": 0, "depth": 1,
"source": "registry", "source": "registry",
"dependencies": { "dependencies": {
"com.unity.ext.nunit": "1.0.6" "com.unity.ext.nunit": "1.0.6"
}, },
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.ide.visualstudio": { "com.unity.ide.visualstudio": {
"version": "2.0.16", "version": "2.0.22",
"depth": 0, "depth": 1,
"source": "registry", "source": "registry",
"dependencies": { "dependencies": {
"com.unity.test-framework": "1.1.9" "com.unity.test-framework": "1.1.9"
}, },
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.ide.vscode": { "com.unity.ide.vscode": {
"version": "1.2.5", "version": "1.2.5",
"depth": 0, "depth": 0,
"source": "registry", "source": "registry",
"dependencies": {}, "dependencies": {},
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.mathematics": { "com.unity.mathematics": {
"version": "1.2.6", "version": "1.2.6",
"depth": 2, "depth": 2,
"source": "registry", "source": "registry",
"dependencies": {}, "dependencies": {},
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.nuget.newtonsoft-json": { "com.unity.nuget.newtonsoft-json": {
"version": "3.0.2", "version": "3.2.1",
"depth": 2, "depth": 2,
"source": "registry", "source": "registry",
"dependencies": {}, "dependencies": {},
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.performance.profile-analyzer": { "com.unity.performance.profile-analyzer": {
"version": "1.1.1", "version": "1.2.3",
"depth": 1, "depth": 1,
"source": "registry", "source": "registry",
"dependencies": {}, "dependencies": {},
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.services.core": { "com.unity.services.core": {
"version": "1.4.2", "version": "1.14.0",
"depth": 1, "depth": 1,
"source": "registry", "source": "registry",
"dependencies": { "dependencies": {
"com.unity.modules.unitywebrequest": "1.0.0", "com.unity.modules.androidjni": "1.0.0",
"com.unity.nuget.newtonsoft-json": "3.0.2", "com.unity.nuget.newtonsoft-json": "3.2.1",
"com.unity.modules.androidjni": "1.0.0" "com.unity.modules.unitywebrequest": "1.0.0"
}, },
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.settings-manager": { "com.unity.settings-manager": {
"version": "1.0.3", "version": "2.1.0",
"depth": 2, "depth": 2,
"source": "registry", "source": "registry",
"dependencies": {}, "dependencies": {},
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.test-framework": { "com.unity.test-framework": {
"version": "1.1.31", "version": "1.1.33",
"depth": 0, "depth": 1,
"source": "registry", "source": "registry",
"dependencies": { "dependencies": {
"com.unity.ext.nunit": "1.0.6", "com.unity.ext.nunit": "1.0.6",
"com.unity.modules.imgui": "1.0.0", "com.unity.modules.imgui": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0" "com.unity.modules.jsonserialize": "1.0.0"
}, },
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.testtools.codecoverage": { "com.unity.testtools.codecoverage": {
"version": "1.0.1", "version": "1.2.6",
"depth": 1, "depth": 1,
"source": "registry", "source": "registry",
"dependencies": { "dependencies": {
"com.unity.test-framework": "1.0.16", "com.unity.test-framework": "1.0.16",
"com.unity.settings-manager": "1.0.1" "com.unity.settings-manager": "1.0.1"
}, },
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.textmeshpro": { "com.unity.textmeshpro": {
"version": "3.0.6", "version": "3.0.6",
@ -165,19 +174,30 @@
"dependencies": { "dependencies": {
"com.unity.ugui": "1.0.0" "com.unity.ugui": "1.0.0"
}, },
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.timeline": { "com.unity.timeline": {
"version": "1.6.4", "version": "1.6.4",
"depth": 0, "depth": 0,
"source": "registry", "source": "registry",
"dependencies": { "dependencies": {
"com.unity.modules.audio": "1.0.0",
"com.unity.modules.director": "1.0.0", "com.unity.modules.director": "1.0.0",
"com.unity.modules.animation": "1.0.0", "com.unity.modules.animation": "1.0.0",
"com.unity.modules.audio": "1.0.0",
"com.unity.modules.particlesystem": "1.0.0" "com.unity.modules.particlesystem": "1.0.0"
}, },
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
},
"com.unity.transport": {
"version": "1.5.0",
"depth": 1,
"source": "registry",
"dependencies": {
"com.unity.burst": "1.6.6",
"com.unity.collections": "1.2.4",
"com.unity.mathematics": "1.2.6"
},
"url": "https://packages.unity.com"
}, },
"com.unity.ugui": { "com.unity.ugui": {
"version": "1.0.0", "version": "1.0.0",
@ -196,7 +216,7 @@
"com.unity.ugui": "1.0.0", "com.unity.ugui": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0" "com.unity.modules.jsonserialize": "1.0.0"
}, },
"url": "https://packages.unity.cn" "url": "https://packages.unity.com"
}, },
"com.unity.modules.ai": { "com.unity.modules.ai": {
"version": "1.0.0", "version": "1.0.0",
@ -330,17 +350,6 @@
"version": "1.0.0", "version": "1.0.0",
"depth": 0, "depth": 0,
"source": "builtin", "source": "builtin",
"dependencies": {
"com.unity.modules.ui": "1.0.0",
"com.unity.modules.imgui": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0",
"com.unity.modules.uielementsnative": "1.0.0"
}
},
"com.unity.modules.uielementsnative": {
"version": "1.0.0",
"depth": 1,
"source": "builtin",
"dependencies": { "dependencies": {
"com.unity.modules.ui": "1.0.0", "com.unity.modules.ui": "1.0.0",
"com.unity.modules.imgui": "1.0.0", "com.unity.modules.imgui": "1.0.0",

@ -13,23 +13,24 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_EnablePreReleasePackages: 0 m_EnablePreReleasePackages: 0
m_EnablePackageDependencies: 0
m_AdvancedSettingsExpanded: 1 m_AdvancedSettingsExpanded: 1
m_ScopedRegistriesSettingsExpanded: 1 m_ScopedRegistriesSettingsExpanded: 1
m_SeeAllPackageVersions: 0 m_SeeAllPackageVersions: 0
m_DismissPreviewPackagesInUse: 0
oneTimeWarningShown: 0 oneTimeWarningShown: 0
m_Registries: m_Registries:
- m_Id: main - m_Id: main
m_Name: m_Name:
m_Url: https://packages.unity.cn m_Url: https://packages.unity.com
m_Scopes: [] m_Scopes: []
m_IsDefault: 1 m_IsDefault: 1
m_Capabilities: 7 m_Capabilities: 7
m_ConfigSource: 0
m_UserSelectedRegistryName: m_UserSelectedRegistryName:
m_UserAddingNewScopedRegistry: 0 m_UserAddingNewScopedRegistry: 0
m_RegistryInfoDraft: m_RegistryInfoDraft:
m_Modified: 0 m_Modified: 0
m_ErrorMessage: m_ErrorMessage:
m_UserModificationsInstanceId: -832 m_UserModificationsInstanceId: -854
m_OriginalInstanceId: -834 m_OriginalInstanceId: -856
m_LoadAssets: 0 m_LoadAssets: 0

@ -1,6 +1,4 @@
{ {
"m_Name": "Settings",
"m_Path": "ProjectSettings/Packages/com.unity.testtools.codecoverage/Settings.json",
"m_Dictionary": { "m_Dictionary": {
"m_DictionaryValues": [] "m_DictionaryValues": []
} }

@ -1,2 +1,2 @@
m_EditorVersion: 2021.3.8f1c1 m_EditorVersion: 2022.3.62f2
m_EditorVersionWithRevision: 2021.3.8f1c1 (c20728c1e961) m_EditorVersionWithRevision: 2022.3.62f2 (7670c08855a9)

@ -0,0 +1,2 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ASystem_002Ecs_002Fl_003AC_0021_003FUsers_003Fsunqinzhe_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F3ea01e77be99618395f448b16bd7cc2bd4248bd9e5d8474964b2d97f39c5d74_003FSystem_002Ecs/@EntryIndexedValue">ForceIncluded</s:String></wpf:ResourceDictionary>
Loading…
Cancel
Save