This commit is contained in:
CortexCore 2024-06-14 14:11:28 +08:00
parent 4a2ab82e20
commit 349877fe7a
10 changed files with 28 additions and 12 deletions

View File

@ -53,7 +53,7 @@ namespace BITKit
AsGlobal = asGlobal;
}
}
#if UNITY_64
#if !Godot
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Field | AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
public class ExportAttribute : System.Attribute
{

View File

@ -8,7 +8,7 @@ namespace BITKit
{
public static class BIT4Log
{
#if UNITY_EDITOR && !UNITY_WEBGL
#if UNITY_EDITOR && UNITY_64
[RuntimeInitializeOnLoadMethod]
private static void Reload()
{

View File

@ -52,8 +52,7 @@ namespace BITKit.Tween
t = math.clamp(t + delta*BITApp.Time.DeltaTime, 0, 1);
var next = math.lerp(from, to, t);
//BIT4Log.Log<TweenSequence>($"当前进度:[{t}]next:[{next}]");
#if UNITY_64
#if UNITY_5_3_OR_NEWER
await UniTask.NextFrame(cancellationToken);
await UniTask.SwitchToMainThread(cancellationToken);
#else

View File

@ -87,6 +87,7 @@ namespace BITKit
BuildinQueryServices = buildinQueryServices,
RemoteServices = remoteServices
};
#if UNITY_EDITOR
if (IsEditorSimulateMode)
{
@ -97,7 +98,9 @@ namespace BITKit
EditorSimulateModeHelper.SimulateBuild("ScriptableBuildPipeline", packageName.Value)
};
initParameters = editorParameters;
}else if (isOffline)
}else
#endif
if (isOffline)
{
initParameters = new OfflinePlayModeParameters();
}

View File

@ -8,7 +8,7 @@ using UnityEngine.UIElements;
namespace BITKit.UX
{
#if !UNITY_WEBGL
#if UNITY_64
public class UXApplicationFile : MonoBehaviour
{
[SerializeReference, SubclassSelector] private IApplicationFile applicationFile;

View File

@ -5,7 +5,9 @@ using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Threading;
#if UNITY_64
using AnotherFileBrowser.Windows;
#endif
using BITKit.Mod;
using Cysharp.Threading.Tasks;
using UnityEngine;
@ -141,12 +143,16 @@ namespace BITKit.UX
return;
void OpenModInternal()
{
#if UNITY_64
BIT4Log.Log<UXModService>("已进入文件对话框线程");
new FileBrowser().OpenFileBrowser(new BrowserProperties()
{
//filterIndex = 0,
//filter = "C Sharp files (*.cs)|*.cs |Dll files (*.dll)|*.dll",
}, Filepath);
#else
throw new NotSupportedException($"{Application.platform} 不支持打开文件对话框");
#endif
return;
async void Filepath(string path)
{
@ -159,9 +165,13 @@ namespace BITKit.UX
switch (file.Extension)
{
case ".cs":
#if UNITY_64
var code = await File.ReadAllTextAsync(path);
var assembly = BITSharp.Compile(code);
await ModService.Load(assembly,Path.GetDirectoryName(path));
#else
throw new NotSupportedException($"{Application.platform} 不支持编译C#代码");
#endif
break;
case ".dll":
var bytes = await File.ReadAllBytesAsync(path);

View File

@ -22,6 +22,12 @@ namespace BITKit
public class MonoBehaviorInspector : BITInspector<MonoBehaviour>
{
}
[CanEditMultipleObjects]
[CustomEditor(typeof(ScriptableObject),true)]
public class ScriptableObjectInspector : BITInspector<ScriptableObject>
{
}
[CustomPropertyDrawer(typeof(ReadOnlyAttribute),true)]
public class ReadOnlyDrawer : PropertyDrawer

View File

@ -3,14 +3,14 @@ using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using UnityEngine.UIElements;
#if UNITY_64
namespace BITKit.IO
{
public class UnityApplicationFile : MonoBehaviour
{
#if !UNITY_WEBGL
[SerializeReference,SubclassSelector] internal IApplicationFile service;
#endif
}
#if UNITY_EDITOR && !UNITY_WEBGL
[CustomEditor(typeof(UnityApplicationFile))]
@ -49,4 +49,4 @@ namespace BITKit.IO
}
#endif
}
#endif

View File

@ -2,7 +2,6 @@ using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using Quadtree;
using Quadtree.Items;
using UnityEngine;

View File

@ -10,7 +10,6 @@ namespace BITKit.Scene
{
[Export]
public static bool AllowGizmos=true;
[SerializeField] private bool draw;
[SerializeField] private Color color;
[SerializeField] private float size;