diff --git a/Assets/ModuleCore/ModuleUI/ModuleUIPage/UITestPage.cs b/Assets/ModuleCore/ModuleUI/ModuleUIPage/UITestPage.cs
deleted file mode 100644
index 63481b5..0000000
--- a/Assets/ModuleCore/ModuleUI/ModuleUIPage/UITestPage.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-using UnityEngine.UIElements;
-using MuHua;
-
-///
-/// 测试页面
-///
-public class UITestPage : ModuleUIPage {
- public VisualTreeAsset TemplateAsset;
- public List list;
-
- private UIToggle toggle;
- private UIDropdown dropdown;
- private UIScrollView scrollView1;
- private UIScrollView scrollView2;
- private UIScrollView scrollView3;
- private UIScrollView scrollView4;
-
- public override VisualElement Element => root;
-
- public VisualElement Toggle => Q("Toggle");
- public VisualElement Dropdown => Q("Dropdown");
- public VisualElement ScrollView1 => Q("ScrollView1");
- public VisualElement ScrollView2 => Q("ScrollView2");
- public VisualElement ScrollView3 => Q("ScrollView3");
- public VisualElement ScrollView4 => Q("ScrollView4");
-
- private void Awake() {
- toggle = new UIToggle(Toggle);
- toggle.ValueChanged += (value) => Debug.Log(value);
-
- dropdown = new UIDropdown(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();
- }
-}
diff --git a/Assets/ModuleCore/ModuleUI/ModuleUIPage/UITestPage.cs.meta b/Assets/ModuleCore/ModuleUI/ModuleUIPage/UITestPage.cs.meta
deleted file mode 100644
index 99c56e9..0000000
--- a/Assets/ModuleCore/ModuleUI/ModuleUIPage/UITestPage.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: a47690fe988195040a2e528bb2e8bce6
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/AALoading/Runtime.meta b/Packages/AALoading/Runtime.meta
deleted file mode 100644
index ba8a86b..0000000
--- a/Packages/AALoading/Runtime.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 3699f8709aed43a46bb5220a7124e92b
-folderAsset: yes
-DefaultImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/AALoading/Runtime/AACatalog.cs b/Packages/AALoading/Runtime/AACatalog.cs
deleted file mode 100644
index c3439a4..0000000
--- a/Packages/AALoading/Runtime/AACatalog.cs
+++ /dev/null
@@ -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 {
- ///
- /// 加载可寻址资源目录
- ///
- public class AACatalog {
- public readonly string filePath;
- public Action OnProgress;
- public Action OnError;
- public Action OnComplete;
-
- /// 加载可寻址资源目录
- public AACatalog(string filePath, Action OnComplete = null) {
- this.filePath = filePath;
- this.OnComplete = OnComplete;
- }
- /// 获取异步句柄
- public AsyncOperationHandle Handle() {
- return Addressables.LoadContentCatalogAsync(filePath, true);
- }
- /// 加载目录
- public async void Load() => await ALoad();
- /// 加载目录
- public async Task ALoad() {
- AsyncOperationHandle 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();
- }
- /// 加载目录
- public IEnumerator ILoad() {
- AsyncOperationHandle 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();
- }
- }
-}
\ No newline at end of file
diff --git a/Packages/AALoading/Runtime/AACatalog.cs.meta b/Packages/AALoading/Runtime/AACatalog.cs.meta
deleted file mode 100644
index eba6bb4..0000000
--- a/Packages/AALoading/Runtime/AACatalog.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: cdf535680c5435444845cfa205c9619f
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/AALoading/Runtime/AACatalogToScene.cs b/Packages/AALoading/Runtime/AACatalogToScene.cs
deleted file mode 100644
index 365fdbb..0000000
--- a/Packages/AALoading/Runtime/AACatalogToScene.cs
+++ /dev/null
@@ -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 {
- ///
- /// 从目录加载场景
- ///
- 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 OnProgress;
- public Action OnError;
- public Action OnComplete;
-
- /// 加载可寻址资源目录
- 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;
- }
- /// 从目录加载场景
- public async void Load() => await ALoad();
- /// 从目录加载场景
- 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();
- }
- /// 从目录加载场景
- 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();
- }
- }
-}
\ No newline at end of file
diff --git a/Packages/AALoading/Runtime/AACatalogToScene.cs.meta b/Packages/AALoading/Runtime/AACatalogToScene.cs.meta
deleted file mode 100644
index 70a1379..0000000
--- a/Packages/AALoading/Runtime/AACatalogToScene.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: c8003e83f422c6e4797a12c63bf25406
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/AALoading/Runtime/AALabel.cs b/Packages/AALoading/Runtime/AALabel.cs
deleted file mode 100644
index 35e7744..0000000
--- a/Packages/AALoading/Runtime/AALabel.cs
+++ /dev/null
@@ -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 {
- ///
- /// 按标签加载可寻址资源
- ///
- public class AALabel {
- public readonly string label;
- public Action OnProgress;
- public Action OnError;
- public Action OnComplete;
- public T result;
-
- /// 按标签加载可寻址资源
- public AALabel(string label, Action OnComplete = null) {
- this.label = label;
- this.OnComplete = OnComplete;
- }
- /// 获取异步句柄
- public AsyncOperationHandle Handle() {
- return Addressables.LoadAssetAsync(label);
- }
- /// 加载资源
- public async void Load() => await ALoad();
- /// 加载资源
- public async Task ALoad() {
- AsyncOperationHandle 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);
- }
- /// 加载资源
- public IEnumerator ILoad() {
- AsyncOperationHandle 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);
- }
- }
-}
\ No newline at end of file
diff --git a/Packages/AALoading/Runtime/AALabel.cs.meta b/Packages/AALoading/Runtime/AALabel.cs.meta
deleted file mode 100644
index b5fa4c2..0000000
--- a/Packages/AALoading/Runtime/AALabel.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 05c642602f45beb4391c7dbbd6b78968
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/AALoading/Runtime/AAScene.cs b/Packages/AALoading/Runtime/AAScene.cs
deleted file mode 100644
index 83cdb7d..0000000
--- a/Packages/AALoading/Runtime/AAScene.cs
+++ /dev/null
@@ -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 {
- ///
- /// 加载可寻址场景
- ///
- public class AAScene {
- public readonly string name;
- public readonly LoadSceneMode loadSceneMode;
- public readonly bool activateOnLoad;
- public Action OnProgress;
- public Action OnError;
- public Action OnComplete;
-
- /// 加载可寻址场景
- public AAScene(string name, LoadSceneMode loadSceneMode = LoadSceneMode.Single, bool activateOnLoad = true) {
- this.name = name;
- this.loadSceneMode = loadSceneMode;
- this.activateOnLoad = activateOnLoad;
- }
- /// 获取异步句柄
- public AsyncOperationHandle Handle() {
- return Addressables.LoadSceneAsync(name, loadSceneMode, activateOnLoad);
- }
- /// 加载场景
- public async void Load() => await ALoad();
- /// 加载场景
- public async Task ALoad() {
- AsyncOperationHandle 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();
- }
- /// 加载场景
- public IEnumerator ILoad() {
- AsyncOperationHandle 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();
- }
- }
-}
diff --git a/Packages/AALoading/Runtime/AAScene.cs.meta b/Packages/AALoading/Runtime/AAScene.cs.meta
deleted file mode 100644
index 0295906..0000000
--- a/Packages/AALoading/Runtime/AAScene.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 68519b916d961c745aeba6680a8cafe3
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/AALoading/Runtime/MuHua.AALoading.asmdef b/Packages/AALoading/Runtime/MuHua.AALoading.asmdef
deleted file mode 100644
index 2215dfb..0000000
--- a/Packages/AALoading/Runtime/MuHua.AALoading.asmdef
+++ /dev/null
@@ -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
-}
\ No newline at end of file
diff --git a/Packages/AALoading/Runtime/MuHua.AALoading.asmdef.meta b/Packages/AALoading/Runtime/MuHua.AALoading.asmdef.meta
deleted file mode 100644
index e7157b2..0000000
--- a/Packages/AALoading/Runtime/MuHua.AALoading.asmdef.meta
+++ /dev/null
@@ -1,7 +0,0 @@
-fileFormatVersion: 2
-guid: 26f33ddf2c81134458ea0d2283ffaaaa
-AssemblyDefinitionImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/AALoading/package.json b/Packages/AALoading/package.json
deleted file mode 100644
index dfa1a8e..0000000
--- a/Packages/AALoading/package.json
+++ /dev/null
@@ -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"
- }
-}
\ No newline at end of file
diff --git a/Packages/AALoading/package.json.meta b/Packages/AALoading/package.json.meta
deleted file mode 100644
index 7008986..0000000
--- a/Packages/AALoading/package.json.meta
+++ /dev/null
@@ -1,7 +0,0 @@
-fileFormatVersion: 2
-guid: 03fe4d2014c6ea3488b135e4f4898c14
-TextScriptImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/Character/Runtime.meta b/Packages/Character/Runtime.meta
deleted file mode 100644
index a64bbf8..0000000
--- a/Packages/Character/Runtime.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 71c884672987ee24d8602dc874e95005
-folderAsset: yes
-DefaultImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/Character/Runtime/Component.meta b/Packages/Character/Runtime/Component.meta
deleted file mode 100644
index 96b7ba6..0000000
--- a/Packages/Character/Runtime/Component.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 5714b692b8275aa4cb37f8f22344174e
-folderAsset: yes
-DefaultImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/Character/Runtime/Component/Movement.cs b/Packages/Character/Runtime/Component/Movement.cs
deleted file mode 100644
index 416db7a..0000000
--- a/Packages/Character/Runtime/Component/Movement.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-namespace MuHua {
- ///
- /// 运动器
- ///
- public abstract class Movement {
- /// 当前速度
- public abstract float Speed { get; }
- /// 是否接地
- public abstract bool Grounded { get; }
- /// 移动
- public abstract void Move(Vector2 moveDirection, float moveSpeed, float acceleration, bool isRotation);
- /// 跳跃
- public abstract void Jump(float jumpHeight);
- /// 更新
- public abstract void Update();
- }
-}
diff --git a/Packages/Character/Runtime/Component/Movement.cs.meta b/Packages/Character/Runtime/Component/Movement.cs.meta
deleted file mode 100644
index aa07dc5..0000000
--- a/Packages/Character/Runtime/Component/Movement.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: c48241a855a542e41b23b017edcab454
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/Character/Runtime/Component/MovementCollision.cs b/Packages/Character/Runtime/Component/MovementCollision.cs
deleted file mode 100644
index 936040c..0000000
--- a/Packages/Character/Runtime/Component/MovementCollision.cs
+++ /dev/null
@@ -1,109 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-namespace MuHua {
- ///
- /// 碰撞 - 运动器
- ///
- public class MovementCollision : Movement {
- /// 地面图层
- public readonly LayerMask groundLayers;
- /// 角色控制器
- 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;// 地面检测半径
-
- /// 垂直重力
- 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;
- }
-
- /// 移动
- public override void Move(Vector2 moveDirection, float moveSpeed, float acceleration, bool isRotation) {
- this.moveSpeed = moveSpeed;
- this.acceleration = acceleration;
- this.moveDirection = moveDirection;
- this.isRotation = isRotation;
- }
- /// H*-2*G的平方根=达到所需高度所需的速度
- public override void Jump(float jumpHeight) {
- verticalVelocity = Mathf.Sqrt(jumpHeight * -2f * Gravity);
- }
- /// 更新
- 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; }
- }
- }
-}
\ No newline at end of file
diff --git a/Packages/Character/Runtime/Component/MovementCollision.cs.meta b/Packages/Character/Runtime/Component/MovementCollision.cs.meta
deleted file mode 100644
index 7b2de4a..0000000
--- a/Packages/Character/Runtime/Component/MovementCollision.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 06f3697338f20ac459ed126fc05a9694
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/Character/Runtime/Component/MovementStandard.cs b/Packages/Character/Runtime/Component/MovementStandard.cs
deleted file mode 100644
index ff18947..0000000
--- a/Packages/Character/Runtime/Component/MovementStandard.cs
+++ /dev/null
@@ -1,101 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-namespace MuHua {
- ///
- /// 标准 - 运动器
- ///
- public class MovementStandard : Movement {
- /// 地面图层
- public readonly LayerMask groundLayers;
- /// 变换
- 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;// 地面检测半径
-
- /// 垂直重力
- 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;
- }
-
- /// 移动
- public override void Move(Vector2 moveDirection, float moveSpeed, float acceleration, bool isRotation) {
- this.moveSpeed = moveSpeed;
- this.acceleration = acceleration;
- this.moveDirection = moveDirection;
- this.isRotation = isRotation;
- }
- /// 跳跃
- public override void Jump(float jumpHeight) {
- verticalVelocity = Mathf.Sqrt(jumpHeight * -2f * Gravity);
- }
- /// 更新
- 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; }
- }
- }
-}
\ No newline at end of file
diff --git a/Packages/Character/Runtime/Component/MovementStandard.cs.meta b/Packages/Character/Runtime/Component/MovementStandard.cs.meta
deleted file mode 100644
index d18f435..0000000
--- a/Packages/Character/Runtime/Component/MovementStandard.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: cf671b0b45929dc4c970eadb97df3ec8
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/Character/Runtime/Interface.meta b/Packages/Character/Runtime/Interface.meta
deleted file mode 100644
index eb75fa7..0000000
--- a/Packages/Character/Runtime/Interface.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 197992f6020004c44a74153f43c5f7d1
-folderAsset: yes
-DefaultImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/Character/Runtime/Interface/IKinesis.cs b/Packages/Character/Runtime/Interface/IKinesis.cs
deleted file mode 100644
index 75d521a..0000000
--- a/Packages/Character/Runtime/Interface/IKinesis.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-namespace MuHua {
- ///
- /// 运动
- ///
- public abstract class IKinesis {
- /// 动作过渡
- public abstract bool Transition(IKinesis kinesis);
- /// 开始动作
- public abstract void StartKinesis();
- /// 更新动作
- public abstract void UpdateKinesis();
- /// 完成动作
- public abstract void FinishKinesis();
- /// 动画结束
- public abstract void AnimationExit();
- }
-}
\ No newline at end of file
diff --git a/Packages/Character/Runtime/Interface/IKinesis.cs.meta b/Packages/Character/Runtime/Interface/IKinesis.cs.meta
deleted file mode 100644
index 4f48410..0000000
--- a/Packages/Character/Runtime/Interface/IKinesis.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 1490d224da1fe674cb366599e7603d66
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/Character/Runtime/Kinesis.meta b/Packages/Character/Runtime/Kinesis.meta
deleted file mode 100644
index eb37d7c..0000000
--- a/Packages/Character/Runtime/Kinesis.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 338d1e647d487fe43aee258fbf63dfd4
-folderAsset: yes
-DefaultImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/Character/Runtime/Kinesis/KIdle.cs b/Packages/Character/Runtime/Kinesis/KIdle.cs
deleted file mode 100644
index b8882f4..0000000
--- a/Packages/Character/Runtime/Kinesis/KIdle.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-namespace MuHua {
- ///
- /// 空闲 - 运动
- ///
- 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();
- }
- }
-}
diff --git a/Packages/Character/Runtime/Kinesis/KIdle.cs.meta b/Packages/Character/Runtime/Kinesis/KIdle.cs.meta
deleted file mode 100644
index d977540..0000000
--- a/Packages/Character/Runtime/Kinesis/KIdle.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 29150243edc07d0429fea37464e830a7
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/Character/Runtime/Kinesis/KJump.cs b/Packages/Character/Runtime/Kinesis/KJump.cs
deleted file mode 100644
index fd37fd5..0000000
--- a/Packages/Character/Runtime/Kinesis/KJump.cs
+++ /dev/null
@@ -1,102 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-namespace MuHua {
- ///
- /// 跳跃 - 运动
- ///
- public class KJump : IKinesis {
- /// 基础角色
- public readonly MCharacter character;
-
- /// 结束跳跃
- public bool isEndJump;
- /// 是否接地
- public bool isGrounded;
- /// 允许转换
- public bool isTransition;
- /// 跳跃高度
- public float jumpHeight;
- /// 衰退速度
- public float decaySpeed;
- /// 移动速度
- public float moveSpeed = 2;
- /// 加速度
- public float acceleration = 15;
- /// 移动方向
- public Vector2 moveDirection;
- /// 初始位置
- public Vector3 position;
- /// 初始角度
- public Vector3 eulerAngles;
- /// 是否旋转
- public bool isRotation;
- /// 初始设置
- public bool isInitial = false;
-
- /// 变换器
- public Transform transform => character.transform;
- /// 动画器
- public Animator animator => character.animator;
- /// 运动器
- 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);
- }
- }
-}
diff --git a/Packages/Character/Runtime/Kinesis/KJump.cs.meta b/Packages/Character/Runtime/Kinesis/KJump.cs.meta
deleted file mode 100644
index ea9735c..0000000
--- a/Packages/Character/Runtime/Kinesis/KJump.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: d61c404e3dc615b4eb590448b876863c
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/Character/Runtime/Kinesis/KMove.cs b/Packages/Character/Runtime/Kinesis/KMove.cs
deleted file mode 100644
index 018b29a..0000000
--- a/Packages/Character/Runtime/Kinesis/KMove.cs
+++ /dev/null
@@ -1,73 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-namespace MuHua {
- ///
- /// 移动 - 运动
- ///
- public class KMove : IKinesis {
- /// 基础角色
- public readonly MCharacter character;
-
- /// 移动速度
- public float moveSpeed = 2;
- /// 加速度
- public float acceleration = 15;
- /// 移动方向
- public Vector2 moveDirection;
- /// 初始位置
- public Vector3 position;
- /// 初始角度
- public Vector3 eulerAngles;
- /// 是否旋转
- public bool isRotation;
- /// 初始设置
- public bool isInitial = false;
-
- /// 变换器
- public Transform transform => character.transform;
- /// 动画器
- public Animator animator => character.animator;
- /// 运动器
- 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();
- }
- }
-}
\ No newline at end of file
diff --git a/Packages/Character/Runtime/Kinesis/KMove.cs.meta b/Packages/Character/Runtime/Kinesis/KMove.cs.meta
deleted file mode 100644
index 4a487c9..0000000
--- a/Packages/Character/Runtime/Kinesis/KMove.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: e2b41872ba018e447a649cb6bb35059f
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/Character/Runtime/MCharacter.cs b/Packages/Character/Runtime/MCharacter.cs
deleted file mode 100644
index 9f91054..0000000
--- a/Packages/Character/Runtime/MCharacter.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-namespace MuHua {
- ///
- /// 角色 - 模块
- ///
- public abstract class MCharacter {
-
- /// 变换器
- public Transform transform;
- /// 动画器
- public Animator animator;
- /// 运动器
- public Movement movement;
-
- public MCharacter(Animator animator) => this.animator = animator;
-
- /// 更新
- public abstract void Update();
- /// 动作过渡
- public abstract bool Transition(IKinesis kinesis);
- /// 动画结束
- public abstract void AnimationExit();
- }
-}
\ No newline at end of file
diff --git a/Packages/Character/Runtime/MCharacter.cs.meta b/Packages/Character/Runtime/MCharacter.cs.meta
deleted file mode 100644
index 9d057c4..0000000
--- a/Packages/Character/Runtime/MCharacter.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: f75543aff254f1c4899eb3d332ba5de9
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/Character/Runtime/MCharacterCollision.cs b/Packages/Character/Runtime/MCharacterCollision.cs
deleted file mode 100644
index 1541c6e..0000000
--- a/Packages/Character/Runtime/MCharacterCollision.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-namespace MuHua {
- ///
- /// 碰撞角色 - 模块
- ///
- public class MCharacterCollision : MCharacter {
-
- /// 当前动作
- 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();
- }
- }
-}
\ No newline at end of file
diff --git a/Packages/Character/Runtime/MCharacterCollision.cs.meta b/Packages/Character/Runtime/MCharacterCollision.cs.meta
deleted file mode 100644
index 4c63c81..0000000
--- a/Packages/Character/Runtime/MCharacterCollision.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: fa752d6843dd06146b699b3588a59ea1
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/Character/Runtime/MCharacterRigidbody.cs b/Packages/Character/Runtime/MCharacterRigidbody.cs
deleted file mode 100644
index 221a09b..0000000
--- a/Packages/Character/Runtime/MCharacterRigidbody.cs
+++ /dev/null
@@ -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()
- {
-
- }
-}
diff --git a/Packages/Character/Runtime/MCharacterRigidbody.cs.meta b/Packages/Character/Runtime/MCharacterRigidbody.cs.meta
deleted file mode 100644
index f54bb9b..0000000
--- a/Packages/Character/Runtime/MCharacterRigidbody.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: c073d7ddd6e118746b2709e22bcf7ea6
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/Character/Runtime/MCharacterStandard.cs b/Packages/Character/Runtime/MCharacterStandard.cs
deleted file mode 100644
index 4d5af02..0000000
--- a/Packages/Character/Runtime/MCharacterStandard.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-namespace MuHua {
- ///
- /// 标准角色 - 模块
- ///
- public class MCharacterStandard : MCharacter {
-
- /// 当前动作
- 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();
- }
- }
-}
diff --git a/Packages/Character/Runtime/MCharacterStandard.cs.meta b/Packages/Character/Runtime/MCharacterStandard.cs.meta
deleted file mode 100644
index 4ef4bef..0000000
--- a/Packages/Character/Runtime/MCharacterStandard.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 7eb8fc105ff36704499c0a954daa9c5c
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/Character/Runtime/MuHua.Character.asmdef b/Packages/Character/Runtime/MuHua.Character.asmdef
deleted file mode 100644
index 23f092d..0000000
--- a/Packages/Character/Runtime/MuHua.Character.asmdef
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "name": "MuHua.Character",
- "rootNamespace": "",
- "references": [],
- "includePlatforms": [],
- "excludePlatforms": [],
- "allowUnsafeCode": false,
- "overrideReferences": false,
- "precompiledReferences": [],
- "autoReferenced": true,
- "defineConstraints": [],
- "versionDefines": [],
- "noEngineReferences": false
-}
\ No newline at end of file
diff --git a/Packages/Character/Runtime/MuHua.Character.asmdef.meta b/Packages/Character/Runtime/MuHua.Character.asmdef.meta
deleted file mode 100644
index c4b9a2b..0000000
--- a/Packages/Character/Runtime/MuHua.Character.asmdef.meta
+++ /dev/null
@@ -1,7 +0,0 @@
-fileFormatVersion: 2
-guid: f71c71a343ef5c8459a9f7773cc07460
-AssemblyDefinitionImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/Character/package.json b/Packages/Character/package.json
deleted file mode 100644
index c46a18a..0000000
--- a/Packages/Character/package.json
+++ /dev/null
@@ -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"
- }
- ]
-}
\ No newline at end of file
diff --git a/Packages/Character/package.json.meta b/Packages/Character/package.json.meta
deleted file mode 100644
index ef72059..0000000
--- a/Packages/Character/package.json.meta
+++ /dev/null
@@ -1,7 +0,0 @@
-fileFormatVersion: 2
-guid: 1ab756a7b132add4ca7511381d74cad6
-PackageManifestImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/FollowTag/README.md b/Packages/FollowTag/README.md
deleted file mode 100644
index e8e75a6..0000000
--- a/Packages/FollowTag/README.md
+++ /dev/null
@@ -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);
- }
- }
\ No newline at end of file
diff --git a/Packages/FollowTag/README.md.meta b/Packages/FollowTag/README.md.meta
deleted file mode 100644
index df39752..0000000
--- a/Packages/FollowTag/README.md.meta
+++ /dev/null
@@ -1,7 +0,0 @@
-fileFormatVersion: 2
-guid: 7978ad7d6c868b142b0d9d612c64c8f7
-TextScriptImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/FollowTag/Runtime.meta b/Packages/FollowTag/Runtime.meta
deleted file mode 100644
index a23e71b..0000000
--- a/Packages/FollowTag/Runtime.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 2d67216a97f88454095422146db2f609
-folderAsset: yes
-DefaultImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/FollowTag/Runtime/FollowController.cs b/Packages/FollowTag/Runtime/FollowController.cs
deleted file mode 100644
index 88f0f36..0000000
--- a/Packages/FollowTag/Runtime/FollowController.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using UnityEngine;
-
-namespace MuHua {
- ///
- /// 跟随标签控制器
- ///
- public abstract class FollowController : MonoBehaviour where T : FollowController {
- /// 模块单例
- public static T I => instance;
- /// 模块单例
- protected static T instance;
- /// 初始化
- protected abstract void Awake();
-
- /// 替换,并且设置切换场景不销毁
- protected virtual void Replace(bool isDontDestroy = true) {
- if (instance != null) { Destroy(instance.gameObject); }
- instance = (T)this;
- if (isDontDestroy) { DontDestroyOnLoad(gameObject); }
- }
- /// 不替换,并且设置切换场景不销毁
- protected virtual void NoReplace(bool isDontDestroy = true) {
- if (isDontDestroy) { DontDestroyOnLoad(gameObject); }
- if (instance == null) { instance = (T)this; }
- else { Destroy(gameObject); }
- }
-
- /// 创建标签
- public static Transform CreateLabel(Transform target, Transform labelPrefab, Transform parent, Vector3 offset) {
- Transform labelObject = Instantiate(labelPrefab, parent);
- FollowTag followObjectLabel = labelObject.GetComponent();
- followObjectLabel.target = target;
- followObjectLabel.offset = offset;
- return labelObject;
- }
- }
-}
\ No newline at end of file
diff --git a/Packages/FollowTag/Runtime/FollowController.cs.meta b/Packages/FollowTag/Runtime/FollowController.cs.meta
deleted file mode 100644
index 9ea56fe..0000000
--- a/Packages/FollowTag/Runtime/FollowController.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: f7eb8180a2e59e44f94464ec35f42b5f
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/FollowTag/Runtime/FollowTag.cs b/Packages/FollowTag/Runtime/FollowTag.cs
deleted file mode 100644
index 264dc68..0000000
--- a/Packages/FollowTag/Runtime/FollowTag.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using UnityEngine;
-
-namespace MuHua {
- ///
- /// 跟随标签
- ///
- 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;
- }
- }
-}
\ No newline at end of file
diff --git a/Packages/FollowTag/Runtime/FollowTag.cs.meta b/Packages/FollowTag/Runtime/FollowTag.cs.meta
deleted file mode 100644
index d5519fa..0000000
--- a/Packages/FollowTag/Runtime/FollowTag.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 485994f2ed6f1e448bea192023877815
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/FollowTag/Runtime/MuHua.FollowTag.asmdef b/Packages/FollowTag/Runtime/MuHua.FollowTag.asmdef
deleted file mode 100644
index 42a5e4b..0000000
--- a/Packages/FollowTag/Runtime/MuHua.FollowTag.asmdef
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "name": "MuHua.FollowTag",
- "rootNamespace": "",
- "references": [],
- "includePlatforms": [],
- "excludePlatforms": [],
- "allowUnsafeCode": false,
- "overrideReferences": false,
- "precompiledReferences": [],
- "autoReferenced": true,
- "defineConstraints": [],
- "versionDefines": [],
- "noEngineReferences": false
-}
\ No newline at end of file
diff --git a/Packages/FollowTag/Runtime/MuHua.FollowTag.asmdef.meta b/Packages/FollowTag/Runtime/MuHua.FollowTag.asmdef.meta
deleted file mode 100644
index 59dc786..0000000
--- a/Packages/FollowTag/Runtime/MuHua.FollowTag.asmdef.meta
+++ /dev/null
@@ -1,7 +0,0 @@
-fileFormatVersion: 2
-guid: 8ea4e4c7b125e9d4e953b91e32da550b
-AssemblyDefinitionImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/FollowTag/Samples~/Sample.unitypackage b/Packages/FollowTag/Samples~/Sample.unitypackage
deleted file mode 100644
index 3b7ee4b..0000000
Binary files a/Packages/FollowTag/Samples~/Sample.unitypackage and /dev/null differ
diff --git a/Packages/FollowTag/Samples~/Sample.unitypackage.meta b/Packages/FollowTag/Samples~/Sample.unitypackage.meta
deleted file mode 100644
index 2ad091d..0000000
--- a/Packages/FollowTag/Samples~/Sample.unitypackage.meta
+++ /dev/null
@@ -1,7 +0,0 @@
-fileFormatVersion: 2
-guid: 004a039923c4e3845b77cdbaae4fae09
-DefaultImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/FollowTag/package.json b/Packages/FollowTag/package.json
deleted file mode 100644
index ffebfa4..0000000
--- a/Packages/FollowTag/package.json
+++ /dev/null
@@ -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~"
- }
- ]
-}
\ No newline at end of file
diff --git a/Packages/FollowTag/package.json.meta b/Packages/FollowTag/package.json.meta
deleted file mode 100644
index f9b9f38..0000000
--- a/Packages/FollowTag/package.json.meta
+++ /dev/null
@@ -1,7 +0,0 @@
-fileFormatVersion: 2
-guid: 2fc14c1f05b41784eacf23e52739a5cc
-PackageManifestImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UIControl/Assets.meta b/Packages/UIControl/Assets.meta
deleted file mode 100644
index 9d8b3af..0000000
--- a/Packages/UIControl/Assets.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 6678239d4b978fa4e986f9992cd24262
-folderAsset: yes
-DefaultImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UIControl/Assets/Themes.meta b/Packages/UIControl/Assets/Themes.meta
deleted file mode 100644
index dab638f..0000000
--- a/Packages/UIControl/Assets/Themes.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: c38e84236dde7c64cbb63ced7e27b9ad
-folderAsset: yes
-DefaultImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UIControl/Assets/Themes/DefaultRuntimeTheme.tss b/Packages/UIControl/Assets/Themes/DefaultRuntimeTheme.tss
deleted file mode 100644
index 9297742..0000000
--- a/Packages/UIControl/Assets/Themes/DefaultRuntimeTheme.tss
+++ /dev/null
@@ -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 {}
diff --git a/Packages/UIControl/Assets/Themes/DefaultRuntimeTheme.tss.meta b/Packages/UIControl/Assets/Themes/DefaultRuntimeTheme.tss.meta
deleted file mode 100644
index 7d0e49e..0000000
--- a/Packages/UIControl/Assets/Themes/DefaultRuntimeTheme.tss.meta
+++ /dev/null
@@ -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
diff --git a/Packages/UIControl/Assets/USS.meta b/Packages/UIControl/Assets/USS.meta
deleted file mode 100644
index e02ee54..0000000
--- a/Packages/UIControl/Assets/USS.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: fc4572784e24c9145b0ba1215575e82a
-folderAsset: yes
-DefaultImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UIControl/Assets/USS/Dropdown.uss b/Packages/UIControl/Assets/USS/Dropdown.uss
deleted file mode 100644
index 3e33bb2..0000000
--- a/Packages/UIControl/Assets/USS/Dropdown.uss
+++ /dev/null
@@ -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;
-}
diff --git a/Packages/UIControl/Assets/USS/Dropdown.uss.meta b/Packages/UIControl/Assets/USS/Dropdown.uss.meta
deleted file mode 100644
index f079081..0000000
--- a/Packages/UIControl/Assets/USS/Dropdown.uss.meta
+++ /dev/null
@@ -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
diff --git a/Packages/UIControl/Assets/USS/Foldout.uss b/Packages/UIControl/Assets/USS/Foldout.uss
deleted file mode 100644
index 7a54d34..0000000
--- a/Packages/UIControl/Assets/USS/Foldout.uss
+++ /dev/null
@@ -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;
-}
diff --git a/Packages/UIControl/Assets/USS/Foldout.uss.meta b/Packages/UIControl/Assets/USS/Foldout.uss.meta
deleted file mode 100644
index 3ad5548..0000000
--- a/Packages/UIControl/Assets/USS/Foldout.uss.meta
+++ /dev/null
@@ -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
diff --git a/Packages/UIControl/Assets/USS/Fonts.uss b/Packages/UIControl/Assets/USS/Fonts.uss
deleted file mode 100644
index 52e9d6b..0000000
--- a/Packages/UIControl/Assets/USS/Fonts.uss
+++ /dev/null
@@ -1,2 +0,0 @@
-.unity-text-element {
-}
diff --git a/Packages/UIControl/Assets/USS/Fonts.uss.meta b/Packages/UIControl/Assets/USS/Fonts.uss.meta
deleted file mode 100644
index 34da748..0000000
--- a/Packages/UIControl/Assets/USS/Fonts.uss.meta
+++ /dev/null
@@ -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
diff --git a/Packages/UIControl/Assets/USS/InputField.uss b/Packages/UIControl/Assets/USS/InputField.uss
deleted file mode 100644
index 249d134..0000000
--- a/Packages/UIControl/Assets/USS/InputField.uss
+++ /dev/null
@@ -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);
-}
\ No newline at end of file
diff --git a/Packages/UIControl/Assets/USS/InputField.uss.meta b/Packages/UIControl/Assets/USS/InputField.uss.meta
deleted file mode 100644
index 0f3f0cd..0000000
--- a/Packages/UIControl/Assets/USS/InputField.uss.meta
+++ /dev/null
@@ -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
diff --git a/Packages/UIControl/Assets/USS/PopupPrompt.uss b/Packages/UIControl/Assets/USS/PopupPrompt.uss
deleted file mode 100644
index 92bf158..0000000
--- a/Packages/UIControl/Assets/USS/PopupPrompt.uss
+++ /dev/null
@@ -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);
-}
diff --git a/Packages/UIControl/Assets/USS/PopupPrompt.uss.meta b/Packages/UIControl/Assets/USS/PopupPrompt.uss.meta
deleted file mode 100644
index c404e09..0000000
--- a/Packages/UIControl/Assets/USS/PopupPrompt.uss.meta
+++ /dev/null
@@ -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
diff --git a/Packages/UIControl/Assets/USS/PopupWindow.uss b/Packages/UIControl/Assets/USS/PopupWindow.uss
deleted file mode 100644
index f4c68f1..0000000
--- a/Packages/UIControl/Assets/USS/PopupWindow.uss
+++ /dev/null
@@ -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;
-}
diff --git a/Packages/UIControl/Assets/USS/PopupWindow.uss.meta b/Packages/UIControl/Assets/USS/PopupWindow.uss.meta
deleted file mode 100644
index 6431c84..0000000
--- a/Packages/UIControl/Assets/USS/PopupWindow.uss.meta
+++ /dev/null
@@ -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
diff --git a/Packages/UIControl/Assets/USS/ScrollView.meta b/Packages/UIControl/Assets/USS/ScrollView.meta
deleted file mode 100644
index 7681c9b..0000000
--- a/Packages/UIControl/Assets/USS/ScrollView.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 8a21016c3754b4c4f9f339247cc04870
-folderAsset: yes
-DefaultImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UIControl/Assets/USS/ScrollView/ScrollView.uss b/Packages/UIControl/Assets/USS/ScrollView/ScrollView.uss
deleted file mode 100644
index 05e484f..0000000
--- a/Packages/UIControl/Assets/USS/ScrollView/ScrollView.uss
+++ /dev/null
@@ -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;
-}
diff --git a/Packages/UIControl/Assets/USS/ScrollView/ScrollView.uss.meta b/Packages/UIControl/Assets/USS/ScrollView/ScrollView.uss.meta
deleted file mode 100644
index 1afee5e..0000000
--- a/Packages/UIControl/Assets/USS/ScrollView/ScrollView.uss.meta
+++ /dev/null
@@ -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
diff --git a/Packages/UIControl/Assets/USS/ScrollView/ScrollViewHorizontal.uss b/Packages/UIControl/Assets/USS/ScrollView/ScrollViewHorizontal.uss
deleted file mode 100644
index 3b7c1d6..0000000
--- a/Packages/UIControl/Assets/USS/ScrollView/ScrollViewHorizontal.uss
+++ /dev/null
@@ -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);
-}
diff --git a/Packages/UIControl/Assets/USS/ScrollView/ScrollViewHorizontal.uss.meta b/Packages/UIControl/Assets/USS/ScrollView/ScrollViewHorizontal.uss.meta
deleted file mode 100644
index f2ddc89..0000000
--- a/Packages/UIControl/Assets/USS/ScrollView/ScrollViewHorizontal.uss.meta
+++ /dev/null
@@ -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
diff --git a/Packages/UIControl/Assets/USS/ScrollView/ScrollViewVertical.uss b/Packages/UIControl/Assets/USS/ScrollView/ScrollViewVertical.uss
deleted file mode 100644
index 420d58c..0000000
--- a/Packages/UIControl/Assets/USS/ScrollView/ScrollViewVertical.uss
+++ /dev/null
@@ -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);
-}
diff --git a/Packages/UIControl/Assets/USS/ScrollView/ScrollViewVertical.uss.meta b/Packages/UIControl/Assets/USS/ScrollView/ScrollViewVertical.uss.meta
deleted file mode 100644
index eba54d9..0000000
--- a/Packages/UIControl/Assets/USS/ScrollView/ScrollViewVertical.uss.meta
+++ /dev/null
@@ -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
diff --git a/Packages/UIControl/Assets/USS/ScrollView/ScrollerHorizontal.uss b/Packages/UIControl/Assets/USS/ScrollView/ScrollerHorizontal.uss
deleted file mode 100644
index 10633af..0000000
--- a/Packages/UIControl/Assets/USS/ScrollView/ScrollerHorizontal.uss
+++ /dev/null
@@ -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%;
-}
diff --git a/Packages/UIControl/Assets/USS/ScrollView/ScrollerHorizontal.uss.meta b/Packages/UIControl/Assets/USS/ScrollView/ScrollerHorizontal.uss.meta
deleted file mode 100644
index a6478b8..0000000
--- a/Packages/UIControl/Assets/USS/ScrollView/ScrollerHorizontal.uss.meta
+++ /dev/null
@@ -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
diff --git a/Packages/UIControl/Assets/USS/ScrollView/ScrollerVertical.uss b/Packages/UIControl/Assets/USS/ScrollView/ScrollerVertical.uss
deleted file mode 100644
index 4f0ba75..0000000
--- a/Packages/UIControl/Assets/USS/ScrollView/ScrollerVertical.uss
+++ /dev/null
@@ -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;
-}
\ No newline at end of file
diff --git a/Packages/UIControl/Assets/USS/ScrollView/ScrollerVertical.uss.meta b/Packages/UIControl/Assets/USS/ScrollView/ScrollerVertical.uss.meta
deleted file mode 100644
index f77f809..0000000
--- a/Packages/UIControl/Assets/USS/ScrollView/ScrollerVertical.uss.meta
+++ /dev/null
@@ -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
diff --git a/Packages/UIControl/Assets/USS/Slider.uss b/Packages/UIControl/Assets/USS/Slider.uss
deleted file mode 100644
index 6071b99..0000000
--- a/Packages/UIControl/Assets/USS/Slider.uss
+++ /dev/null
@@ -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 {
-}
diff --git a/Packages/UIControl/Assets/USS/Slider.uss.meta b/Packages/UIControl/Assets/USS/Slider.uss.meta
deleted file mode 100644
index 5d8788b..0000000
--- a/Packages/UIControl/Assets/USS/Slider.uss.meta
+++ /dev/null
@@ -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
diff --git a/Packages/UIControl/Assets/USS/Toggle.uss b/Packages/UIControl/Assets/USS/Toggle.uss
deleted file mode 100644
index a53d1af..0000000
--- a/Packages/UIControl/Assets/USS/Toggle.uss
+++ /dev/null
@@ -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);
-}
diff --git a/Packages/UIControl/Assets/USS/Toggle.uss.meta b/Packages/UIControl/Assets/USS/Toggle.uss.meta
deleted file mode 100644
index 4aa3e53..0000000
--- a/Packages/UIControl/Assets/USS/Toggle.uss.meta
+++ /dev/null
@@ -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
diff --git a/Packages/UIControl/Editor.meta b/Packages/UIControl/Editor.meta
deleted file mode 100644
index bcaaf9f..0000000
--- a/Packages/UIControl/Editor.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: d7b7f7b1b1ebc514f98aa5e5423780d3
-folderAsset: yes
-DefaultImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UIControl/Editor/CreateUSS.cs b/Packages/UIControl/Editor/CreateUSS.cs
deleted file mode 100644
index 5894cc8..0000000
--- a/Packages/UIControl/Editor/CreateUSS.cs
+++ /dev/null
@@ -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/";
- ///
- /// 创建自定义控件的USS
- ///
- ///
- ///
- 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");
- }
- }
-}
diff --git a/Packages/UIControl/Editor/CreateUSS.cs.meta b/Packages/UIControl/Editor/CreateUSS.cs.meta
deleted file mode 100644
index 24d241b..0000000
--- a/Packages/UIControl/Editor/CreateUSS.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 76969ecdaf2dfbb4ebe3158ac878c064
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UIControl/Editor/MuHuaEditor.UIControl.asmdef b/Packages/UIControl/Editor/MuHuaEditor.UIControl.asmdef
deleted file mode 100644
index 55aa40f..0000000
--- a/Packages/UIControl/Editor/MuHuaEditor.UIControl.asmdef
+++ /dev/null
@@ -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
-}
\ No newline at end of file
diff --git a/Packages/UIControl/Editor/MuHuaEditor.UIControl.asmdef.meta b/Packages/UIControl/Editor/MuHuaEditor.UIControl.asmdef.meta
deleted file mode 100644
index d3d354d..0000000
--- a/Packages/UIControl/Editor/MuHuaEditor.UIControl.asmdef.meta
+++ /dev/null
@@ -1,7 +0,0 @@
-fileFormatVersion: 2
-guid: d65fad5c0ea42e04d9f1ce8a25a767a0
-AssemblyDefinitionImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UIControl/Runtime.meta b/Packages/UIControl/Runtime.meta
deleted file mode 100644
index 6e800e3..0000000
--- a/Packages/UIControl/Runtime.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 9efed5badf2dabb4d80f2f285b50bae0
-folderAsset: yes
-DefaultImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UIControl/Runtime/InputField.meta b/Packages/UIControl/Runtime/InputField.meta
deleted file mode 100644
index 9467d84..0000000
--- a/Packages/UIControl/Runtime/InputField.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 83b14667ab3d30c419e00ca29d617be8
-folderAsset: yes
-DefaultImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UIControl/Runtime/InputField/MUFloatField.cs b/Packages/UIControl/Runtime/InputField/MUFloatField.cs
deleted file mode 100644
index 15bc34d..0000000
--- a/Packages/UIControl/Runtime/InputField/MUFloatField.cs
+++ /dev/null
@@ -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 { }
- 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("unity-text-input");
- inputElement.ClearClassList();
- inputElement.AddToClassList("input-field-box");
-
- textElement = inputElement.Q("");
- textElement.ClearClassList();
- textElement.AddToClassList("unity-text-element");
- textElement.AddToClassList("input-field-text");
- }
- }
-}
diff --git a/Packages/UIControl/Runtime/InputField/MUFloatField.cs.meta b/Packages/UIControl/Runtime/InputField/MUFloatField.cs.meta
deleted file mode 100644
index a833c25..0000000
--- a/Packages/UIControl/Runtime/InputField/MUFloatField.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 1723fbf2e9a4ff74c8fdbc5388ca21a1
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UIControl/Runtime/InputField/MULongField.cs b/Packages/UIControl/Runtime/InputField/MULongField.cs
deleted file mode 100644
index 4868ecf..0000000
--- a/Packages/UIControl/Runtime/InputField/MULongField.cs
+++ /dev/null
@@ -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 { }
- 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("unity-text-input");
- inputElement.ClearClassList();
- inputElement.AddToClassList("input-field-box");
-
- VisualElement textElement = inputElement.Q("");
- textElement.ClearClassList();
- textElement.AddToClassList("unity-text-element");
- textElement.AddToClassList("input-field-text");
- }
- }
-}
diff --git a/Packages/UIControl/Runtime/InputField/MULongField.cs.meta b/Packages/UIControl/Runtime/InputField/MULongField.cs.meta
deleted file mode 100644
index 98b136a..0000000
--- a/Packages/UIControl/Runtime/InputField/MULongField.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: e80321332164d2b45b486ad26b5be961
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UIControl/Runtime/InputField/MUTextField.cs b/Packages/UIControl/Runtime/InputField/MUTextField.cs
deleted file mode 100644
index 55e5991..0000000
--- a/Packages/UIControl/Runtime/InputField/MUTextField.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-using UnityEngine.UIElements;
-
-namespace MuHua {
- public class MUTextField : TextField {
- public new class UxmlFactory : UxmlFactory { }
- public new class UxmlTraits : TextField.UxmlTraits {
- public UxmlStringAttributeDescription DefaultPrompt = new UxmlStringAttributeDescription {
- name = "default-prompt"
- };
- public override void Init(VisualElement ve, IUxmlAttributes bag, CreationContext cc) {
- base.Init(ve, bag, cc);
- MUTextField textField = (MUTextField)ve;
- textField.DefaultPrompt = DefaultPrompt.GetValueFromBag(bag, cc);
- textField.SetDefaultPrompt();
- }
- }
- public string DefaultPrompt { get; set; }
-
- public VisualElement inputElement => this.Q("unity-text-input");
- public VisualElement textElement => inputElement.Q("");
-
- public MUTextField() {
- ClearClassList();
- AddToClassList("input-field");
-
- labelElement.ClearClassList();
- labelElement.AddToClassList("unity-text-element");
- labelElement.AddToClassList("input-field-label");
-
- inputElement.ClearClassList();
- inputElement.AddToClassList("input-field-box");
-
- textElement.ClearClassList();
- textElement.AddToClassList("unity-text-element");
- textElement.AddToClassList("input-field-text");
-
- RegisterCallback((evt) => { PrepareInput(); });
- RegisterCallback((evt) => { SetDefaultPrompt(); });
- }
- public void PrepareInput() {
- textElement.RemoveFromClassList("input-field-text-d");
- if (text != DefaultPrompt) { return; }
- text = "";
- }
- public void SetDefaultPrompt() {
- textElement.RemoveFromClassList("input-field-text-d");
- if (value != "") { return; }
- text = DefaultPrompt;
- textElement.AddToClassList("input-field-text-d");
- }
- }
-}
\ No newline at end of file
diff --git a/Packages/UIControl/Runtime/InputField/MUTextField.cs.meta b/Packages/UIControl/Runtime/InputField/MUTextField.cs.meta
deleted file mode 100644
index 5befac6..0000000
--- a/Packages/UIControl/Runtime/InputField/MUTextField.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 9d99552e73f58694f9dde4009dc6f0fb
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UIControl/Runtime/MUDropdown.cs b/Packages/UIControl/Runtime/MUDropdown.cs
deleted file mode 100644
index 2d5d029..0000000
--- a/Packages/UIControl/Runtime/MUDropdown.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-using UnityEngine.UIElements;
-
-namespace MuHua {
- public class MUDropdown : DropdownField {
- public new class UxmlFactory : UxmlFactory { }
- public new class UxmlTraits : DropdownField.UxmlTraits { }
- public MUDropdown() {
- ClearClassList();
- AddToClassList("dropdown");
-
- labelElement.ClearClassList();
- labelElement.AddToClassList("unity-text-element");
- labelElement.AddToClassList("dropdown-label");
-
- VisualElement inputElement = this.Query(null, "unity-popup-field__input");
- inputElement.ClearClassList();
- inputElement.AddToClassList("dropdown-box");
-
- VisualElement textElement = this.Query(null, "unity-base-popup-field__text");
- textElement.ClearClassList();
- textElement.AddToClassList("unity-text-element");
- textElement.AddToClassList("dropdown-text");
-
- VisualElement arrowElement = this.Query(null, "unity-base-popup-field__arrow");
- arrowElement.AddToClassList("dropdown-arrow");
- }
- }
-}
diff --git a/Packages/UIControl/Runtime/MUDropdown.cs.meta b/Packages/UIControl/Runtime/MUDropdown.cs.meta
deleted file mode 100644
index f8de6fc..0000000
--- a/Packages/UIControl/Runtime/MUDropdown.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 17d0169e7671d5442a79e525ee388bd7
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UIControl/Runtime/MUFoldout.cs b/Packages/UIControl/Runtime/MUFoldout.cs
deleted file mode 100644
index e512fde..0000000
--- a/Packages/UIControl/Runtime/MUFoldout.cs
+++ /dev/null
@@ -1,95 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-using UnityEngine.UIElements;
-
-#if UNITY_EDITOR
-using UnityEditor;
-#endif
-
-namespace MuHua {
- public class MUFoldout : VisualElement {
- public new class UxmlFactory : UxmlFactory { }
- public new class UxmlTraits : VisualElement.UxmlTraits {
- private UxmlStringAttributeDescription Text = new UxmlStringAttributeDescription {
- name = "text",
- defaultValue = "标题"
- };
- private UxmlBoolAttributeDescription Active = new UxmlBoolAttributeDescription {
- name = "active",
- defaultValue = false
- };
- public UxmlIntAttributeDescription Count = new UxmlIntAttributeDescription {
- name = "count"
- };
- public UxmlStringAttributeDescription AssetPath = new UxmlStringAttributeDescription {
- name = "asset-path"
- };
- public override void Init(VisualElement ve, IUxmlAttributes bag, CreationContext cc) {
- base.Init(ve, bag, cc);
- MUFoldout foldout = (MUFoldout)ve;
- foldout.Text = Text.GetValueFromBag(bag, cc);
- foldout.Active = Active.GetValueFromBag(bag, cc);
- foldout.AssetPath = AssetPath.GetValueFromBag(bag, cc);
-#if UNITY_EDITOR
- VisualTreeAsset asset = AssetDatabase.LoadAssetAtPath(foldout.AssetPath);
- if (asset == null) { return; }
- foldout.ClearContainer();
- int count = Count.GetValueFromBag(bag, cc);
- for (int i = 0; i < count; i++) { foldout.AddContainer(asset); }
-#endif
- }
- }
- public Label labelElement = new Label();
- public VisualElement title = new VisualElement();
- public VisualElement image = new VisualElement();
- public VisualElement container = new VisualElement();
-
- public string Text {
- get => labelElement.text;
- set => labelElement.text = value;
- }
- public bool Active {
- get => isActive;
- set => SetActive(value);
- }
-
- public void AddContainer(VisualTreeAsset asset) {
- AddContainer(asset.Instantiate());
- }
- public void AddContainer(VisualElement element) {
- container.Add(element);
- }
- public void ClearContainer() {
- container.Clear();
- }
-
- internal bool isActive;
- internal string AssetPath { get; set; }
- internal void SetActive(bool value) {
- isActive = value;
- container.style.display = Active ? DisplayStyle.Flex : DisplayStyle.None;
- }
-
- public MUFoldout() {
- //设置名称
- title.name = "title";
- image.name = "image";
- labelElement.name = "label";
- container.name = "container";
- //设置USS类名
- AddToClassList("foldout");
- title.AddToClassList("foldout-title");
- image.AddToClassList("foldout-title-image");
- labelElement.AddToClassList("foldout-title-label");
- container.AddToClassList("foldout-container");
- //设置层级结构
- hierarchy.Add(title);
- hierarchy.Add(container);
- title.Add(image);
- title.Add(labelElement);
- //设置事件
- title.RegisterCallback((evt) => Active = !Active);
- }
- }
-}
diff --git a/Packages/UIControl/Runtime/MUFoldout.cs.meta b/Packages/UIControl/Runtime/MUFoldout.cs.meta
deleted file mode 100644
index df15a68..0000000
--- a/Packages/UIControl/Runtime/MUFoldout.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: a638c4a7cfde51d4cbc15810d986605c
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UIControl/Runtime/MUSliderHorizontal.cs b/Packages/UIControl/Runtime/MUSliderHorizontal.cs
deleted file mode 100644
index a7f8a5e..0000000
--- a/Packages/UIControl/Runtime/MUSliderHorizontal.cs
+++ /dev/null
@@ -1,223 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-using UnityEngine.UIElements;
-
-namespace MuHua
-{
- public class MUSliderHorizontal : VisualElement
- {
- public enum RoundDataType
- {
- 保留两位小数 = 0,
- 小数 = 1,
- 整数 = 2,
- }
- public new class UxmlFactory : UxmlFactory { }
- public new class UxmlTraits : VisualElement.UxmlTraits
- {
- private UxmlStringAttributeDescription Text = new UxmlStringAttributeDescription
- {
- name = "text"
- };
- private UxmlFloatAttributeDescription MinValue = new UxmlFloatAttributeDescription
- {
- name = "min-value"
- };
- private UxmlFloatAttributeDescription MaxValue = new UxmlFloatAttributeDescription
- {
- name = "max-value"
- };
- private UxmlFloatAttributeDescription SlidingValue = new UxmlFloatAttributeDescription
- {
- name = "sliding-value"
- };
- private UxmlBoolAttributeDescription DisplayInput = new UxmlBoolAttributeDescription
- {
- name = "display-input"
- };
- private UxmlEnumAttributeDescription DataType = new UxmlEnumAttributeDescription
- {
- name = "data-type"
- };
- public override void Init(VisualElement ve, IUxmlAttributes bag, CreationContext cc)
- {
- base.Init(ve, bag, cc);
- MUSliderHorizontal slider = (MUSliderHorizontal)ve;
- slider.Text = Text.GetValueFromBag(bag, cc);
- slider.MinValue = MinValue.GetValueFromBag(bag, cc);
- slider.MaxValue = MaxValue.GetValueFromBag(bag, cc);
- slider.SlidingValue = SlidingValue.GetValueFromBag(bag, cc);
- slider.DisplayInput = DisplayInput.GetValueFromBag(bag, cc);
- slider.DataType = DataType.GetValueFromBag(bag, cc);
- }
- }
- public event Action SlidingValueChanged;
- public Label labelElement = new Label();
- public MUFloatField floatField = new MUFloatField();
- public VisualElement background = new VisualElement();
- public VisualElement container = new VisualElement();
- public VisualElement tracker = new VisualElement();
- public VisualElement dragger = new VisualElement();
-
- public string Text
- {
- get => labelElement.text;
- set => UpdateLabelElement(value);
- }
- public float MinValue
- {
- get => minValue;
- set { minValue = value; UpdateFloatField(); }
- }
- public float MaxValue
- {
- get => maxValue;
- set { maxValue = value; UpdateFloatField(); }
- }
- public float SlidingValue
- {
- get => slidingValue;
- set => UpdateSlidingValue(value);
- }
- public bool DisplayInput
- {
- get => isDisplayInput;
- set => UpdateFloatField(value);
- }
- public RoundDataType DataType
- {
- get => dataType;
- set { dataType = value; UpdateFloatField(); }
- }
- public float Value
- {
- get => UpdateValue();
- set => UpdateValue(value);
- }
-
- internal float minValue;
- internal float maxValue;
- internal float slidingValue;
- internal bool isDisplayInput;
- internal bool isDragger;
- internal float mousePosition;
- internal float originalPosition;
- public RoundDataType dataType;
-
- internal float MaxPosition { get => container.resolvedStyle.width; }
- internal float CurrentPosition { get => slidingValue * container.resolvedStyle.width; }
-
- internal void UpdateLabelElement(string value)
- {
- bool display = value != "" && value != null;
- labelElement.text = value;
- labelElement.style.display = display ? DisplayStyle.Flex : DisplayStyle.None;
- }
- internal void UpdateSlidingValue(float value)
- {
- UpdateDragger(value);
- SlidingValueChanged?.Invoke(Value);
- }
- internal void UpdateDragger(float value)
- {
- slidingValue = value;
- slidingValue = Mathf.Clamp(slidingValue, 0, 1);
- tracker.style.width = Length.Percent(slidingValue * 100);
- UpdateFloatField();
- }
- internal void UpdateFloatField(ChangeEvent evt)
- {
- float value = Mathf.Clamp(evt.newValue, MinValue, MaxValue);
- slidingValue = Mathf.InverseLerp(MinValue, MaxValue, value);
- tracker.style.width = Length.Percent(slidingValue * 100);
- SlidingValueChanged?.Invoke(Value);
- }
- internal void UpdateFloatField(bool value)
- {
- isDisplayInput = value;
- floatField.style.display = isDisplayInput ? DisplayStyle.Flex : DisplayStyle.None;
- }
- internal void UpdateFloatField()
- {
- floatField.value = Value;
- }
- internal float UpdateValue()
- {
- float value = Mathf.Lerp(MinValue, MaxValue, SlidingValue);
- if (dataType == RoundDataType.保留两位小数) { value = (float)Math.Round(value, 2); }
- if (dataType == RoundDataType.整数) { value = Mathf.FloorToInt(value); }
- return Mathf.Clamp(value, MinValue, MaxValue);
- }
- internal void UpdateValue(float value)
- {
- slidingValue = Mathf.InverseLerp(MinValue, MaxValue, value);
- tracker.style.width = Length.Percent(slidingValue * 100);
- UpdateFloatField();
- }
-
- public MUSliderHorizontal()
- {
- //设置名称
- labelElement.name = "Label";
- floatField.name = "FloatField";
- background.name = "Background";
- container.name = "Container";
- tracker.name = "Tracker";
- dragger.name = "Dragger";
- //设置USS类名
- AddToClassList("horizontal-slider");
- labelElement.ClearClassList();
- labelElement.AddToClassList("unity-text-element");
- labelElement.AddToClassList("horizontal-slider-label");
-
- background.AddToClassList("horizontal-slider-background");
- container.AddToClassList("horizontal-slider-container");
- tracker.AddToClassList("horizontal-slider-tracker");
- dragger.AddToClassList("horizontal-slider-dragger");
-
- floatField.ClearClassList();
- floatField.AddToClassList("horizontal-slider-field");
- floatField.inputElement.ClearClassList();
- floatField.inputElement.AddToClassList("horizontal-slider-field-box");
- floatField.textElement.ClearClassList();
- floatField.textElement.AddToClassList("unity-text-element");
- floatField.textElement.AddToClassList("horizontal-slider-field-text");
- //设置层级结构
- hierarchy.Add(labelElement);
- hierarchy.Add(background);
- hierarchy.Add(floatField);
- background.Add(container);
- container.Add(tracker);
- tracker.Add(dragger);
- //设置事件
- dragger.RegisterCallback(DraggerDown);
- dragger.RegisterCallback(DraggerDrag);
- dragger.RegisterCallback((evt) => isDragger = false);
- dragger.RegisterCallback((evt) => isDragger = false);
-
- floatField.RegisterCallback>(UpdateFloatField);
-
- container.RegisterCallback(ContainerDown);
- }
- private void DraggerDown(PointerDownEvent evt)
- {
- isDragger = true;
- mousePosition = evt.position.x;
- originalPosition = CurrentPosition;
- }
- private void DraggerDrag(PointerMoveEvent evt)
- {
- if (!isDragger) { return; }
- float offset = evt.position.x - mousePosition;
- float value = (originalPosition + offset) / MaxPosition;
- UpdateSlidingValue(value);
- }
- private void ContainerDown(PointerDownEvent evt)
- {
- float value = evt.localPosition.x / MaxPosition;
- UpdateSlidingValue(value);
- }
- }
-}
diff --git a/Packages/UIControl/Runtime/MUSliderHorizontal.cs.meta b/Packages/UIControl/Runtime/MUSliderHorizontal.cs.meta
deleted file mode 100644
index 87b9cc6..0000000
--- a/Packages/UIControl/Runtime/MUSliderHorizontal.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 1fd74f9e0c7ede342a809b375fd4175b
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UIControl/Runtime/MUToggle.cs b/Packages/UIControl/Runtime/MUToggle.cs
deleted file mode 100644
index 5430c1e..0000000
--- a/Packages/UIControl/Runtime/MUToggle.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-using UnityEngine.UIElements;
-
-namespace MuHua {
- public class MUToggle : VisualElement {
- public new class UxmlFactory : UxmlFactory { }
- public new class UxmlTraits : VisualElement.UxmlTraits {
- private UxmlBoolAttributeDescription Value = new UxmlBoolAttributeDescription {
- name = "Value"
- };
- public override void Init(VisualElement ve, IUxmlAttributes bag, CreationContext cc) {
- base.Init(ve, bag, cc);
- MUToggle toggle = (MUToggle)ve;
- toggle.Value = Value.GetValueFromBag(bag, cc);
- }
- }
- public event Action OnChange;
- public VisualElement checkmark = new VisualElement();
- /// 设置值 触发事件
- public bool Value {
- get { return value; }
- set { SetValue(value); OnChange?.Invoke(value); }
- }
- /// 设置值不会触发事件
- public void SetValue(bool value) {
- this.value = value;
- if (value) { checkmark.AddToClassList("toggle-checkmark-a"); }
- else { checkmark.RemoveFromClassList("toggle-checkmark-a"); }
- }
-
- internal bool value;
-
- public MUToggle() {
- //设置名称
- checkmark.name = "Checkmark";
- //设置USS类名
- AddToClassList("toggle");
- checkmark.AddToClassList("toggle-checkmark");
- //设置层级结构
- hierarchy.Add(checkmark);
- //设置事件
- checkmark.RegisterCallback((evt) => Value = !Value);
- }
- }
-}
diff --git a/Packages/UIControl/Runtime/MUToggle.cs.meta b/Packages/UIControl/Runtime/MUToggle.cs.meta
deleted file mode 100644
index b89edcc..0000000
--- a/Packages/UIControl/Runtime/MUToggle.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: cb8deac54a479ee4595f01b00b8403f4
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UIControl/Runtime/MuHua.UIControl.asmdef b/Packages/UIControl/Runtime/MuHua.UIControl.asmdef
deleted file mode 100644
index e1c79ec..0000000
--- a/Packages/UIControl/Runtime/MuHua.UIControl.asmdef
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "name": "MuHua.UIControl"
-}
diff --git a/Packages/UIControl/Runtime/MuHua.UIControl.asmdef.meta b/Packages/UIControl/Runtime/MuHua.UIControl.asmdef.meta
deleted file mode 100644
index f50e5f8..0000000
--- a/Packages/UIControl/Runtime/MuHua.UIControl.asmdef.meta
+++ /dev/null
@@ -1,7 +0,0 @@
-fileFormatVersion: 2
-guid: f2f8bb6405747de46b4fdb1313592dd5
-AssemblyDefinitionImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UIControl/Runtime/Popup.meta b/Packages/UIControl/Runtime/Popup.meta
deleted file mode 100644
index 1cc8f2b..0000000
--- a/Packages/UIControl/Runtime/Popup.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: ba211e11f722a6e4d985f60d27b7dfc7
-folderAsset: yes
-DefaultImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UIControl/Runtime/Popup/MUPopupPrompt.cs b/Packages/UIControl/Runtime/Popup/MUPopupPrompt.cs
deleted file mode 100644
index b2e528d..0000000
--- a/Packages/UIControl/Runtime/Popup/MUPopupPrompt.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-using UnityEngine.UIElements;
-
-namespace MuHua {
- public class MUPopupPrompt : VisualElement {
- public new class UxmlFactory : UxmlFactory { }
- public new class UxmlTraits : VisualElement.UxmlTraits {
- public UxmlStringAttributeDescription LabelText = new UxmlStringAttributeDescription {
- name = "Label-Text", defaultValue = "弹窗内容"
- };
- public UxmlStringAttributeDescription ButtonText = new UxmlStringAttributeDescription {
- name = "Button-Text", defaultValue = "确认"
- };
- public override void Init(VisualElement ve, IUxmlAttributes bag, CreationContext cc) {
- base.Init(ve, bag, cc);
- MUPopupPrompt popupPrompt = ve as MUPopupPrompt;
- popupPrompt.labelText = LabelText.GetValueFromBag(bag, cc);
- popupPrompt.buttonText = ButtonText.GetValueFromBag(bag, cc);
- }
- }
- //布局
- public VisualElement background = new VisualElement();
- public VisualElement content = new VisualElement();
- public VisualElement bottom = new VisualElement();
- //组件
- public Label label = new Label();
- public Button button = new Button();
- //参数
- public Action callback;
- public string labelText { get => label.text; set => label.text = value; }
- public string buttonText { get => button.text; set => button.text = value; }
-
- public MUPopupPrompt() {
- //清除原有样式
- label.ClearClassList();
- button.ClearClassList();
- //设置USS类名
- AddToClassList("popup-prompt");
- background.AddToClassList("popup-prompt-background");
- content.AddToClassList("popup-prompt-content");
- bottom.AddToClassList("popup-prompt-bottom");
- label.AddToClassList("unity-text-element");
- label.AddToClassList("popup-prompt-label");
- button.AddToClassList("unity-text-element");
- button.AddToClassList("popup-prompt-button");
- //设置层级结构
- hierarchy.Add(background);
- background.Add(content);
- background.Add(bottom);
- content.Add(label);
- bottom.Add(button);
- //设置事件
- button.RegisterCallback((evt) => Close());
- }
- public void Open(string text, Action action) {
- labelText = text; callback = action; visible = true;
- }
- public void Close() {
- callback?.Invoke(); callback = null; visible = false;
- }
- }
-}
\ No newline at end of file
diff --git a/Packages/UIControl/Runtime/Popup/MUPopupPrompt.cs.meta b/Packages/UIControl/Runtime/Popup/MUPopupPrompt.cs.meta
deleted file mode 100644
index 70453dd..0000000
--- a/Packages/UIControl/Runtime/Popup/MUPopupPrompt.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: d03e3806ea383d14f8f2aadeb9c5cd00
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UIControl/Runtime/Popup/MUPopupWindow.cs b/Packages/UIControl/Runtime/Popup/MUPopupWindow.cs
deleted file mode 100644
index d273236..0000000
--- a/Packages/UIControl/Runtime/Popup/MUPopupWindow.cs
+++ /dev/null
@@ -1,90 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-using UnityEngine.UIElements;
-
-#if UNITY_EDITOR
-using UnityEditor;
-#endif
-
-namespace MuHua {
- public class MUPopupWindow : VisualElement {
- public new class UxmlFactory : UxmlFactory { }
- public new class UxmlTraits : VisualElement.UxmlTraits {
- public UxmlStringAttributeDescription TitleText = new UxmlStringAttributeDescription {
- name = "Title-Text", defaultValue = "标题"
- };
- public UxmlStringAttributeDescription ButtonText = new UxmlStringAttributeDescription {
- name = "Button-Text", defaultValue = "确认"
- };
- public UxmlStringAttributeDescription AssetPath = new UxmlStringAttributeDescription {
- name = "Asset-Path"
- };
- public override void Init(VisualElement ve, IUxmlAttributes bag, CreationContext cc) {
- base.Init(ve, bag, cc);
- MUPopupWindow popup = ve as MUPopupWindow;
- popup.titleText = TitleText.GetValueFromBag(bag, cc);
- popup.buttonText = ButtonText.GetValueFromBag(bag, cc);
-
- popup.assetPath = AssetPath.GetValueFromBag(bag, cc);
-#if UNITY_EDITOR
- VisualTreeAsset asset = AssetDatabase.LoadAssetAtPath(popup.assetPath);
- if (asset != null) { popup.ReplaceContent(asset.Instantiate()); }
- else { popup.middle.Clear(); }
-#endif
- }
- }
- //布局
- public VisualElement background = new VisualElement();
- public VisualElement top = new VisualElement();
- public VisualElement middle = new VisualElement();
- public VisualElement bottom = new VisualElement();
- //组件
- public Label title = new Label();
- public Button button = new Button();
- //参数
- public Action callback;
- public string assetPath { get; set; }
- public string titleText { get => title.text; set => title.text = value; }
- public string buttonText { get => button.text; set => button.text = value; }
-
- public MUPopupWindow() {
- //清除原有样式
- title.ClearClassList();
- button.ClearClassList();
- //设置USS类名
- AddToClassList("popup-window");
- background.AddToClassList("popup-window-background");
- top.AddToClassList("popup-window-top");
- middle.AddToClassList("popup-window-middle");
- bottom.AddToClassList("popup-window-bottom");
- title.AddToClassList("unity-text-element");
- title.AddToClassList("popup-window-title");
- button.AddToClassList("unity-text-element");
- button.AddToClassList("popup-window-button");
- //设置层级结构
- hierarchy.Add(background);
- background.Add(top);
- background.Add(middle);
- background.Add(bottom);
- top.Add(title);
- bottom.Add(button);
- //设置事件
- button.RegisterCallback((evt) => Close());
- }
- public void Open(Action action) {
- callback = action;
- visible = true;
- }
- public void Close() {
- callback?.Invoke();
- callback = null;
- visible = false;
- }
- public void ReplaceContent(VisualElement element) {
- middle.Clear();
- middle.Add(element);
- }
- }
-}
\ No newline at end of file
diff --git a/Packages/UIControl/Runtime/Popup/MUPopupWindow.cs.meta b/Packages/UIControl/Runtime/Popup/MUPopupWindow.cs.meta
deleted file mode 100644
index 554ba19..0000000
--- a/Packages/UIControl/Runtime/Popup/MUPopupWindow.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: b9f7a20f4d66c4a42840fbb21226ce48
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UIControl/Runtime/ScrollView.meta b/Packages/UIControl/Runtime/ScrollView.meta
deleted file mode 100644
index 9e3aa78..0000000
--- a/Packages/UIControl/Runtime/ScrollView.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 8cdf1edce1f3c1047a25a8845aee7f35
-folderAsset: yes
-DefaultImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UIControl/Runtime/ScrollView/MUScrollView.cs b/Packages/UIControl/Runtime/ScrollView/MUScrollView.cs
deleted file mode 100644
index 8f8d570..0000000
--- a/Packages/UIControl/Runtime/ScrollView/MUScrollView.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-using UnityEngine.UIElements;
-
-#if UNITY_EDITOR
-using UnityEditor;
-#endif
-
-namespace MuHua {
- public class MUScrollView : VisualElement {
- public new class UxmlFactory : UxmlFactory { }
- public new class UxmlTraits : VisualElement.UxmlTraits {
-
- }
- public VisualElement viewport = new VisualElement();
- public VisualElement container = new VisualElement();
-
- public MUScrollView() {
- //设置名称
- viewport.name = "viewport";
- container.name = "container";
- //设置USS类名
- AddToClassList("scroll-view");
- viewport.AddToClassList("scroll-view-viewport");
- container.AddToClassList("scroll-view-container");
- //设置层级结构
- hierarchy.Add(viewport);
- viewport.Add(container);
- }
- }
-}
-
diff --git a/Packages/UIControl/Runtime/ScrollView/MUScrollView.cs.meta b/Packages/UIControl/Runtime/ScrollView/MUScrollView.cs.meta
deleted file mode 100644
index af2a3e2..0000000
--- a/Packages/UIControl/Runtime/ScrollView/MUScrollView.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 1f44619e724604b47834e3639ffe2947
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UIControl/Runtime/ScrollView/MUScrollViewHorizontal.cs b/Packages/UIControl/Runtime/ScrollView/MUScrollViewHorizontal.cs
deleted file mode 100644
index 90b5a00..0000000
--- a/Packages/UIControl/Runtime/ScrollView/MUScrollViewHorizontal.cs
+++ /dev/null
@@ -1,138 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-using UnityEngine.UIElements;
-
-#if UNITY_EDITOR
-using UnityEditor;
-#endif
-
-namespace MuHua {
- public class MUScrollViewHorizontal : VisualElement {
- public new class UxmlFactory : UxmlFactory { }
- public new class UxmlTraits : VisualElement.UxmlTraits {
- private UxmlIntAttributeDescription MouseWheelScrollSize = new UxmlIntAttributeDescription {
- name = "mouse-wheel-scroll-size",
- defaultValue = 18
- };
- private UxmlFloatAttributeDescription SlidingValue = new UxmlFloatAttributeDescription {
- name = "sliding-value",
- defaultValue = 0
- };
- public UxmlIntAttributeDescription Count = new UxmlIntAttributeDescription {
- name = "count"
- };
- public UxmlStringAttributeDescription AssetPath = new UxmlStringAttributeDescription {
- name = "asset-path"
- };
- public override void Init(VisualElement ve, IUxmlAttributes bag, CreationContext cc) {
- base.Init(ve, bag, cc);
- MUScrollViewHorizontal scrollView = (MUScrollViewHorizontal)ve;
- scrollView.MouseWheelScrollSize = MouseWheelScrollSize.GetValueFromBag(bag, cc);
- scrollView.SlidingValue = SlidingValue.GetValueFromBag(bag, cc);
- scrollView.AssetPath = AssetPath.GetValueFromBag(bag, cc);
-#if UNITY_EDITOR
- VisualTreeAsset asset = AssetDatabase.LoadAssetAtPath(scrollView.AssetPath);
- if (asset == null) { return; }
- scrollView.ClearContainer();
- int count = Count.GetValueFromBag(bag, cc);
- for (int i = 0; i < count; i++) { scrollView.AddContainer(asset); }
-#endif
- scrollView.scroller.MouseWheelScrollSize = scrollView.MouseWheelScrollSize;
- scrollView.ContainerRelease();
- }
- }
- public MUScrollerHorizontal scroller = new MUScrollerHorizontal();
- public VisualElement viewport = new VisualElement();
- public VisualElement container = new VisualElement();
-
- public string AssetPath { get; set; }
- public float MouseWheelScrollSize { get; set; }
- public float SlidingValue { get; set; }
-
- public void AddContainer(VisualTreeAsset asset) {
- AddContainer(asset.Instantiate());
- }
- public void AddContainer(VisualElement element) {
- container.Add(element);
- }
- public void ClearContainer() {
- container.Clear();
- }
-
- internal bool isDragger;
- internal float mousePosition;
-
- internal float ViewportWidth { get => viewport.resolvedStyle.width; }
- internal float ContainerWidth { get => container.resolvedStyle.width; }
- internal float MaxPosition { get => ComputeMaxPosition(); }
- internal float ComputeMaxPosition() {
- float value = ViewportWidth - ContainerWidth;
- return value <= 0 ? value : -1;
- }
-
- internal void UpdateVisualElement(float value) {
- SlidingValue = value;
- container.transform.position = new Vector3(MaxPosition * SlidingValue, 0);
- scroller.UpdateVisualElement(SlidingValue);
- }
-
- public MUScrollViewHorizontal() {
- //设置名称
- viewport.name = "viewport";
- container.name = "container";
- //设置USS类名
- AddToClassList("horizontal-scroll-view");
- viewport.AddToClassList("horizontal-scroll-view-viewport");
- container.AddToClassList("horizontal-scroll-view-container");
-
- scroller.ClearClassList();
- scroller.AddToClassList("horizontal-scroll-view-scroller");
-
- VisualElement dragger = scroller.dragger;
- dragger.ClearClassList();
- dragger.AddToClassList("horizontal-scroll-view-dragger");
- //设置层级结构
- hierarchy.Add(viewport);
- hierarchy.Add(scroller);
- viewport.Add(container);
- //设置事件
- scroller.SlidingValueChanged += UpdateVisualElement;
- container.RegisterCallback(ContainerDown);
- container.RegisterCallback(ContainerDrag);
- container.RegisterCallback((evt) => ContainerRelease());
- container.RegisterCallback((evt) => ContainerRelease());
- container.RegisterCallback(ContainerWheel);
- container.generateVisualContent += ContainerGenerateVisualContent;
- }
- private void ContainerDown(PointerDownEvent evt) {
- isDragger = true;
- mousePosition = evt.position.x - SlidingValue * MaxPosition;
- }
- private void ContainerDrag(PointerMoveEvent evt) {
- if (!isDragger) { return; }
- float offset = evt.position.x - mousePosition;
- float value = offset / MaxPosition;
- UpdateVisualElement(value);
- mousePosition = evt.position.x - SlidingValue * MaxPosition;
- }
- private void ContainerRelease() {
- isDragger = false;
- float value = Mathf.Clamp01(SlidingValue);
- container.schedule.Execute(() => { UpdateVisualElement(value); }).StartingIn(1);
- }
- private void ContainerWheel(WheelEvent evt) {
- float wheel = Mathf.Clamp(evt.delta.y, -1, 1);
- float current = SlidingValue * MaxPosition;
- float offset = current - wheel * MouseWheelScrollSize;
- float value = offset / MaxPosition;
- UpdateVisualElement(value);
- ContainerRelease();
- }
- private void ContainerGenerateVisualContent(MeshGenerationContext mgc) {
- float ratio = Mathf.Clamp01(ViewportWidth / ContainerWidth);
- scroller.UpdateDragger(ratio);
- ContainerRelease();
- }
- }
-}
diff --git a/Packages/UIControl/Runtime/ScrollView/MUScrollViewHorizontal.cs.meta b/Packages/UIControl/Runtime/ScrollView/MUScrollViewHorizontal.cs.meta
deleted file mode 100644
index 585ca94..0000000
--- a/Packages/UIControl/Runtime/ScrollView/MUScrollViewHorizontal.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 6d083933c2f0cfa448e7c5a5f22c253c
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UIControl/Runtime/ScrollView/MUScrollViewVertical.cs b/Packages/UIControl/Runtime/ScrollView/MUScrollViewVertical.cs
deleted file mode 100644
index 6ebd0a2..0000000
--- a/Packages/UIControl/Runtime/ScrollView/MUScrollViewVertical.cs
+++ /dev/null
@@ -1,139 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-using UnityEngine.UIElements;
-
-#if UNITY_EDITOR
-using UnityEditor;
-#endif
-
-namespace MuHua {
- public class MUScrollViewVertical : VisualElement {
- public new class UxmlFactory : UxmlFactory { }
- public new class UxmlTraits : VisualElement.UxmlTraits {
- private UxmlIntAttributeDescription MouseWheelScrollSize = new UxmlIntAttributeDescription {
- name = "mouse-wheel-scroll-size",
- defaultValue = 18
- };
- private UxmlFloatAttributeDescription SlidingValue = new UxmlFloatAttributeDescription {
- name = "sliding-value",
- defaultValue = 0
- };
- public UxmlIntAttributeDescription Count = new UxmlIntAttributeDescription {
- name = "count"
- };
- public UxmlStringAttributeDescription AssetPath = new UxmlStringAttributeDescription {
- name = "asset-path"
- };
- public override void Init(VisualElement ve, IUxmlAttributes bag, CreationContext cc) {
- base.Init(ve, bag, cc);
- MUScrollViewVertical scrollView = (MUScrollViewVertical)ve;
- scrollView.MouseWheelScrollSize = MouseWheelScrollSize.GetValueFromBag(bag, cc);
- scrollView.SlidingValue = SlidingValue.GetValueFromBag(bag, cc);
- scrollView.AssetPath = AssetPath.GetValueFromBag(bag, cc);
-#if UNITY_EDITOR
- VisualTreeAsset asset = AssetDatabase.LoadAssetAtPath(scrollView.AssetPath);
- if (asset == null) { return; }
- scrollView.ClearContainer();
- int count = Count.GetValueFromBag(bag, cc);
- for (int i = 0; i < count; i++) { scrollView.AddContainer(asset); }
-#endif
- scrollView.scroller.MouseWheelScrollSize = scrollView.MouseWheelScrollSize;
- scrollView.ContainerRelease();
- }
- }
- public MUScrollerVertical scroller = new MUScrollerVertical();
- public VisualElement viewport = new VisualElement();
- public VisualElement container = new VisualElement();
-
- public string AssetPath { get; set; }
- public float MouseWheelScrollSize { get; set; }
- public float SlidingValue { get; set; }
-
- public void AddContainer(VisualTreeAsset asset) {
- AddContainer(asset.Instantiate());
- }
- public void AddContainer(VisualElement element) {
- container.Add(element);
- }
- public void ClearContainer() {
- container.Clear();
- }
-
- internal bool isDragger;
- internal float mousePosition;
-
- internal float ViewportHeight { get => viewport.resolvedStyle.height; }
- internal float ContainerHeight { get => container.resolvedStyle.height; }
- internal float MaxPosition { get => ComputeMaxPosition(); }
- internal float ComputeMaxPosition() {
- float value = ViewportHeight - ContainerHeight;
- return value <= 0 ? value : -1;
- }
-
- internal void UpdateVisualElement(float value) {
- SlidingValue = value;
- container.transform.position = new Vector3(0, MaxPosition * SlidingValue);
- scroller.UpdateVisualElement(SlidingValue);
- }
-
- public MUScrollViewVertical() {
- //设置名称
- viewport.name = "viewport";
- container.name = "container";
- //设置USS类名
- AddToClassList("vertical-scroll-view");
- viewport.AddToClassList("vertical-scroll-view-viewport");
- container.AddToClassList("vertical-scroll-view-container");
-
- scroller.ClearClassList();
- scroller.AddToClassList("vertical-scroll-view-scroller");
-
- VisualElement dragger = scroller.dragger;
- dragger.ClearClassList();
- dragger.AddToClassList("vertical-scroll-view-dragger");
- //设置层级结构
- hierarchy.Add(viewport);
- hierarchy.Add(scroller);
- viewport.Add(container);
- //设置事件
- scroller.SlidingValueChanged += UpdateVisualElement;
- container.RegisterCallback(ContainerDown);
- container.RegisterCallback(ContainerDrag);
- container.RegisterCallback((evt) => ContainerRelease());
- container.RegisterCallback((evt) => ContainerRelease());
- container.RegisterCallback(ContainerWheel);
- container.generateVisualContent += ContainerGenerateVisualContent;
- }
- private void ContainerDown(PointerDownEvent evt) {
- isDragger = true;
- mousePosition = evt.position.y - SlidingValue * MaxPosition;
- }
- private void ContainerDrag(PointerMoveEvent evt) {
- if (!isDragger) { return; }
- float offset = evt.position.y - mousePosition;
- float value = offset / MaxPosition;
- UpdateVisualElement(value);
- mousePosition = evt.position.y - SlidingValue * MaxPosition;
- }
- private void ContainerRelease() {
- isDragger = false;
- float value = Mathf.Clamp01(SlidingValue);
- container.schedule.Execute(() => { UpdateVisualElement(value); }).StartingIn(1);
- }
- private void ContainerWheel(WheelEvent evt) {
- float wheel = Mathf.Clamp(evt.delta.y, -1, 1);
- float current = SlidingValue * MaxPosition;
- float offset = current - wheel * MouseWheelScrollSize;
- float value = offset / MaxPosition;
- UpdateVisualElement(value);
- ContainerRelease();
- }
- private void ContainerGenerateVisualContent(MeshGenerationContext mgc) {
- float ratio = Mathf.Clamp01(ViewportHeight / ContainerHeight);
- scroller.UpdateDragger(ratio);
- ContainerRelease();
- }
- }
-}
diff --git a/Packages/UIControl/Runtime/ScrollView/MUScrollViewVertical.cs.meta b/Packages/UIControl/Runtime/ScrollView/MUScrollViewVertical.cs.meta
deleted file mode 100644
index 42e280d..0000000
--- a/Packages/UIControl/Runtime/ScrollView/MUScrollViewVertical.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: e8d4926c5a75b394b843a5630d5005f7
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UIControl/Runtime/ScrollView/MUScrollerHorizontal.cs b/Packages/UIControl/Runtime/ScrollView/MUScrollerHorizontal.cs
deleted file mode 100644
index 8592cfe..0000000
--- a/Packages/UIControl/Runtime/ScrollView/MUScrollerHorizontal.cs
+++ /dev/null
@@ -1,105 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-using UnityEngine.UIElements;
-
-namespace MuHua {
- public class MUScrollerHorizontal : VisualElement {
- public new class UxmlFactory : UxmlFactory { }
- public new class UxmlTraits : VisualElement.UxmlTraits {
- private UxmlIntAttributeDescription MouseWheelScrollSize = new UxmlIntAttributeDescription {
- name = "mouse-wheel-scroll-size",
- defaultValue = 18
- };
- private UxmlFloatAttributeDescription SlidingValue = new UxmlFloatAttributeDescription {
- name = "sliding-value",
- defaultValue = 0
- };
- public override void Init(VisualElement ve, IUxmlAttributes bag, CreationContext cc) {
- base.Init(ve, bag, cc);
- MUScrollerHorizontal scroller = (MUScrollerHorizontal)ve;
- scroller.MouseWheelScrollSize = MouseWheelScrollSize.GetValueFromBag(bag, cc);
- scroller.SlidingValue = SlidingValue.GetValueFromBag(bag, cc);
- scroller.ElasticRestoration();
- }
- }
- public event Action SlidingValueChanged;
- public VisualElement dragger = new VisualElement();
-
- public float MouseWheelScrollSize { get; set; }
- public float SlidingValue { get; set; }
-
- internal bool isDragger;
- internal float mousePosition;
-
- internal float ViewportWidth { get => resolvedStyle.width; }
- internal float ContainerWidth { get => dragger.resolvedStyle.width; }
- internal float MaxPosition { get => ComputeMaxPosition(); }
- internal float ComputeMaxPosition() {
- float value = ViewportWidth - ContainerWidth;
- return value >= 0 ? value : -1;
- }
-
- internal void UpdateDragger(float ratio) {
- dragger.style.width = ratio * resolvedStyle.width;
- }
- internal void UpdateVisualElement(float value, bool callback = false) {
- SlidingValue = Mathf.Clamp(value, 0, 1);
- dragger.transform.position = new Vector3(MaxPosition * SlidingValue, 0);
- if (callback) { SlidingValueChanged?.Invoke(SlidingValue); }
- }
- internal void ElasticRestoration() {
- dragger.schedule.Execute(() => { UpdateVisualElement(SlidingValue); }).StartingIn(1);
- }
-
- public MUScrollerHorizontal() {
- //设置名称
- dragger.name = "dragger";
- //设置USS类名
- AddToClassList("horizontal-scroller");
- dragger.AddToClassList("horizontal-scroller-dragger");
- //设置层级结构
- hierarchy.Add(dragger);
- //设置事件
- dragger.RegisterCallback(DraggerDown);
- dragger.RegisterCallback(DraggerDrag);
- dragger.generateVisualContent += DraggerGenerateVisualContent;
-
- RegisterCallback(ScrollerDown);
- RegisterCallback(ScrollerWheel);
- RegisterCallback((evt) => ScrollerRelease());
- RegisterCallback((evt) => ScrollerRelease());
- }
- private void DraggerDown(PointerDownEvent evt) {
- isDragger = true;
- mousePosition = evt.position.x - SlidingValue * MaxPosition;
- }
- private void DraggerDrag(PointerMoveEvent evt) {
- if (!isDragger) { return; }
- float offset = evt.position.x - mousePosition;
- float value = offset / MaxPosition;
- UpdateVisualElement(value, true);
- mousePosition = evt.position.x - SlidingValue * MaxPosition;
- }
- private void DraggerGenerateVisualContent(MeshGenerationContext mgc) {
- ElasticRestoration();
- }
-
- private void ScrollerDown(PointerDownEvent evt) {
- float offset = evt.localPosition.x - dragger.resolvedStyle.width * 0.5f;
- float value = offset / MaxPosition;
- UpdateVisualElement(value, true);
- }
- private void ScrollerWheel(WheelEvent evt) {
- float wheel = Mathf.Clamp(evt.delta.y, -1, 1);
- float current = SlidingValue * MaxPosition;
- float offset = current + wheel * MouseWheelScrollSize;
- float value = offset / MaxPosition;
- UpdateVisualElement(value, true);
- }
- private void ScrollerRelease() {
- isDragger = false;
- }
- }
-}
diff --git a/Packages/UIControl/Runtime/ScrollView/MUScrollerHorizontal.cs.meta b/Packages/UIControl/Runtime/ScrollView/MUScrollerHorizontal.cs.meta
deleted file mode 100644
index 5152501..0000000
--- a/Packages/UIControl/Runtime/ScrollView/MUScrollerHorizontal.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: e9c31f78aa7665041a4858f2db3b5c07
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UIControl/Runtime/ScrollView/MUScrollerVertical.cs b/Packages/UIControl/Runtime/ScrollView/MUScrollerVertical.cs
deleted file mode 100644
index 3aa509c..0000000
--- a/Packages/UIControl/Runtime/ScrollView/MUScrollerVertical.cs
+++ /dev/null
@@ -1,105 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-using UnityEngine.UIElements;
-
-namespace MuHua {
- public class MUScrollerVertical : VisualElement {
- public new class UxmlFactory : UxmlFactory { }
- public new class UxmlTraits : VisualElement.UxmlTraits {
- private UxmlIntAttributeDescription MouseWheelScrollSize = new UxmlIntAttributeDescription {
- name = "mouse-wheel-scroll-size",
- defaultValue = 18
- };
- private UxmlFloatAttributeDescription SlidingValue = new UxmlFloatAttributeDescription {
- name = "sliding-value",
- defaultValue = 0
- };
- public override void Init(VisualElement ve, IUxmlAttributes bag, CreationContext cc) {
- base.Init(ve, bag, cc);
- MUScrollerVertical scroller = (MUScrollerVertical)ve;
- scroller.MouseWheelScrollSize = MouseWheelScrollSize.GetValueFromBag(bag, cc);
- scroller.SlidingValue = SlidingValue.GetValueFromBag(bag, cc);
- scroller.ElasticRestoration();
- }
- }
- public event Action SlidingValueChanged;
- public VisualElement dragger = new VisualElement();
-
- public float MouseWheelScrollSize { get; set; }
- public float SlidingValue { get; set; }
-
- internal bool isDragger;
- internal float mousePosition;
-
- internal float ViewportHeight { get => resolvedStyle.height; }
- internal float ContainerHeight { get => dragger.resolvedStyle.height; }
- internal float MaxPosition { get => ComputeMaxPosition(); }
- internal float ComputeMaxPosition() {
- float value = ViewportHeight - ContainerHeight;
- return value >= 0 ? value : -1;
- }
-
- internal void UpdateDragger(float ratio) {
- dragger.style.height = ratio * resolvedStyle.height;
- }
- internal void UpdateVisualElement(float value, bool callback = false) {
- SlidingValue = Mathf.Clamp(value, 0, 1);
- dragger.transform.position = new Vector3(0, MaxPosition * SlidingValue);
- if (callback) { SlidingValueChanged?.Invoke(SlidingValue); }
- }
- internal void ElasticRestoration() {
- dragger.schedule.Execute(() => { UpdateVisualElement(SlidingValue); }).StartingIn(1);
- }
-
- public MUScrollerVertical() {
- //设置名称
- dragger.name = "dragger";
- //设置USS类名
- AddToClassList("vertical-scroller");
- dragger.AddToClassList("vertical-scroller-dragger");
- //设置层级结构
- hierarchy.Add(dragger);
- //设置事件
- dragger.RegisterCallback(DraggerDown);
- dragger.RegisterCallback(DraggerDrag);
- dragger.generateVisualContent += DraggerGenerateVisualContent;
-
- RegisterCallback(ScrollerDown);
- RegisterCallback(ScrollerWheel);
- RegisterCallback((evt) => ScrollerRelease());
- RegisterCallback((evt) => ScrollerRelease());
- }
- private void DraggerDown(PointerDownEvent evt) {
- isDragger = true;
- mousePosition = evt.position.y - SlidingValue * MaxPosition;
- }
- private void DraggerDrag(PointerMoveEvent evt) {
- if (!isDragger) { return; }
- float offset = evt.position.y - mousePosition;
- float value = offset / MaxPosition;
- UpdateVisualElement(value, true);
- mousePosition = evt.position.y - SlidingValue * MaxPosition;
- }
- private void DraggerGenerateVisualContent(MeshGenerationContext mgc) {
- ElasticRestoration();
- }
-
- private void ScrollerDown(PointerDownEvent evt) {
- float offset = evt.localPosition.y - dragger.resolvedStyle.height * 0.5f;
- float value = offset / MaxPosition;
- UpdateVisualElement(value, true);
- }
- private void ScrollerWheel(WheelEvent evt) {
- float wheel = Mathf.Clamp(evt.delta.y, -1, 1);
- float current = SlidingValue * MaxPosition;
- float offset = current + wheel * MouseWheelScrollSize;
- float value = offset / MaxPosition;
- UpdateVisualElement(value, true);
- }
- private void ScrollerRelease() {
- isDragger = false;
- }
- }
-}
diff --git a/Packages/UIControl/Runtime/ScrollView/MUScrollerVertical.cs.meta b/Packages/UIControl/Runtime/ScrollView/MUScrollerVertical.cs.meta
deleted file mode 100644
index 0ebd562..0000000
--- a/Packages/UIControl/Runtime/ScrollView/MUScrollerVertical.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 170e690428c828a4bbfad60ded902e45
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UIControl/Runtime/UIViewModel.meta b/Packages/UIControl/Runtime/UIViewModel.meta
deleted file mode 100644
index df9103a..0000000
--- a/Packages/UIControl/Runtime/UIViewModel.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: af81a61bb7f5221428d4d976cff44866
-folderAsset: yes
-DefaultImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UIControl/Runtime/UIViewModel/UIViewExtend.cs b/Packages/UIControl/Runtime/UIViewModel/UIViewExtend.cs
deleted file mode 100644
index cd2fdd8..0000000
--- a/Packages/UIControl/Runtime/UIViewModel/UIViewExtend.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-using UnityEngine.UIElements;
-
-namespace MuHua {
- public class UIViewExtend : MonoBehaviour where ViewModel : UIViewModel {
- public ViewModel view;
- public virtual VisualElement element => view.Q();
-
- public T Q(string name = null, string className = null) where T : VisualElement {
- return element.Q(name, className);
- }
- }
-}
diff --git a/Packages/UIControl/Runtime/UIViewModel/UIViewExtend.cs.meta b/Packages/UIControl/Runtime/UIViewModel/UIViewExtend.cs.meta
deleted file mode 100644
index 03f44c9..0000000
--- a/Packages/UIControl/Runtime/UIViewModel/UIViewExtend.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: c3f91d8edeffb1143b3eb547a09cc321
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UIControl/Runtime/UIViewModel/UIViewModel.cs b/Packages/UIControl/Runtime/UIViewModel/UIViewModel.cs
deleted file mode 100644
index e237a79..0000000
--- a/Packages/UIControl/Runtime/UIViewModel/UIViewModel.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-using UnityEngine.UIElements;
-
-namespace MuHua {
- public class UIViewModel : MonoBehaviour {
- public UIDocument document;
- public VisualElement element => document.rootVisualElement;
-
- public T Q(string name = null, string className = null) where T : VisualElement {
- return element.Q(name, className);
- }
- }
-}
\ No newline at end of file
diff --git a/Packages/UIControl/Runtime/UIViewModel/UIViewModel.cs.meta b/Packages/UIControl/Runtime/UIViewModel/UIViewModel.cs.meta
deleted file mode 100644
index 0775081..0000000
--- a/Packages/UIControl/Runtime/UIViewModel/UIViewModel.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: f15a2fe11989e884d9294ac8577594a8
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UIControl/Runtime/UIViewModel/UIViewTemplate.cs b/Packages/UIControl/Runtime/UIViewModel/UIViewTemplate.cs
deleted file mode 100644
index 09096dd..0000000
--- a/Packages/UIControl/Runtime/UIViewModel/UIViewTemplate.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-using UnityEngine.UIElements;
-
-namespace MuHua {
- public class UIViewTemplate {
- public Data value;
- public VisualElement element;
- public virtual void SetValue(VisualTreeAsset asset, Data value) {
- this.value = value;
- this.element = asset.Instantiate();
- }
- }
-}
diff --git a/Packages/UIControl/Runtime/UIViewModel/UIViewTemplate.cs.meta b/Packages/UIControl/Runtime/UIViewModel/UIViewTemplate.cs.meta
deleted file mode 100644
index 5ee2408..0000000
--- a/Packages/UIControl/Runtime/UIViewModel/UIViewTemplate.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 1962450aff64953408148b16dd9ff69f
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UIControl/Runtime/UIViewModel/UIViewTool.cs b/Packages/UIControl/Runtime/UIViewModel/UIViewTool.cs
deleted file mode 100644
index 441b24f..0000000
--- a/Packages/UIControl/Runtime/UIViewModel/UIViewTool.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-using UnityEngine.UIElements;
-
-namespace MuHua {
- public static class UIViewTool {
- public static List Instantiate(this VisualElement parent, VisualTreeAsset template, V[] list) where Template : UIViewTemplate, new() {
- List templates = new List();
- for (int i = 0; i < list.Length; i++) {
- templates.Add(parent.Instantiate(template, list[i]));
- }
- return templates;
- }
- public static List Instantiate(this VisualElement parent, VisualTreeAsset template, List list) where Template : UIViewTemplate, new() {
- List templates = new List();
- for (int i = 0; i < list.Count; i++) {
- templates.Add(parent.Instantiate(template, list[i]));
- }
- return templates;
- }
- public static Template Instantiate(this VisualElement parent, VisualTreeAsset template, V value) where Template : UIViewTemplate, new() {
- Template temp = new Template();
- temp.SetValue(template, value);
- parent.Add(temp.element);
- return temp;
- }
- }
-}
diff --git a/Packages/UIControl/Runtime/UIViewModel/UIViewTool.cs.meta b/Packages/UIControl/Runtime/UIViewModel/UIViewTool.cs.meta
deleted file mode 100644
index 6830e6d..0000000
--- a/Packages/UIControl/Runtime/UIViewModel/UIViewTool.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: f47b238dc04f6f243b00dd9ab82419bd
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UIControl/package.json b/Packages/UIControl/package.json
deleted file mode 100644
index aa99bf8..0000000
--- a/Packages/UIControl/package.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "name": "com.muhua.uicontrol",
- "version": "0.0.3",
- "displayName": "MuHua UIControl",
- "description": "\u57fa\u4e8eUI Toolkit\u7684\u81ea\u5b9a\u4e49\u63a7\u4ef6",
- "author": {
- "name": "MuHua",
- "email": "2960208585@qq.com"
- },
- "type": "tool"
-}
\ No newline at end of file
diff --git a/Packages/UIControl/package.json.meta b/Packages/UIControl/package.json.meta
deleted file mode 100644
index 0da9815..0000000
--- a/Packages/UIControl/package.json.meta
+++ /dev/null
@@ -1,7 +0,0 @@
-fileFormatVersion: 2
-guid: 91f2ffdb42f95d74dab890cd2c0de2ff
-PackageManifestImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UITool/Runtime.meta b/Packages/UITool/Runtime.meta
deleted file mode 100644
index 99a1c3c..0000000
--- a/Packages/UITool/Runtime.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 687421b262e8f94438ea3821bca49d6b
-folderAsset: yes
-DefaultImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UITool/Runtime/ModuleCoreUI.meta b/Packages/UITool/Runtime/ModuleCoreUI.meta
deleted file mode 100644
index 53b065b..0000000
--- a/Packages/UITool/Runtime/ModuleCoreUI.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 0fec0c5043434164c8a5cb28f3886b1d
-folderAsset: yes
-DefaultImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UITool/Runtime/ModuleCoreUI/ModuleUIItem.cs b/Packages/UITool/Runtime/ModuleCoreUI/ModuleUIItem.cs
deleted file mode 100644
index 9bbda0e..0000000
--- a/Packages/UITool/Runtime/ModuleCoreUI/ModuleUIItem.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-using UnityEngine.UIElements;
-
-namespace MuHua {
- ///
- /// UI项
- ///
- public abstract class ModuleUIItem : ModuleUIPanel {
- /// 选择事件
- public static event Action OnSelect;
- /// 触发事件
- public static void Select(Data data) => OnSelect?.Invoke(data);
-
- /// 绑定的数据
- public readonly Data value;
- /// UI项
- public ModuleUIItem(Data value, VisualElement element) : base(element) {
- this.value = value;
- OnSelect += UIItem_OnSelect;
- }
-
- /// 侦听选择事件
- public virtual void UIItem_OnSelect(Data obj) {
- if (value.Equals(obj)) { SelectState(); } else { DefaultState(); }
- }
-
- /// 触发选择事件
- public virtual void Select() => OnSelect?.Invoke(value);
- /// 默认状态
- public virtual void DefaultState() { }
- /// 选中状态
- public virtual void SelectState() { }
- /// 释放
- public virtual void Release() => OnSelect -= UIItem_OnSelect;
- }
-}
\ No newline at end of file
diff --git a/Packages/UITool/Runtime/ModuleCoreUI/ModuleUIItem.cs.meta b/Packages/UITool/Runtime/ModuleCoreUI/ModuleUIItem.cs.meta
deleted file mode 100644
index c1135db..0000000
--- a/Packages/UITool/Runtime/ModuleCoreUI/ModuleUIItem.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: dfa6a8682a5ec384d98b88b54ace505f
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UITool/Runtime/ModuleCoreUI/ModuleUIItems.cs b/Packages/UITool/Runtime/ModuleCoreUI/ModuleUIItems.cs
deleted file mode 100644
index 395cb3e..0000000
--- a/Packages/UITool/Runtime/ModuleCoreUI/ModuleUIItems.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-using UnityEngine.UIElements;
-
-namespace MuHua {
- ///
- /// UI项容器
- ///
- public class ModuleUIItems : ModuleUIPanel where TItem : ModuleUIItem {
- public readonly VisualTreeAsset templateAsset;// 模板资源
- public readonly Func generate;// 生成UI项的函数
-
- public List uiItems = new List();// UI项列表
-
- public TItem this[int index] { get => uiItems[index]; }// 索引器
-
- /// UI容器
- public ModuleUIItems(VisualElement element, VisualTreeAsset templateAsset, Func generate) : base(element) {
- this.templateAsset = templateAsset;
- this.generate = generate;
- }
- /// 释放资源
- public void Release() {
- element.Clear();
- uiItems.ForEach(obj => obj.Release());
- uiItems = new List();
- }
- /// 创建UI项
- public void Create(List datas) {
- Release();
- datas.ForEach(Create);
- }
- /// 创建UI项
- public void Create(TData data) {
- VisualElement element = templateAsset.Instantiate();
- TItem item = generate(data, element);
- this.element.Add(item.element);
- uiItems.Add(item);
- }
- /// 遍历
- public void ForEach(Action action) {
- uiItems.ForEach(action);
- }
- }
-}
diff --git a/Packages/UITool/Runtime/ModuleCoreUI/ModuleUIItems.cs.meta b/Packages/UITool/Runtime/ModuleCoreUI/ModuleUIItems.cs.meta
deleted file mode 100644
index 4858966..0000000
--- a/Packages/UITool/Runtime/ModuleCoreUI/ModuleUIItems.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: b5854bcf80117aa49b327f2c19914ba3
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UITool/Runtime/ModuleCoreUI/ModuleUIPage.cs b/Packages/UITool/Runtime/ModuleCoreUI/ModuleUIPage.cs
deleted file mode 100644
index 1e84706..0000000
--- a/Packages/UITool/Runtime/ModuleCoreUI/ModuleUIPage.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-using UnityEngine.UIElements;
-
-namespace MuHua {
- ///
- /// 页面模块
- ///
- public abstract class ModuleUIPage : MonoBehaviour {
- /// 绑定文档
- public UIDocument document;
- /// 根目录文档
- public VisualElement root => document.rootVisualElement;
- /// 绑定文档
- public abstract VisualElement Element { get; }
- /// 添加UI元素
- public void Add(VisualElement child) => Element.Add(child);
- /// 查询UI元素
- public T Q(string name = null, string className = null) where T : VisualElement => Element.Q(name, className);
- }
-}
\ No newline at end of file
diff --git a/Packages/UITool/Runtime/ModuleCoreUI/ModuleUIPage.cs.meta b/Packages/UITool/Runtime/ModuleCoreUI/ModuleUIPage.cs.meta
deleted file mode 100644
index 9ec1474..0000000
--- a/Packages/UITool/Runtime/ModuleCoreUI/ModuleUIPage.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: a20e816476c4c5d4b83e112be2e08697
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UITool/Runtime/ModuleCoreUI/ModuleUIPanel.cs b/Packages/UITool/Runtime/ModuleCoreUI/ModuleUIPanel.cs
deleted file mode 100644
index a4e6e99..0000000
--- a/Packages/UITool/Runtime/ModuleCoreUI/ModuleUIPanel.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-using UnityEngine.UIElements;
-
-namespace MuHua {
- ///
- /// UI控件
- ///
- public class ModuleUIPanel {
- /// 绑定的元素
- public readonly VisualElement element;
- /// UI控件
- public ModuleUIPanel(VisualElement element) => this.element = element;
- /// 查询UI元素
- public T Q(string name = null, string className = null) where T : VisualElement => element.Q(name, className);
- }
-}
\ No newline at end of file
diff --git a/Packages/UITool/Runtime/ModuleCoreUI/ModuleUIPanel.cs.meta b/Packages/UITool/Runtime/ModuleCoreUI/ModuleUIPanel.cs.meta
deleted file mode 100644
index 4c0c2cf..0000000
--- a/Packages/UITool/Runtime/ModuleCoreUI/ModuleUIPanel.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 97e1bf60274de61419b2d9588340cafa
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UITool/Runtime/ModuleTools.meta b/Packages/UITool/Runtime/ModuleTools.meta
deleted file mode 100644
index f74d0a1..0000000
--- a/Packages/UITool/Runtime/ModuleTools.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 5c114499ba33d59478f35ca583231e02
-folderAsset: yes
-DefaultImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UITool/Runtime/ModuleTools/UIDirection.cs b/Packages/UITool/Runtime/ModuleTools/UIDirection.cs
deleted file mode 100644
index 54ce565..0000000
--- a/Packages/UITool/Runtime/ModuleTools/UIDirection.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-namespace MuHua {
- ///
- /// 方向
- ///
- public enum UIDirection {
- FromLeftToRight = 0,
- FromRightToLeft = 1,
- FromTopToBottom = 2,
- FromBottomToTop = 3,
-
- HorizontalAndVertical = 4,
- Horizontal = 5,
- Vertical = 6,
- }
-}
\ No newline at end of file
diff --git a/Packages/UITool/Runtime/ModuleTools/UIDirection.cs.meta b/Packages/UITool/Runtime/ModuleTools/UIDirection.cs.meta
deleted file mode 100644
index 1481ea1..0000000
--- a/Packages/UITool/Runtime/ModuleTools/UIDirection.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: c2b0340184fec6c45815d13d6a1f7321
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UITool/Runtime/ModuleTools/UITool.cs b/Packages/UITool/Runtime/ModuleTools/UITool.cs
deleted file mode 100644
index 017d180..0000000
--- a/Packages/UITool/Runtime/ModuleTools/UITool.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-#if ENABLE_INPUT_SYSTEM && UNITY_INPUT_SYSTEM_PACKAGE
-using UnityEngine.InputSystem;
-#endif
-
-namespace MuHua
-{
- ///
- /// UI工具
- ///
- public static class UITool
- {
- /// 获取鼠标位置
- public static Vector3 GetMousePosition()
- {
-#if ENABLE_INPUT_SYSTEM && UNITY_INPUT_SYSTEM_PACKAGE
- return Mouse.current.position.ReadValue();
-#else
- return Input.mousePosition;
-#endif
- }
- }
-}
\ No newline at end of file
diff --git a/Packages/UITool/Runtime/ModuleTools/UITool.cs.meta b/Packages/UITool/Runtime/ModuleTools/UITool.cs.meta
deleted file mode 100644
index e6d6841..0000000
--- a/Packages/UITool/Runtime/ModuleTools/UITool.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: ac8f1de11a0d473409df019e3d014d21
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UITool/Runtime/ModuleUIControl.meta b/Packages/UITool/Runtime/ModuleUIControl.meta
deleted file mode 100644
index bebc867..0000000
--- a/Packages/UITool/Runtime/ModuleUIControl.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 90a36026f648a6f45add234bc15d5548
-folderAsset: yes
-DefaultImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UITool/Runtime/ModuleUIControl/UICircularBar.cs b/Packages/UITool/Runtime/ModuleUIControl/UICircularBar.cs
deleted file mode 100644
index 6cfbb94..0000000
--- a/Packages/UITool/Runtime/ModuleUIControl/UICircularBar.cs
+++ /dev/null
@@ -1,71 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-using UnityEngine.Rendering;
-using UnityEngine.UIElements;
-
-public class CircularBar : VisualElement {
- public new class UxmlFactory : UxmlFactory { }
- public new class UxmlTraits : VisualElement.UxmlTraits {
- private readonly UxmlFloatAttributeDescription Fill = new() { name = "fill", defaultValue = 0.1f };
-
- public override void Init(VisualElement ve, IUxmlAttributes bag, CreationContext cc) {
- base.Init(ve, bag, cc);
- var circularBar = ve as CircularBar;
- circularBar.Fill = Fill.GetValueFromBag(bag, cc);
- circularBar.UpdateValue();
- }
- }
-
- public readonly Material material;
- public readonly RenderTexture rt;
-
- public VisualElement visual;
-
- public float Fill { get; set; }
-
- public CircularBar() {
- visual = new VisualElement();
- visual.style.flexGrow = 1;
- hierarchy.Add(visual);
-
- var shader = Shader.Find("MuHua/UI/CircularBar");
- if (shader == null) {
- Debug.LogError("Failed to find Shader Graphs/CircularBar.");
- return;
- }
- material = new Material(shader);
-
- rt = new RenderTexture(128, 128, 0, RenderTextureFormat.ARGBFloat);
-
- Background background = Background.FromRenderTexture(rt);
- visual.style.backgroundImage = new StyleBackground(background);
- }
-
- public void UpdateValue(float fill) {
- Fill = fill;
- UpdateValue();
- }
- public void UpdateValue() {
- if (material == null) { return; }
- Texture2D texture = resolvedStyle.backgroundImage.texture;
- if (texture == null) { return; }
-
- material.SetFloat("_fill", Fill);
-
- CommandBuffer command = CommandBufferPool.Get();
-
- // 设置渲染目标为tempRTHandle
- CoreUtils.SetRenderTarget(command, rt);
- // 清除纹理内容
- CoreUtils.ClearRenderTarget(command, ClearFlag.All, Color.clear);
- // 渲染
- command.Blit(texture, rt, material, 0);
-
- Graphics.ExecuteCommandBuffer(command);
- CommandBufferPool.Release(command);
-
- Background background = Background.FromRenderTexture(rt);
- visual.style.backgroundImage = new StyleBackground(background);
- }
-}
diff --git a/Packages/UITool/Runtime/ModuleUIControl/UICircularBar.cs.meta b/Packages/UITool/Runtime/ModuleUIControl/UICircularBar.cs.meta
deleted file mode 100644
index ecd3672..0000000
--- a/Packages/UITool/Runtime/ModuleUIControl/UICircularBar.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: dd9bb527169c05848b8946bc93645079
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UITool/Runtime/ModuleUIControl/UIFloatField.cs b/Packages/UITool/Runtime/ModuleUIControl/UIFloatField.cs
deleted file mode 100644
index 50ebf83..0000000
--- a/Packages/UITool/Runtime/ModuleUIControl/UIFloatField.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-using UnityEngine.UIElements;
-
-namespace MuHua {
- public class UIFloatField : FloatField {
- public new class UxmlFactory : UxmlFactory { }
- public new class UxmlTraits : FloatField.UxmlTraits { }
- public VisualElement inputElement;
- public VisualElement textElement;
- public UIFloatField() {
- ClearClassList();
- AddToClassList("input-field");
-
- labelElement.ClearClassList();
- labelElement.AddToClassList("unity-text-element");
- labelElement.AddToClassList("input-field-label");
-
- inputElement = this.Q("unity-text-input");
- inputElement.ClearClassList();
- inputElement.AddToClassList("input-field-box");
-
- textElement = inputElement.Q("");
- textElement.ClearClassList();
- textElement.AddToClassList("unity-text-element");
- textElement.AddToClassList("input-field-text");
- }
- }
-}
diff --git a/Packages/UITool/Runtime/ModuleUIControl/UIFloatField.cs.meta b/Packages/UITool/Runtime/ModuleUIControl/UIFloatField.cs.meta
deleted file mode 100644
index cc68417..0000000
--- a/Packages/UITool/Runtime/ModuleUIControl/UIFloatField.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 7046acdb2e5ef0c458969a4022ee9ab4
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UITool/Runtime/ModuleUIControl/UILongField.cs b/Packages/UITool/Runtime/ModuleUIControl/UILongField.cs
deleted file mode 100644
index c597562..0000000
--- a/Packages/UITool/Runtime/ModuleUIControl/UILongField.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-using UnityEngine.UIElements;
-
-namespace MuHua {
- public class UILongField : LongField {
- public new class UxmlFactory : UxmlFactory { }
- public new class UxmlTraits : LongField.UxmlTraits { }
- public UILongField() {
- ClearClassList();
- AddToClassList("input-field");
-
- labelElement.ClearClassList();
- labelElement.AddToClassList("unity-text-element");
- labelElement.AddToClassList("input-field-label");
-
- VisualElement inputElement = this.Q("unity-text-input");
- inputElement.ClearClassList();
- inputElement.AddToClassList("input-field-box");
-
- VisualElement textElement = inputElement.Q("");
- textElement.ClearClassList();
- textElement.AddToClassList("unity-text-element");
- textElement.AddToClassList("input-field-text");
- }
- }
-}
diff --git a/Packages/UITool/Runtime/ModuleUIControl/UILongField.cs.meta b/Packages/UITool/Runtime/ModuleUIControl/UILongField.cs.meta
deleted file mode 100644
index 94f0f33..0000000
--- a/Packages/UITool/Runtime/ModuleUIControl/UILongField.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 1d30b5caf969d9b4ab1464d329cf16ca
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UITool/Runtime/ModuleUIControl/UITextField.cs b/Packages/UITool/Runtime/ModuleUIControl/UITextField.cs
deleted file mode 100644
index 25885fc..0000000
--- a/Packages/UITool/Runtime/ModuleUIControl/UITextField.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-using UnityEngine.UIElements;
-
-namespace MuHua {
- public class UITextField : TextField {
- public new class UxmlFactory : UxmlFactory { }
- public new class UxmlTraits : TextField.UxmlTraits {
- public UxmlStringAttributeDescription DefaultPrompt = new UxmlStringAttributeDescription {
- name = "default-prompt"
- };
- public override void Init(VisualElement ve, IUxmlAttributes bag, CreationContext cc) {
- base.Init(ve, bag, cc);
- UITextField textField = (UITextField)ve;
- textField.DefaultPrompt = DefaultPrompt.GetValueFromBag(bag, cc);
- textField.SetDefaultPrompt();
- }
- }
- public string DefaultPrompt { get; set; }
-
- public VisualElement inputElement => this.Q("unity-text-input");
- public VisualElement textElement => inputElement.Q("");
-
- public UITextField() {
- ClearClassList();
- AddToClassList("input-field");
-
- labelElement.ClearClassList();
- labelElement.AddToClassList("unity-text-element");
- labelElement.AddToClassList("input-field-label");
-
- inputElement.ClearClassList();
- inputElement.AddToClassList("input-field-box");
-
- textElement.ClearClassList();
- textElement.AddToClassList("unity-text-element");
- textElement.AddToClassList("input-field-text");
-
- RegisterCallback((evt) => { PrepareInput(); });
- RegisterCallback((evt) => { SetDefaultPrompt(); });
- }
- public void PrepareInput() {
- textElement.RemoveFromClassList("input-field-text-d");
- if (text != DefaultPrompt) { return; }
- text = "";
- }
- public void SetDefaultPrompt() {
- textElement.RemoveFromClassList("input-field-text-d");
- if (value != "") { return; }
- text = DefaultPrompt;
- textElement.AddToClassList("input-field-text-d");
- }
- }
-}
\ No newline at end of file
diff --git a/Packages/UITool/Runtime/ModuleUIControl/UITextField.cs.meta b/Packages/UITool/Runtime/ModuleUIControl/UITextField.cs.meta
deleted file mode 100644
index 3ef4851..0000000
--- a/Packages/UITool/Runtime/ModuleUIControl/UITextField.cs.meta
+++ /dev/null
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 3bbf7cc5bf423304dbb4eac4f82b2bee
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UITool/Runtime/ModuleUIPanel.meta b/Packages/UITool/Runtime/ModuleUIPanel.meta
deleted file mode 100644
index 0c5bc68..0000000
--- a/Packages/UITool/Runtime/ModuleUIPanel.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: be53e2c2d10706340aa8ed31656a6473
-folderAsset: yes
-DefaultImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Packages/UITool/Runtime/ModuleUIPanel/UIDropdown.cs b/Packages/UITool/Runtime/ModuleUIPanel/UIDropdown.cs
deleted file mode 100644
index a817e20..0000000
--- a/Packages/UITool/Runtime/ModuleUIPanel/UIDropdown.cs
+++ /dev/null
@@ -1,124 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-using UnityEngine.UIElements;
-
-namespace MuHua {
- ///
- /// 下拉框
- ///
- public class UIDropdown : ModuleUIPanel {
- /// 绑定的画布
- internal readonly VisualElement canvas;
- /// 下拉框容器
- internal readonly VisualElement DropdownContainer;
- /// 下拉框滚动视图
- internal readonly VisualElement DropdownScrollView;
- /// 选项模板
- internal readonly VisualTreeAsset TemplateAsset;
- /// 值改变时
- public event Action ValueChanged;
-
- public T value;
- public List list = new List();
-
- internal UIScrollView scrollView;
- internal ModuleUIItems DropdownItems;
-
- /// 数据操作 list[index];
- /// 总数 list.Count;
-
- internal Label Tag => Q