This commit is contained in:
CortexCore 2024-07-05 15:07:38 +08:00
parent 87eae34f4b
commit b3768a7aa8
5 changed files with 36 additions and 6 deletions

View File

@ -6,8 +6,9 @@ using System.Collections.Generic;
using System.IO;
using System.Threading;
#if UNITY_WINDOW
using AnotherFileBrowser.Windows;
#endif
using UnityEngine;
using Cysharp.Threading.Tasks;
@ -29,6 +30,7 @@ namespace BITKit.IO
void AddListener(string key, Action<byte[]> action);
void RemoveListener(string key, Action<byte[]> action);
}
#if UNITY_WINDOW
[Serializable]
public sealed class ApplicationFile:IApplicationFile
{
@ -221,6 +223,7 @@ namespace BITKit.IO
void IApplicationFile.Reload()=>ReloadFile();
}
#endif
}
#endif

View File

@ -9,6 +9,9 @@ namespace BITKit.UX
{
public class UXToolTips : MonoBehaviour
{
[SerializeField]
[ReadOnly]
private string currentHoverName;
private VisualElement root;
private Label label;
@ -51,10 +54,12 @@ namespace BITKit.UX
if (!EventSystem.current.IsPointerOverGameObject()) return "";
var screenPosition = Input.mousePosition;
var screenPosition = Mouse.current.position.ReadValue();
screenPosition.y = Screen.height - screenPosition.y;
VisualElement ve = panel.Pick(RuntimePanelUtils.ScreenToPanel(panel, screenPosition));
currentHoverName = ve?.name;
return ve == null ? "" : ve.tooltip;
}
}

View File

@ -1,3 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@ -5,11 +6,33 @@ using BITKit;
using UnityEngine.UIElements;
using Cysharp.Threading.Tasks;
using System.Linq;
using System.Text;
namespace BITKit.UX
{
public sealed class UXDebuger : MonoBehaviour
{
private readonly StringBuilder _logBuilder=new();
private void OnEnable()
{
Application.logMessageReceivedThreaded += OnLog;
}
private void OnDisable()
{
Application.logMessageReceivedThreaded -= OnLog;
}
private void OnLog(string condition, string stacktrace, LogType type)
{
_logBuilder.Append(condition);
}
private void OnGUI()
{
GUILayout.BeginArea(new Rect(0, 0, Screen.width, Screen.height));
GUILayout.BeginVertical();
GUILayout.Label(_logBuilder.ToString());
GUILayout.EndVertical();
GUILayout.EndArea();
}
}
}

View File

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

View File

@ -5,7 +5,7 @@ using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Threading;
#if UNITY_5_3_OR_NEWER
#if UNITY_5_3_OR_NEWER && UNITY_WINDOW
using AnotherFileBrowser.Windows;
#endif
using BITKit.Mod;
@ -143,7 +143,7 @@ namespace BITKit.UX
return;
void OpenModInternal()
{
#if UNITY_5_3_OR_NEWER
#if UNITY_5_3_OR_NEWER && UNITY_WINDOW
BIT4Log.Log<UXModService>("已进入文件对话框线程");
new FileBrowser().OpenFileBrowser(new BrowserProperties()
{