add kcp
This commit is contained in:
@@ -7,6 +7,7 @@ using Cysharp.Threading.Tasks;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
// ReSharper disable StringLiteralTypo
|
||||
#if NET5_0_OR_GREATER
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
#endif
|
||||
@@ -19,6 +20,10 @@ namespace BITKit
|
||||
}
|
||||
public class BITApp
|
||||
{
|
||||
public static async UniTask SwitchToMainThread()
|
||||
{
|
||||
await UniTask.SwitchToSynchronizationContext(SynchronizationContext);
|
||||
}
|
||||
public static class Time
|
||||
{
|
||||
public static float DeltaTime { get; internal set; }
|
||||
@@ -59,7 +64,89 @@ namespace BITKit
|
||||
"TextCopy",
|
||||
"Blazored",
|
||||
"TextCopy",
|
||||
"mattatz"
|
||||
"mattatz",
|
||||
"TrailsFX",
|
||||
"Knife",
|
||||
"Needle",
|
||||
"NiceIO",
|
||||
"AndroidPlayerBuildProgram",
|
||||
"DocCodeExamples",
|
||||
"System",
|
||||
"UnityEngine",
|
||||
"Unity",
|
||||
"Microsoft",
|
||||
"UnityEditor",
|
||||
"Google",
|
||||
"Mono",
|
||||
"ZXing",
|
||||
"ImmersiveVRTools",
|
||||
"MonKey",
|
||||
"FLib",
|
||||
"Kcp",
|
||||
"Udx",
|
||||
"Sirenix",
|
||||
"TMPro",
|
||||
"RotaryHeart",
|
||||
"Cinemachine",
|
||||
"ParadoxNotion",
|
||||
"Net",
|
||||
"VSCodeEditor",
|
||||
"AOT",
|
||||
"UnityEditorInternal",
|
||||
"UnityEngineInternal",
|
||||
"JetBrains",
|
||||
"Bee",
|
||||
"NotInvited",
|
||||
"HighlightPlus",
|
||||
"DG",
|
||||
"Hierarchy2",
|
||||
"Cysharp",
|
||||
"JetBrains",
|
||||
"Packages",
|
||||
"Newtonsoft_X",
|
||||
"Binding",
|
||||
"NodeCanvas",
|
||||
"SaveDuringPlay",
|
||||
"LimWorks",
|
||||
"MagicaCloth2",
|
||||
"FastScriptReload",
|
||||
"ParrelSync",
|
||||
"KinematicCharacterController",
|
||||
"LimWorksEditor",
|
||||
"BuildComponent",
|
||||
"dnlib",
|
||||
"BigIntegerLibrary",
|
||||
"Ionic",
|
||||
"log4net",
|
||||
"ImmersiveVrToolsCommon",
|
||||
"NUnit",
|
||||
"HarmonyLib",
|
||||
"MonoMod",
|
||||
"WebDav",
|
||||
"PlasticGui",
|
||||
"Codice",
|
||||
"GluonGui",
|
||||
"PlasticPipe",
|
||||
"XDiffGui",
|
||||
"MacFsWatcher",
|
||||
"MacUI",
|
||||
"PlayerBuildProgramLibrary",
|
||||
"ExCSS",
|
||||
"ScriptCompilationBuildProgram",
|
||||
"BeeBuildProgramCommon",
|
||||
"Accessibility",
|
||||
"CodiceApp",
|
||||
"Newtonsoft",
|
||||
"MergetoolGui",
|
||||
"TreeEditor",
|
||||
"MackySoft",
|
||||
"FullscreenEditor",
|
||||
"mattatz",
|
||||
"AYellowpaper",
|
||||
"kcp2k",
|
||||
"MeshCombineStudio",
|
||||
"AmazingAssets",
|
||||
"Utilities"
|
||||
};
|
||||
}
|
||||
#if NET5_0_OR_GREATER
|
||||
@@ -144,7 +231,8 @@ namespace BITKit
|
||||
public static InitializationState State;
|
||||
public static Assembly[] Assemblies;
|
||||
public static AppSettings Settings { get; protected set; }
|
||||
public static async void Start(string appName = nameof(BITApp),AppSettings settings=default)
|
||||
private static DateTime InitialTime { get; set; }=DateTime.Now;
|
||||
public static async UniTask Start(string appName = nameof(BITApp),AppSettings settings=default)
|
||||
{
|
||||
Time.TimeAsDouble = 0;
|
||||
Time.DeltaTime = 1 / 60f;
|
||||
@@ -153,7 +241,7 @@ namespace BITKit
|
||||
CancellationTokenSource = new CancellationTokenSource();
|
||||
AppName = appName;
|
||||
ThreadHelper.LogCurrentThread();
|
||||
|
||||
InitialTime = DateTime.Now;
|
||||
await Init();
|
||||
}
|
||||
private static async Task Init()
|
||||
@@ -182,10 +270,16 @@ namespace BITKit
|
||||
reflectionHelperWatch.Start();
|
||||
await ReflectionHelper.Init();
|
||||
reflectionHelperWatch.Stop();
|
||||
|
||||
Stopwatch commandWatch = new();
|
||||
await BITCommands.InitializeAsync();
|
||||
commandWatch.Stop();
|
||||
|
||||
|
||||
stopwatch.Stop();
|
||||
State = InitializationState.Initialized;
|
||||
BIT4Log.Log<BITApp>($"已完成初始化,耗时:{stopwatch.ElapsedMilliseconds}ms");
|
||||
BIT4Log.Log<BITApp>($"反射初始化耗时:{reflectionHelperWatch.ElapsedMilliseconds}ms");
|
||||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
@@ -196,11 +290,18 @@ namespace BITKit
|
||||
}
|
||||
public static void Stop()
|
||||
{
|
||||
var runTime = DateTime.Now - InitialTime;
|
||||
|
||||
BIT4Log.Log<BITApp>($"正在停止{nameof(BITApp)}");
|
||||
CancellationTokenSource.Cancel();
|
||||
State = InitializationState.None;
|
||||
|
||||
BITCommands.Dispose();
|
||||
|
||||
BIT4Log.Log<BITApp>($"已停止{nameof(BITApp)}");
|
||||
BIT4Log.Log<BITApp>($"运行时间:{runTime}");
|
||||
BIT4Log.Log<BITApp>("Exit Code:0");
|
||||
|
||||
}
|
||||
public static void Run(string path, string WorkingDirectory = "")
|
||||
{
|
||||
|
Reference in New Issue
Block a user