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; AsGlobal = asGlobal;
} }
} }
#if UNITY_64 #if !Godot
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Field | AttributeTargets.Method, AllowMultiple = true, Inherited = true)] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Field | AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
public class ExportAttribute : System.Attribute public class ExportAttribute : System.Attribute
{ {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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