1
This commit is contained in:
@@ -22,6 +22,11 @@ namespace BITKit.Console
|
||||
{
|
||||
public class BITConsole : MonoBehaviour
|
||||
{
|
||||
[RuntimeInitializeOnLoadMethod]
|
||||
private static void Reload()
|
||||
{
|
||||
Application.logMessageReceivedThreaded += EnqueueLog;
|
||||
}
|
||||
private class CommandSelector
|
||||
{
|
||||
public VisualElement Container { get; set; }
|
||||
@@ -163,17 +168,6 @@ namespace BITKit.Console
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
Application.logMessageReceived += EnqueueLog;
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
Application.logMessageReceived -= EnqueueLog;
|
||||
}
|
||||
|
||||
private void OnNextLine()
|
||||
{
|
||||
if (outputString.Count is not 0 && outputString.Last() != string.Empty)
|
||||
|
BIN
Assets/BITKit/Unity/Scripts/I18N/I18N.CJK.dll
Normal file
BIN
Assets/BITKit/Unity/Scripts/I18N/I18N.CJK.dll
Normal file
Binary file not shown.
BIN
Assets/BITKit/Unity/Scripts/I18N/I18N.MidEast.dll
Normal file
BIN
Assets/BITKit/Unity/Scripts/I18N/I18N.MidEast.dll
Normal file
Binary file not shown.
BIN
Assets/BITKit/Unity/Scripts/I18N/I18N.Other.dll
Normal file
BIN
Assets/BITKit/Unity/Scripts/I18N/I18N.Other.dll
Normal file
Binary file not shown.
BIN
Assets/BITKit/Unity/Scripts/I18N/I18N.Rare.dll
Normal file
BIN
Assets/BITKit/Unity/Scripts/I18N/I18N.Rare.dll
Normal file
Binary file not shown.
BIN
Assets/BITKit/Unity/Scripts/I18N/I18N.West.dll
Normal file
BIN
Assets/BITKit/Unity/Scripts/I18N/I18N.West.dll
Normal file
Binary file not shown.
16
Assets/BITKit/Unity/Scripts/I18N/I18N.asmdef
Normal file
16
Assets/BITKit/Unity/Scripts/I18N/I18N.asmdef
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "I18N",
|
||||
"rootNamespace": "",
|
||||
"references": [],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
BIN
Assets/BITKit/Unity/Scripts/I18N/I18N.dll
Normal file
BIN
Assets/BITKit/Unity/Scripts/I18N/I18N.dll
Normal file
Binary file not shown.
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
@@ -17,6 +18,15 @@ namespace BITKit.Mod
|
||||
[SerializeField] private bool loadLocalPackageOnStart;
|
||||
private async void Start()
|
||||
{
|
||||
|
||||
if (Application.isEditor is false)
|
||||
{
|
||||
BIT4Log.Log<UnityModService>($"UnityPlayer所在位置:{Application.dataPath}");
|
||||
|
||||
BIT4Log.Log<UnityModService>($"{nameof(System.Linq)}位于{typeof(Enumerable).Assembly.Location}");
|
||||
}
|
||||
|
||||
|
||||
foreach (var x in referencedAssemblies)
|
||||
{
|
||||
var dllName = x.Value.Contains(".dll") ? x.Value : $"{x.Value}.dll";
|
||||
|
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using BITKit.Net.LAN;
|
||||
using Cysharp.Threading.Tasks;
|
||||
@@ -23,8 +24,10 @@ namespace BITKit.Mod
|
||||
_broadcaster.StartListen();
|
||||
}
|
||||
|
||||
private void OnReceive(EndPoint arg1, byte[] bytes)
|
||||
private async void OnReceive(EndPoint arg1, byte[] bytes)
|
||||
{
|
||||
await UniTask.SwitchToMainThread();
|
||||
if(destroyCancellationToken.IsCancellationRequested) return;
|
||||
var command = BITBinary.ReadAsValue(bytes);
|
||||
switch (command)
|
||||
{
|
||||
@@ -32,6 +35,17 @@ namespace BITKit.Mod
|
||||
BIT4Log.Log<UnityWorkshopClient>($"收到加载命令:{loadFromFolderCommand.FolderPath}");
|
||||
ModService.LoadFromPackage(loadFromFolderCommand.FolderPath).Forget();
|
||||
break;
|
||||
case UninstallPackageCommand uninstallPackageCommand:
|
||||
BIT4Log.Log<UnityWorkshopClient>($"收到卸载命令:{uninstallPackageCommand.PackageName}");
|
||||
var mod = ModService.Mods.SingleOrDefault(x=>x.PackageName == uninstallPackageCommand.PackageName);
|
||||
if (mod is null)
|
||||
{
|
||||
BIT4Log.Warning<UnityWorkshopClient>($"未找到包:{uninstallPackageCommand.PackageName}");
|
||||
return;
|
||||
}
|
||||
ModService.UnLoad(mod);
|
||||
ModService.UnInstall(mod);
|
||||
break;
|
||||
default:
|
||||
BIT4Log.Log<UnityWorkshopClient>($"未知命令:{command}");
|
||||
break;
|
||||
|
@@ -99,15 +99,26 @@ namespace BITKit.UX
|
||||
{
|
||||
await UniTask.SwitchToMainThread();
|
||||
if (destroyCancellationToken.IsCancellationRequested) return;
|
||||
_modContainers.GetOrAdd(obj.Name,_=> Create(obj));
|
||||
|
||||
var container = _modContainers.GetOrAdd(obj.Name,_=> Create(obj));
|
||||
container.visualElement.RegisterCallback<MouseDownEvent>(x =>
|
||||
{
|
||||
if (x.button != 1) return;
|
||||
ContextMenuBuilder.Create().BuildAction("卸载", () =>
|
||||
{
|
||||
ModService.UnLoad(obj);
|
||||
ModService.UnInstall(obj);
|
||||
}).Build();
|
||||
});
|
||||
}
|
||||
private async void OnModUnLoaded(IMod obj)
|
||||
{
|
||||
await UniTask.SwitchToMainThread();
|
||||
if (destroyCancellationToken.IsCancellationRequested) return;
|
||||
var container = _modContainers.GetOrAdd(obj.Name,_=> Create(obj));
|
||||
container.toggle.SetValueWithoutNotify(false);
|
||||
//var container = _modContainers.GetOrAdd(obj.Name,_=> Create(obj));
|
||||
if(_modContainers.TryGetValue(obj.Name,out var container))
|
||||
{
|
||||
container.toggle.SetValueWithoutNotify(false);
|
||||
}
|
||||
}
|
||||
|
||||
private async void OnModLoaded(IMod obj)
|
||||
|
@@ -27,9 +27,9 @@ namespace BITKit
|
||||
CreateNoWindow = true,
|
||||
RedirectStandardOutput = true,
|
||||
RedirectStandardError =true,
|
||||
StandardErrorEncoding = System.Text.Encoding.UTF8,
|
||||
StandardInputEncoding = System.Text.Encoding.UTF8,
|
||||
StandardOutputEncoding = System.Text.Encoding.UTF8,
|
||||
StandardErrorEncoding = System.Text.Encoding.GetEncoding("gb2312"),
|
||||
//StandardInputEncoding = System.Text.Encoding.GetEncoding("gb2312"),
|
||||
StandardOutputEncoding = System.Text.Encoding.GetEncoding("gb2312"),
|
||||
};
|
||||
if(arguments != null)
|
||||
{
|
||||
|
Reference in New Issue
Block a user