TEngine全面更新,升级YooAsset2.1.1、UniTask、UIWindow、I2Localization

TEngine全面更新,升级YooAsset2.1.1、UniTask、UIWindow、I2Localization
This commit is contained in:
ALEXTANG
2024-03-18 14:53:26 +08:00
parent 04ecf71eab
commit 6fec792e05
1015 changed files with 55183 additions and 35089 deletions

View File

@@ -0,0 +1,39 @@
#if UNITY_2020_3_OR_NEWER
using System;
using UnityEditor;
using UnityEngine;
using UnityEditor.UIElements;
using UnityEngine.UIElements;
namespace YooAsset.Editor
{
/// <summary>
/// 分屏控件
/// </summary>
public class SplitView : TwoPaneSplitView
{
public new class UxmlFactory : UxmlFactory<SplitView, TwoPaneSplitView.UxmlTraits>
{
}
/// <summary>
/// 窗口分屏适配
/// </summary>
public static void Adjuster(VisualElement root)
{
var topGroup = root.Q<VisualElement>("TopGroup");
var bottomGroup = root.Q<VisualElement>("BottomGroup");
topGroup.style.minHeight = 100f;
bottomGroup.style.minHeight = 100f;
root.Remove(topGroup);
root.Remove(bottomGroup);
var spliteView = new SplitView();
spliteView.fixedPaneInitialDimension = 300;
spliteView.orientation = TwoPaneSplitViewOrientation.Vertical;
spliteView.contentContainer.Add(topGroup);
spliteView.contentContainer.Add(bottomGroup);
root.Add(spliteView);
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0c3f4136cf7142346ae33e8a82cbdb27
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,25 @@

namespace YooAsset.Editor
{
#if UNITY_2019
public static partial class UnityEngine_UIElements_ListView_Extension
{
public static void ClearSelection(this UnityEngine.UIElements.ListView o)
{
o.selectedIndex = -1;
}
}
#endif
#if UNITY_2019 || UNITY_2020
public static partial class UnityEngine_UIElements_ListView_Extension
{
public static void Rebuild(this UnityEngine.UIElements.ListView o)
{
o.Refresh();
}
}
#endif
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e8e4a86c3bd8c8947a947776891e14b1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,21 @@
#if UNITY_2019_4_OR_NEWER
using UnityEditor;
using UnityEngine;
using UnityEditor.UIElements;
using UnityEngine.UIElements;
namespace YooAsset.Editor
{
public static class UIElementsTools
{
public static void SetElementVisible(VisualElement element, bool visible)
{
if (element == null)
return;
element.style.display = visible ? DisplayStyle.Flex : DisplayStyle.None;
element.style.visibility = visible ? Visibility.Visible : Visibility.Hidden;
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: cacb478021cc90b49a635aae388996fa
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,55 @@
#if UNITY_2019_4_OR_NEWER
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using UnityEditor.UIElements;
using UnityEngine.UIElements;
namespace YooAsset.Editor
{
public class UxmlLoader
{
private readonly static Dictionary<System.Type, string> _uxmlDic = new Dictionary<System.Type, string>();
/// <summary>
/// 加载窗口的布局文件
/// </summary>
public static UnityEngine.UIElements.VisualTreeAsset LoadWindowUXML<TWindow>() where TWindow : class
{
var windowType = typeof(TWindow);
// 缓存里查询并加载
if (_uxmlDic.TryGetValue(windowType, out string uxmlGUID))
{
string assetPath = AssetDatabase.GUIDToAssetPath(uxmlGUID);
if (string.IsNullOrEmpty(assetPath))
{
_uxmlDic.Clear();
throw new System.Exception($"Invalid UXML GUID : {uxmlGUID} ! Please close the window and open it again !");
}
var treeAsset = AssetDatabase.LoadAssetAtPath<UnityEngine.UIElements.VisualTreeAsset>(assetPath);
return treeAsset;
}
// 全局搜索并加载
string[] guids = AssetDatabase.FindAssets(windowType.Name);
if (guids.Length == 0)
throw new System.Exception($"Not found any assets : {windowType.Name}");
foreach (string assetGUID in guids)
{
string assetPath = AssetDatabase.GUIDToAssetPath(assetGUID);
var assetType = AssetDatabase.GetMainAssetTypeAtPath(assetPath);
if (assetType == typeof(UnityEngine.UIElements.VisualTreeAsset))
{
_uxmlDic.Add(windowType, assetGUID);
var treeAsset = AssetDatabase.LoadAssetAtPath<UnityEngine.UIElements.VisualTreeAsset>(assetPath);
return treeAsset;
}
}
throw new System.Exception($"Not found UXML file : {windowType.Name}");
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ed843f102c2467845b34fdce5d537e47
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: