This commit is contained in:
MuHua-123
2025-08-04 18:02:15 +08:00
parent 6028ec4024
commit 1aa68f8be3
203 changed files with 6 additions and 7961 deletions
@@ -1,53 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;
using MuHua;
/// <summary>
/// 测试页面
/// </summary>
public class UITestPage : ModuleUIPage {
public VisualTreeAsset TemplateAsset;
public List<string> list;
private UIToggle toggle;
private UIDropdown<string> dropdown;
private UIScrollView scrollView1;
private UIScrollView scrollView2;
private UIScrollView scrollView3;
private UIScrollView scrollView4;
public override VisualElement Element => root;
public VisualElement Toggle => Q<VisualElement>("Toggle");
public VisualElement Dropdown => Q<VisualElement>("Dropdown");
public VisualElement ScrollView1 => Q<VisualElement>("ScrollView1");
public VisualElement ScrollView2 => Q<VisualElement>("ScrollView2");
public VisualElement ScrollView3 => Q<VisualElement>("ScrollView3");
public VisualElement ScrollView4 => Q<VisualElement>("ScrollView4");
private void Awake() {
toggle = new UIToggle(Toggle);
toggle.ValueChanged += (value) => Debug.Log(value);
dropdown = new UIDropdown<string>(Dropdown, root, TemplateAsset);
dropdown.SetValue(list);
dropdown.ValueChanged += (value) => Debug.Log(value);
scrollView1 = new UIScrollView(ScrollView1, root, UIDirection.Vertical, UIDirection.FromLeftToRight, UIDirection.FromTopToBottom);
scrollView2 = new UIScrollView(ScrollView2, root, UIDirection.Vertical, UIDirection.FromLeftToRight, UIDirection.FromBottomToTop);
scrollView3 = new UIScrollView(ScrollView3, root, UIDirection.Horizontal, UIDirection.FromLeftToRight);
scrollView4 = new UIScrollView(ScrollView4, root, UIDirection.Horizontal, UIDirection.FromLeftToRight);
}
private void Update() {
dropdown.Update();
scrollView1.Update();
scrollView2.Update();
scrollView3.Update();
scrollView4.Update();
}
private void OnDestroy() {
dropdown.Release();
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: a47690fe988195040a2e528bb2e8bce6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
-8
View File
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 3699f8709aed43a46bb5220a7124e92b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
-64
View File
@@ -1,64 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.AddressableAssets.ResourceLocators;
using UnityEngine.ResourceManagement.AsyncOperations;
namespace MuHua {
/// <summary>
/// 加载可寻址资源目录
/// </summary>
public class AACatalog {
public readonly string filePath;
public Action<float> OnProgress;
public Action<string> OnError;
public Action OnComplete;
/// <summary> 加载可寻址资源目录 </summary>
public AACatalog(string filePath, Action OnComplete = null) {
this.filePath = filePath;
this.OnComplete = OnComplete;
}
/// <summary> 获取异步句柄 </summary>
public AsyncOperationHandle<IResourceLocator> Handle() {
return Addressables.LoadContentCatalogAsync(filePath, true);
}
/// <summary> 加载目录 </summary>
public async void Load() => await ALoad();
/// <summary> 加载目录 </summary>
public async Task ALoad() {
AsyncOperationHandle<IResourceLocator> handle = Handle();
if (handle.Status == AsyncOperationStatus.Failed) {
OnError?.Invoke($"无法加载资源目录!({filePath})"); return;
}
while (!handle.IsDone) {
float downloadProgress = handle.GetDownloadStatus().Percent;
float loadProgress = handle.PercentComplete;
float totalProgress = (downloadProgress + loadProgress) / 2.0f;
// Debug.Log($"下载进度: {downloadProgress * 100}% , 加载进度: {loadProgress * 100}% , 总进度: {totalProgress * 100}%");
OnProgress?.Invoke(totalProgress);
await Task.Delay(100);
}
OnComplete?.Invoke();
}
/// <summary> 加载目录 </summary>
public IEnumerator ILoad() {
AsyncOperationHandle<IResourceLocator> handle = Handle();
if (handle.Status == AsyncOperationStatus.Failed) {
OnError?.Invoke($"无法加载资源目录!({filePath})");
yield break;
}
while (!handle.IsDone) {
float downloadProgress = handle.GetDownloadStatus().Percent;
float loadProgress = handle.PercentComplete;
float totalProgress = (downloadProgress + loadProgress) / 2.0f;
OnProgress?.Invoke(totalProgress);
yield return new WaitForEndOfFrame();
}
OnComplete?.Invoke();
}
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: cdf535680c5435444845cfa205c9619f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,57 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.SceneManagement;
namespace MuHua {
/// <summary>
/// 从目录加载场景
/// </summary>
public class AACatalogToScene {
public enum Progress { Catalog, Label, Scene }
public readonly string filePath;
public readonly string sceneName;
public readonly LoadSceneMode loadSceneMode;
public readonly bool activateOnLoad;
public Action<float, Progress> OnProgress;
public Action<string> OnError;
public Action OnComplete;
/// <summary> 加载可寻址资源目录 </summary>
public AACatalogToScene(string filePath, string sceneName, LoadSceneMode loadSceneMode = LoadSceneMode.Single, bool activateOnLoad = true) {
this.filePath = filePath;
this.sceneName = sceneName;
this.loadSceneMode = loadSceneMode;
this.activateOnLoad = activateOnLoad;
}
/// <summary> 从目录加载场景 </summary>
public async void Load() => await ALoad();
/// <summary> 从目录加载场景 </summary>
public async Task ALoad() {
AACatalog catalog = new AACatalog(filePath);
catalog.OnProgress = (value) => { OnProgress?.Invoke(value, Progress.Catalog); };
catalog.OnError = OnError;
await catalog.ALoad();
AAScene aaScene = new AAScene(sceneName, loadSceneMode, activateOnLoad);
aaScene.OnProgress = (value) => { OnProgress?.Invoke(value, Progress.Scene); };
aaScene.OnError = OnError;
aaScene.OnComplete = OnComplete;
await aaScene.ALoad();
}
/// <summary> 从目录加载场景 </summary>
public IEnumerator ILoad() {
AACatalog catalog = new AACatalog(filePath);
catalog.OnProgress = (value) => { OnProgress?.Invoke(value, Progress.Catalog); };
catalog.OnError = OnError;
yield return catalog.ILoad();
AAScene aaScene = new AAScene(sceneName, loadSceneMode, activateOnLoad);
aaScene.OnProgress = (value) => { OnProgress?.Invoke(value, Progress.Scene); };
aaScene.OnError = OnError;
aaScene.OnComplete = OnComplete;
yield return aaScene.ILoad();
}
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: c8003e83f422c6e4797a12c63bf25406
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
-65
View File
@@ -1,65 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.AddressableAssets.ResourceLocators;
using UnityEngine.ResourceManagement.AsyncOperations;
namespace MuHua {
/// <summary>
/// 按标签加载可寻址资源
/// </summary>
public class AALabel<T> {
public readonly string label;
public Action<float> OnProgress;
public Action<string> OnError;
public Action<T> OnComplete;
public T result;
/// <summary> 按标签加载可寻址资源 </summary>
public AALabel(string label, Action<T> OnComplete = null) {
this.label = label;
this.OnComplete = OnComplete;
}
/// <summary> 获取异步句柄 </summary>
public AsyncOperationHandle<T> Handle() {
return Addressables.LoadAssetAsync<T>(label);
}
/// <summary> 加载资源 </summary>
public async void Load() => await ALoad();
/// <summary> 加载资源 </summary>
public async Task ALoad() {
AsyncOperationHandle<T> handle = Handle();
if (handle.Status == AsyncOperationStatus.Failed) {
OnError?.Invoke($"无法加载资源!(label={label} , type={typeof(T)})"); return;
}
while (!handle.IsDone) {
float downloadProgress = handle.GetDownloadStatus().Percent;
float loadProgress = handle.PercentComplete;
float totalProgress = (downloadProgress + loadProgress) / 2.0f;
// Debug.Log($"下载进度: {downloadProgress * 100}% , 加载进度: {loadProgress * 100}% , 总进度: {totalProgress * 100}%");
OnProgress?.Invoke(totalProgress);
await Task.Delay(100);
}
OnComplete?.Invoke(handle.Result);
}
/// <summary> 加载资源 </summary>
public IEnumerator ILoad() {
AsyncOperationHandle<T> handle = Handle();
if (handle.Status == AsyncOperationStatus.Failed) {
OnError?.Invoke($"无法加载资源!(label={label} , type={typeof(T)})"); yield break;
}
while (!handle.IsDone) {
float downloadProgress = handle.GetDownloadStatus().Percent;
float loadProgress = handle.PercentComplete;
float totalProgress = (downloadProgress + loadProgress) / 2.0f;
OnProgress?.Invoke(totalProgress);
yield return new WaitForEndOfFrame();
}
result = handle.Result;
OnComplete?.Invoke(handle.Result);
}
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 05c642602f45beb4391c7dbbd6b78968
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
-68
View File
@@ -1,68 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.AddressableAssets.ResourceLocators;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.ResourceManagement.ResourceProviders;
using UnityEngine.SceneManagement;
namespace MuHua {
/// <summary>
/// 加载可寻址场景
/// </summary>
public class AAScene {
public readonly string name;
public readonly LoadSceneMode loadSceneMode;
public readonly bool activateOnLoad;
public Action<float> OnProgress;
public Action<string> OnError;
public Action OnComplete;
/// <summary> 加载可寻址场景 </summary>
public AAScene(string name, LoadSceneMode loadSceneMode = LoadSceneMode.Single, bool activateOnLoad = true) {
this.name = name;
this.loadSceneMode = loadSceneMode;
this.activateOnLoad = activateOnLoad;
}
/// <summary> 获取异步句柄 </summary>
public AsyncOperationHandle<SceneInstance> Handle() {
return Addressables.LoadSceneAsync(name, loadSceneMode, activateOnLoad);
}
/// <summary> 加载场景 </summary>
public async void Load() => await ALoad();
/// <summary> 加载场景 </summary>
public async Task ALoad() {
AsyncOperationHandle<SceneInstance> handle = Handle();
if (handle.Status == AsyncOperationStatus.Failed) {
OnError?.Invoke($"无法加载场景!({name})"); return;
}
while (!handle.IsDone) {
float downloadProgress = handle.GetDownloadStatus().Percent;
float loadProgress = handle.PercentComplete;
float totalProgress = (downloadProgress + loadProgress) / 2.0f;
// Debug.Log($"下载进度: {downloadProgress * 100}% , 加载进度: {loadProgress * 100}% , 总进度: {totalProgress * 100}%");
OnProgress?.Invoke(totalProgress);
await Task.Delay(100);
}
OnComplete?.Invoke();
}
/// <summary> 加载场景 </summary>
public IEnumerator ILoad() {
AsyncOperationHandle<SceneInstance> handle = Handle();
if (handle.Status == AsyncOperationStatus.Failed) {
OnError?.Invoke($"无法加载场景!({name})"); yield break;
}
while (!handle.IsDone) {
float downloadProgress = handle.GetDownloadStatus().Percent;
float loadProgress = handle.PercentComplete;
float totalProgress = (downloadProgress + loadProgress) / 2.0f;
OnProgress?.Invoke(totalProgress);
yield return new WaitForEndOfFrame();
}
OnComplete?.Invoke();
}
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 68519b916d961c745aeba6680a8cafe3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,17 +0,0 @@
{
"name": "MuHua.AALoading",
"rootNamespace": "",
"references": [
"GUID:9e24947de15b9834991c9d8411ea37cf",
"GUID:84651a3751eca9349aac36a66bba901b"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}
@@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 26f33ddf2c81134458ea0d2283ffaaaa
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
-14
View File
@@ -1,14 +0,0 @@
{
"name": "muhua-aaloading",
"version": "1.0.0",
"displayName": "MuHua AALoading",
"description": "\u534f\u7a0b\u548c\u5f02\u6b65\u5b9e\u73b0\u52a0\u8f7daa\u8d44\u6e90",
"author": {
"name": "MuHua",
"email": "muhua233@qq.com"
},
"type": "tool",
"dependencies": {
"com.unity.addressables": "1.21.21"
}
}
-7
View File
@@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 03fe4d2014c6ea3488b135e4f4898c14
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
-8
View File
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 71c884672987ee24d8602dc874e95005
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 5714b692b8275aa4cb37f8f22344174e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,21 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace MuHua {
/// <summary>
/// 运动器
/// </summary>
public abstract class Movement {
/// <summary> 当前速度 </summary>
public abstract float Speed { get; }
/// <summary> 是否接地 </summary>
public abstract bool Grounded { get; }
/// <summary> 移动 </summary>
public abstract void Move(Vector2 moveDirection, float moveSpeed, float acceleration, bool isRotation);
/// <summary> 跳跃 </summary>
public abstract void Jump(float jumpHeight);
/// <summary> 更新 </summary>
public abstract void Update();
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: c48241a855a542e41b23b017edcab454
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,109 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace MuHua {
/// <summary>
/// 碰撞 - 运动器
/// </summary>
public class MovementCollision : Movement {
/// <summary> 地面图层 </summary>
public readonly LayerMask groundLayers;
/// <summary> 角色控制器 </summary>
public readonly CharacterController controller;
public float moveSpeed;// 移动速度
public float currentSpeed;// 当前速度
public float acceleration;// 加速度
public float animationBlend;// 动画混合速度
public Vector2 moveDirection;// 移动方向
public bool isRotation;// 是否旋转
public float targetRotation;// 目标旋转
public float rotationVelocity;// 旋转速度
public float rotationSmoothTime = 0.12f;// 旋转平滑 Range(0.0f, 0.3f)
public bool grounded = true;// 是否接地
public float verticalVelocity;// 垂直速度
public float groundedRadius = 0.14f;// 地面检测半径
/// <summary> 垂直重力 </summary>
public float Gravity => Physics.gravity.y;
public override float Speed => currentSpeed;
public override bool Grounded => grounded;
public MovementCollision(CharacterController controller, LayerMask groundLayers) {
this.controller = controller;
this.groundLayers = groundLayers;
}
/// <summary> 移动 </summary>
public override void Move(Vector2 moveDirection, float moveSpeed, float acceleration, bool isRotation) {
this.moveSpeed = moveSpeed;
this.acceleration = acceleration;
this.moveDirection = moveDirection;
this.isRotation = isRotation;
}
/// <summary> H*-2*G的平方根=达到所需高度所需的速度 </summary>
public override void Jump(float jumpHeight) {
verticalVelocity = Mathf.Sqrt(jumpHeight * -2f * Gravity);
}
/// <summary> 更新 </summary>
public override void Update() {
// 如果没有输入,将目标速度设置为0
if (moveDirection == Vector2.zero) moveSpeed = 0.0f;
// 当前速度
currentSpeed = Mathf.Lerp(currentSpeed, moveSpeed, Time.deltaTime * acceleration);
// 四舍五入到小数点后3位
currentSpeed = Mathf.Round(currentSpeed * 1000f) / 1000f;
animationBlend = Mathf.Lerp(animationBlend, moveSpeed, Time.deltaTime * acceleration);
if (animationBlend < 0.01f) animationBlend = 0f;
// 使输入方向标准化
Vector3 inputDirection = new Vector3(moveDirection.x, 0.0f, moveDirection.y).normalized;
if (isRotation) {
// 如果有移动输入,则在玩家移动时旋转玩家
if (moveDirection != Vector2.zero) {
targetRotation = Mathf.Atan2(inputDirection.x, inputDirection.z) * Mathf.Rad2Deg;
float rotation = Mathf.SmoothDampAngle(controller.transform.eulerAngles.y, targetRotation, ref rotationVelocity, rotationSmoothTime);
// 相对于相机位置旋转到面向输入方向
controller.transform.rotation = Quaternion.Euler(0.0f, rotation, 0.0f);
}
// 移动
Vector3 targetDirection = Quaternion.Euler(0.0f, targetRotation, 0.0f) * Vector3.forward;
Vector3 horizontal = targetDirection.normalized * (currentSpeed * Time.deltaTime);
Vector3 vertical = new Vector3(0.0f, verticalVelocity, 0.0f) * Time.deltaTime;
controller.Move(horizontal + vertical);
}
else {
// 移动
Vector3 horizontal = inputDirection * (currentSpeed * Time.deltaTime);
Vector3 vertical = new Vector3(0.0f, verticalVelocity, 0.0f) * Time.deltaTime;
controller.Move(horizontal + vertical);
}
// 地面检测
Vector3 position = controller.transform.position;
Vector3 rayOrigin = new Vector3(position.x, position.y + groundedRadius, position.z);
// 射线长度稍微大于检测半径
float rayLength = groundedRadius * 2 + 0.1f;
// 使用射线检测地面
grounded = Physics.Raycast(rayOrigin, Vector3.down, rayLength, groundLayers, QueryTriggerInteraction.Ignore);
// 可选:调试显示射线
Debug.DrawRay(rayOrigin, Vector3.down * rayLength, grounded ? Color.green : Color.red);
// 引力
verticalVelocity += Gravity * Time.deltaTime;
// 站在地面上时,限制最大下落速度
if (grounded && verticalVelocity < 0.0f) { verticalVelocity = -2f; }
}
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 06f3697338f20ac459ed126fc05a9694
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,101 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace MuHua {
/// <summary>
/// 标准 - 运动器
/// </summary>
public class MovementStandard : Movement {
/// <summary> 地面图层 </summary>
public readonly LayerMask groundLayers;
/// <summary> 变换 </summary>
public readonly Transform transform;
public float moveSpeed;// 移动速度
public float currentSpeed;// 当前速度
public float acceleration;// 加速度
public float animationBlend;// 动画混合速度
public Vector2 moveDirection;// 移动方向
public bool isRotation;// 是否旋转
public float targetRotation;// 目标旋转
public float rotationVelocity;// 旋转速度
public float rotationSmoothTime = 0.12f;// 旋转平滑 Range(0.0f, 0.3f)
public bool grounded = true;// 是否接地
public float verticalVelocity;// 垂直速度
public float groundedRadius = 0.14f;// 地面检测半径
/// <summary> 垂直重力 </summary>
public float Gravity => Physics.gravity.y;
public override float Speed => currentSpeed;
public override bool Grounded => grounded;
public MovementStandard(Transform transform, LayerMask groundLayers) {
this.transform = transform;
this.groundLayers = groundLayers;
}
/// <summary> 移动 </summary>
public override void Move(Vector2 moveDirection, float moveSpeed, float acceleration, bool isRotation) {
this.moveSpeed = moveSpeed;
this.acceleration = acceleration;
this.moveDirection = moveDirection;
this.isRotation = isRotation;
}
/// <summary> 跳跃 </summary>
public override void Jump(float jumpHeight) {
verticalVelocity = Mathf.Sqrt(jumpHeight * -2f * Gravity);
}
/// <summary> 更新 </summary>
public override void Update() {
// 如果没有输入,将目标速度设置为0
if (moveDirection == Vector2.zero) moveSpeed = 0.0f;
// 当前速度
currentSpeed = Mathf.Lerp(currentSpeed, moveSpeed, Time.deltaTime * acceleration);
// 四舍五入到小数点后3位
currentSpeed = Mathf.Round(currentSpeed * 1000f) / 1000f;
animationBlend = Mathf.Lerp(animationBlend, moveSpeed, Time.deltaTime * acceleration);
if (animationBlend < 0.01f) animationBlend = 0f;
// 使输入方向标准化
Vector3 inputDirection = new Vector3(moveDirection.x, 0.0f, moveDirection.y).normalized;
// 如果有移动输入,则在玩家移动时旋转玩家
if (moveDirection != Vector2.zero && isRotation) {
targetRotation = Mathf.Atan2(inputDirection.x, inputDirection.z) * Mathf.Rad2Deg;
float rotation = Mathf.SmoothDampAngle(transform.eulerAngles.y, targetRotation, ref rotationVelocity, rotationSmoothTime);
// 相对于相机位置旋转到面向输入方向
transform.rotation = Quaternion.Euler(0.0f, rotation, 0.0f);
}
// 移动
Vector3 targetDirection = Quaternion.Euler(0.0f, targetRotation, 0.0f) * Vector3.forward;
Vector3 horizontal = targetDirection.normalized * (currentSpeed * Time.deltaTime);
Vector3 vertical = new Vector3(0.0f, verticalVelocity, 0.0f) * Time.deltaTime;
transform.position += horizontal + vertical;
// 地面检测
Vector3 position = transform.position;
Vector3 rayOrigin = new Vector3(position.x, position.y + groundedRadius, position.z);
// 射线长度稍微大于检测半径
float rayLength = groundedRadius * 2 + 0.1f;
// 使用射线检测地面
grounded = Physics.Raycast(rayOrigin, Vector3.down, rayLength, groundLayers, QueryTriggerInteraction.Ignore);
// 可选:调试显示射线
Debug.DrawRay(rayOrigin, Vector3.down * rayLength, grounded ? Color.green : Color.red);
// 引力
verticalVelocity += Gravity * Time.deltaTime;
// 站在地面上时,限制最大下落速度
if (grounded && verticalVelocity < 0.0f) { verticalVelocity = -2f; }
}
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: cf671b0b45929dc4c970eadb97df3ec8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 197992f6020004c44a74153f43c5f7d1
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,21 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace MuHua {
/// <summary>
/// 运动
/// </summary>
public abstract class IKinesis {
/// <summary> 动作过渡 </summary>
public abstract bool Transition(IKinesis kinesis);
/// <summary> 开始动作 </summary>
public abstract void StartKinesis();
/// <summary> 更新动作 </summary>
public abstract void UpdateKinesis();
/// <summary> 完成动作 </summary>
public abstract void FinishKinesis();
/// <summary> 动画结束 </summary>
public abstract void AnimationExit();
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 1490d224da1fe674cb366599e7603d66
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
-8
View File
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 338d1e647d487fe43aee258fbf63dfd4
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,26 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace MuHua {
/// <summary>
/// 空闲 - 运动
/// </summary>
public class KIdle : IKinesis {
public override bool Transition(IKinesis kinesis) {
return true;
}
public override void StartKinesis() {
// throw new System.NotImplementedException();
}
public override void UpdateKinesis() {
// throw new System.NotImplementedException();
}
public override void FinishKinesis() {
// throw new System.NotImplementedException();
}
public override void AnimationExit() {
// throw new System.NotImplementedException();
}
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 29150243edc07d0429fea37464e830a7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
-102
View File
@@ -1,102 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace MuHua {
/// <summary>
/// 跳跃 - 运动
/// </summary>
public class KJump : IKinesis {
/// <summary> 基础角色 </summary>
public readonly MCharacter character;
/// <summary> 结束跳跃 </summary>
public bool isEndJump;
/// <summary> 是否接地 </summary>
public bool isGrounded;
/// <summary> 允许转换 </summary>
public bool isTransition;
/// <summary> 跳跃高度 </summary>
public float jumpHeight;
/// <summary> 衰退速度 </summary>
public float decaySpeed;
/// <summary> 移动速度 </summary>
public float moveSpeed = 2;
/// <summary> 加速度 </summary>
public float acceleration = 15;
/// <summary> 移动方向 </summary>
public Vector2 moveDirection;
/// <summary> 初始位置 </summary>
public Vector3 position;
/// <summary> 初始角度 </summary>
public Vector3 eulerAngles;
/// <summary> 是否旋转 </summary>
public bool isRotation;
/// <summary> 初始设置 </summary>
public bool isInitial = false;
/// <summary> 变换器 </summary>
public Transform transform => character.transform;
/// <summary> 动画器 </summary>
public Animator animator => character.animator;
/// <summary> 运动器 </summary>
public Movement movement => character.movement;
public KJump(MCharacter character, Vector2 moveDirection, float jumpHeight, bool isRotation) {
this.character = character;
this.moveDirection = moveDirection;
this.jumpHeight = jumpHeight;
}
public void Settings(float moveSpeed, float acceleration) {
this.moveSpeed = moveSpeed;
this.acceleration = acceleration;
}
public void Settings(Vector3 position, Vector3 eulerAngles) {
this.position = position;
this.eulerAngles = eulerAngles;
isInitial = true;
}
public override bool Transition(IKinesis kinesis) {
return isTransition;
}
public override void StartKinesis() {
if (isInitial) {
character.transform.position = position;
character.transform.eulerAngles = eulerAngles;
}
isEndJump = false;
isTransition = false;
isGrounded = movement.Grounded;
decaySpeed = movement.Speed;
movement.Jump(jumpHeight);
animator.SetTrigger("JumpStart");
}
public override void UpdateKinesis() {
if (isEndJump) { return; }
// 衰退速度
decaySpeed = Mathf.Lerp(decaySpeed, 0, Time.deltaTime * 0.8f);
movement.Move(moveDirection, decaySpeed, acceleration, isRotation);
// 跳跃状态判断
if (isGrounded == movement.Grounded) { return; }
isGrounded = movement.Grounded;
// 起跳
if (!isGrounded) { return; }
// 落地
isEndJump = true;
animator.SetTrigger("JumpLand");
movement.Move(Vector2.zero, decaySpeed, acceleration, isRotation);
}
public override void FinishKinesis() {
// throw new System.NotImplementedException();
}
public override void AnimationExit() {
isTransition = true;
// 转换到移动
KMove kMove = new KMove(character, moveDirection, isRotation);
kMove.Settings(moveSpeed, acceleration);
character.Transition(kMove);
}
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: d61c404e3dc615b4eb590448b876863c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,73 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace MuHua {
/// <summary>
/// 移动 - 运动
/// </summary>
public class KMove : IKinesis {
/// <summary> 基础角色 </summary>
public readonly MCharacter character;
/// <summary> 移动速度 </summary>
public float moveSpeed = 2;
/// <summary> 加速度 </summary>
public float acceleration = 15;
/// <summary> 移动方向 </summary>
public Vector2 moveDirection;
/// <summary> 初始位置 </summary>
public Vector3 position;
/// <summary> 初始角度 </summary>
public Vector3 eulerAngles;
/// <summary> 是否旋转 </summary>
public bool isRotation;
/// <summary> 初始设置 </summary>
public bool isInitial = false;
/// <summary> 变换器 </summary>
public Transform transform => character.transform;
/// <summary> 动画器 </summary>
public Animator animator => character.animator;
/// <summary> 运动器 </summary>
public Movement movement => character.movement;
public KMove(MCharacter character, Vector2 moveDirection, bool isRotation) {
this.character = character;
this.moveDirection = moveDirection;
this.isRotation = isRotation;
}
public void Settings(float moveSpeed, float acceleration) {
this.moveSpeed = moveSpeed;
this.acceleration = acceleration;
}
public void Settings(Vector3 position, Vector3 eulerAngles) {
this.position = position;
this.eulerAngles = eulerAngles;
isInitial = true;
}
public override bool Transition(IKinesis kinesis) {
return true;
}
public override void StartKinesis() {
movement.Move(moveDirection, moveSpeed, acceleration, isRotation);
if (!isInitial) { return; }
transform.position = position;
transform.eulerAngles = eulerAngles;
}
public override void UpdateKinesis() {
// 更新动画器
animator.SetFloat("MoveSpeed", movement.Speed);
// 移动结束
if (movement.Speed == 0) { character.Transition(new KIdle()); }
}
public override void FinishKinesis() {
// throw new System.NotImplementedException();
}
public override void AnimationExit() {
// throw new System.NotImplementedException();
}
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: e2b41872ba018e447a649cb6bb35059f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
-27
View File
@@ -1,27 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace MuHua {
/// <summary>
/// 角色 - 模块
/// </summary>
public abstract class MCharacter {
/// <summary> 变换器 </summary>
public Transform transform;
/// <summary> 动画器 </summary>
public Animator animator;
/// <summary> 运动器 </summary>
public Movement movement;
public MCharacter(Animator animator) => this.animator = animator;
/// <summary> 更新 </summary>
public abstract void Update();
/// <summary> 动作过渡 </summary>
public abstract bool Transition(IKinesis kinesis);
/// <summary> 动画结束 </summary>
public abstract void AnimationExit();
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: f75543aff254f1c4899eb3d332ba5de9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,37 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace MuHua {
/// <summary>
/// 碰撞角色 - 模块
/// </summary>
public class MCharacterCollision : MCharacter {
/// <summary> 当前动作 </summary>
public IKinesis currentKinesis;
public MCharacterCollision(Animator animator, CharacterController controller, LayerMask ground) : base(animator) {
movement = new MovementCollision(controller, ground);
Transition(new KIdle());
}
public override void Update() {
movement.Update();
currentKinesis.UpdateKinesis();
}
public override bool Transition(IKinesis kinesis) {
// 不可以转换
if (currentKinesis != null && !currentKinesis.Transition(kinesis)) { return false; }
// 进行转换
currentKinesis?.FinishKinesis();
currentKinesis = kinesis;
currentKinesis?.StartKinesis();
return true;
}
public override void AnimationExit() {
currentKinesis.AnimationExit();
}
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: fa752d6843dd06146b699b3588a59ea1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,18 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MCharacterRigidbody : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: c073d7ddd6e118746b2709e22bcf7ea6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,37 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace MuHua {
/// <summary>
/// 标准角色 - 模块
/// </summary>
public class MCharacterStandard : MCharacter {
/// <summary> 当前动作 </summary>
public IKinesis currentKinesis;
public MCharacterStandard(Animator animator, LayerMask ground) : base(animator) {
movement = new MovementStandard(transform, ground);
Transition(new KIdle());
}
public override void Update() {
movement.Update();
currentKinesis.UpdateKinesis();
}
public override bool Transition(IKinesis kinesis) {
// 不可以转换
if (currentKinesis != null && !currentKinesis.Transition(kinesis)) { return false; }
// 进行转换
currentKinesis?.FinishKinesis();
currentKinesis = kinesis;
currentKinesis?.StartKinesis();
return true;
}
public override void AnimationExit() {
currentKinesis.AnimationExit();
}
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 7eb8fc105ff36704499c0a954daa9c5c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,14 +0,0 @@
{
"name": "MuHua.Character",
"rootNamespace": "",
"references": [],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}
@@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: f71c71a343ef5c8459a9f7773cc07460
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
-18
View File
@@ -1,18 +0,0 @@
{
"name": "muhua-character",
"version": "1.0.0",
"displayName": "MuHua Character",
"description": "\u89d2\u8272\u5305",
"author": {
"name": "MuHua",
"email": "muhua233@qq.com"
},
"type": "tool",
"samples": [
{
"displayName": "\u793a\u4f8b",
"description": "",
"path": "Samples"
}
]
}
-7
View File
@@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 1ab756a7b132add4ca7511381d74cad6
PackageManifestImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
-44
View File
@@ -1,44 +0,0 @@
# Unity UI Label Follow System
## 概述
这个项目展示了如何在Unity中创建一个UI标签,并使其在世界空间中跟随一个目标物体。标签会根据相机距离进行缩放。
## 文件列表
- `LabelFollower.cs`:用于使标签跟随目标物体,并根据相机距离进行缩放。
- `LabelController.cs`:用于创建和管理标签的静态管理器类。
## 使用步骤
1. **创建一个Canvas**
- 在Unity编辑器中,右键点击层级视图,选择`UI -> Canvas`创建一个Canvas。
- 确保Canvas的`Render Mode`设置为`World Space`
2. **创建一个标签预制件**
- 在Canvas下创建一个`UI -> Image`对象作为标签的背景。
- 设置图片的样式。
- 在Image对象下创建一个`UI -> Text`对象,作为标签的文本内容。
- 设置文本的内容和样式。
- 将包含Image和Text的标签对象拖动到项目窗口中以创建一个预制件,然后删除层级视图中的标签对象。
3. **创建LabelController**
- 在一个空的GameObject上添加`LabelController`脚本。
- 在脚本的Inspector面板中,设置`Canvas`为包含标签的Canvas对象。
4. **使用LabelController创建标签**
- 你可以在其他脚本中使用`LabelController.CreateLabel`方法来创建标签。例如:
```csharp
using UnityEngine;
public class ExampleUsage : MonoBehaviour
{
public Transform target;
public GameObject labelPrefab;
void Start()
{
LabelController.CreateLabel(target, labelPrefab, new Vector3(0, 2, 0), 1.0f);
}
}
-7
View File
@@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 7978ad7d6c868b142b0d9d612c64c8f7
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
-8
View File
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 2d67216a97f88454095422146db2f609
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,37 +0,0 @@
using UnityEngine;
namespace MuHua {
/// <summary>
/// 跟随标签控制器
/// </summary>
public abstract class FollowController<T> : MonoBehaviour where T : FollowController<T> {
/// <summary> 模块单例 </summary>
public static T I => instance;
/// <summary> 模块单例 </summary>
protected static T instance;
/// <summary> 初始化 </summary>
protected abstract void Awake();
/// <summary> 替换,并且设置切换场景不销毁 </summary>
protected virtual void Replace(bool isDontDestroy = true) {
if (instance != null) { Destroy(instance.gameObject); }
instance = (T)this;
if (isDontDestroy) { DontDestroyOnLoad(gameObject); }
}
/// <summary> 不替换,并且设置切换场景不销毁 </summary>
protected virtual void NoReplace(bool isDontDestroy = true) {
if (isDontDestroy) { DontDestroyOnLoad(gameObject); }
if (instance == null) { instance = (T)this; }
else { Destroy(gameObject); }
}
/// <summary> 创建标签 </summary>
public static Transform CreateLabel(Transform target, Transform labelPrefab, Transform parent, Vector3 offset) {
Transform labelObject = Instantiate(labelPrefab, parent);
FollowTag followObjectLabel = labelObject.GetComponent<FollowTag>();
followObjectLabel.target = target;
followObjectLabel.offset = offset;
return labelObject;
}
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: f7eb8180a2e59e44f94464ec35f42b5f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
-19
View File
@@ -1,19 +0,0 @@
using UnityEngine;
namespace MuHua {
/// <summary>
/// 跟随标签
/// </summary>
public class FollowTag : MonoBehaviour {
public Transform target; // 要跟随的目标物体
public Vector3 offset; // 标签的偏移量
protected virtual void Update() {
if (target == null) { return; }
// 设置标签的位置
transform.position = target.position + offset;
// 使标签面向相机
transform.rotation = Camera.main.transform.rotation;
}
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 485994f2ed6f1e448bea192023877815
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,14 +0,0 @@
{
"name": "MuHua.FollowTag",
"rootNamespace": "",
"references": [],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}
@@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 8ea4e4c7b125e9d4e953b91e32da550b
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.
@@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 004a039923c4e3845b77cdbaae4fae09
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
-18
View File
@@ -1,18 +0,0 @@
{
"name": "muhua-follow-tag",
"version": "1.0.0",
"displayName": "MuHua FollowTag",
"description": "\u6d6e\u52a8\u6807\u7b7e\u7cfb\u7edf",
"author": {
"name": "MuHua",
"email": "muhua233@qq.com"
},
"type": "tool",
"samples": [
{
"displayName": "Example",
"description": "An example showing how to use the Label Follow system.",
"path": "Samples~"
}
]
}
-7
View File
@@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 2fc14c1f05b41784eacf23e52739a5cc
PackageManifestImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
-8
View File
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 6678239d4b978fa4e986f9992cd24262
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
-8
View File
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: c38e84236dde7c64cbb63ced7e27b9ad
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,30 +0,0 @@
@import url("unity-theme://default");
@import url("/Packages/com.muhua.uicontrol/Assets/USS/Fonts.uss");
@import url("/Packages/com.muhua.uicontrol/Assets/USS/Dropdown.uss");
@import url("/Packages/com.muhua.uicontrol/Assets/USS/Foldout.uss");
@import url("/Packages/com.muhua.uicontrol/Assets/USS/InputField.uss");
@import url("/Packages/com.muhua.uicontrol/Assets/USS/PopupPrompt.uss");
@import url("/Packages/com.muhua.uicontrol/Assets/USS/PopupWindow.uss");
@import url("/Packages/com.muhua.uicontrol/Assets/USS/ScrollView/ScrollerHorizontal.uss");
@import url("/Packages/com.muhua.uicontrol/Assets/USS/ScrollView/ScrollerVertical.uss");
@import url("/Packages/com.muhua.uicontrol/Assets/USS/ScrollView/ScrollView.uss");
@import url("/Packages/com.muhua.uicontrol/Assets/USS/ScrollView/ScrollViewHorizontal.uss");
@import url("/Packages/com.muhua.uicontrol/Assets/USS/ScrollView/ScrollViewVertical.uss");
@import url("/Packages/com.muhua.uicontrol/Assets/USS/Slider.uss");
@import url("/Packages/com.muhua.uicontrol/Assets/USS/Toggle.uss");
VisualElement {}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 4a132c40dbcde0e4b8ee5330aebc6c23
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 12388, guid: 0000000000000000e000000000000000, type: 0}
disableValidation: 0
-8
View File
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: fc4572784e24c9145b0ba1215575e82a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,52 +0,0 @@
.dropdown {
flex-direction: row;
background-color: rgba(255, 255, 255, 0.5);
width: 100%;
height: 30px;
flex-grow: 0;
flex-shrink: 1;
}
.dropdown-label {
flex-grow: 0;
flex-basis: auto;
flex-shrink: 0;
min-width: 150px;
-unity-text-align: middle-left;
padding-top: 0;
padding-right: 0;
padding-bottom: 0;
padding-left: 5px;
width: auto;
background-color: rgba(0, 0, 0, 0);
margin-top: 0;
margin-right: 0;
margin-bottom: 0;
margin-left: 0;
}
.dropdown-box {
background-color: rgb(255, 255, 255);
width: auto;
flex-grow: 1;
flex-shrink: 1;
flex-basis: 0;
flex-direction: row;
padding-top: 0;
padding-right: 7px;
padding-left: 7px;
}
.dropdown-text {
-unity-text-align: middle-left;
height: 100%;
width: 100%;
white-space: nowrap;
text-overflow: ellipsis;
overflow: visible;
}
.dropdown-arrow {
padding-right: 0;
translate: 0 0;
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: f963dadb562d5884ebe5565d9e95110c
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
disableValidation: 0
-43
View File
@@ -1,43 +0,0 @@
.foldout {
}
.foldout-title {
flex-direction: row;
align-items: center;
}
.foldout-title-image {
background-color: rgb(51, 51, 51);
width: 10px;
height: 10px;
border-top-left-radius: 30px;
border-top-right-radius: 30px;
border-bottom-right-radius: 30px;
border-bottom-left-radius: 30px;
margin-top: 10px;
margin-right: 10px;
margin-bottom: 10px;
margin-left: 10px;
flex-grow: 0;
flex-shrink: 0;
}
.foldout-title-label {
margin-top: 0;
margin-right: 0;
margin-bottom: 0;
margin-left: 0;
padding-top: 0;
padding-right: 0;
padding-bottom: 0;
padding-left: 0;
height: 30px;
width: 100%;
flex-shrink: 1;
flex-grow: 1;
-unity-text-align: middle-left;
}
.foldout-container {
padding-left: 30px;
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: de4110da990ddc747843c5fb483c86e1
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
disableValidation: 0
-2
View File
@@ -1,2 +0,0 @@
.unity-text-element {
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: fc67c76a4f0792b4ba9b6c17ec7a3658
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
disableValidation: 0
@@ -1,49 +0,0 @@
.input-field {
flex-direction: row;
background-color: rgba(255, 255, 255, 0.5);
width: 100%;
height: 30px;
flex-grow: 0;
flex-shrink: 1;
}
.input-field-label {
flex-grow: 0;
flex-basis: auto;
flex-shrink: 0;
min-width: 150px;
-unity-text-align: middle-left;
padding-top: 0;
padding-right: 0;
padding-bottom: 0;
padding-left: 5px;
width: auto;
background-color: rgba(0, 0, 0, 0);
margin-top: 0;
margin-right: 0;
margin-bottom: 0;
margin-left: 0;
}
.input-field-box {
background-color: rgb(255, 255, 255);
width: auto;
flex-grow: 1;
flex-shrink: 1;
flex-basis: 0;
}
.input-field-text {
-unity-text-align: middle-left;
height: 100%;
width: 100%;
padding-right: 0;
padding-left: 7px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: visible;
}
.input-field-text-d {
-unity-font-style: italic;
color: rgba(27, 27, 27, 0.6);
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 03cd515915708e84f84ad5a8ac7f39fc
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
disableValidation: 0
@@ -1,101 +0,0 @@
.popup-prompt {
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.3);
align-items: center;
justify-content: center;
}
.popup-prompt-background {
width: 300px;
height: 200px;
background-color: rgba(255, 255, 255, 0.5);
border-top-width: 10px;
border-right-width: 10px;
border-bottom-width: 10px;
border-left-width: 10px;
border-top-left-radius: 15px;
border-top-right-radius: 15px;
border-bottom-right-radius: 15px;
border-bottom-left-radius: 15px;
}
.popup-prompt-content {
width: 100%;
height: 70%;
}
.popup-prompt-bottom {
height: 30%;
align-items: center;
align-self: auto;
justify-content: center;
width: 100%;
}
.popup-prompt-label {
scale: 1 1;
-unity-text-align: middle-center;
flex-grow: 1;
border-top-width: 0;
border-right-width: 0;
border-bottom-width: 0;
border-left-width: 0;
border-top-left-radius: 0;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
margin-top: 0;
margin-right: 0;
margin-bottom: 0;
margin-left: 0;
padding-top: 0;
padding-right: 0;
padding-bottom: 0;
padding-left: 0;
}
.popup-prompt-button {
width: 80px;
margin-top: 0;
margin-right: 0;
margin-bottom: 0;
margin-left: 0;
padding-top: 0;
padding-right: 0;
padding-bottom: 0;
padding-left: 0;
height: 30px;
background-color: rgb(0, 181, 255);
border-top-width: 5px;
border-right-width: 5px;
border-bottom-width: 5px;
border-left-width: 5px;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
border-bottom-right-radius: 10px;
border-bottom-left-radius: 10px;
border-left-color: rgba(0, 0, 0, 0);
border-right-color: rgba(0, 0, 0, 0);
border-top-color: rgba(0, 0, 0, 0);
border-bottom-color: rgba(0, 0, 0, 0);
-unity-text-align: middle-center;
}
.popup-prompt-button:hover {
scale: 1.1 1.1;
transition-duration: 0.2s;
background-color: rgb(0, 181, 255);
}
.popup-prompt-button:focus {
border-top-width: 5px;
border-right-width: 5px;
border-bottom-width: 5px;
border-left-width: 5px;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
border-bottom-right-radius: 10px;
border-bottom-left-radius: 10px;
background-color: rgb(0, 181, 255);
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 7d555d2a2ed2d0042bf8a6aa00bdcfe0
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
disableValidation: 0
@@ -1,95 +0,0 @@
.popup-window {
background-color: rgba(0, 0, 0, 0.3);
width: 100%;
height: 100%;
align-items: center;
justify-content: center;
}
.popup-window-background {
width: 300px;
height: 400px;
background-color: rgba(255, 255, 255, 0.5);
border-top-width: 10px;
border-right-width: 10px;
border-bottom-width: 10px;
border-left-width: 10px;
border-top-left-radius: 15px;
border-top-right-radius: 15px;
border-bottom-right-radius: 15px;
border-bottom-left-radius: 15px;
}
.popup-window-top {
height: 10%;
}
.popup-window-middle {
height: 80%;
}
.popup-window-bottom {
height: 10%;
align-items: center;
justify-content: center;
}
.popup-window-title {
width: 100%;
height: 100%;
margin-top: 0;
margin-right: 0;
margin-bottom: 0;
margin-left: 0;
padding-top: 0;
padding-right: 0;
padding-bottom: 0;
padding-left: 0;
-unity-text-align: middle-center;
font-size: 24px;
}
.popup-window-button {
margin-top: 0;
margin-right: 0;
margin-bottom: 0;
margin-left: 0;
padding-top: 0;
padding-right: 0;
padding-bottom: 0;
padding-left: 0;
border-top-width: 5px;
border-right-width: 5px;
border-bottom-width: 5px;
border-left-width: 5px;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
border-bottom-right-radius: 10px;
border-bottom-left-radius: 10px;
width: 80px;
height: 30px;
border-left-color: rgba(0, 0, 0, 0);
border-right-color: rgba(0, 0, 0, 0);
border-top-color: rgba(0, 0, 0, 0);
border-bottom-color: rgba(0, 0, 0, 0);
background-color: rgb(0, 181, 255);
font-size: 24px;
}
.popup-window-button:hover {
scale: 1.05 1.05;
transition-duration: 0.2s;
background-color: rgb(0, 181, 255);
}
.popup-window-button:focus {
background-color: rgb(0, 181, 255);
border-top-width: 5px;
border-right-width: 5px;
border-bottom-width: 5px;
border-left-width: 5px;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
border-bottom-right-radius: 10px;
border-bottom-left-radius: 10px;
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 614da9cbef6567f4dbe07797fb050475
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
disableValidation: 0
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 8a21016c3754b4c4f9f339247cc04870
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,24 +0,0 @@
.scroll-view {
height: 100%;
width: 100%;
flex-direction: row;
}
.scroll-view-viewport {
width: 100%;
height: 100%;
}
.scroll-view-container {
}
.scroll-view-scroller {
height: 100%;
width: 30px;
background-color: rgb(255, 255, 255);
}
.scroll-view-dragger {
background-color: rgb(255, 134, 134);
height: 30px;
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 03dbe2cf697b06e4c89e88b4d46d76ea
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
disableValidation: 0
@@ -1,30 +0,0 @@
.horizontal-scroll-view {
width: 100%;
height: 100%;
}
.horizontal-scroll-view-viewport {
width: 100%;
height: 100%;
background-color: rgba(255, 255, 255, 0.6);
overflow: hidden;
}
.horizontal-scroll-view-container {
width: 1000px;
height: 100%;
background-color: rgba(0, 0, 0, 0.2);
transition-duration: 0.1s;
}
.horizontal-scroll-view-scroller {
height: 30px;
width: 100%;
background-color: rgb(255, 255, 255);
}
.horizontal-scroll-view-dragger {
width: 30px;
height: 100%;
background-color: rgb(255, 141, 141);
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 0ad929d1cc924d94f8b6bdd74f5986b4
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
disableValidation: 0
@@ -1,32 +0,0 @@
.vertical-scroll-view {
width: 100%;
height: 100%;
flex-direction: row;
}
.vertical-scroll-view-viewport {
width: 100%;
height: 100%;
background-color: rgba(255, 255, 255, 0.6);
overflow: hidden;
}
.vertical-scroll-view-container {
width: 100%;
height: 1000px;
background-color: rgba(0, 0, 0, 0.2);
flex-shrink: 0;
transition-duration: 0.1s;
}
.vertical-scroll-view-scroller {
width: 30px;
height: 100%;
background-color: rgb(255, 255, 255);
}
.vertical-scroll-view-dragger {
height: 30px;
width: 100%;
background-color: rgb(255, 141, 141);
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 9fd4c2e9476885e4ea09eec173385ef3
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
disableValidation: 0
@@ -1,11 +0,0 @@
.horizontal-scroller {
width: 100%;
height: 30px;
background-color: rgb(255, 255, 255);
}
.horizontal-scroller-dragger {
background-color: rgb(255, 126, 126);
width: 30px;
height: 100%;
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 7feb150ff7e13c94482b3b5c3fc7e0e5
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
disableValidation: 0
@@ -1,11 +0,0 @@
.vertical-scroller {
width: 30px;
height: 100%;
background-color: rgb(255, 255, 255);
}
.vertical-scroller-dragger {
background-color: rgb(255, 126, 126);
width: 100%;
height: 30px;
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 7602d968081373c40b29023dfa3593bb
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
disableValidation: 0
-129
View File
@@ -1,129 +0,0 @@
.horizontal-slider {
flex-direction: row;
width: auto;
height: 30px;
flex-grow: 0;
flex-shrink: 1;
align-items: center;
justify-content: space-between;
}
.horizontal-slider-label {
flex-grow: 0;
flex-basis: auto;
flex-shrink: 0;
min-width: 70px;
-unity-text-align: middle-left;
padding-top: 0;
padding-right: 0;
padding-bottom: 0;
padding-left: 0;
width: auto;
background-color: rgba(0, 0, 0, 0);
margin-top: 5px;
margin-right: 5px;
margin-bottom: 5px;
margin-left: 5px;
border-top-width: 0;
border-right-width: 0;
border-bottom-width: 0;
border-left-width: 0;
border-top-left-radius: 0;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.horizontal-slider-background {
height: 10px;
width: 100%;
margin-left: 10px;
margin-right: 10px;
margin-top: 10px;
margin-bottom: 10px;
padding-right: 0;
padding-left: 0;
background-color: rgb(128, 128, 128);
padding-top: 0;
padding-bottom: 0;
border-top-left-radius: 3px;
border-top-right-radius: 3px;
border-bottom-right-radius: 3px;
border-bottom-left-radius: 3px;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-left-color: rgb(51, 51, 51);
border-right-color: rgb(51, 51, 51);
border-top-color: rgb(51, 51, 51);
border-bottom-color: rgb(51, 51, 51);
}
.horizontal-slider-container {
height: 100%;
width: auto;
margin-right: 0;
margin-left: 0;
margin-top: 0;
margin-bottom: 0;
}
.horizontal-slider-tracker {
height: 100%;
background-color: rgb(255, 255, 255);
width: 0;
flex-direction: row;
align-items: center;
justify-content: flex-end;
border-top-left-radius: 3px;
border-top-right-radius: 3px;
border-bottom-right-radius: 3px;
border-bottom-left-radius: 3px;
}
.horizontal-slider-dragger {
width: 16px;
height: 16px;
position: absolute;
background-color: rgb(255, 255, 255);
translate: 8px 0;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
border-bottom-right-radius: 10px;
border-bottom-left-radius: 10px;
border-left-color: rgb(51, 51, 51);
border-right-color: rgb(51, 51, 51);
border-top-color: rgb(51, 51, 51);
border-bottom-color: rgb(51, 51, 51);
}
.horizontal-slider-field {
background-color: rgb(255, 255, 255);
width: 40px;
height: 20px;
flex-grow: 0;
flex-shrink: 0;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
border-bottom-left-radius: 5px;
margin-top: 5px;
margin-right: 5px;
margin-bottom: 5px;
margin-left: 5px;
}
.horizontal-slider-field-box {
width: 100%;
height: 100%;
align-items: center;
justify-content: space-around;
}
.horizontal-slider-field-text {
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: c161c16266dbad447b027442b9f3d1ae
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
disableValidation: 0
-34
View File
@@ -1,34 +0,0 @@
.toggle {
flex-direction: row;
overflow: hidden;
}
.toggle-checkmark {
width: 24px;
height: 24px;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-left-color: rgb(100, 100, 100);
border-right-color: rgb(100, 100, 100);
border-top-color: rgb(100, 100, 100);
border-bottom-color: rgb(100, 100, 100);
background-color: rgb(255, 255, 255);
-unity-background-image-tint-color: rgb(65, 65, 65);
margin-top: 3px;
margin-right: 3px;
margin-bottom: 3px;
margin-left: 3px;
}
.toggle-checkmark:hover {
border-left-color: rgb(0, 0, 0);
border-right-color: rgb(0, 0, 0);
border-top-color: rgb(0, 0, 0);
border-bottom-color: rgb(0, 0, 0);
}
.toggle-checkmark-a {
background-color: rgb(147, 147, 147);
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 8854406ee13fdba42832b51910d3b251
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
disableValidation: 0
-8
View File
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: d7b7f7b1b1ebc514f98aa5e5423780d3
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
-80
View File
@@ -1,80 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UnityEngine.UIElements;
using UnityEditor;
using MuHua;
namespace MuHuaEditor.UIControl {
public class CreateUSS : Editor {
public static readonly string USS = "Packages/com.muhua.uicontrol/Assets/USS/";
/// <summary>
/// 创建自定义控件的USS
/// </summary>
/// <param name="ussResourcesPath"></param>
/// <param name="name"></param>
private static void USSCreate(string usspath, string name) {
string selectPath = AssetDatabase.GetAssetPath(Selection.activeObject);
string filePath = $"{selectPath}/{name}.uss";
AssetDatabase.CopyAsset(usspath + ".uss", filePath);
AssetDatabase.Refresh();
Object asset = AssetDatabase.LoadAssetAtPath(filePath, typeof(Object));
Selection.activeObject = asset;
}
[MenuItem("Assets/Create/UI Toolkit/Fonts USS")]
private static void USSFonts() {
USSCreate(USS + "Fonts", "Fonts");
}
[MenuItem("Assets/Create/UI Toolkit/ScrollView/ScrollerHorizontal USS")]
private static void USSScrollerHorizontal() {
USSCreate(USS + "ScrollView/ScrollerHorizontal", "ScrollerHorizontal");
}
[MenuItem("Assets/Create/UI Toolkit/ScrollView/ScrollerVertical USS")]
private static void USSScrollerVertical() {
USSCreate(USS + "ScrollView/ScrollerVertical", "ScrollerVertical");
}
[MenuItem("Assets/Create/UI Toolkit/ScrollView/ScrollView USS")]
private static void USSScrollView() {
USSCreate(USS + "ScrollView/ScrollView", "ScrollView");
}
[MenuItem("Assets/Create/UI Toolkit/ScrollView/ScrollViewHorizontal USS")]
private static void USSScrollViewHorizontal() {
USSCreate(USS + "ScrollView/ScrollViewHorizontal", "ScrollViewHorizontal");
}
[MenuItem("Assets/Create/UI Toolkit/ScrollView/ScrollViewVertical USS")]
private static void USSScrollViewVertical() {
USSCreate(USS + "ScrollView/ScrollViewVertical", "ScrollViewVertical");
}
[MenuItem("Assets/Create/UI Toolkit/Dropdown USS")]
private static void USSDropdown() {
USSCreate(USS + "Dropdown", "Dropdown");
}
[MenuItem("Assets/Create/UI Toolkit/Foldout USS")]
private static void USSFoldout() {
USSCreate(USS + "Foldout", "Foldout");
}
[MenuItem("Assets/Create/UI Toolkit/InputField USS")]
private static void USSInputField() {
USSCreate(USS + "InputField", "InputField");
}
[MenuItem("Assets/Create/UI Toolkit/PopupPrompt USS")]
private static void USSPopupPrompt() {
USSCreate(USS + "PopupPrompt", "PopupPrompt");
}
[MenuItem("Assets/Create/UI Toolkit/PopupWindow USS")]
private static void USSPopupWindow() {
USSCreate(USS + "PopupWindow", "PopupWindow");
}
[MenuItem("Assets/Create/UI Toolkit/Slider USS")]
private static void USSSlider() {
USSCreate(USS + "Slider", "Slider");
}
[MenuItem("Assets/Create/UI Toolkit/Toggle USS")]
private static void USSToggle() {
USSCreate(USS + "Toggle", "Toggle");
}
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 76969ecdaf2dfbb4ebe3158ac878c064
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,18 +0,0 @@
{
"name": "MuHuaEditor.UIControl",
"rootNamespace": "",
"references": [
"GUID:f2f8bb6405747de46b4fdb1313592dd5"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}
@@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: d65fad5c0ea42e04d9f1ce8a25a767a0
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
-8
View File
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 9efed5badf2dabb4d80f2f285b50bae0
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 83b14667ab3d30c419e00ca29d617be8
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,30 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;
namespace MuHua {
public class MUFloatField : FloatField {
public new class UxmlFactory : UxmlFactory<MUFloatField, UxmlTraits> { }
public new class UxmlTraits : FloatField.UxmlTraits { }
public VisualElement inputElement;
public VisualElement textElement;
public MUFloatField() {
ClearClassList();
AddToClassList("input-field");
labelElement.ClearClassList();
labelElement.AddToClassList("unity-text-element");
labelElement.AddToClassList("input-field-label");
inputElement = this.Q<VisualElement>("unity-text-input");
inputElement.ClearClassList();
inputElement.AddToClassList("input-field-box");
textElement = inputElement.Q<VisualElement>("");
textElement.ClearClassList();
textElement.AddToClassList("unity-text-element");
textElement.AddToClassList("input-field-text");
}
}
}
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 1723fbf2e9a4ff74c8fdbc5388ca21a1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,28 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;
namespace MuHua{
public class MULongField : LongField {
public new class UxmlFactory : UxmlFactory<MULongField, UxmlTraits> { }
public new class UxmlTraits : LongField.UxmlTraits { }
public MULongField() {
ClearClassList();
AddToClassList("input-field");
labelElement.ClearClassList();
labelElement.AddToClassList("unity-text-element");
labelElement.AddToClassList("input-field-label");
VisualElement inputElement = this.Q<VisualElement>("unity-text-input");
inputElement.ClearClassList();
inputElement.AddToClassList("input-field-box");
VisualElement textElement = inputElement.Q<VisualElement>("");
textElement.ClearClassList();
textElement.AddToClassList("unity-text-element");
textElement.AddToClassList("input-field-text");
}
}
}

Some files were not shown because too many files have changed in this diff Show More