text
stringlengths
7
35.3M
id
stringlengths
11
185
metadata
dict
__index_level_0__
int64
0
2.14k
using System; using System.Collections.Generic; namespace ET { public class EntitySystem { private readonly Queue<EntityRef<Entity>>[] queues = new Queue<EntityRef<Entity>>[InstanceQueueIndex.Max]; public EntitySystem() { for (int i = 0; i < this.queues.Length; i++) { this.queues[i] = new Queue<EntityRef<Entity>>(); } } public virtual void RegisterSystem(Entity component) { Type type = component.GetType(); TypeSystems.OneTypeSystems oneTypeSystems = EntitySystemSingleton.Instance.TypeSystems.GetOneTypeSystems(type); if (oneTypeSystems == null) { return; } for (int i = 0; i < oneTypeSystems.QueueFlag.Length; ++i) { if (!oneTypeSystems.QueueFlag[i]) { continue; } this.queues[i].Enqueue(component); } } public void Update() { Queue<EntityRef<Entity>> queue = this.queues[InstanceQueueIndex.Update]; int count = queue.Count; while (count-- > 0) { Entity component = queue.Dequeue(); if (component == null) { continue; } if (component.IsDisposed) { continue; } if (component is not IUpdate) { continue; } try { List<SystemObject> iUpdateSystems = EntitySystemSingleton.Instance.TypeSystems.GetSystems(component.GetType(), typeof (IUpdateSystem)); if (iUpdateSystems == null) { continue; } queue.Enqueue(component); foreach (IUpdateSystem iUpdateSystem in iUpdateSystems) { try { iUpdateSystem.Run(component); } catch (Exception e) { Log.Error(e); } } } catch (Exception e) { throw new Exception($"entity system update fail: {component.GetType().FullName}", e); } } } public void LateUpdate() { Queue<EntityRef<Entity>> queue = this.queues[InstanceQueueIndex.LateUpdate]; int count = queue.Count; while (count-- > 0) { Entity component = queue.Dequeue(); if (component == null) { continue; } if (component.IsDisposed) { continue; } if (component is not ILateUpdate) { continue; } List<SystemObject> iLateUpdateSystems = EntitySystemSingleton.Instance.TypeSystems.GetSystems(component.GetType(), typeof (ILateUpdateSystem)); if (iLateUpdateSystems == null) { continue; } queue.Enqueue(component); foreach (ILateUpdateSystem iLateUpdateSystem in iLateUpdateSystems) { try { iLateUpdateSystem.Run(component); } catch (Exception e) { Log.Error(e); } } } } } }
ET/Unity/Assets/Scripts/Core/Fiber/EntitySystem.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/Core/Fiber/EntitySystem.cs", "repo_id": "ET", "token_count": 2429 }
100
using System.Collections.Generic; namespace ET { [ComponentOf(typeof(Scene))] public class ProcessInnerSender: Entity, IAwake, IDestroy, IUpdate { public const long TIMEOUT_TIME = 40 * 1000; public int RpcId; public readonly Dictionary<int, MessageSenderStruct> requestCallback = new(); public readonly List<MessageInfo> list = new(); } }
ET/Unity/Assets/Scripts/Core/Fiber/Module/Actor/ProcessInnerSender.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/Core/Fiber/Module/Actor/ProcessInnerSender.cs", "repo_id": "ET", "token_count": 165 }
101
fileFormatVersion: 2 guid: 17b1d64d5899f124f9b5df1c2d73e687 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/Core/Fiber/Module/CoroutineLock/WaitCoroutineLock.cs.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/Core/Fiber/Module/CoroutineLock/WaitCoroutineLock.cs.meta", "repo_id": "ET", "token_count": 97 }
102
fileFormatVersion: 2 guid: 33f44962744fcd64d98b9bcd0fc41bf9 timeCreated: 1474942922 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/Core/Helper/ByteHelper.cs.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/Core/Helper/ByteHelper.cs.meta", "repo_id": "ET", "token_count": 101 }
103
fileFormatVersion: 2 guid: 3fae633c3f0136a49b65fe6e909b4851 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/Core/Helper/RandomGenerator.cs.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/Core/Helper/RandomGenerator.cs.meta", "repo_id": "ET", "token_count": 96 }
104
using System.Collections.Generic; namespace ET { public class MultiDictionary<T, M, N>: Dictionary<T, Dictionary<M, N>> { public bool TryGetDic(T t, out Dictionary<M, N> k) { return this.TryGetValue(t, out k); } public bool TryGetValue(T t, M m, out N n) { n = default; if (!this.TryGetValue(t, out Dictionary<M, N> dic)) { return false; } return dic.TryGetValue(m, out n); } public void Add(T t, M m, N n) { Dictionary<M, N> kSet; this.TryGetValue(t, out kSet); if (kSet == null) { kSet = new Dictionary<M, N>(); this[t] = kSet; } kSet.Add(m, n); } public bool Remove(T t, M m) { this.TryGetValue(t, out Dictionary<M, N> dic); if (dic == null || !dic.Remove(m)) { return false; } if (dic.Count == 0) { this.Remove(t); } return true; } public bool ContainSubKey(T t, M m) { this.TryGetValue(t, out Dictionary<M, N> dic); if (dic == null) { return false; } return dic.ContainsKey(m); } public bool ContainValue(T t, M m, N n) { this.TryGetValue(t, out Dictionary<M, N> dic); if (dic == null) { return false; } if (!dic.ContainsKey(m)) { return false; } return dic.ContainsValue(n); } } }
ET/Unity/Assets/Scripts/Core/MultiDictionary.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/Core/MultiDictionary.cs", "repo_id": "ET", "token_count": 1088 }
105
fileFormatVersion: 2 guid: c8f80bcf0bdf19f4c98ddad194e155a4 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/Core/Network/IKcpTransport.cs.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/Core/Network/IKcpTransport.cs.meta", "repo_id": "ET", "token_count": 96 }
106
fileFormatVersion: 2 guid: c86d0145bc0f3904795b74ea77da1c45 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/Core/Network/TService.cs.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/Core/Network/TService.cs.meta", "repo_id": "ET", "token_count": 94 }
107
namespace ET { public abstract class SystemObject: Object { } }
ET/Unity/Assets/Scripts/Core/Object/SystemObject.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/Core/Object/SystemObject.cs", "repo_id": "ET", "token_count": 31 }
108
fileFormatVersion: 2 guid: 747fe7a9303dd3a40b5385d5a58ffbef MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/Core/UnOrderMultiMap.cs.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/Core/UnOrderMultiMap.cs.meta", "repo_id": "ET", "token_count": 95 }
109
using System; namespace ET { public class MessageHandlerAttribute: BaseAttribute { public SceneType SceneType { get; } public MessageHandlerAttribute(SceneType sceneType) { this.SceneType = sceneType; } } }
ET/Unity/Assets/Scripts/Core/World/Module/Actor/MessageHandlerAttribute.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/Core/World/Module/Actor/MessageHandlerAttribute.cs", "repo_id": "ET", "token_count": 110 }
110
namespace ET { /// <summary> /// 每个Config的基类 /// </summary> public interface IConfig { int Id { get; set; } } }
ET/Unity/Assets/Scripts/Core/World/Module/Config/IConfig.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/Core/World/Module/Config/IConfig.cs", "repo_id": "ET", "token_count": 61 }
111
fileFormatVersion: 2 guid: 31ef4af33bd048f49b0b9b0d9a9a0547 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/Core/World/Module/EventSystem/InvokeAttribute.cs.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/Core/World/Module/EventSystem/InvokeAttribute.cs.meta", "repo_id": "ET", "token_count": 97 }
112
fileFormatVersion: 2 guid: 7e3e2aed9e0845edb35993d7496f871f timeCreated: 1687098052
ET/Unity/Assets/Scripts/Core/World/Module/IdGenerater.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/Core/World/Module/IdGenerater.meta", "repo_id": "ET", "token_count": 41 }
113
using CommandLine; using System; using System.Collections.Generic; namespace ET { public enum AppType { Server, Watcher, // 每台物理机一个守护进程,用来启动该物理机上的所有进程 GameTool, ExcelExporter, Proto2CS, BenchmarkClient, BenchmarkServer, Demo, LockStep, } public class Options: Singleton<Options> { [Option("AppType", Required = false, Default = AppType.Server, HelpText = "AppType enum")] public AppType AppType { get; set; } [Option("StartConfig", Required = false, Default = "StartConfig/Localhost")] public string StartConfig { get; set; } [Option("Process", Required = false, Default = 1)] public int Process { get; set; } [Option("Develop", Required = false, Default = 0, HelpText = "develop mode, 0正式 1开发 2压测")] public int Develop { get; set; } [Option("LogLevel", Required = false, Default = 0)] public int LogLevel { get; set; } [Option("Console", Required = false, Default = 0)] public int Console { get; set; } } }
ET/Unity/Assets/Scripts/Core/World/Module/Options/Options.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/Core/World/Module/Options/Options.cs", "repo_id": "ET", "token_count": 532 }
114
using System.IO; using System.Text.RegularExpressions; using System.Xml; using UnityEditor; using UnityEngine; namespace ET { public class OnGenerateCSProjectProcessor: AssetPostprocessor { /// <summary> /// 对生成的C#项目文件(.csproj)进行处理 /// 文档:https://learn.microsoft.com/zh-cn/visualstudio/gamedev/unity/extensibility/customize-project-files-created-by-vstu#%E6%A6%82%E8%A7%88 /// </summary> public static string OnGeneratedCSProject(string path, string content) { GlobalConfig globalConfig = Resources.Load<GlobalConfig>("GlobalConfig"); // 判空原因:初次打开工程时会加载失败, 因为此时Unity的资源数据库(AssetDatabase)还未完成初始化 BuildType buildType = globalConfig != null? globalConfig.BuildType : BuildType.Release; if (buildType == BuildType.Release) { content = content.Replace("<Optimize>false</Optimize>", "<Optimize>true</Optimize>"); content = content.Replace(";DEBUG;", ";"); } if (path.EndsWith("Unity.Core.csproj")) { return GenerateCustomProject(content); } if (path.EndsWith("Unity.Model.csproj") || path.EndsWith("Unity.Hotfix.csproj")) { return AddCopyAfterBuild(GenerateCustomProject(content)); } if (path.EndsWith("Unity.ModelView.csproj") || path.EndsWith("Unity.HotfixView.csproj")) { return AddCopyAfterBuild(GenerateCustomProject(content)); } return content; } /// <summary> /// 对生成的解决方案文件(.sln)进行处理, 此处主要为了隐藏一些没有作用的C#项目 /// </summary> public static string OnGeneratedSlnSolution(string _, string content) { // Client content = HideCSProject(content, "Ignore.Generate.Client.csproj"); content = HideCSProject(content, "Ignore.Model.Client.csproj"); content = HideCSProject(content, "Ignore.Hotfix.Client.csproj"); content = HideCSProject(content, "Ignore.ModelView.Client.csproj"); content = HideCSProject(content, "Ignore.HotfixView.Client.csproj"); // Server content = HideCSProject(content, "Ignore.Generate.Server.csproj"); content = HideCSProject(content, "Ignore.Model.Server.csproj"); content = HideCSProject(content, "Ignore.Hotfix.Server.csproj"); // ClientServer content = HideCSProject(content, "Ignore.Generate.ClientServer.csproj"); return content; } /// <summary> /// 自定义C#项目配置 /// 参考链接: /// https://zhuanlan.zhihu.com/p/509046784 /// https://learn.microsoft.com/zh-cn/visualstudio/ide/reference/build-events-page-project-designer-csharp?view=vs-2022 /// https://learn.microsoft.com/zh-cn/visualstudio/ide/how-to-specify-build-events-csharp?view=vs-2022 /// </summary> static string GenerateCustomProject(string content) { XmlDocument doc = new(); doc.LoadXml(content); var newDoc = doc.Clone() as XmlDocument; var rootNode = newDoc.GetElementsByTagName("Project")[0]; // 添加分析器引用 { XmlElement itemGroup = newDoc.CreateElement("ItemGroup", newDoc.DocumentElement.NamespaceURI); var projectReference = newDoc.CreateElement("ProjectReference", newDoc.DocumentElement.NamespaceURI); projectReference.SetAttribute("Include", @"..\Share\Analyzer\Share.Analyzer.csproj"); projectReference.SetAttribute("OutputItemType", @"Analyzer"); projectReference.SetAttribute("ReferenceOutputAssembly", @"false"); var project = newDoc.CreateElement("Project", newDoc.DocumentElement.NamespaceURI); project.InnerText = @"{d1f2986b-b296-4a2d-8f12-be9f470014c3}"; projectReference.AppendChild(project); var name = newDoc.CreateElement("Name", newDoc.DocumentElement.NamespaceURI); name.InnerText = "Analyzer"; projectReference.AppendChild(name); itemGroup.AppendChild(projectReference); rootNode.AppendChild(itemGroup); } // AfterBuild(字符串替换后作用是编译后复制到CodeDir) { var target = newDoc.CreateElement("Target", newDoc.DocumentElement.NamespaceURI); target.SetAttribute("Name", "AfterBuild"); rootNode.AppendChild(target); } using StringWriter sw = new(); using XmlTextWriter tx = new(sw); tx.Formatting = Formatting.Indented; newDoc.WriteTo(tx); tx.Flush(); return sw.GetStringBuilder().ToString(); } /// <summary> /// 编译dll文件后额外复制的目录配置 /// </summary> static string AddCopyAfterBuild(string content) { return content.Replace("<Target Name=\"AfterBuild\" />", "<Target Name=\"PostBuild\" AfterTargets=\"PostBuildEvent\">\n" + $" <Copy SourceFiles=\"$(TargetDir)/$(TargetName).dll\" DestinationFiles=\"$(ProjectDir)/{Define.CodeDir}/$(TargetName).dll.bytes\" ContinueOnError=\"false\" />\n" + $" <Copy SourceFiles=\"$(TargetDir)/$(TargetName).pdb\" DestinationFiles=\"$(ProjectDir)/{Define.CodeDir}/$(TargetName).pdb.bytes\" ContinueOnError=\"false\" />\n" + $" <Copy SourceFiles=\"$(TargetDir)/$(TargetName).dll\" DestinationFiles=\"$(ProjectDir)/{Define.BuildOutputDir}/$(TargetName).dll\" ContinueOnError=\"false\" />\n" + $" <Copy SourceFiles=\"$(TargetDir)/$(TargetName).pdb\" DestinationFiles=\"$(ProjectDir)/{Define.BuildOutputDir}/$(TargetName).pdb\" ContinueOnError=\"false\" />\n" + " </Target>\n"); } /// <summary> /// 隐藏指定项目 /// </summary> static string HideCSProject(string content, string projectName) { return Regex.Replace(content, $"Project.*{projectName}.*\nEndProject", string.Empty); } } }
ET/Unity/Assets/Scripts/Editor/AssetPostProcessor/OnGenerateCSProjectProcessor.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/Editor/AssetPostProcessor/OnGenerateCSProjectProcessor.cs", "repo_id": "ET", "token_count": 3043 }
115
fileFormatVersion: 2 guid: e8022a6e902073946b421230f287c214 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/Editor/ComponentViewEditor/TypeDrawer/BoolTypeDrawer.cs.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/Editor/ComponentViewEditor/TypeDrawer/BoolTypeDrawer.cs.meta", "repo_id": "ET", "token_count": 93 }
116
using System; using UnityEditor; namespace ET { [CustomEditor(typeof(GlobalConfig))] public class GlobalConfigEditor : Editor { private CodeMode codeMode; private BuildType buildType; private void OnEnable() { GlobalConfig globalConfig = (GlobalConfig)this.target; this.codeMode = globalConfig.CodeMode; globalConfig.BuildType = EditorUserBuildSettings.development ? BuildType.Debug : BuildType.Release; this.buildType = globalConfig.BuildType; } public override void OnInspectorGUI() { base.OnInspectorGUI(); GlobalConfig globalConfig = (GlobalConfig)this.target; if (this.codeMode != globalConfig.CodeMode) { this.codeMode = globalConfig.CodeMode; this.serializedObject.Update(); AssemblyTool.DoCompile(); } if (this.buildType != globalConfig.BuildType) { this.buildType = globalConfig.BuildType; EditorUserBuildSettings.development = this.buildType switch { BuildType.Debug => true, BuildType.Release => false, _ => throw new ArgumentOutOfRangeException() }; this.serializedObject.Update(); AssemblyTool.DoCompile(); } } } }
ET/Unity/Assets/Scripts/Editor/GlobalConfigEditor/GlobalConfigEditor.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/Editor/GlobalConfigEditor/GlobalConfigEditor.cs", "repo_id": "ET", "token_count": 694 }
117
fileFormatVersion: 2 guid: c9f874225c3c8497c80a4cb6b07cd8df folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/Editor/ToolEditor.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/Editor/ToolEditor.meta", "repo_id": "ET", "token_count": 72 }
118
using System.Threading.Tasks; namespace ET.Client { [EntitySystemOf(typeof(ClientSenderComponent))] [FriendOf(typeof(ClientSenderComponent))] public static partial class ClientSenderComponentSystem { [EntitySystem] private static void Awake(this ClientSenderComponent self) { } [EntitySystem] private static void Destroy(this ClientSenderComponent self) { self.RemoveFiberAsync().Coroutine(); } private static async ETTask RemoveFiberAsync(this ClientSenderComponent self) { if (self.fiberId == 0) { return; } int fiberId = self.fiberId; self.fiberId = 0; await FiberManager.Instance.Remove(fiberId); } public static async ETTask DisposeAsync(this ClientSenderComponent self) { await self.RemoveFiberAsync(); self.Dispose(); } public static async ETTask<long> LoginAsync(this ClientSenderComponent self, string account, string password) { self.fiberId = await FiberManager.Instance.Create(SchedulerType.ThreadPool, 0, SceneType.NetClient, ""); self.netClientActorId = new ActorId(self.Fiber().Process, self.fiberId); Main2NetClient_Login main2NetClientLogin = Main2NetClient_Login.Create(); main2NetClientLogin.OwnerFiberId = self.Fiber().Id; main2NetClientLogin.Account = account; main2NetClientLogin.Password = password; NetClient2Main_Login response = await self.Root().GetComponent<ProcessInnerSender>().Call(self.netClientActorId, main2NetClientLogin) as NetClient2Main_Login; return response.PlayerId; } public static void Send(this ClientSenderComponent self, IMessage message) { A2NetClient_Message a2NetClientMessage = A2NetClient_Message.Create(); a2NetClientMessage.MessageObject = message; self.Root().GetComponent<ProcessInnerSender>().Send(self.netClientActorId, a2NetClientMessage); } public static async ETTask<IResponse> Call(this ClientSenderComponent self, IRequest request, bool needException = true) { A2NetClient_Request a2NetClientRequest = A2NetClient_Request.Create(); a2NetClientRequest.MessageObject = request; using A2NetClient_Response a2NetClientResponse = await self.Root().GetComponent<ProcessInnerSender>().Call(self.netClientActorId, a2NetClientRequest) as A2NetClient_Response; IResponse response = a2NetClientResponse.MessageObject; if (response.Error == ErrorCore.ERR_MessageTimeout) { throw new RpcException(response.Error, $"Rpc error: request, 注意Actor消息超时,请注意查看是否死锁或者没有reply: {request}, response: {response}"); } if (needException && ErrorCore.IsRpcNeedThrowException(response.Error)) { throw new RpcException(response.Error, $"Rpc error: {request}, response: {response}"); } return response; } } }
ET/Unity/Assets/Scripts/Hotfix/Client/Demo/Main/ClientSenderComponentSystem.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/Hotfix/Client/Demo/Main/ClientSenderComponentSystem.cs", "repo_id": "ET", "token_count": 1400 }
119
fileFormatVersion: 2 guid: d7e7628945100a44193d11f6c86856fb MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/Hotfix/Client/Demo/Main/Scene/CurrentSceneFactory.cs.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/Hotfix/Client/Demo/Main/Scene/CurrentSceneFactory.cs.meta", "repo_id": "ET", "token_count": 94 }
120
fileFormatVersion: 2 guid: b9016545e3eb60946afce20928d2d34b folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/Hotfix/Client/Demo/NetClient.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/Hotfix/Client/Demo/NetClient.meta", "repo_id": "ET", "token_count": 68 }
121
using System; using System.IO; namespace ET.Client { [EntitySystemOf(typeof(LSClientUpdater))] [FriendOf(typeof (LSClientUpdater))] public static partial class LSClientUpdaterSystem { [EntitySystem] private static void Awake(this LSClientUpdater self) { Room room = self.GetParent<Room>(); self.MyId = room.Root().GetComponent<PlayerComponent>().MyId; } [EntitySystem] private static void Update(this LSClientUpdater self) { Room room = self.GetParent<Room>(); long timeNow = TimeInfo.Instance.ServerNow(); Scene root = room.Root(); int i = 0; while (true) { if (timeNow < room.FixedTimeCounter.FrameTime(room.PredictionFrame + 1)) { return; } // 最多只预测5帧 if (room.PredictionFrame - room.AuthorityFrame > 5) { return; } ++room.PredictionFrame; OneFrameInputs oneFrameInputs = self.GetOneFrameMessages(room.PredictionFrame); room.Update(oneFrameInputs); room.SendHash(room.PredictionFrame); room.SpeedMultiply = ++i; FrameMessage frameMessage = FrameMessage.Create(); frameMessage.Frame = room.PredictionFrame; frameMessage.Input = self.Input; root.GetComponent<ClientSenderComponent>().Send(frameMessage); long timeNow2 = TimeInfo.Instance.ServerNow(); if (timeNow2 - timeNow > 5) { break; } } } private static OneFrameInputs GetOneFrameMessages(this LSClientUpdater self, int frame) { Room room = self.GetParent<Room>(); FrameBuffer frameBuffer = room.FrameBuffer; if (frame <= room.AuthorityFrame) { return frameBuffer.FrameInputs(frame); } // predict OneFrameInputs predictionFrame = frameBuffer.FrameInputs(frame); frameBuffer.MoveForward(frame); if (frameBuffer.CheckFrame(room.AuthorityFrame)) { OneFrameInputs authorityFrame = frameBuffer.FrameInputs(room.AuthorityFrame); authorityFrame.CopyTo(predictionFrame); } predictionFrame.Inputs[self.MyId] = self.Input; return predictionFrame; } } }
ET/Unity/Assets/Scripts/Hotfix/Client/LockStep/LSClientUpdaterSystem.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/Hotfix/Client/LockStep/LSClientUpdaterSystem.cs", "repo_id": "ET", "token_count": 1438 }
122
namespace ET.Client { [EntitySystemOf(typeof(ClientSessionErrorComponent))] public static partial class ClientSessionErrorComponentSystem { [EntitySystem] private static void Awake(this ClientSessionErrorComponent self) { } [EntitySystem] private static void Destroy(this ClientSessionErrorComponent self) { Fiber fiber = self.Fiber(); if (fiber.IsDisposed) { return; } NetClient2Main_SessionDispose message = NetClient2Main_SessionDispose.Create(); message.Error = self.GetParent<Session>().Error; fiber.Root.GetComponent<ProcessInnerSender>().Send(new ActorId(fiber.Process, ConstFiberId.Main), message); } } }
ET/Unity/Assets/Scripts/Hotfix/Client/Module/Message/ClientSessionErrorComponentSystem.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/Hotfix/Client/Module/Message/ClientSessionErrorComponentSystem.cs", "repo_id": "ET", "token_count": 353 }
123
using System.Net; using System.Net.Sockets; using ET.Client; namespace ET.Server { [Invoke((long)SceneType.BenchmarkClient)] public class FiberInit_BenchmarkClient: AInvokeHandler<FiberInit, ETTask> { public override async ETTask Handle(FiberInit fiberInit) { Scene root = fiberInit.Fiber.Root; //root.AddComponent<MailBoxComponent, MailBoxType>(MailBoxType.UnOrderedMessage); //root.AddComponent<TimerComponent>(); //root.AddComponent<CoroutineLockComponent>(); //root.AddComponent<ActorInnerComponent>(); //root.AddComponent<PlayerComponent>(); //root.AddComponent<GateSessionKeyComponent>(); //root.AddComponent<LocationProxyComponent>(); //root.AddComponent<ActorLocationSenderComponent>(); root.AddComponent<NetComponent, AddressFamily, NetworkProtocol>(AddressFamily.InterNetwork, NetworkProtocol.UDP); root.AddComponent<BenchmarkClientComponent>(); await ETTask.CompletedTask; } } }
ET/Unity/Assets/Scripts/Hotfix/Server/Benchmark/FiberInit_BenchmarkClient.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/Hotfix/Server/Benchmark/FiberInit_BenchmarkClient.cs", "repo_id": "ET", "token_count": 429 }
124
fileFormatVersion: 2 guid: 3eed1c782eb930d41aa33b6967a6b344 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/Hotfix/Server/Demo/Gate/PlayerSystem.cs.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/Hotfix/Server/Demo/Gate/PlayerSystem.cs.meta", "repo_id": "ET", "token_count": 93 }
125
namespace ET.Server { // 进入视野通知 [Event(SceneType.Map)] public class UnitEnterSightRange_NotifyClient: AEvent<Scene, UnitEnterSightRange> { protected override async ETTask Run(Scene scene, UnitEnterSightRange args) { AOIEntity a = args.A; AOIEntity b = args.B; if (a.Id == b.Id) { return; } Unit ua = a.GetParent<Unit>(); if (ua.Type() != UnitType.Player) { return; } Unit ub = b.GetParent<Unit>(); MapMessageHelper.NoticeUnitAdd(ua, ub); await ETTask.CompletedTask; } } }
ET/Unity/Assets/Scripts/Hotfix/Server/Demo/Map/Unit/UnitEnterSightRange_NotifyClient.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/Hotfix/Server/Demo/Map/Unit/UnitEnterSightRange_NotifyClient.cs", "repo_id": "ET", "token_count": 407 }
126
fileFormatVersion: 2 guid: cb7be8a992c4c8e4f9c54c0543834360 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/Hotfix/Server/Demo/Realm/RealmGateAddressHelper.cs.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/Hotfix/Server/Demo/Realm/RealmGateAddressHelper.cs.meta", "repo_id": "ET", "token_count": 97 }
127
fileFormatVersion: 2 guid: 5ca381a4c6ce9b64ebd6f0497f8ebdee folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/Hotfix/Server/Demo/Watcher.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/Hotfix/Server/Demo/Watcher.meta", "repo_id": "ET", "token_count": 72 }
128
using System; using System.Collections.Generic; namespace ET.Server { [MessageHandler(SceneType.RoomRoot)] public class FrameMessageHandler: MessageHandler<Scene, FrameMessage> { protected override async ETTask Run(Scene root, FrameMessage message) { using FrameMessage _ = message; // 让消息回到池中 Room room = root.GetComponent<Room>(); FrameBuffer frameBuffer = room.FrameBuffer; if (message.Frame % (1000 / LSConstValue.UpdateInterval) == 0) { long nowFrameTime = room.FixedTimeCounter.FrameTime(message.Frame); int diffTime = (int)(nowFrameTime - TimeInfo.Instance.ServerFrameTime()); Room2C_AdjustUpdateTime room2CAdjustUpdateTime = Room2C_AdjustUpdateTime.Create(); room2CAdjustUpdateTime.DiffTime = diffTime; room.Root().GetComponent<MessageLocationSenderComponent>().Get(LocationType.GateSession).Send(message.PlayerId, room2CAdjustUpdateTime); } if (message.Frame < room.AuthorityFrame) // 小于AuthorityFrame,丢弃 { Log.Warning($"FrameMessage < AuthorityFrame discard: {message}"); return; } if (message.Frame > room.AuthorityFrame + 10) // 大于AuthorityFrame + 10,丢弃 { Log.Warning($"FrameMessage > AuthorityFrame + 10 discard: {message}"); return; } OneFrameInputs oneFrameInputs = frameBuffer.FrameInputs(message.Frame); if (oneFrameInputs == null) { Log.Error($"FrameMessageHandler get frame is null: {message.Frame}, max frame: {frameBuffer.MaxFrame}"); return; } oneFrameInputs.Inputs[message.PlayerId] = message.Input; await ETTask.CompletedTask; } } }
ET/Unity/Assets/Scripts/Hotfix/Server/LockStep/Map/FrameMessageHandler.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/Hotfix/Server/LockStep/Map/FrameMessageHandler.cs", "repo_id": "ET", "token_count": 893 }
129
namespace ET.Server { [MessageHandler(SceneType.RoomRoot)] public class C2Room_CheckHashHandler: MessageHandler<Scene, C2Room_CheckHash> { protected override async ETTask Run(Scene root, C2Room_CheckHash message) { Room room = root.GetComponent<Room>(); long hash = room.FrameBuffer.GetHash(message.Frame); if (message.Hash != hash) { byte[] bytes = room.FrameBuffer.Snapshot(message.Frame).ToArray(); Room2C_CheckHashFail room2CCheckHashFail = Room2C_CheckHashFail.Create(); room2CCheckHashFail.Frame = message.Frame; room2CCheckHashFail.LSWorldBytes = bytes; room.Root().GetComponent<MessageLocationSenderComponent>().Get(LocationType.GateSession).Send(message.PlayerId, room2CCheckHashFail); } await ETTask.CompletedTask; } } }
ET/Unity/Assets/Scripts/Hotfix/Server/LockStep/Room/C2Room_CheckHashHandler.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/Hotfix/Server/LockStep/Room/C2Room_CheckHashHandler.cs", "repo_id": "ET", "token_count": 407 }
130
using System.Collections.Generic; namespace ET.Server { [FriendOf(typeof(AOIManagerComponent))] [FriendOf(typeof(AOIEntity))] [FriendOf(typeof(Cell))] public static partial class AOIManagerComponentSystem { public static void Add(this AOIManagerComponent self, AOIEntity aoiEntity, float x, float y) { int cellX = (int)(x * 1000) / AOIManagerComponent.CellSize; int cellY = (int)(y * 1000) / AOIManagerComponent.CellSize; if (aoiEntity.ViewDistance == 0) { aoiEntity.ViewDistance = 1; } AOIHelper.CalcEnterAndLeaveCell(aoiEntity, cellX, cellY, aoiEntity.SubEnterCells, aoiEntity.SubLeaveCells); // 遍历EnterCell foreach (long cellId in aoiEntity.SubEnterCells) { Cell cell = self.GetCell(cellId); aoiEntity.SubEnter(cell); } // 遍历LeaveCell foreach (long cellId in aoiEntity.SubLeaveCells) { Cell cell = self.GetCell(cellId); aoiEntity.SubLeave(cell); } // 自己加入的Cell Cell selfCell = self.GetCell(AOIHelper.CreateCellId(cellX, cellY)); aoiEntity.Cell = selfCell; selfCell.Add(aoiEntity); // 通知订阅该Cell Enter的Unit foreach (KeyValuePair<long, EntityRef<AOIEntity>> kv in selfCell.SubsEnterEntities) { AOIEntity e = kv.Value; e.EnterSight(aoiEntity); } } public static void Remove(this AOIManagerComponent self, AOIEntity aoiEntity) { if (aoiEntity.Cell == null) { return; } // 通知订阅该Cell Leave的Unit aoiEntity.Cell.Remove(aoiEntity); foreach (KeyValuePair<long, EntityRef<AOIEntity>> kv in aoiEntity.Cell.SubsLeaveEntities) { AOIEntity e = kv.Value; e?.LeaveSight(aoiEntity); } // 通知自己订阅的Enter Cell,清理自己 foreach (long cellId in aoiEntity.SubEnterCells) { Cell cell = self.GetCell(cellId); aoiEntity.UnSubEnter(cell); } foreach (long cellId in aoiEntity.SubLeaveCells) { Cell cell = self.GetCell(cellId); aoiEntity.UnSubLeave(cell); } // 检查 if (aoiEntity.SeeUnits.Count > 1) { Log.Error($"aoiEntity has see units: {aoiEntity.SeeUnits.Count}"); } if (aoiEntity.BeSeeUnits.Count > 1) { Log.Error($"aoiEntity has beSee units: {aoiEntity.BeSeeUnits.Count}"); } } private static Cell GetCell(this AOIManagerComponent self, long cellId) { Cell cell = self.GetChild<Cell>(cellId); if (cell == null) { cell = self.AddChildWithId<Cell>(cellId); } return cell; } public static void Move(AOIEntity aoiEntity, Cell newCell, Cell preCell) { aoiEntity.Cell = newCell; preCell.Remove(aoiEntity); newCell.Add(aoiEntity); // 通知订阅该newCell Enter的Unit foreach (KeyValuePair<long, EntityRef<AOIEntity>> kv in newCell.SubsEnterEntities) { AOIEntity e = kv.Value; if (e.SubEnterCells.Contains(preCell.Id)) { continue; } e.EnterSight(aoiEntity); } // 通知订阅preCell leave的Unit foreach (KeyValuePair<long, EntityRef<AOIEntity>> kv in preCell.SubsLeaveEntities) { // 如果新的cell仍然在对方订阅的subleave中 AOIEntity e = kv.Value; if (e.SubLeaveCells.Contains(newCell.Id)) { continue; } e.LeaveSight(aoiEntity); } } public static void Move(this AOIManagerComponent self, AOIEntity aoiEntity, int cellX, int cellY) { long newCellId = AOIHelper.CreateCellId(cellX, cellY); if (aoiEntity.Cell.Id == newCellId) // cell没有变化 { return; } // 自己加入新的Cell Cell newCell = self.GetCell(newCellId); Move(aoiEntity, newCell, aoiEntity.Cell); AOIHelper.CalcEnterAndLeaveCell(aoiEntity, cellX, cellY, aoiEntity.enterHashSet, aoiEntity.leaveHashSet); // 算出自己leave新Cell foreach (long cellId in aoiEntity.leaveHashSet) { if (aoiEntity.SubLeaveCells.Contains(cellId)) { continue; } Cell cell = self.GetCell(cellId); aoiEntity.SubLeave(cell); } // 算出需要通知离开的Cell aoiEntity.SubLeaveCells.ExceptWith(aoiEntity.leaveHashSet); foreach (long cellId in aoiEntity.SubLeaveCells) { Cell cell = self.GetCell(cellId); aoiEntity.UnSubLeave(cell); } // 这里交换两个HashSet,提高性能 ObjectHelper.Swap(ref aoiEntity.SubLeaveCells, ref aoiEntity.leaveHashSet); // 算出自己看到的新Cell foreach (long cellId in aoiEntity.enterHashSet) { if (aoiEntity.SubEnterCells.Contains(cellId)) { continue; } Cell cell = self.GetCell(cellId); aoiEntity.SubEnter(cell); } // 离开的Enter aoiEntity.SubEnterCells.ExceptWith(aoiEntity.enterHashSet); foreach (long cellId in aoiEntity.SubEnterCells) { Cell cell = self.GetCell(cellId); aoiEntity.UnSubEnter(cell); } // 这里交换两个HashSet,提高性能 ObjectHelper.Swap(ref aoiEntity.SubEnterCells, ref aoiEntity.enterHashSet); } } }
ET/Unity/Assets/Scripts/Hotfix/Server/Module/AOI/AOIManagerComponentSystem.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/Hotfix/Server/Module/AOI/AOIManagerComponentSystem.cs", "repo_id": "ET", "token_count": 3648 }
131
fileFormatVersion: 2 guid: 5750c669ea9dbed4cbf59cfab3b435d1 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/Hotfix/Server/Module/ActorLocation/MessageLocationSenderComponentSystem.cs.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/Hotfix/Server/Module/ActorLocation/MessageLocationSenderComponentSystem.cs.meta", "repo_id": "ET", "token_count": 94 }
132
using System; namespace ET.Server { [FriendOf(typeof(DBManagerComponent))] public static partial class DBManagerComponentSystem { public static DBComponent GetZoneDB(this DBManagerComponent self, int zone) { DBComponent dbComponent = self.DBComponents[zone]; if (dbComponent != null) { return dbComponent; } StartZoneConfig startZoneConfig = StartZoneConfigCategory.Instance.Get(zone); if (startZoneConfig.DBConnection == "") { throw new Exception($"zone: {zone} not found mongo connect string"); } dbComponent = self.AddChild<DBComponent, string, string, int>(startZoneConfig.DBConnection, startZoneConfig.DBName, zone); self.DBComponents[zone] = dbComponent; return dbComponent; } } }
ET/Unity/Assets/Scripts/Hotfix/Server/Module/DB/DBManagerComponentSystem.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/Hotfix/Server/Module/DB/DBManagerComponentSystem.cs", "repo_id": "ET", "token_count": 399 }
133
fileFormatVersion: 2 guid: 104b44fc093478b4c84ca77939c9c073 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/Hotfix/Server/Plugins/Example.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/Hotfix/Server/Plugins/Example.meta", "repo_id": "ET", "token_count": 69 }
134
using System; using System.Collections.Generic; using System.IO; namespace ET { [FriendOf(typeof(Room))] public static partial class RoomSystem { public static Room Room(this Entity entity) { return entity.IScene as Room; } public static void Init(this Room self, List<LockStepUnitInfo> unitInfos, long startTime, int frame = -1) { self.StartTime = startTime; self.AuthorityFrame = frame; self.PredictionFrame = frame; self.Replay.UnitInfos = unitInfos; self.FrameBuffer = new FrameBuffer(frame); self.FixedTimeCounter = new FixedTimeCounter(self.StartTime, 0, LSConstValue.UpdateInterval); LSWorld lsWorld = self.LSWorld; lsWorld.Frame = frame + 1; lsWorld.AddComponent<LSUnitComponent>(); for (int i = 0; i < unitInfos.Count; ++i) { LockStepUnitInfo unitInfo = unitInfos[i]; LSUnitFactory.Init(lsWorld, unitInfo); self.PlayerIds.Add(unitInfo.PlayerId); } } public static void Update(this Room self, OneFrameInputs oneFrameInputs) { LSWorld lsWorld = self.LSWorld; // 设置输入到每个LSUnit身上 LSUnitComponent unitComponent = lsWorld.GetComponent<LSUnitComponent>(); foreach (var kv in oneFrameInputs.Inputs) { LSUnit lsUnit = unitComponent.GetChild<LSUnit>(kv.Key); LSInputComponent lsInputComponent = lsUnit.GetComponent<LSInputComponent>(); lsInputComponent.LSInput = kv.Value; } if (!self.IsReplay) { // 保存当前帧场景数据 self.SaveLSWorld(); self.Record(self.LSWorld.Frame); } lsWorld.Update(); } public static LSWorld GetLSWorld(this Room self, SceneType sceneType, int frame) { MemoryBuffer memoryBuffer = self.FrameBuffer.Snapshot(frame); memoryBuffer.Seek(0, SeekOrigin.Begin); LSWorld lsWorld = MemoryPackHelper.Deserialize(typeof (LSWorld), memoryBuffer) as LSWorld; lsWorld.SceneType = sceneType; memoryBuffer.Seek(0, SeekOrigin.Begin); return lsWorld; } private static void SaveLSWorld(this Room self) { int frame = self.LSWorld.Frame; MemoryBuffer memoryBuffer = self.FrameBuffer.Snapshot(frame); memoryBuffer.Seek(0, SeekOrigin.Begin); memoryBuffer.SetLength(0); MemoryPackHelper.Serialize(self.LSWorld, memoryBuffer); memoryBuffer.Seek(0, SeekOrigin.Begin); long hash = memoryBuffer.GetBuffer().Hash(0, (int) memoryBuffer.Length); self.FrameBuffer.SetHash(frame, hash); } // 记录需要存档的数据 public static void Record(this Room self, int frame) { if (frame > self.AuthorityFrame) { return; } OneFrameInputs oneFrameInputs = self.FrameBuffer.FrameInputs(frame); OneFrameInputs saveInput = OneFrameInputs.Create(); oneFrameInputs.CopyTo(saveInput); self.Replay.FrameInputs.Add(saveInput); if (frame % LSConstValue.SaveLSWorldFrameCount == 0) { MemoryBuffer memoryBuffer = self.FrameBuffer.Snapshot(frame); byte[] bytes = memoryBuffer.ToArray(); self.Replay.Snapshots.Add(bytes); } } } }
ET/Unity/Assets/Scripts/Hotfix/Share/LockStep/RoomSystem.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/Hotfix/Share/LockStep/RoomSystem.cs", "repo_id": "ET", "token_count": 1835 }
135
using System; namespace ET { [ConsoleHandler(ConsoleMode.ReloadConfig)] public class ReloadConfigConsoleHandler: IConsoleHandler { public async ETTask Run(Fiber fiber, ModeContex contex, string content) { switch (content) { case ConsoleMode.ReloadConfig: contex.Parent.RemoveComponent<ModeContex>(); Log.Console("C must have config name, like: C UnitConfig"); break; default: string[] ss = content.Split(" "); string configName = ss[1]; string category = $"{configName}Category"; Type type = CodeTypes.Instance.GetType($"ET.{category}"); if (type == null) { Log.Console($"reload config but not find {category}"); return; } await ConfigLoader.Instance.Reload(type); Log.Console($"reload config {configName} finish!"); break; } await ETTask.CompletedTask; } } }
ET/Unity/Assets/Scripts/Hotfix/Share/Module/Console/ReloadConfigConsoleHandler.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/Hotfix/Share/Module/Console/ReloadConfigConsoleHandler.cs", "repo_id": "ET", "token_count": 651 }
136
fileFormatVersion: 2 guid: e4ee1a86c772c6d42a5d25c36004720e MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/Hotfix/Share/Module/Numeric/NumericChangeEvent_NotifyWatcher.cs.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/Hotfix/Share/Module/Numeric/NumericChangeEvent_NotifyWatcher.cs.meta", "repo_id": "ET", "token_count": 97 }
137
fileFormatVersion: 2 guid: 8c25105237a61964a8a3a1398d9abe29 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/HotfixView/Client/Demo/Scene/AfterCreateCurrentScene_AddComponent.cs.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/HotfixView/Client/Demo/Scene/AfterCreateCurrentScene_AddComponent.cs.meta", "repo_id": "ET", "token_count": 94 }
138
using UnityEngine; namespace ET.Client { [UIEvent(UIType.UILobby)] public class UILobbyEvent: AUIEvent { public override async ETTask<UI> OnCreate(UIComponent uiComponent, UILayer uiLayer) { await ETTask.CompletedTask; string assetsName = $"Assets/Bundles/UI/Demo/{UIType.UILobby}.prefab"; GameObject bundleGameObject = await uiComponent.Scene().GetComponent<ResourcesLoaderComponent>().LoadAssetAsync<GameObject>(assetsName); GameObject gameObject = UnityEngine.Object.Instantiate(bundleGameObject, uiComponent.UIGlobalComponent.GetLayer((int)uiLayer)); UI ui = uiComponent.AddChild<UI, string, GameObject>(UIType.UILobby, gameObject); ui.AddComponent<UILobbyComponent>(); return ui; } public override void OnRemove(UIComponent uiComponent) { } } }
ET/Unity/Assets/Scripts/HotfixView/Client/Demo/UI/UILobby/UILobbyEvent.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/HotfixView/Client/Demo/UI/UILobby/UILobbyEvent.cs", "repo_id": "ET", "token_count": 383 }
139
using UnityEngine; namespace ET.Client { [Event(SceneType.Current)] public class ChangePosition_SyncGameObjectPos: AEvent<Scene, ChangePosition> { protected override async ETTask Run(Scene scene, ChangePosition args) { Unit unit = args.Unit; GameObjectComponent gameObjectComponent = unit.GetComponent<GameObjectComponent>(); if (gameObjectComponent == null) { return; } Transform transform = gameObjectComponent.Transform; transform.position = unit.Position; await ETTask.CompletedTask; } } }
ET/Unity/Assets/Scripts/HotfixView/Client/Demo/Unit/ChangePosition_SyncGameObjectPos.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/HotfixView/Client/Demo/Unit/ChangePosition_SyncGameObjectPos.cs", "repo_id": "ET", "token_count": 274 }
140
namespace ET.Client { [Event(SceneType.LockStep)] public class LSSceneInitFinish_Finish: AEvent<Scene, LSSceneInitFinish> { protected override async ETTask Run(Scene clientScene, LSSceneInitFinish args) { Room room = clientScene.GetComponent<Room>(); await room.AddComponent<LSUnitViewComponent>().InitAsync(); room.AddComponent<LSCameraComponent>(); if (!room.IsReplay) { room.AddComponent<LSOperaComponent>(); } await UIHelper.Remove(clientScene, UIType.UILSLobby); await ETTask.CompletedTask; } } }
ET/Unity/Assets/Scripts/HotfixView/Client/LockStep/LSSceneInitFinish_Finish.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/HotfixView/Client/LockStep/LSSceneInitFinish_Finish.cs", "repo_id": "ET", "token_count": 320 }
141
fileFormatVersion: 2 guid: 10b14ff8e5cd943a092aa210b117c64d MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/HotfixView/Client/LockStep/UI/UILSLobby/UILSLobbyEvent.cs.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/HotfixView/Client/LockStep/UI/UILSLobby/UILSLobbyEvent.cs.meta", "repo_id": "ET", "token_count": 95 }
142
fileFormatVersion: 2 guid: b47a7b83d8faceb44be118855f8d7bdf folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/HotfixView/Client/Module/Resource.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/HotfixView/Client/Module/Resource.meta", "repo_id": "ET", "token_count": 71 }
143
fileFormatVersion: 2 guid: 8c3ef232e983bf647b5b126dafb36618 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/Loader/Helper/AcceptAllCertificate.cs.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/Loader/Helper/AcceptAllCertificate.cs.meta", "repo_id": "ET", "token_count": 94 }
144
using UnityEngine; namespace ET { public enum UILayer { Hidden = 0, Low = 10, Mid = 20, High = 30, } public class UILayerScript: MonoBehaviour { public UILayer UILayer; } }
ET/Unity/Assets/Scripts/Loader/MonoBehaviour/UILayerScript.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/Loader/MonoBehaviour/UILayerScript.cs", "repo_id": "ET", "token_count": 125 }
145
using Unity.Mathematics; namespace ET.Client { [ComponentOf(typeof(Unit))] public class XunLuoPathComponent: Entity, IAwake { public float3[] path = new float3[] { new float3(0, 0, 0), new float3(20, 0, 0), new float3(20, 0, 20), new float3(0, 0, 20), }; public int Index; } }
ET/Unity/Assets/Scripts/Model/Client/Demo/AI/XunLuoPathComponent.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/Model/Client/Demo/AI/XunLuoPathComponent.cs", "repo_id": "ET", "token_count": 132 }
146
fileFormatVersion: 2 guid: ec90b5e546bd6de47a19d79b92c28ae4 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/Model/Client/Demo/NetClient.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/Model/Client/Demo/NetClient.meta", "repo_id": "ET", "token_count": 70 }
147
fileFormatVersion: 2 guid: 913d59a68856e4244ab6a43c8f55c5fb folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/Model/Client/LockStep.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/Model/Client/LockStep.meta", "repo_id": "ET", "token_count": 71 }
148
fileFormatVersion: 2 guid: 48e744f775b87f642a71dd150007829b MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/Model/Generate/Client/Message/OuterMessage_C_10001.cs.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/Model/Generate/Client/Message/OuterMessage_C_10001.cs.meta", "repo_id": "ET", "token_count": 93 }
149
using System.Net; namespace ET { public partial class StartProcessConfig { public string InnerIP => this.StartMachineConfig.InnerIP; public string OuterIP => this.StartMachineConfig.OuterIP; // 内网地址外网端口,通过防火墙映射端口过来 private IPEndPoint ipEndPoint; public IPEndPoint IPEndPoint { get { if (ipEndPoint == null) { this.ipEndPoint = NetworkHelper.ToIPEndPoint(this.InnerIP, this.Port); } return this.ipEndPoint; } } public StartMachineConfig StartMachineConfig => StartMachineConfigCategory.Instance.Get(this.MachineId); public override void EndInit() { } } }
ET/Unity/Assets/Scripts/Model/Generate/ClientServer/ConfigPartial/StartProcessConfig.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/Model/Generate/ClientServer/ConfigPartial/StartProcessConfig.cs", "repo_id": "ET", "token_count": 420 }
150
fileFormatVersion: 2 guid: c85bf5cb7b62b2f4d83f401d23ab35bb folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/Model/Generate/Server/Config.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/Model/Generate/Server/Config.meta", "repo_id": "ET", "token_count": 71 }
151
using System.Collections.Generic; using System.ComponentModel; using System.Net; namespace ET { public partial class StartSceneConfigCategory { public MultiMap<int, StartSceneConfig> Gates = new(); public MultiMap<int, StartSceneConfig> ProcessScenes = new(); public Dictionary<long, Dictionary<string, StartSceneConfig>> ClientScenesByName = new(); public StartSceneConfig LocationConfig; public List<StartSceneConfig> Realms = new(); public List<StartSceneConfig> Routers = new(); public List<StartSceneConfig> Maps = new(); public StartSceneConfig Match; public StartSceneConfig Benchmark; public List<StartSceneConfig> GetByProcess(int process) { return this.ProcessScenes[process]; } public StartSceneConfig GetBySceneName(int zone, string name) { return this.ClientScenesByName[zone][name]; } public override void EndInit() { foreach (StartSceneConfig startSceneConfig in this.GetAll().Values) { this.ProcessScenes.Add(startSceneConfig.Process, startSceneConfig); if (!this.ClientScenesByName.ContainsKey(startSceneConfig.Zone)) { this.ClientScenesByName.Add(startSceneConfig.Zone, new Dictionary<string, StartSceneConfig>()); } this.ClientScenesByName[startSceneConfig.Zone].Add(startSceneConfig.Name, startSceneConfig); switch (startSceneConfig.Type) { case SceneType.Realm: this.Realms.Add(startSceneConfig); break; case SceneType.Gate: this.Gates.Add(startSceneConfig.Zone, startSceneConfig); break; case SceneType.Location: this.LocationConfig = startSceneConfig; break; case SceneType.Router: this.Routers.Add(startSceneConfig); break; case SceneType.Map: this.Maps.Add(startSceneConfig); break; case SceneType.Match: this.Match = startSceneConfig; break; case SceneType.BenchmarkServer: this.Benchmark = startSceneConfig; break; } } } } public partial class StartSceneConfig: ISupportInitialize { public ActorId ActorId; public SceneType Type; public StartProcessConfig StartProcessConfig { get { return StartProcessConfigCategory.Instance.Get(this.Process); } } public StartZoneConfig StartZoneConfig { get { return StartZoneConfigCategory.Instance.Get(this.Zone); } } // 内网地址外网端口,通过防火墙映射端口过来 private IPEndPoint innerIPPort; public IPEndPoint InnerIPPort { get { if (this.innerIPPort == null) { this.innerIPPort = NetworkHelper.ToIPEndPoint($"{this.StartProcessConfig.InnerIP}:{this.Port}"); } return this.innerIPPort; } } private IPEndPoint outerIPPort; // 外网地址外网端口 public IPEndPoint OuterIPPort { get { if (this.outerIPPort == null) { this.outerIPPort = NetworkHelper.ToIPEndPoint($"{this.StartProcessConfig.OuterIP}:{this.Port}"); } return this.outerIPPort; } } public override void EndInit() { this.ActorId = new ActorId(this.Process, this.Id, 1); this.Type = EnumHelper.FromString<SceneType>(this.SceneType); } } }
ET/Unity/Assets/Scripts/Model/Generate/Server/ConfigPartial/StartSceneConfig.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/Model/Generate/Server/ConfigPartial/StartSceneConfig.cs", "repo_id": "ET", "token_count": 2299 }
152
fileFormatVersion: 2 guid: 2050b75f23e28ec45855e14d21d299f4 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/Model/Server/Benchmark.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/Model/Server/Benchmark.meta", "repo_id": "ET", "token_count": 68 }
153
namespace ET.Server { [ComponentOf(typeof(Player))] public class PlayerSessionComponent : Entity, IAwake { private EntityRef<Session> session; public Session Session { get { return this.session; } set { this.session = value; } } } }
ET/Unity/Assets/Scripts/Model/Server/Demo/Gate/PlayerSessionComponent.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/Model/Server/Demo/Gate/PlayerSessionComponent.cs", "repo_id": "ET", "token_count": 119 }
154
using System.Collections.Generic; namespace ET.Server { [ComponentOf(typeof(Scene))] public class MatchComponent: Entity, IAwake { public List<long> waitMatchPlayers = new List<long>(); } }
ET/Unity/Assets/Scripts/Model/Server/LockStep/Match/MatchComponent.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/Model/Server/LockStep/Match/MatchComponent.cs", "repo_id": "ET", "token_count": 81 }
155
using System.Collections.Generic; namespace ET.Server { [UniqueId(0, 100)] public static class LocationType { public const int Unit = 0; public const int Player = 1; public const int Friend = 2; public const int Chat = 3; public const int GateSession = 4; public const int Max = 100; } [ChildOf(typeof(LocationOneType))] public class LockInfo: Entity, IAwake<ActorId, CoroutineLock>, IDestroy { public ActorId LockActorId; public CoroutineLock CoroutineLock { get; set; } } [ChildOf(typeof(LocationManagerComoponent))] public class LocationOneType: Entity, IAwake<int> { public int LocationType; public readonly Dictionary<long, ActorId> locations = new(); public readonly Dictionary<long, EntityRef<LockInfo>> lockInfos = new(); } [ComponentOf(typeof(Scene))] public class LocationManagerComoponent: Entity, IAwake { public LocationOneType[] LocationOneTypes = new LocationOneType[LocationType.Max]; } }
ET/Unity/Assets/Scripts/Model/Server/Module/ActorLocation/LocationComponent.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/Model/Server/Module/ActorLocation/LocationComponent.cs", "repo_id": "ET", "token_count": 458 }
156
using System.Collections.Generic; using System.Net; namespace ET.Server { /// <summary> /// http请求分发器 /// </summary> [ComponentOf(typeof(Scene))] public class HttpComponent: Entity, IAwake<string>, IDestroy { public HttpListener Listener; } }
ET/Unity/Assets/Scripts/Model/Server/Module/Http/HttpComponent.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/Model/Server/Module/Http/HttpComponent.cs", "repo_id": "ET", "token_count": 122 }
157
fileFormatVersion: 2 guid: 45a2289132188ea4783d8a7858cf50ad folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/Model/Server/Module/RobotCase.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/Model/Server/Module/RobotCase.meta", "repo_id": "ET", "token_count": 67 }
158
fileFormatVersion: 2 guid: 4020a5d77b28a594d9482ecf461022ae folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/Model/Share.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/Model/Share.meta", "repo_id": "ET", "token_count": 69 }
159
fileFormatVersion: 2 guid: 27067471cd1c7d045bb855b9f4f4c9b4 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/Model/Share/LockStep/ILSRollbackSystem.cs.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/Model/Share/LockStep/ILSRollbackSystem.cs.meta", "repo_id": "ET", "token_count": 96 }
160
fileFormatVersion: 2 guid: e0df77bdfbbb4a5fa2e9de116dabaaa2 timeCreated: 1682051388
ET/Unity/Assets/Scripts/Model/Share/LockStep/LSInputComponent.cs.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/Model/Share/LockStep/LSInputComponent.cs.meta", "repo_id": "ET", "token_count": 38 }
161
fileFormatVersion: 2 guid: 17314ef2e141d8f4e8b75777cec648ce folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/Model/Share/Module/AI.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/Model/Share/Module/AI.meta", "repo_id": "ET", "token_count": 69 }
162
namespace ET { public interface IConsoleHandler { ETTask Run(Fiber fiber, ModeContex contex, string content); } }
ET/Unity/Assets/Scripts/Model/Share/Module/Console/IConsoleHandler.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/Model/Share/Module/Console/IConsoleHandler.cs", "repo_id": "ET", "token_count": 51 }
163
fileFormatVersion: 2 guid: 3d6a99783c189d543ac801a2d36b362b folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/Model/Share/Module/Numeric.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/Model/Share/Module/Numeric.meta", "repo_id": "ET", "token_count": 70 }
164
fileFormatVersion: 2 guid: 0e22ef73640ac8944baf71f1960cc67b MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/Model/Share/Module/Recast/PathfindingComponent.cs.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/Model/Share/Module/Recast/PathfindingComponent.cs.meta", "repo_id": "ET", "token_count": 92 }
165
fileFormatVersion: 2 guid: 617e190a5f9908446a769d3dc850e335 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/Model/Share/MongoRegister.cs.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/Model/Share/MongoRegister.cs.meta", "repo_id": "ET", "token_count": 94 }
166
fileFormatVersion: 2 guid: 544bc1d8594835c45b17f803fe6ec089 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/ModelView/Client/Demo/UI/UIHelp.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/ModelView/Client/Demo/UI/UIHelp.meta", "repo_id": "ET", "token_count": 69 }
167
fileFormatVersion: 2 guid: 4708c326dadf743d6a707f49d917b3f7 folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/ModelView/Client/LockStep/UI/UILSLobby.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/ModelView/Client/LockStep/UI/UILSLobby.meta", "repo_id": "ET", "token_count": 71 }
168
namespace ET.Client { public abstract class AUIEvent: HandlerObject { public abstract ETTask<UI> OnCreate(UIComponent uiComponent, UILayer uiLayer); public abstract void OnRemove(UIComponent uiComponent); } }
ET/Unity/Assets/Scripts/ModelView/Client/Module/UI/AUIEvent.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/ModelView/Client/Module/UI/AUIEvent.cs", "repo_id": "ET", "token_count": 87 }
169
using System.Threading; namespace DotRecast.Core { public class RcAtomicInteger { private volatile int _location; public RcAtomicInteger() : this(0) { } public RcAtomicInteger(int location) { _location = location; } public int IncrementAndGet() { return Interlocked.Increment(ref _location); } public int GetAndIncrement() { var next = Interlocked.Increment(ref _location); return next - 1; } public int DecrementAndGet() { return Interlocked.Decrement(ref _location); } public int Read() { return _location; } public int GetSoft() { return _location; } public int Exchange(int exchange) { return Interlocked.Exchange(ref _location, exchange); } public int Decrease(int value) { return Interlocked.Add(ref _location, -value); } public int CompareExchange(int value, int comparand) { return Interlocked.CompareExchange(ref _location, value, comparand); } public int Add(int value) { return Interlocked.Add(ref _location, value); } } }
ET/Unity/Assets/Scripts/ThirdParty/DotRecast/Core/RcAtomicInteger.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/ThirdParty/DotRecast/Core/RcAtomicInteger.cs", "repo_id": "ET", "token_count": 671 }
170
using System; using System.Collections; using System.Collections.Generic; namespace DotRecast.Core { public readonly partial struct RcImmutableArray<T> { public IEnumerator<T> GetEnumerator() { return EnumeratorObject.Create(_array); } IEnumerator IEnumerable.GetEnumerator() { return EnumeratorObject.Create(_array); } private sealed class EnumeratorObject : IEnumerator<T> { private static readonly IEnumerator<T> EmptyEnumerator = new EnumeratorObject(Empty._array!); private readonly T[] _array; private int _index; internal static IEnumerator<T> Create(T[] array) { if (array.Length != 0) { return new EnumeratorObject(array); } else { return EmptyEnumerator; } } private EnumeratorObject(T[] array) { _index = -1; _array = array; } public T Current { get { if (unchecked((uint)_index) < (uint)_array.Length) { return _array[_index]; } throw new InvalidOperationException(); } } object IEnumerator.Current => this.Current; public void Dispose() { } public bool MoveNext() { int newIndex = _index + 1; int length = _array.Length; if ((uint)newIndex <= (uint)length) { _index = newIndex; return (uint)newIndex < (uint)length; } return false; } void IEnumerator.Reset() { _index = -1; } } } }
ET/Unity/Assets/Scripts/ThirdParty/DotRecast/Core/RcImmutableArray.Enumerable.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/ThirdParty/DotRecast/Core/RcImmutableArray.Enumerable.cs", "repo_id": "ET", "token_count": 1206 }
171
/* recast4j copyright (c) 2021 Piotr Piastucki [email protected] DotRecast Copyright (c) 2023 Choi Ikpil [email protected] This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Threading; namespace DotRecast.Core { public class RcTelemetry { private readonly ThreadLocal<Dictionary<string, RcAtomicLong>> _timerStart; private readonly ConcurrentDictionary<string, RcAtomicLong> _timerAccum; public RcTelemetry() { _timerStart = new ThreadLocal<Dictionary<string, RcAtomicLong>>(() => new Dictionary<string, RcAtomicLong>()); _timerAccum = new ConcurrentDictionary<string, RcAtomicLong>(); } public IDisposable ScopedTimer(RcTimerLabel label) { StartTimer(label); return new RcAnonymousDisposable(() => StopTimer(label)); } public void StartTimer(RcTimerLabel label) { _timerStart.Value[label.Name] = new RcAtomicLong(RcFrequency.Ticks); } public void StopTimer(RcTimerLabel label) { _timerAccum .GetOrAdd(label.Name, _ => new RcAtomicLong(0)) .AddAndGet(RcFrequency.Ticks - _timerStart.Value?[label.Name].Read() ?? 0); } public void Warn(string message) { Console.WriteLine(message); } public List<RcTelemetryTick> ToList() { return _timerAccum .Select(x => new RcTelemetryTick(x.Key, x.Value.Read())) .ToList(); } } }
ET/Unity/Assets/Scripts/ThirdParty/DotRecast/Core/RcTelemetry.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/ThirdParty/DotRecast/Core/RcTelemetry.cs", "repo_id": "ET", "token_count": 941 }
172
fileFormatVersion: 2 guid: 330e30ee55e21914b85832b7ddf78faf MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/ThirdParty/DotRecast/Detour.Crowd/DtCrowdAgentAnimation.cs.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/ThirdParty/DotRecast/Detour.Crowd/DtCrowdAgentAnimation.cs.meta", "repo_id": "ET", "token_count": 94 }
173
fileFormatVersion: 2 guid: f4ff20da079101049a535909765c0619 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/ThirdParty/DotRecast/Detour.Crowd/DtMoveRequestState.cs.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/ThirdParty/DotRecast/Detour.Crowd/DtMoveRequestState.cs.meta", "repo_id": "ET", "token_count": 92 }
174
fileFormatVersion: 2 guid: 4c0ab164bda28ad4f82b7e9a426ad624 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/ThirdParty/DotRecast/Detour.Crowd/DtPathQueue.cs.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/ThirdParty/DotRecast/Detour.Crowd/DtPathQueue.cs.meta", "repo_id": "ET", "token_count": 95 }
175
/* recast4j copyright (c) 2021 Piotr Piastucki [email protected] DotRecast Copyright (c) 2023 Choi Ikpil [email protected] This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ using System; using DotRecast.Core; using DotRecast.Recast; namespace DotRecast.Detour.Dynamic.Colliders { public class BoxCollider : AbstractCollider { private readonly RcVec3f center; private readonly RcVec3f[] halfEdges; public BoxCollider(RcVec3f center, RcVec3f[] halfEdges, int area, float flagMergeThreshold) : base(area, flagMergeThreshold, Bounds(center, halfEdges)) { this.center = center; this.halfEdges = halfEdges; } private static float[] Bounds(RcVec3f center, RcVec3f[] halfEdges) { float[] bounds = new float[] { float.PositiveInfinity, float.PositiveInfinity, float.PositiveInfinity, float.NegativeInfinity, float.NegativeInfinity, float.NegativeInfinity }; for (int i = 0; i < 8; ++i) { float s0 = (i & 1) != 0 ? 1f : -1f; float s1 = (i & 2) != 0 ? 1f : -1f; float s2 = (i & 4) != 0 ? 1f : -1f; float vx = center.x + s0 * halfEdges[0].x + s1 * halfEdges[1].x + s2 * halfEdges[2].x; float vy = center.y + s0 * halfEdges[0].y + s1 * halfEdges[1].y + s2 * halfEdges[2].y; float vz = center.z + s0 * halfEdges[0].z + s1 * halfEdges[1].z + s2 * halfEdges[2].z; bounds[0] = Math.Min(bounds[0], vx); bounds[1] = Math.Min(bounds[1], vy); bounds[2] = Math.Min(bounds[2], vz); bounds[3] = Math.Max(bounds[3], vx); bounds[4] = Math.Max(bounds[4], vy); bounds[5] = Math.Max(bounds[5], vz); } return bounds; } public override void Rasterize(RcHeightfield hf, RcTelemetry telemetry) { RecastFilledVolumeRasterization.RasterizeBox( hf, center, halfEdges, area, (int)Math.Floor(flagMergeThreshold / hf.ch), telemetry); } public static RcVec3f[] GetHalfEdges(RcVec3f up, RcVec3f forward, RcVec3f extent) { RcVec3f[] halfEdges = { RcVec3f.Zero, RcVec3f.Of(up.x, up.y, up.z), RcVec3f.Zero }; RcVec3f.Normalize(ref halfEdges[1]); RcVec3f.Cross(ref halfEdges[0], up, forward); RcVec3f.Normalize(ref halfEdges[0]); RcVec3f.Cross(ref halfEdges[2], halfEdges[0], up); RcVec3f.Normalize(ref halfEdges[2]); halfEdges[0].x *= extent.x; halfEdges[0].y *= extent.x; halfEdges[0].z *= extent.x; halfEdges[1].x *= extent.y; halfEdges[1].y *= extent.y; halfEdges[1].z *= extent.y; halfEdges[2].x *= extent.z; halfEdges[2].y *= extent.z; halfEdges[2].z *= extent.z; return halfEdges; } } }
ET/Unity/Assets/Scripts/ThirdParty/DotRecast/Detour.Dynamic/Colliders/BoxCollider.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/ThirdParty/DotRecast/Detour.Dynamic/Colliders/BoxCollider.cs", "repo_id": "ET", "token_count": 1896 }
176
/* recast4j copyright (c) 2021 Piotr Piastucki [email protected] DotRecast Copyright (c) 2023 Choi Ikpil [email protected] This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Threading.Tasks; using DotRecast.Core; using DotRecast.Detour.Dynamic.Colliders; using DotRecast.Detour.Dynamic.Io; using DotRecast.Recast; namespace DotRecast.Detour.Dynamic { public class DynamicNavMesh { public const int MAX_VERTS_PER_POLY = 6; public readonly DynamicNavMeshConfig config; private readonly RecastBuilder builder; private readonly Dictionary<long, DynamicTile> _tiles = new Dictionary<long, DynamicTile>(); private readonly RcTelemetry telemetry; private readonly DtNavMeshParams navMeshParams; private readonly BlockingCollection<IUpdateQueueItem> updateQueue = new BlockingCollection<IUpdateQueueItem>(); private readonly RcAtomicLong currentColliderId = new RcAtomicLong(0); private DtNavMesh _navMesh; private bool dirty = true; public DynamicNavMesh(VoxelFile voxelFile) { config = new DynamicNavMeshConfig(voxelFile.useTiles, voxelFile.tileSizeX, voxelFile.tileSizeZ, voxelFile.cellSize); config.walkableHeight = voxelFile.walkableHeight; config.walkableRadius = voxelFile.walkableRadius; config.walkableClimb = voxelFile.walkableClimb; config.walkableSlopeAngle = voxelFile.walkableSlopeAngle; config.maxSimplificationError = voxelFile.maxSimplificationError; config.maxEdgeLen = voxelFile.maxEdgeLen; config.minRegionArea = voxelFile.minRegionArea; config.regionMergeArea = voxelFile.regionMergeArea; config.vertsPerPoly = voxelFile.vertsPerPoly; config.buildDetailMesh = voxelFile.buildMeshDetail; config.detailSampleDistance = voxelFile.detailSampleDistance; config.detailSampleMaxError = voxelFile.detailSampleMaxError; builder = new RecastBuilder(); navMeshParams = new DtNavMeshParams(); navMeshParams.orig.x = voxelFile.bounds[0]; navMeshParams.orig.y = voxelFile.bounds[1]; navMeshParams.orig.z = voxelFile.bounds[2]; navMeshParams.tileWidth = voxelFile.cellSize * voxelFile.tileSizeX; navMeshParams.tileHeight = voxelFile.cellSize * voxelFile.tileSizeZ; navMeshParams.maxTiles = voxelFile.tiles.Count; navMeshParams.maxPolys = 0x8000; foreach (var t in voxelFile.tiles) { _tiles.Add(LookupKey(t.tileX, t.tileZ), new DynamicTile(t)); } ; telemetry = new RcTelemetry(); } public DtNavMesh NavMesh() { return _navMesh; } /** * Voxel queries require checkpoints to be enabled in {@link DynamicNavMeshConfig} */ public VoxelQuery VoxelQuery() { return new VoxelQuery(navMeshParams.orig, navMeshParams.tileWidth, navMeshParams.tileHeight, LookupHeightfield); } private RcHeightfield LookupHeightfield(int x, int z) { return GetTileAt(x, z)?.checkpoint.heightfield; } public long AddCollider(ICollider collider) { long cid = currentColliderId.IncrementAndGet(); updateQueue.Add(new AddColliderQueueItem(cid, collider, GetTiles(collider.Bounds()))); return cid; } public void RemoveCollider(long colliderId) { updateQueue.Add(new RemoveColliderQueueItem(colliderId, GetTilesByCollider(colliderId))); } /** * Perform full build of the nav mesh */ public void Build() { ProcessQueue(); Rebuild(_tiles.Values); } /** * Perform incremental update of the nav mesh */ public bool Update() { return Rebuild(ProcessQueue()); } private bool Rebuild(ICollection<DynamicTile> stream) { foreach (var dynamicTile in stream) Rebuild(dynamicTile); return UpdateNavMesh(); } private HashSet<DynamicTile> ProcessQueue() { var items = ConsumeQueue(); foreach (var item in items) { Process(item); } return items.SelectMany(i => i.AffectedTiles()).ToHashSet(); } private List<IUpdateQueueItem> ConsumeQueue() { List<IUpdateQueueItem> items = new List<IUpdateQueueItem>(); while (updateQueue.TryTake(out var item)) { items.Add(item); } return items; } private void Process(IUpdateQueueItem item) { foreach (var tile in item.AffectedTiles()) { item.Process(tile); } } /** * Perform full build concurrently using the given {@link ExecutorService} */ public Task<bool> Build(TaskFactory executor) { ProcessQueue(); return Rebuild(_tiles.Values, executor); } /** * Perform incremental update concurrently using the given {@link ExecutorService} */ public Task<bool> Update(TaskFactory executor) { return Rebuild(ProcessQueue(), executor); } private Task<bool> Rebuild(ICollection<DynamicTile> tiles, TaskFactory executor) { var tasks = tiles.Select(tile => executor.StartNew(() => Rebuild(tile))).ToArray(); return Task.WhenAll(tasks).ContinueWith(k => UpdateNavMesh()); } private ICollection<DynamicTile> GetTiles(float[] bounds) { if (bounds == null) { return _tiles.Values; } int minx = (int)Math.Floor((bounds[0] - navMeshParams.orig.x) / navMeshParams.tileWidth); int minz = (int)Math.Floor((bounds[2] - navMeshParams.orig.z) / navMeshParams.tileHeight); int maxx = (int)Math.Floor((bounds[3] - navMeshParams.orig.x) / navMeshParams.tileWidth); int maxz = (int)Math.Floor((bounds[5] - navMeshParams.orig.z) / navMeshParams.tileHeight); List<DynamicTile> tiles = new List<DynamicTile>(); for (int z = minz; z <= maxz; ++z) { for (int x = minx; x <= maxx; ++x) { DynamicTile tile = GetTileAt(x, z); if (tile != null) { tiles.Add(tile); } } } return tiles; } private List<DynamicTile> GetTilesByCollider(long cid) { return _tiles.Values.Where(t => t.ContainsCollider(cid)).ToList(); } private void Rebuild(DynamicTile tile) { DtNavMeshCreateParams option = new DtNavMeshCreateParams(); option.walkableHeight = config.walkableHeight; dirty = dirty | tile.Build(builder, config, telemetry); } private bool UpdateNavMesh() { if (dirty) { DtNavMesh navMesh = new DtNavMesh(navMeshParams, MAX_VERTS_PER_POLY); foreach (var t in _tiles.Values) t.AddTo(navMesh); this._navMesh = navMesh; dirty = false; return true; } return false; } private DynamicTile GetTileAt(int x, int z) { return _tiles.TryGetValue(LookupKey(x, z), out var tile) ? tile : null; } private long LookupKey(long x, long z) { return (z << 32) | x; } public List<VoxelTile> VoxelTiles() { return _tiles.Values.Select(t => t.voxelTile).ToList(); } public List<RecastBuilderResult> RecastResults() { return _tiles.Values.Select(t => t.recastResult).ToList(); } } }
ET/Unity/Assets/Scripts/ThirdParty/DotRecast/Detour.Dynamic/DynamicNavMesh.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/ThirdParty/DotRecast/Detour.Dynamic/DynamicNavMesh.cs", "repo_id": "ET", "token_count": 4219 }
177
fileFormatVersion: 2 guid: 773beb1a9a9276c46879965700b70e2b MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/ThirdParty/DotRecast/Detour.Dynamic/Io/VoxelFileReader.cs.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/ThirdParty/DotRecast/Detour.Dynamic/Io/VoxelFileReader.cs.meta", "repo_id": "ET", "token_count": 95 }
178
/* Copyright (c) 2009-2010 Mikko Mononen [email protected] recast4j copyright (c) 2015-2019 Piotr Piastucki [email protected] DotRecast Copyright (c) 2023 Choi Ikpil [email protected] This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using DotRecast.Core; using DotRecast.Detour.TileCache.Io.Compress; using DotRecast.Recast; using DotRecast.Recast.Geom; namespace DotRecast.Detour.TileCache { public class DtTileCacheLayerBuilder { private readonly IDtTileCacheCompressorFactory _compFactory; public DtTileCacheLayerBuilder(IDtTileCacheCompressorFactory compFactory) { _compFactory = compFactory; } public List<DtTileCacheLayerBuildResult> Build(IInputGeomProvider geom, RcConfig cfg, DtTileCacheStorageParams storageParams, int threads, int tw, int th) { if (threads == 1) { return BuildSingleThread(geom, cfg, storageParams, tw, th); } return BuildMultiThread(geom, cfg, storageParams, tw, th, threads); } private List<DtTileCacheLayerBuildResult> BuildSingleThread(IInputGeomProvider geom, RcConfig cfg, DtTileCacheStorageParams storageParams, int tw, int th) { var results = new List<DtTileCacheLayerBuildResult>(); for (int y = 0; y < th; ++y) { for (int x = 0; x < tw; ++x) { var result = BuildTileCacheLayer(geom, cfg, x, y, storageParams); results.Add(result); } } return results; } private List<DtTileCacheLayerBuildResult> BuildMultiThread(IInputGeomProvider geom, RcConfig cfg, DtTileCacheStorageParams storageParams, int tw, int th, int threads) { var results = new List<Task<DtTileCacheLayerBuildResult>>(); for (int y = 0; y < th; ++y) { for (int x = 0; x < tw; ++x) { int tx = x; int ty = y; var task = Task.Run(() => BuildTileCacheLayer(geom, cfg, tx, ty, storageParams)); results.Add(task); } } return results .Select(x => x.Result) .ToList(); } protected virtual RcHeightfieldLayerSet BuildHeightfieldLayerSet(IInputGeomProvider geom, RcConfig cfg, int tx, int ty) { RecastBuilder rcBuilder = new RecastBuilder(); RcVec3f bmin = geom.GetMeshBoundsMin(); RcVec3f bmax = geom.GetMeshBoundsMax(); RecastBuilderConfig builderCfg = new RecastBuilderConfig(cfg, bmin, bmax, tx, ty); RcHeightfieldLayerSet lset = rcBuilder.BuildLayers(geom, builderCfg); return lset; } protected virtual DtTileCacheLayerBuildResult BuildTileCacheLayer(IInputGeomProvider geom, RcConfig cfg, int tx, int ty, DtTileCacheStorageParams storageParams) { RcHeightfieldLayerSet lset = BuildHeightfieldLayerSet(geom, cfg, tx, ty); List<byte[]> result = new List<byte[]>(); if (lset != null) { DtTileCacheBuilder builder = new DtTileCacheBuilder(); for (int i = 0; i < lset.layers.Length; ++i) { RcHeightfieldLayer layer = lset.layers[i]; // Store header DtTileCacheLayerHeader header = new DtTileCacheLayerHeader(); header.magic = DtTileCacheLayerHeader.DT_TILECACHE_MAGIC; header.version = DtTileCacheLayerHeader.DT_TILECACHE_VERSION; // Tile layer location in the navmesh. header.tx = tx; header.ty = ty; header.tlayer = i; header.bmin = layer.bmin; header.bmax = layer.bmax; // Tile info. header.width = layer.width; header.height = layer.height; header.minx = layer.minx; header.maxx = layer.maxx; header.miny = layer.miny; header.maxy = layer.maxy; header.hmin = layer.hmin; header.hmax = layer.hmax; var comp = _compFactory.Create(storageParams.Compatibility ? 0 : 1); var bytes = builder.CompressTileCacheLayer(header, layer.heights, layer.areas, layer.cons, storageParams.Order, storageParams.Compatibility, comp); result.Add(bytes); } } return new DtTileCacheLayerBuildResult(tx, ty, result); } } }
ET/Unity/Assets/Scripts/ThirdParty/DotRecast/Detour.TileCache/DtTileCacheLayerBuilder.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/ThirdParty/DotRecast/Detour.TileCache/DtTileCacheLayerBuilder.cs", "repo_id": "ET", "token_count": 2622 }
179
using System.Collections.Generic; using DotRecast.Core; namespace DotRecast.Detour.TileCache.Io.Compress { public class DtTileCacheCompressorFactory : IDtTileCacheCompressorFactory { public static readonly DtTileCacheCompressorFactory Shared = new DtTileCacheCompressorFactory(); private readonly Dictionary<int, IRcCompressor> _compressors = new Dictionary<int, IRcCompressor>(); public bool TryAdd(int type, IRcCompressor compressor) { if (0 == type) return false; _compressors[type] = compressor; return true; } public IRcCompressor Create(int compatibility) { // default if (0 == compatibility) { return DtTileCacheFastLzCompressor.Shared; } if (!_compressors.TryGetValue(compatibility, out var comp)) { return null; } return comp; } } }
ET/Unity/Assets/Scripts/ThirdParty/DotRecast/Detour.TileCache/Io/Compress/DtTileCacheCompressorFactory.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/ThirdParty/DotRecast/Detour.TileCache/Io/Compress/DtTileCacheCompressorFactory.cs", "repo_id": "ET", "token_count": 467 }
180
fileFormatVersion: 2 guid: 356c3960d922fcb4b9b3ff2eddf4b347 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/ThirdParty/DotRecast/Detour/ConvexConvexIntersection.cs.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/ThirdParty/DotRecast/Detour/ConvexConvexIntersection.cs.meta", "repo_id": "ET", "token_count": 96 }
181
fileFormatVersion: 2 guid: 1f151d9d7114bfd488cc62164a44f99e MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/ThirdParty/DotRecast/Detour/DtMeshData.cs.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/ThirdParty/DotRecast/Detour/DtMeshData.cs.meta", "repo_id": "ET", "token_count": 94 }
182
fileFormatVersion: 2 guid: 17d421538fceb3046ac83704bf20564b MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/ThirdParty/DotRecast/Detour/DtPolyPoint.cs.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/ThirdParty/DotRecast/Detour/DtPolyPoint.cs.meta", "repo_id": "ET", "token_count": 92 }
183
fileFormatVersion: 2 guid: c86f6f28af4db594db5436aa6de520b6 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/ThirdParty/DotRecast/Detour/DtStraightPathOption.cs.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/ThirdParty/DotRecast/Detour/DtStraightPathOption.cs.meta", "repo_id": "ET", "token_count": 94 }
184
using System.Collections.Generic; namespace DotRecast.Recast.Geom { public class BoundsItemYComparer : IComparer<BoundsItem> { public static readonly BoundsItemYComparer Shared = new BoundsItemYComparer(); private BoundsItemYComparer() { } public int Compare(BoundsItem a, BoundsItem b) { return a.bmin.y.CompareTo(b.bmin.y); } } }
ET/Unity/Assets/Scripts/ThirdParty/DotRecast/Recast/Geom/BoundsItemYComparer.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/ThirdParty/DotRecast/Recast/Geom/BoundsItemYComparer.cs", "repo_id": "ET", "token_count": 191 }
185
/* recast4j Copyright (c) 2015-2019 Piotr Piastucki [email protected] This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ using System; using System.Collections.Generic; using System.Globalization; using System.IO; using DotRecast.Recast.Geom; namespace DotRecast.Recast { public static class ObjImporter { public static IInputGeomProvider Load(byte[] chunk) { var context = LoadContext(chunk); return new SimpleInputGeomProvider(context.vertexPositions, context.meshFaces); } public static ObjImporterContext LoadContext(byte[] chunk) { ObjImporterContext context = new ObjImporterContext(); try { using StreamReader reader = new StreamReader(new MemoryStream(chunk)); string line; while ((line = reader.ReadLine()) != null) { line = line.Trim(); ReadLine(line, context); } } catch (Exception e) { throw new Exception(e.Message, e); } return context; } public static void ReadLine(string line, ObjImporterContext context) { if (line.StartsWith("v")) { ReadVertex(line, context); } else if (line.StartsWith("f")) { ReadFace(line, context); } } private static void ReadVertex(string line, ObjImporterContext context) { if (line.StartsWith("v ")) { float[] vert = ReadVector3f(line); foreach (float vp in vert) { context.vertexPositions.Add(vp); } } } private static float[] ReadVector3f(string line) { string[] v = line.Split(' ', StringSplitOptions.RemoveEmptyEntries); if (v.Length < 4) { throw new Exception("Invalid vector, expected 3 coordinates, found " + (v.Length - 1)); } // fix - https://github.com/ikpil/DotRecast/issues/7 return new float[] { float.Parse(v[1], CultureInfo.InvariantCulture), float.Parse(v[2], CultureInfo.InvariantCulture), float.Parse(v[3], CultureInfo.InvariantCulture) }; } private static void ReadFace(string line, ObjImporterContext context) { string[] v = line.Split(' ', StringSplitOptions.RemoveEmptyEntries); if (v.Length < 4) { throw new Exception("Invalid number of face vertices: 3 coordinates expected, found " + v.Length); } for (int j = 0; j < v.Length - 3; j++) { context.meshFaces.Add(ReadFaceVertex(v[1], context)); for (int i = 0; i < 2; i++) { context.meshFaces.Add(ReadFaceVertex(v[2 + j + i], context)); } } } private static int ReadFaceVertex(string face, ObjImporterContext context) { string[] v = face.Split("/"); return GetIndex(int.Parse(v[0]), context.vertexPositions.Count); } private static int GetIndex(int posi, int size) { if (posi > 0) { posi--; } else if (posi < 0) { posi = size + posi; } else { throw new Exception("0 vertex index"); } return posi; } } }
ET/Unity/Assets/Scripts/ThirdParty/DotRecast/Recast/ObjImporter.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/ThirdParty/DotRecast/Recast/ObjImporter.cs", "repo_id": "ET", "token_count": 2156 }
186
/* Copyright (c) 2009-2010 Mikko Mononen [email protected] recast4j copyright (c) 2015-2019 Piotr Piastucki [email protected] DotRecast Copyright (c) 2023 Choi Ikpil [email protected] This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ namespace DotRecast.Recast { public static class RcConstants { /// Represents the null area. /// When a data element is given this value it is considered to no longer be /// assigned to a usable area. (E.g. It is un-walkable.) public const int RC_NULL_AREA = 0; /// The default area id used to indicate a walkable polygon. /// This is also the maximum allowed area id, and the only non-null area id /// recognized by some steps in the build process. public const int RC_WALKABLE_AREA = 63; /// The value returned by #rcGetCon if the specified direction is not connected /// to another span. (Has no neighbor.) public const int RC_NOT_CONNECTED = 0x3f; /// Defines the number of bits allocated to rcSpan::smin and rcSpan::smax. public const int SPAN_HEIGHT_BITS = 20; /// Defines the maximum value for rcSpan::smin and rcSpan::smax. public const int SPAN_MAX_HEIGHT = (1 << SPAN_HEIGHT_BITS) - 1; /// Heighfield border flag. /// If a heightfield region ID has this bit set, then the region is a border /// region and its spans are considered unwalkable. /// (Used during the region and contour build process.) /// @see rcCompactSpan::reg public const int RC_BORDER_REG = 0x8000; /// Polygon touches multiple regions. /// If a polygon has this region ID it was merged with or created /// from polygons of different regions during the polymesh /// build step that removes redundant border vertices. /// (Used during the polymesh and detail polymesh build processes) /// @see rcPolyMesh::regs public const int RC_MULTIPLE_REGS = 0; // Border vertex flag. /// If a region ID has this bit set, then the associated element lies on /// a tile border. If a contour vertex's region ID has this bit set, the /// vertex will later be removed in order to match the segments and vertices /// at tile boundaries. /// (Used during the build process.) /// @see rcCompactSpan::reg, #rcContour::verts, #rcContour::rverts public const int RC_BORDER_VERTEX = 0x10000; /// Area border flag. /// If a region ID has this bit set, then the associated element lies on /// the border of an area. /// (Used during the region and contour build process.) /// @see rcCompactSpan::reg, #rcContour::verts, #rcContour::rverts public const int RC_AREA_BORDER = 0x20000; /// Applied to the region id field of contour vertices in order to extract the region id. /// The region id field of a vertex may have several flags applied to it. So the /// fields value can't be used directly. /// @see rcContour::verts, rcContour::rverts public const int RC_CONTOUR_REG_MASK = 0xffff; /// A value which indicates an invalid index within a mesh. /// @note This does not necessarily indicate an error. /// @see rcPolyMesh::polys public const int RC_MESH_NULL_IDX = 0xffff; public const int RC_CONTOUR_TESS_WALL_EDGES = 0x01; /// < Tessellate solid (impassable) edges during contour /// simplification. public const int RC_CONTOUR_TESS_AREA_EDGES = 0x02; public const int RC_LOG_WARNING = 1; } }
ET/Unity/Assets/Scripts/ThirdParty/DotRecast/Recast/RcConstants.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/ThirdParty/DotRecast/Recast/RcConstants.cs", "repo_id": "ET", "token_count": 1540 }
187
/* Copyright (c) 2009-2010 Mikko Mononen [email protected] recast4j copyright (c) 2015-2019 Piotr Piastucki [email protected] DotRecast Copyright (c) 2023 Choi Ikpil [email protected] This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ using DotRecast.Core; namespace DotRecast.Recast { /** Represents a heightfield layer within a layer set. */ public class RcHeightfield { /** The width of the heightfield. (Along the x-axis in cell units.) */ public readonly int width; /** The height of the heightfield. (Along the z-axis in cell units.) */ public readonly int height; /** The minimum bounds in world space. [(x, y, z)] */ public readonly RcVec3f bmin; /** The maximum bounds in world space. [(x, y, z)] */ public RcVec3f bmax; /** The size of each cell. (On the xz-plane.) */ public readonly float cs; /** The height of each cell. (The minimum increment along the y-axis.) */ public readonly float ch; /** Heightfield of spans (width*height). */ public readonly RcSpan[] spans; /** Border size in cell units */ public readonly int borderSize; public RcHeightfield(int width, int height, RcVec3f bmin, RcVec3f bmax, float cs, float ch, int borderSize) { this.width = width; this.height = height; this.bmin = bmin; this.bmax = bmax; this.cs = cs; this.ch = ch; this.borderSize = borderSize; spans = new RcSpan[width * height]; } } }
ET/Unity/Assets/Scripts/ThirdParty/DotRecast/Recast/RcHeightfield.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/ThirdParty/DotRecast/Recast/RcHeightfield.cs", "repo_id": "ET", "token_count": 844 }
188
/* recast4j copyright (c) 2021 Piotr Piastucki [email protected] DotRecast Copyright (c) 2023 Choi Ikpil [email protected] This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ using System.Collections.Generic; using DotRecast.Core; namespace DotRecast.Recast { public static class RcPolyMeshRaycast { public static bool Raycast(IList<RecastBuilderResult> results, RcVec3f src, RcVec3f dst, out float hitTime) { hitTime = 0.0f; foreach (RecastBuilderResult result in results) { if (result.GetMeshDetail() != null) { if (Raycast(result.GetMesh(), result.GetMeshDetail(), src, dst, out hitTime)) { return true; } } } return false; } private static bool Raycast(RcPolyMesh poly, RcPolyMeshDetail meshDetail, RcVec3f sp, RcVec3f sq, out float hitTime) { hitTime = 0; if (meshDetail != null) { for (int i = 0; i < meshDetail.nmeshes; ++i) { int m = i * 4; int bverts = meshDetail.meshes[m]; int btris = meshDetail.meshes[m + 2]; int ntris = meshDetail.meshes[m + 3]; int verts = bverts * 3; int tris = btris * 4; for (int j = 0; j < ntris; ++j) { RcVec3f[] vs = new RcVec3f[3]; for (int k = 0; k < 3; ++k) { vs[k].x = meshDetail.verts[verts + meshDetail.tris[tris + j * 4 + k] * 3]; vs[k].y = meshDetail.verts[verts + meshDetail.tris[tris + j * 4 + k] * 3 + 1]; vs[k].z = meshDetail.verts[verts + meshDetail.tris[tris + j * 4 + k] * 3 + 2]; } if (Intersections.IntersectSegmentTriangle(sp, sq, vs[0], vs[1], vs[2], out hitTime)) { return true; } } } } else { // TODO: check PolyMesh instead } return false; } } }
ET/Unity/Assets/Scripts/ThirdParty/DotRecast/Recast/RcPolyMeshRaycast.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/ThirdParty/DotRecast/Recast/RcPolyMeshRaycast.cs", "repo_id": "ET", "token_count": 1612 }
189
/* Copyright (c) 2009-2010 Mikko Mononen [email protected] recast4j copyright (c) 2015-2019 Piotr Piastucki [email protected] DotRecast Copyright (c) 2023 Choi Ikpil [email protected] This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using DotRecast.Core; using DotRecast.Recast.Geom; namespace DotRecast.Recast { public class RecastBuilder { private readonly IRecastBuilderProgressListener progressListener; public RecastBuilder() { progressListener = null; } public RecastBuilder(IRecastBuilderProgressListener progressListener) { this.progressListener = progressListener; } public List<RecastBuilderResult> BuildTiles(IInputGeomProvider geom, RcConfig cfg, TaskFactory taskFactory) { RcVec3f bmin = geom.GetMeshBoundsMin(); RcVec3f bmax = geom.GetMeshBoundsMax(); RcUtils.CalcTileCount(bmin, bmax, cfg.Cs, cfg.TileSizeX, cfg.TileSizeZ, out var tw, out var th); List<RecastBuilderResult> results = new List<RecastBuilderResult>(); if (null != taskFactory) { BuildMultiThreadAsync(geom, cfg, bmin, bmax, tw, th, results, taskFactory, default); } else { BuildSingleThreadAsync(geom, cfg, bmin, bmax, tw, th, results); } return results; } public Task BuildTilesAsync(IInputGeomProvider geom, RcConfig cfg, int threads, List<RecastBuilderResult> results, TaskFactory taskFactory, CancellationToken cancellationToken) { RcVec3f bmin = geom.GetMeshBoundsMin(); RcVec3f bmax = geom.GetMeshBoundsMax(); RcUtils.CalcTileCount(bmin, bmax, cfg.Cs, cfg.TileSizeX, cfg.TileSizeZ, out var tw, out var th); Task task; if (1 < threads) { task = BuildMultiThreadAsync(geom, cfg, bmin, bmax, tw, th, results, taskFactory, cancellationToken); } else { task = BuildSingleThreadAsync(geom, cfg, bmin, bmax, tw, th, results); } return task; } private Task BuildSingleThreadAsync(IInputGeomProvider geom, RcConfig cfg, RcVec3f bmin, RcVec3f bmax, int tw, int th, List<RecastBuilderResult> results) { RcAtomicInteger counter = new RcAtomicInteger(0); for (int y = 0; y < th; ++y) { for (int x = 0; x < tw; ++x) { results.Add(BuildTile(geom, cfg, bmin, bmax, x, y, counter, tw * th)); } } return Task.CompletedTask; } private Task BuildMultiThreadAsync(IInputGeomProvider geom, RcConfig cfg, RcVec3f bmin, RcVec3f bmax, int tw, int th, List<RecastBuilderResult> results, TaskFactory taskFactory, CancellationToken cancellationToken) { RcAtomicInteger counter = new RcAtomicInteger(0); CountdownEvent latch = new CountdownEvent(tw * th); List<Task> tasks = new List<Task>(); for (int x = 0; x < tw; ++x) { for (int y = 0; y < th; ++y) { int tx = x; int ty = y; var task = taskFactory.StartNew(() => { if (cancellationToken.IsCancellationRequested) return; try { RecastBuilderResult tile = BuildTile(geom, cfg, bmin, bmax, tx, ty, counter, tw * th); lock (results) { results.Add(tile); } } catch (Exception e) { Console.WriteLine(e); } latch.Signal(); }, cancellationToken); tasks.Add(task); } } try { latch.Wait(); } catch (ThreadInterruptedException) { } return Task.WhenAll(tasks.ToArray()); } public RecastBuilderResult BuildTile(IInputGeomProvider geom, RcConfig cfg, RcVec3f bmin, RcVec3f bmax, int tx, int ty, RcAtomicInteger counter, int total) { RecastBuilderResult result = Build(geom, new RecastBuilderConfig(cfg, bmin, bmax, tx, ty)); if (progressListener != null) { progressListener.OnProgress(counter.IncrementAndGet(), total); } return result; } public RecastBuilderResult Build(IInputGeomProvider geom, RecastBuilderConfig builderCfg) { RcConfig cfg = builderCfg.cfg; RcTelemetry ctx = new RcTelemetry(); // // Step 1. Rasterize input polygon soup. // RcHeightfield solid = RecastVoxelization.BuildSolidHeightfield(geom, builderCfg, ctx); return Build(builderCfg.tileX, builderCfg.tileZ, geom, cfg, solid, ctx); } public RecastBuilderResult Build(int tileX, int tileZ, IInputGeomProvider geom, RcConfig cfg, RcHeightfield solid, RcTelemetry ctx) { FilterHeightfield(solid, cfg, ctx); RcCompactHeightfield chf = BuildCompactHeightfield(geom, cfg, ctx, solid); // Partition the heightfield so that we can use simple algorithm later // to triangulate the walkable areas. // There are 3 partitioning methods, each with some pros and cons: // 1) Watershed partitioning // - the classic Recast partitioning // - creates the nicest tessellation // - usually slowest // - partitions the heightfield into nice regions without holes or // overlaps // - the are some corner cases where this method creates produces holes // and overlaps // - holes may appear when a small obstacles is close to large open area // (triangulation can handle this) // - overlaps may occur if you have narrow spiral corridors (i.e // stairs), this make triangulation to fail // * generally the best choice if you precompute the navmesh, use this // if you have large open areas // 2) Monotone partioning // - fastest // - partitions the heightfield into regions without holes and overlaps // (guaranteed) // - creates long thin polygons, which sometimes causes paths with // detours // * use this if you want fast navmesh generation // 3) Layer partitoining // - quite fast // - partitions the heighfield into non-overlapping regions // - relies on the triangulation code to cope with holes (thus slower // than monotone partitioning) // - produces better triangles than monotone partitioning // - does not have the corner cases of watershed partitioning // - can be slow and create a bit ugly tessellation (still better than // monotone) // if you have large open areas with small obstacles (not a problem if // you use tiles) // * good choice to use for tiled navmesh with medium and small sized // tiles if (cfg.Partition == RcPartitionType.WATERSHED.Value) { // Prepare for region partitioning, by calculating distance field // along the walkable surface. RecastRegion.BuildDistanceField(ctx, chf); // Partition the walkable surface into simple regions without holes. RecastRegion.BuildRegions(ctx, chf, cfg.MinRegionArea, cfg.MergeRegionArea); } else if (cfg.Partition == RcPartitionType.MONOTONE.Value) { // Partition the walkable surface into simple regions without holes. // Monotone partitioning does not need distancefield. RecastRegion.BuildRegionsMonotone(ctx, chf, cfg.MinRegionArea, cfg.MergeRegionArea); } else { // Partition the walkable surface into simple regions without holes. RecastRegion.BuildLayerRegions(ctx, chf, cfg.MinRegionArea); } // // Step 5. Trace and simplify region contours. // // Create contours. RcContourSet cset = RecastContour.BuildContours(ctx, chf, cfg.MaxSimplificationError, cfg.MaxEdgeLen, RcConstants.RC_CONTOUR_TESS_WALL_EDGES); // // Step 6. Build polygons mesh from contours. // RcPolyMesh pmesh = RecastMesh.BuildPolyMesh(ctx, cset, cfg.MaxVertsPerPoly); // // Step 7. Create detail mesh which allows to access approximate height // on each polygon. // RcPolyMeshDetail dmesh = cfg.BuildMeshDetail ? RecastMeshDetail.BuildPolyMeshDetail(ctx, pmesh, chf, cfg.DetailSampleDist, cfg.DetailSampleMaxError) : null; return new RecastBuilderResult(tileX, tileZ, solid, chf, cset, pmesh, dmesh, ctx); } /* * Step 2. Filter walkable surfaces. */ private void FilterHeightfield(RcHeightfield solid, RcConfig cfg, RcTelemetry ctx) { // Once all geometry is rasterized, we do initial pass of filtering to // remove unwanted overhangs caused by the conservative rasterization // as well as filter spans where the character cannot possibly stand. if (cfg.FilterLowHangingObstacles) { RecastFilter.FilterLowHangingWalkableObstacles(ctx, cfg.WalkableClimb, solid); } if (cfg.FilterLedgeSpans) { RecastFilter.FilterLedgeSpans(ctx, cfg.WalkableHeight, cfg.WalkableClimb, solid); } if (cfg.FilterWalkableLowHeightSpans) { RecastFilter.FilterWalkableLowHeightSpans(ctx, cfg.WalkableHeight, solid); } } /* * Step 3. Partition walkable surface to simple regions. */ private RcCompactHeightfield BuildCompactHeightfield(IInputGeomProvider geom, RcConfig cfg, RcTelemetry ctx, RcHeightfield solid) { // Compact the heightfield so that it is faster to handle from now on. // This will result more cache coherent data as well as the neighbours // between walkable cells will be calculated. RcCompactHeightfield chf = RecastCompact.BuildCompactHeightfield(ctx, cfg.WalkableHeight, cfg.WalkableClimb, solid); // Erode the walkable area by agent radius. RecastArea.ErodeWalkableArea(ctx, cfg.WalkableRadius, chf); // (Optional) Mark areas. if (geom != null) { foreach (RcConvexVolume vol in geom.ConvexVolumes()) { RecastArea.MarkConvexPolyArea(ctx, vol.verts, vol.hmin, vol.hmax, vol.areaMod, chf); } } return chf; } public RcHeightfieldLayerSet BuildLayers(IInputGeomProvider geom, RecastBuilderConfig builderCfg) { RcTelemetry ctx = new RcTelemetry(); RcHeightfield solid = RecastVoxelization.BuildSolidHeightfield(geom, builderCfg, ctx); FilterHeightfield(solid, builderCfg.cfg, ctx); RcCompactHeightfield chf = BuildCompactHeightfield(geom, builderCfg.cfg, ctx, solid); return RecastLayers.BuildHeightfieldLayers(ctx, chf, builderCfg.cfg.WalkableHeight); } } }
ET/Unity/Assets/Scripts/ThirdParty/DotRecast/Recast/RecastBuilder.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/ThirdParty/DotRecast/Recast/RecastBuilder.cs", "repo_id": "ET", "token_count": 6095 }
190
/* Copyright (c) 2009-2010 Mikko Mononen [email protected] recast4j copyright (c) 2015-2019 Piotr Piastucki [email protected] DotRecast Copyright (c) 2023 Choi Ikpil [email protected] This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ using System; using System.Collections.Generic; using DotRecast.Core; namespace DotRecast.Recast { using static RecastCommon; using static RcConstants; public static class RecastLayers { const int RC_MAX_LAYERS = RcConstants.RC_NOT_CONNECTED; const int RC_MAX_NEIS = 16; private static void AddUnique(List<int> a, int v) { if (!a.Contains(v)) { a.Add(v); } } private static bool Contains(List<int> a, int v) { return a.Contains(v); } private static bool OverlapRange(int amin, int amax, int bmin, int bmax) { return (amin > bmax || amax < bmin) ? false : true; } public static RcHeightfieldLayerSet BuildHeightfieldLayers(RcTelemetry ctx, RcCompactHeightfield chf, int walkableHeight) { using var timer = ctx.ScopedTimer(RcTimerLabel.RC_TIMER_BUILD_LAYERS); int w = chf.width; int h = chf.height; int borderSize = chf.borderSize; int[] srcReg = new int[chf.spanCount]; Array.Fill(srcReg, 0xFF); int nsweeps = chf.width; // Math.Max(chf.width, chf.height); RcSweepSpan[] sweeps = new RcSweepSpan[nsweeps]; for (int i = 0; i < sweeps.Length; i++) { sweeps[i] = new RcSweepSpan(); } // Partition walkable area into monotone regions. int[] prevCount = new int[256]; int regId = 0; // Sweep one line at a time. for (int y = borderSize; y < h - borderSize; ++y) { // Collect spans from this row. Array.Fill(prevCount, 0, 0, (regId) - (0)); int sweepId = 0; for (int x = borderSize; x < w - borderSize; ++x) { RcCompactCell c = chf.cells[x + y * w]; for (int i = c.index, ni = c.index + c.count; i < ni; ++i) { RcCompactSpan s = chf.spans[i]; if (chf.areas[i] == RC_NULL_AREA) continue; int sid = 0xFF; // -x if (GetCon(s, 0) != RC_NOT_CONNECTED) { int ax = x + GetDirOffsetX(0); int ay = y + GetDirOffsetY(0); int ai = chf.cells[ax + ay * w].index + GetCon(s, 0); if (chf.areas[ai] != RC_NULL_AREA && srcReg[ai] != 0xff) sid = srcReg[ai]; } if (sid == 0xff) { sid = sweepId++; sweeps[sid].nei = 0xff; sweeps[sid].ns = 0; } // -y if (GetCon(s, 3) != RC_NOT_CONNECTED) { int ax = x + GetDirOffsetX(3); int ay = y + GetDirOffsetY(3); int ai = chf.cells[ax + ay * w].index + GetCon(s, 3); int nr = srcReg[ai]; if (nr != 0xff) { // Set neighbour when first valid neighbour is // encoutered. if (sweeps[sid].ns == 0) sweeps[sid].nei = nr; if (sweeps[sid].nei == nr) { // Update existing neighbour sweeps[sid].ns++; prevCount[nr]++; } else { // This is hit if there is nore than one // neighbour. // Invalidate the neighbour. sweeps[sid].nei = 0xff; } } } srcReg[i] = sid; } } // Create unique ID. for (int i = 0; i < sweepId; ++i) { // If the neighbour is set and there is only one continuous // connection to it, // the sweep will be merged with the previous one, else new // region is created. if (sweeps[i].nei != 0xff && prevCount[sweeps[i].nei] == sweeps[i].ns) { sweeps[i].id = sweeps[i].nei; } else { if (regId == 255) { throw new Exception("rcBuildHeightfieldLayers: Region ID overflow."); } sweeps[i].id = regId++; } } // Remap local sweep ids to region ids. for (int x = borderSize; x < w - borderSize; ++x) { RcCompactCell c = chf.cells[x + y * w]; for (int i = c.index, ni = c.index + c.count; i < ni; ++i) { if (srcReg[i] != 0xff) srcReg[i] = sweeps[srcReg[i]].id; } } } int nregs = regId; RcLayerRegion[] regs = new RcLayerRegion[nregs]; // Construct regions for (int i = 0; i < nregs; ++i) { regs[i] = new RcLayerRegion(i); } // Find region neighbours and overlapping regions. List<int> lregs = new List<int>(); for (int y = 0; y < h; ++y) { for (int x = 0; x < w; ++x) { RcCompactCell c = chf.cells[x + y * w]; lregs.Clear(); for (int i = c.index, ni = c.index + c.count; i < ni; ++i) { RcCompactSpan s = chf.spans[i]; int ri = srcReg[i]; if (ri == 0xff) continue; regs[ri].ymin = Math.Min(regs[ri].ymin, s.y); regs[ri].ymax = Math.Max(regs[ri].ymax, s.y); // Collect all region layers. lregs.Add(ri); // Update neighbours for (int dir = 0; dir < 4; ++dir) { if (GetCon(s, dir) != RC_NOT_CONNECTED) { int ax = x + GetDirOffsetX(dir); int ay = y + GetDirOffsetY(dir); int ai = chf.cells[ax + ay * w].index + GetCon(s, dir); int rai = srcReg[ai]; if (rai != 0xff && rai != ri) AddUnique(regs[ri].neis, rai); } } } // Update overlapping regions. for (int i = 0; i < lregs.Count - 1; ++i) { for (int j = i + 1; j < lregs.Count; ++j) { if (lregs[i] != lregs[j]) { RcLayerRegion ri = regs[lregs[i]]; RcLayerRegion rj = regs[lregs[j]]; AddUnique(ri.layers, lregs[j]); AddUnique(rj.layers, lregs[i]); } } } } } // Create 2D layers from regions. int layerId = 0; List<int> stack = new List<int>(); for (int i = 0; i < nregs; ++i) { RcLayerRegion root = regs[i]; // Skip already visited. if (root.layerId != 0xff) continue; // Start search. root.layerId = layerId; root.@base = true; stack.Add(i); while (stack.Count != 0) { // Pop front int pop = stack[0]; // TODO : 여기에 stack 처럼 작동하게 했는데, 스택인지는 모르겠음 stack.RemoveAt(0); RcLayerRegion reg = regs[pop]; foreach (int nei in reg.neis) { RcLayerRegion regn = regs[nei]; // Skip already visited. if (regn.layerId != 0xff) continue; // Skip if the neighbour is overlapping root region. if (Contains(root.layers, nei)) continue; // Skip if the height range would become too large. int ymin = Math.Min(root.ymin, regn.ymin); int ymax = Math.Max(root.ymax, regn.ymax); if ((ymax - ymin) >= 255) continue; // Deepen stack.Add(nei); // Mark layer id regn.layerId = layerId; // Merge current layers to root. foreach (int layer in regn.layers) AddUnique(root.layers, layer); root.ymin = Math.Min(root.ymin, regn.ymin); root.ymax = Math.Max(root.ymax, regn.ymax); } } layerId++; } // Merge non-overlapping regions that are close in height. int mergeHeight = walkableHeight * 4; for (int i = 0; i < nregs; ++i) { RcLayerRegion ri = regs[i]; if (!ri.@base) continue; int newId = ri.layerId; for (;;) { int oldId = 0xff; for (int j = 0; j < nregs; ++j) { if (i == j) continue; RcLayerRegion rj = regs[j]; if (!rj.@base) continue; // Skip if the regions are not close to each other. if (!OverlapRange(ri.ymin, ri.ymax + mergeHeight, rj.ymin, rj.ymax + mergeHeight)) continue; // Skip if the height range would become too large. int ymin = Math.Min(ri.ymin, rj.ymin); int ymax = Math.Max(ri.ymax, rj.ymax); if ((ymax - ymin) >= 255) continue; // Make sure that there is no overlap when merging 'ri' and // 'rj'. bool overlap = false; // Iterate over all regions which have the same layerId as // 'rj' for (int k = 0; k < nregs; ++k) { if (regs[k].layerId != rj.layerId) continue; // Check if region 'k' is overlapping region 'ri' // Index to 'regs' is the same as region id. if (Contains(ri.layers, k)) { overlap = true; break; } } // Cannot merge of regions overlap. if (overlap) continue; // Can merge i and j. oldId = rj.layerId; break; } // Could not find anything to merge with, stop. if (oldId == 0xff) break; // Merge for (int j = 0; j < nregs; ++j) { RcLayerRegion rj = regs[j]; if (rj.layerId == oldId) { rj.@base = false; // Remap layerIds. rj.layerId = newId; // Add overlaid layers from 'rj' to 'ri'. foreach (int layer in rj.layers) AddUnique(ri.layers, layer); // Update height bounds. ri.ymin = Math.Min(ri.ymin, rj.ymin); ri.ymax = Math.Max(ri.ymax, rj.ymax); } } } } // Compact layerIds int[] remap = new int[256]; // Find number of unique layers. layerId = 0; for (int i = 0; i < nregs; ++i) remap[regs[i].layerId] = 1; for (int i = 0; i < 256; ++i) { if (remap[i] != 0) remap[i] = layerId++; else remap[i] = 0xff; } // Remap ids. for (int i = 0; i < nregs; ++i) regs[i].layerId = remap[regs[i].layerId]; // No layers, return empty. if (layerId == 0) { // ctx.Stop(RC_TIMER_BUILD_LAYERS); return null; } // Create layers. // RcAssert(lset.layers == 0); int lw = w - borderSize * 2; int lh = h - borderSize * 2; // Build contracted bbox for layers. RcVec3f bmin = chf.bmin; RcVec3f bmax = chf.bmax; bmin.x += borderSize * chf.cs; bmin.z += borderSize * chf.cs; bmax.x -= borderSize * chf.cs; bmax.z -= borderSize * chf.cs; RcHeightfieldLayerSet lset = new RcHeightfieldLayerSet(); lset.layers = new RcHeightfieldLayer[layerId]; for (int i = 0; i < lset.layers.Length; i++) { lset.layers[i] = new RcHeightfieldLayer(); } // Store layers. for (int i = 0; i < lset.layers.Length; ++i) { int curId = i; RcHeightfieldLayer layer = lset.layers[i]; int gridSize = lw * lh; layer.heights = new int[gridSize]; Array.Fill(layer.heights, 0xFF); layer.areas = new int[gridSize]; layer.cons = new int[gridSize]; // Find layer height bounds. int hmin = 0, hmax = 0; for (int j = 0; j < nregs; ++j) { if (regs[j].@base && regs[j].layerId == curId) { hmin = regs[j].ymin; hmax = regs[j].ymax; } } layer.width = lw; layer.height = lh; layer.cs = chf.cs; layer.ch = chf.ch; // Adjust the bbox to fit the heightfield. layer.bmin = bmin; layer.bmax = bmax; layer.bmin.y = bmin.y + hmin * chf.ch; layer.bmax.y = bmin.y + hmax * chf.ch; layer.hmin = hmin; layer.hmax = hmax; // Update usable data region. layer.minx = layer.width; layer.maxx = 0; layer.miny = layer.height; layer.maxy = 0; // Copy height and area from compact heightfield. for (int y = 0; y < lh; ++y) { for (int x = 0; x < lw; ++x) { int cx = borderSize + x; int cy = borderSize + y; RcCompactCell c = chf.cells[cx + cy * w]; for (int j = c.index, nj = c.index + c.count; j < nj; ++j) { RcCompactSpan s = chf.spans[j]; // Skip unassigned regions. if (srcReg[j] == 0xff) continue; // Skip of does nto belong to current layer. int lid = regs[srcReg[j]].layerId; if (lid != curId) continue; // Update data bounds. layer.minx = Math.Min(layer.minx, x); layer.maxx = Math.Max(layer.maxx, x); layer.miny = Math.Min(layer.miny, y); layer.maxy = Math.Max(layer.maxy, y); // Store height and area type. int idx = x + y * lw; layer.heights[idx] = (char)(s.y - hmin); layer.areas[idx] = chf.areas[j]; // Check connection. char portal = (char)0; char con = (char)0; for (int dir = 0; dir < 4; ++dir) { if (GetCon(s, dir) != RC_NOT_CONNECTED) { int ax = cx + GetDirOffsetX(dir); int ay = cy + GetDirOffsetY(dir); int ai = chf.cells[ax + ay * w].index + GetCon(s, dir); int alid = srcReg[ai] != 0xff ? regs[srcReg[ai]].layerId : 0xff; // Portal mask if (chf.areas[ai] != RC_NULL_AREA && lid != alid) { portal |= (char)(1 << dir); // Update height so that it matches on both // sides of the portal. RcCompactSpan @as = chf.spans[ai]; if (@as.y > hmin) layer.heights[idx] = Math.Max(layer.heights[idx], (char)(@as.y - hmin)); } // Valid connection mask if (chf.areas[ai] != RC_NULL_AREA && lid == alid) { int nx = ax - borderSize; int ny = ay - borderSize; if (nx >= 0 && ny >= 0 && nx < lw && ny < lh) con |= (char)(1 << dir); } } } layer.cons[idx] = (portal << 4) | con; } } } if (layer.minx > layer.maxx) layer.minx = layer.maxx = 0; if (layer.miny > layer.maxy) layer.miny = layer.maxy = 0; } // ctx->StopTimer(RC_TIMER_BUILD_LAYERS); return lset; } } }
ET/Unity/Assets/Scripts/ThirdParty/DotRecast/Recast/RecastLayers.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/ThirdParty/DotRecast/Recast/RecastLayers.cs", "repo_id": "ET", "token_count": 13927 }
191
fileFormatVersion: 2 guid: 3949ca80c556c1646882da57051f3945 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/ThirdParty/ETTask/StateMachineWrap.cs.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/ThirdParty/ETTask/StateMachineWrap.cs.meta", "repo_id": "ET", "token_count": 91 }
192
using System; using System.Diagnostics; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; namespace NativeCollection { public unsafe partial struct FixedSizeMemoryPool { public struct Slab : IDisposable { public int BlockSize; public int FreeSize; public int ItemSize; public ListNode* FreeList; public Slab* Prev; public Slab* Next; public Slab* Self { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { return (Slab*)Unsafe.AsPointer(ref this); } } public static Slab* Create(int blockSize,int itemSize,Slab* prevSlab , Slab* nextSlab ) { int size = itemSize + Unsafe.SizeOf<IntPtr>(); int slabSize =Unsafe.SizeOf<Slab>() + size * blockSize; byte* slabBuffer = (byte*)NativeMemoryHelper.Alloc((UIntPtr)slabSize); Slab* slab = (Slab*)slabBuffer; slab->BlockSize = blockSize; slab->FreeSize = blockSize; slab->ItemSize = itemSize; slab->Prev = prevSlab; slab->Next = nextSlab; slabBuffer+=Unsafe.SizeOf<Slab>(); ListNode* next = null; for (int i = blockSize-1; i >= 0; i--) { ListNode* listNode = (ListNode*)(slabBuffer + i*size); listNode->Next = next; next = listNode; } slab->FreeList = next; return slab; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public byte* Alloc() { Debug.Assert(FreeList!=null && FreeSize>0); FreeSize--; ListNode* node = FreeList; FreeList = FreeList->Next; node->ParentSlab = Self; node += 1; return (byte*)node; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public void Free(ListNode* node) { Debug.Assert(FreeSize<BlockSize && node!=null); FreeSize++; node->Next = FreeList; FreeList = node; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public bool IsAllFree() { return FreeSize == BlockSize; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public bool IsAllAlloc() { return FreeSize == 0; } public void Dispose() { int slabSize =Unsafe.SizeOf<Slab>() + (ItemSize + Unsafe.SizeOf<IntPtr>()) * BlockSize; Slab* self = Self; NativeMemoryHelper.Free(self); NativeMemoryHelper.RemoveNativeMemoryByte(slabSize); } } [StructLayout(LayoutKind.Explicit)] public struct ListNode { [FieldOffset(0)] public ListNode* Next; [FieldOffset(0)] public Slab* ParentSlab; } public struct SlabLinkedList { public int SlabCount; public Slab* Top; public Slab* Bottom; public SlabLinkedList(Slab* initSlab) { Top = initSlab; Bottom = initSlab; SlabCount = initSlab==null?0:1; } public void MoveTopToBottom() { Debug.Assert(Top!=null && Bottom!=null); if (Top==Bottom) { return; } Slab* oldTop = Top; Top = Top->Next; Top->Prev = null; Bottom->Next = oldTop; oldTop->Prev = Bottom; oldTop->Next = null; Bottom = oldTop; } public void SplitOut(Slab* splitSlab) { Debug.Assert(splitSlab!=null && Top!=null && Bottom!=null); SlabCount--; // 只有一个slab if (Top==Bottom) { splitSlab->Prev = null; splitSlab->Next = null; Top = null; Bottom = null; return; } // 链表头部 if (splitSlab == Top) { Top = splitSlab->Next; splitSlab->Next = null; Top->Prev = null; return; } if (splitSlab == Bottom) { Bottom = splitSlab->Prev; Bottom->Next = null; splitSlab->Prev = null; return; } var prev = splitSlab->Prev; var next = splitSlab->Next; prev->Next = next; next->Prev = prev; splitSlab->Prev = null; splitSlab->Next = null; } public void AddToTop(Slab* slab) { SlabCount++; if (Top == Bottom) { if (Top==null) { Top = slab; Bottom = slab; slab->Prev = null; slab->Next = null; } else { Slab* oldTop = Top; Top = slab; Top->Next = oldTop; Top->Prev = null; oldTop->Prev = Top; } return; } Slab* oldSlab = Top; Top = slab; Top->Next = oldSlab; Top->Prev = null; oldSlab->Prev = Top; } } } }
ET/Unity/Assets/Scripts/ThirdParty/NativeCollection/FixedSizeMemoryPool/Slab.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/ThirdParty/NativeCollection/FixedSizeMemoryPool/Slab.cs", "repo_id": "ET", "token_count": 3837 }
193
using System; using System.Runtime.CompilerServices; namespace NativeCollection { public unsafe class Queue<T> : INativeCollectionClass where T : unmanaged { private UnsafeType.Queue<T>* _queue; private const int _defaultCapacity = 10; private int _capacity; public Queue(int capacity = 10) { _capacity = capacity; _queue = UnsafeType.Queue<T>.Create(_capacity); IsDisposed = false; } public int Count => _queue->Count; public void Dispose() { if (IsDisposed) { return; } if (_queue != null) { _queue->Dispose(); NativeMemoryHelper.Free(_queue); NativeMemoryHelper.RemoveNativeMemoryByte(Unsafe.SizeOf<UnsafeType.Queue<T>>()); IsDisposed = true; } } [MethodImpl(MethodImplOptions.AggressiveInlining)] public void Clear() { _queue->Clear(); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public void Enqueue(in T item) { _queue->Enqueue(item); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public T Dequeue() { return _queue->Dequeue(); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public bool TryDequeue(out T result) { var value = _queue->TryDequeue(out result); return value; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public T Peek() { return _queue->Peek(); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public bool TryPeek(out T result) { var value = _queue->TryPeek(out result); return value; } ~Queue() { Dispose(); } public void ReInit() { if (IsDisposed) { _queue = UnsafeType.Queue<T>.Create(_capacity); IsDisposed = false; } } public bool IsDisposed { get; private set; } } }
ET/Unity/Assets/Scripts/ThirdParty/NativeCollection/Queue.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/ThirdParty/NativeCollection/Queue.cs", "repo_id": "ET", "token_count": 1194 }
194
using System; using System.Diagnostics; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; namespace NativeCollection.UnsafeType { public unsafe partial struct SortedSet<T> { internal enum NodeColor : byte { Black, Red } internal enum TreeRotation : byte { Left, LeftRight, Right, RightLeft } internal struct Node : IEquatable<Node>, IPool { public Node* Left; public Node* Right; public NodeColor Color; public T Item; public Node* Self { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { return (Node*)Unsafe.AsPointer(ref this); } } public bool IsBlack { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { return Color == NodeColor.Black; } } public bool IsRed { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { return Color == NodeColor.Red; } } public bool Is2Node { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { return IsBlack && IsNullOrBlack(Left) && IsNullOrBlack(Right); } } public bool Is4Node { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { return IsNonNullRed(Left) && IsNonNullRed(Right); } } [MethodImpl(MethodImplOptions.AggressiveInlining)] public void ColorBlack() { Color = NodeColor.Black; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public void ColorRed() { Color = NodeColor.Red; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool IsNonNullBlack(Node* node) { return node != null && node->IsBlack; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool IsNonNullRed(Node* node) { return node != null && node->IsRed; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool IsNullOrBlack(Node* node) { return node == null || node->IsBlack; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Node* Create(in T item, NodeColor nodeColor) { var node = (Node*)NativeMemoryHelper.Alloc((UIntPtr)Unsafe.SizeOf<Node>()); node->Item = item; node->Color = nodeColor; node->Left = null; node->Right = null; return node; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Node* AllocFromMemoryPool(in T item, NodeColor nodeColor, FixedSizeMemoryPool* memoryPool) { Node* node = (Node*)memoryPool->Alloc(); node->Item = item; node->Color = nodeColor; node->Left = null; node->Right = null; return node; } public struct NodeSourceTarget : IEquatable<NodeSourceTarget> { public Node* Source; public Node* Target; public NodeSourceTarget(Node* source, Node* target) { Source = source; Target = target; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public bool Equals(NodeSourceTarget other) { return Source == other.Source && Target == other.Target; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public override int GetHashCode() { return HashCode.Combine(unchecked((int)(long)Source), unchecked((int)(long)Target)); } } public Node* DeepClone(int count) { #if DEBUG Debug.Assert(count == GetCount()); #endif var newRoot = ShallowClone(); var pendingNodes = UnsafeType.Stack<NodeSourceTarget>.Create(2 * Log2(count) + 2); pendingNodes->Push(new NodeSourceTarget(Self, newRoot)); while (pendingNodes->TryPop(out var next)) { Node* clonedNode; var left = next.Source->Left; var right = next.Source->Right; if (left != null) { clonedNode = left->ShallowClone(); next.Target->Left = clonedNode; pendingNodes->Push(new NodeSourceTarget(left, clonedNode)); } if (right != null) { clonedNode = right->ShallowClone(); next.Target->Right = clonedNode; pendingNodes->Push(new NodeSourceTarget(right, clonedNode)); } } pendingNodes->Dispose(); NativeMemoryHelper.Free(pendingNodes); NativeMemoryHelper.RemoveNativeMemoryByte(Unsafe.SizeOf<UnsafeType.Stack<NodeSourceTarget>>()); return newRoot; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public TreeRotation GetRotation(Node* current, Node* sibling) { Debug.Assert(IsNonNullRed(sibling->Left) || IsNonNullRed(sibling->Right)); #if DEBUG Debug.Assert(HasChildren(current, sibling)); #endif var currentIsLeftChild = Left == current; return IsNonNullRed(sibling->Left) ? currentIsLeftChild ? TreeRotation.RightLeft : TreeRotation.Right : currentIsLeftChild ? TreeRotation.Left : TreeRotation.LeftRight; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public Node* GetSibling(Node* node) { Debug.Assert(node != null); Debug.Assert((node == Left) ^ (node == Right)); return node == Left ? Right : Left; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public Node* ShallowClone() { return Create(Item, Color); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public void Split4Node() { Debug.Assert(Left != null); Debug.Assert(Right != null); ColorRed(); Left->ColorBlack(); Right->ColorBlack(); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public Node* Rotate(TreeRotation rotation) { Node* removeRed; switch (rotation) { case TreeRotation.Right: removeRed = Left == null ? Left : Left->Left; Debug.Assert(removeRed->IsRed); removeRed->ColorBlack(); return RotateRight(); case TreeRotation.Left: removeRed = Right == null ? Right : Right->Right!; Debug.Assert(removeRed->IsRed); removeRed->ColorBlack(); return RotateLeft(); case TreeRotation.RightLeft: Debug.Assert(Right->Left->IsRed); return RotateRightLeft(); case TreeRotation.LeftRight: Debug.Assert(Left->Right->IsRed); return RotateLeftRight(); default: Debug.Fail($"{nameof(rotation)}: {rotation} is not a defined {nameof(TreeRotation)} value."); return null; } } [MethodImpl(MethodImplOptions.AggressiveInlining)] public Node* RotateLeft() { var child = Right; Right = child->Left; child->Left = Self; return child; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public Node* RotateLeftRight() { var child = Left; var grandChild = child->Right!; Left = grandChild->Right; grandChild->Right = Self; child->Right = grandChild->Left; grandChild->Left = child; return grandChild; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public Node* RotateRight() { var child = Left; Left = child->Right; child->Right = Self; return child; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public Node* RotateRightLeft() { var child = Right; var grandChild = child->Left; Right = grandChild->Left; grandChild->Left = Self; child->Left = grandChild->Right; grandChild->Right = child; return grandChild; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public void Merge2Nodes() { Debug.Assert(IsRed); Debug.Assert(Left->Is2Node); Debug.Assert(Right->Is2Node); // Combine two 2-nodes into a 4-node. ColorBlack(); Left->ColorRed(); Right->ColorRed(); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public void ReplaceChild(Node* child, Node* newChild) { #if DEBUG Debug.Assert(HasChild(child)); #endif if (Left == child) Left = newChild; else Right = newChild; } #if DEBUG private int GetCount() { var value = 1; if (Left != null) value += Left->GetCount(); if (Right != null) value += Right->GetCount(); return value; } private bool HasChild(Node* child) { return child == Left || child == Right; } private bool HasChildren(Node* child1, Node* child2) { Debug.Assert(child1 != child2); return (Left == child1 && Right == child2) || (Left == child2 && Right == child1); } #endif [MethodImpl(MethodImplOptions.AggressiveInlining)] public bool Equals(Node other) { return (Item).Equals(other.Item) && Self == other.Self && Color == other.Color && Left == other.Left && Right == other.Right; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public override int GetHashCode() { return HashCode.Combine(Item, unchecked((int)(long)Self), (int)Color, unchecked((int)(long)Left), unchecked((int)(long)Right)); } public void Dispose() { } public void OnReturnToPool() { } public void OnGetFromPool() { } } } }
ET/Unity/Assets/Scripts/ThirdParty/NativeCollection/UnsafeType/SortedSet/Node.cs/0
{ "file_path": "ET/Unity/Assets/Scripts/ThirdParty/NativeCollection/UnsafeType/SortedSet/Node.cs", "repo_id": "ET", "token_count": 5420 }
195
fileFormatVersion: 2 guid: 534562c452001463e85f157213209e19 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Scripts/ThirdParty/TrueSync/Fix64SinLut.cs.meta/0
{ "file_path": "ET/Unity/Assets/Scripts/ThirdParty/TrueSync/Fix64SinLut.cs.meta", "repo_id": "ET", "token_count": 92 }
196
fileFormatVersion: 2 guid: de6fa04b596a40249abf616d06b292cf DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Settings/IgnoreAsmdef/Hotfix/Client/Ignore.asmdef.DISABLED.meta/0
{ "file_path": "ET/Unity/Assets/Settings/IgnoreAsmdef/Hotfix/Client/Ignore.asmdef.DISABLED.meta", "repo_id": "ET", "token_count": 62 }
197
fileFormatVersion: 2 guid: acccac95374e243419605c129112464f folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Settings/IgnoreAsmdef/Model/Generate/ClientServer.meta/0
{ "file_path": "ET/Unity/Assets/Settings/IgnoreAsmdef/Model/Generate/ClientServer.meta", "repo_id": "ET", "token_count": 66 }
198
fileFormatVersion: 2 guid: 7995cfbbc1fea9d49b9d9e9b1a4bee57 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 userData: assetBundleName: assetBundleVariant:
ET/Unity/Assets/Settings/UniversalRenderPipelineGlobalSettings.asset.meta/0
{ "file_path": "ET/Unity/Assets/Settings/UniversalRenderPipelineGlobalSettings.asset.meta", "repo_id": "ET", "token_count": 79 }
199