10 Commits

Author SHA1 Message Date
MuHua-123 6891f43baa 完成UISlideButton测试用例 2026-07-15 14:55:53 +08:00
MuHua 4c5b91c530 更新 README.md 2026-05-25 14:51:47 +08:00
MuHua-123 6cc52ca4c8 1 2026-05-07 16:23:27 +08:00
MuHua-123 627165e519 1 2026-05-07 16:20:37 +08:00
MuHua-123 ef918588f5 修改滚动视图逻辑 2026-05-07 16:17:30 +08:00
MuHua-123 7c6acc5fa2 1 2026-03-26 11:03:31 +08:00
MuHua-123 64938f1137 1 2025-11-12 10:19:42 +08:00
MuHua-123 28c121f6d9 Update UIWindow.cs 2025-11-10 16:32:21 +08:00
MuHua-123 089651f7ab Update UIWindow.cs 2025-11-01 15:32:48 +08:00
MuHua-123 21959b46e1 Update UIWindow.cs 2025-11-01 15:31:11 +08:00
58 changed files with 1501 additions and 50 deletions
@@ -9,25 +9,7 @@ using MuHua;
/// </summary>
public class InputMenu : InputControl {
private UIMenuPanel menu;
private void Start() {
ShortcutMenu.I.Add("测试1/测试11", () => { Debug.Log("测试1/测试11"); });
ShortcutMenu.I.Add("测试1/测试12", () => { Debug.Log("测试1/测试12"); });
ShortcutMenu.I.Add("删除测试5", () => {
ShortcutMenu.I.Remove("测试5");
});
ShortcutMenu.I.Add("删除测试51", () => {
ShortcutMenu.I.Remove("测试5/测试51");
});
ShortcutMenu.I.Add("删除测试52", () => {
ShortcutMenu.I.Remove("测试5/测试52");
});
ShortcutMenu.I.Add("测试5/测试51", () => { Debug.Log("测试51"); });
ShortcutMenu.I.Add("测试5/测试52", () => { Debug.Log("测试52"); });
}
// private UIMenuPanel menu;
protected override void ModuleInput_OnInputMode(InputMode mode) {
// throw new System.NotImplementedException();
@@ -37,11 +19,16 @@ public class InputMenu : InputControl {
/// <summary> 鼠标左键 </summary>
public void OnMouseLeft(InputValue inputValue) {
if (inputValue.isPressed) return;
ShortcutMenu.I.Close();
// UIShortcutMenu.I.Close();
}
/// <summary> 鼠标右键 </summary>
public void OnMouseRight(InputValue inputValue) {
ShortcutMenu.I.Open();
// UIShortcutMenu.I.Add("测试1/测试11", () => { Debug.Log("测试1/测试11"); });
// UIShortcutMenu.I.Add("测试1/测试12", () => { Debug.Log("测试1/测试12"); });
// UIShortcutMenu.I.Add("测试2", () => { Debug.Log("测试2"); });
// UIShortcutMenu.I.Open();
}
#endregion
}
+1 -1
View File
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: d73f0702f68e73243ab4c6940caafa59
guid: c22eaed15bf06ed44ac6ed66f7a6487c
folderAsset: yes
DefaultImporter:
externalObjects: {}
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: df40a9389111de24a8e95adccd3cb8d3
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 398 B

@@ -0,0 +1,140 @@
fileFormatVersion: 2
guid: 556aa0a60c7c1b947a80bd5f89e13850
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
@@ -12,7 +12,7 @@ public class ShortcutMenu : Module<ShortcutMenu> {
public List<ShortcutMenuItem> menuItems = new List<ShortcutMenuItem>();
/// <summary> 打开菜单 </summary>
public void Open() => UIShortcutMenu.I?.Open();
public void Open() => UIShortcutMenu.I?.Open(UIShortcutMenu.I.MousePosition, menuItems);
/// <summary> 关闭菜单 </summary>
public void Close() => UIShortcutMenu.I?.Close();
@@ -4,7 +4,7 @@ using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 快捷菜单项目
/// 菜单项目
/// </summary>
public class ShortcutMenuItem {
/// <summary> 名称 </summary>
@@ -17,6 +17,8 @@ public class UIShortcutMenu : ModuleUISingle<UIShortcutMenu> {
/// <summary> 控件列表 </summary>
public static List<UIControl> controls = new List<UIControl>();
public Vector3 MousePosition => UITool.GetMousePosition(Element);
public override VisualElement Element => root.Q<VisualElement>("ShortcutMenu");
protected override void Awake() => NoReplace(false);
@@ -26,11 +28,10 @@ public class UIShortcutMenu : ModuleUISingle<UIShortcutMenu> {
private void OnDestroy() => controls.ForEach(control => control.Dispose());
/// <summary> 打开菜单 </summary>
public void Open() {
public void Open(Vector3 position, List<ShortcutMenuItem> datas) {
Close();
Vector3 position = UITool.GetMousePosition(Element);
UIMenuPanel menuPanel = Create();
menuPanel.Settings(position, ShortcutMenu.I.menuItems);
menuPanel.Settings(position, datas);
}
/// <summary> 关闭菜单 </summary>
public void Close() {
@@ -3,7 +3,10 @@ guid: 422a458e7229d6b4a8fff66af1840238
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
defaultReferences:
- document: {instanceID: 0}
- MenuPanel: {fileID: 9197481963319205126, guid: 5034a86c1b336b644968fdb3be5f851a, type: 3}
- MenuTemplate: {fileID: 9197481963319205126, guid: 1ee167986f6e9a840a45450b4b6adfc2, type: 3}
executionOrder: 0
icon: {instanceID: 0}
userData:
@@ -4,6 +4,7 @@
flex-grow: 0;
width: 100%;
height: 25px;
align-items: center;
}
.menu-unit:hover {
@@ -16,10 +17,10 @@
.menu-arrow {
flex-grow: 0;
height: 25px;
height: 20px;
width: 25px;
background-image: url("project://database/Assets/UI%20Toolkit/UnityThemes/UnityDefaultRuntimeTheme.tss?fileID=-1087164816274819069&guid=05f864e67ee1ecb4bbe67427564d394c&type=3#arrow-right@2x");
-unity-background-image-tint-color: rgb(51, 51, 51);
background-image: url("project://database/Assets/ModuleCore/ModuleUISMenu/Assets/%E7%AE%AD%E5%A4%B4.png?fileID=2800000&guid=556aa0a60c7c1b947a80bd5f89e13850&type=3#箭头");
-unity-background-image-tint-color: rgb(51, 50, 50);
}
.menu-arrow-hide {
@@ -0,0 +1,48 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;
using MuHua;
public class UISlideButtonTest : MonoBehaviour {
/// <summary> 绑定文档 </summary>
public UIDocument document;
/// <summary> 模板 </summary>
public VisualTreeAsset templateAsset;
private UISlideButton<UIData, Data> slideButton;
/// <summary> 根目录文档 </summary>
public VisualElement Root => document.rootVisualElement;
public VisualElement SlideButton => Root.Q<VisualElement>("SlideButton");
public void Awake() {
slideButton = new UISlideButton<UIData, Data>(SlideButton, Root, templateAsset,
(data, element) => new UIData(data, element));
List<Data> datas = new List<Data>();
datas.Add(new Data { name = "匹配" });
datas.Add(new Data { name = "配置" });
datas.Add(new Data { name = "招募" });
slideButton.Create(datas);
}
public void Update() {
slideButton.Update();
}
public class Data : DataSlideButton {
public string name;
}
public class UIData : ModuleUIItem<Data> {
public Button Button => Q<Button>("Button");
public UIData(Data value, VisualElement element) : base(value, element) {
value.element = element;
Button.text = value.name;
Button.clicked += Select;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 28e0d9425b52b0d4191cead2eeaf25be
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 06f31db1c09e8a0409a8b3b960a13216
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,48 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;
using MuHua;
/// <summary>
/// SliderInputH - Panel
/// </summary>
public class UISliderInputH : ModuleUIPanel {
public float value;
public Vector2 range = new Vector2(1, 1);
public UISliderH slider;
public event Action<float> ValueChanged;
public VisualElement Slider => Q<VisualElement>("Slider");
public UIFloatField FloatField => Q<UIFloatField>("UIFloatField");
public UISliderInputH(VisualElement element, VisualElement canvas) : base(element) {
slider = new UISliderH(element, canvas);
slider.ValueChanged += Slider_ValueChanged;
FloatField.RegisterCallback<ChangeEvent<float>>(FloatField_ValueChanged);
}
private void Slider_ValueChanged(float obj) {
value = Mathf.Lerp(range.x, range.y, obj);
FloatField.SetValueWithoutNotify(value);
ValueChanged?.Invoke(value);
}
private void FloatField_ValueChanged(ChangeEvent<float> obj) {
value = Mathf.Clamp(obj.newValue, range.x, range.y);
float scale = Mathf.InverseLerp(range.x, range.y, value);
slider.UpdateValue(scale, false);
ValueChanged?.Invoke(value);
}
public void Update() {
slider.Update();
}
/// <summary> 更新值 </summary>
public void UpdateValue(float value) {
this.value = Mathf.Clamp(range.x, range.y, value);
float scale = Mathf.InverseLerp(range.x, range.y, value);
slider.UpdateValue(scale, false);
FloatField.SetValueWithoutNotify(value);
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d5f8ad3cc3aff1940bdf68f3d911a263
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,64 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;
using MuHua;
/// <summary>
/// Vector2 - Panel
/// </summary>
public class UIVector2 : ModuleUIPanel {
public bool isLock;
public Vector2 value;
public UISliderInputH sliderX;
public UISliderInputH sliderY;
public event Action<Vector2, bool> ValueChanged;
public Button Lock => Q<Button>("Lock");
public VisualElement SliderX => Q<VisualElement>("SliderInputX");
public VisualElement SliderY => Q<VisualElement>("SliderInputY");
public UIVector2(VisualElement element, VisualElement canvas) : base(element) {
sliderX = new UISliderInputH(SliderX, canvas);
sliderY = new UISliderInputH(SliderY, canvas);
Lock.clicked += Lock_clicked;
sliderX.ValueChanged += SliderX_ValueChanged;
sliderY.ValueChanged += SliderY_ValueChanged;
}
private void Lock_clicked() {
isLock = !isLock;
Lock.EnableInClassList("dashboard-button-s", isLock);
if (isLock) { value.y = value.x; sliderY.UpdateValue(value.x); }
ValueChanged?.Invoke(value, isLock);
}
private void SliderX_ValueChanged(float obj) {
value.x = obj;
if (isLock) { value.y = obj; sliderY.UpdateValue(obj); }
ValueChanged?.Invoke(value, isLock);
}
private void SliderY_ValueChanged(float obj) {
value.y = obj;
if (isLock) { value.x = obj; sliderX.UpdateValue(obj); }
ValueChanged?.Invoke(value, isLock);
}
public void Update() {
sliderX.Update();
sliderY.Update();
}
/// <summary> 更新值 </summary>
public void UpdateValue(Vector2 value, bool isLock) {
this.value = value;
this.isLock = isLock;
sliderX.UpdateValue(value.x);
sliderY.UpdateValue(value.y);
Lock.EnableInClassList("dashboard-button-s", isLock);
}
/// <summary> 设置范围 </summary>
public void Settings(Vector2 range) {
sliderX.range = range;
sliderY.range = range;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c0898288ac15d9a4e9a82e0d6d36ff17
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,63 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;
using MuHua;
/// <summary>
/// Vector3 - Panel
/// </summary>
public class UIVector3 : ModuleUIPanel {
public Vector3 value;
public UISliderInputH sliderX;
public UISliderInputH sliderY;
public UISliderInputH sliderZ;
public event Action<Vector3> ValueChanged;
public VisualElement SliderInputX => Q<VisualElement>("SliderInputX");
public VisualElement SliderInputY => Q<VisualElement>("SliderInputY");
public VisualElement SliderInputZ => Q<VisualElement>("SliderInputZ");
public UIVector3(VisualElement element, VisualElement canvas) : base(element) {
sliderX = new UISliderInputH(SliderInputX, canvas);
sliderY = new UISliderInputH(SliderInputY, canvas);
sliderZ = new UISliderInputH(SliderInputZ, canvas);
sliderX.ValueChanged += SliderX_ValueChanged;
sliderY.ValueChanged += SliderY_ValueChanged;
sliderZ.ValueChanged += SliderZ_ValueChanged;
}
private void SliderX_ValueChanged(float obj) {
value.x = obj;
ValueChanged?.Invoke(value);
}
private void SliderY_ValueChanged(float obj) {
value.y = obj;
ValueChanged?.Invoke(value);
}
private void SliderZ_ValueChanged(float obj) {
value.z = obj;
ValueChanged?.Invoke(value);
}
public void Update() {
sliderX.Update();
sliderY.Update();
sliderZ.Update();
}
/// <summary> 更新值 </summary>
public void UpdateValue(Vector3 value) {
this.value = value;
sliderX.UpdateValue(value.x);
sliderY.UpdateValue(value.y);
sliderZ.UpdateValue(value.z);
}
/// <summary> 设置范围 </summary>
public void Settings(Vector2 range) {
sliderX.range = range;
sliderY.range = range;
sliderZ.range = range;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 36d613e41a27e8f40be6e6c05de1aeb1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,113 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;
using UnityEngine.Video;
using MuHua;
/// <summary>
/// 视频播放控件
/// </summary>
public class UIVideoPlayPanel : ModuleUIPanel {
private float showTime;
private bool isDownSlider;
private Action fullAction;
private RenderTexture renderTexture;
private VideoPlayer videoPlayer;
private UISliderH slider;
private VisualElement VideoView => element.Q<VisualElement>("VideoView");
private VisualElement VideoController => element.Q<VisualElement>("VideoController");
private VisualElement Slider => element.Q<VisualElement>("Slider");
private Label Time => element.Q<Label>("Time");
private Button Play => element.Q<Button>("Play");
private Button Pause => element.Q<Button>("Pause");
private Button FullScreen => element.Q<Button>("FullScreen");
public UIVideoPlayPanel(VisualElement element, VisualElement canvas, VideoPlayer videoPlayer, Action fullAction = null) : base(element) {
this.videoPlayer = videoPlayer;
this.fullAction = fullAction;
int width = (int)element.parent.resolvedStyle.width;
int height = (int)element.parent.resolvedStyle.height;
renderTexture = new RenderTexture(width, height, 0);
Background background = Background.FromRenderTexture(renderTexture);
VideoView.style.backgroundImage = new StyleBackground(background);
Play.clicked += Play_clicked;
Pause.clicked += Pause_clicked;
FullScreen.clicked += FullScreen_clicked;
VideoView.RegisterCallback<PointerDownEvent>((evt) => showTime = 5);
VideoController.RegisterCallback<PointerDownEvent>((evt) => showTime = 5);
Slider.RegisterCallback<PointerDownEvent>((evt) => isDownSlider = true);
Slider.RegisterCallback<PointerUpEvent>((evt) => isDownSlider = false);
Slider.RegisterCallback<PointerLeaveEvent>((evt) => isDownSlider = false);
slider = new UISliderH(element, canvas);
slider.ValueChanged += Slider_SlidingValueChanged;
}
/// <summary> 启用 </summary>
public void Enable(string url) {
videoPlayer.url = url; Enable();
}
/// <summary> 启用 </summary>
public void Enable() {
UpdateRenderTexture();
videoPlayer.targetTexture = renderTexture;
if (videoPlayer.isPlaying) { Play_clicked(); }
else { Pause_clicked(); }
}
/// <summary> 更新 </summary>
public void Update() {
if (videoPlayer == null) { return; }
showTime -= UnityEngine.Time.deltaTime;
Visibility visibility = showTime > 0 ? Visibility.Visible : Visibility.Hidden;
VideoController.style.visibility = visibility;
//进度条
float value = (float)videoPlayer.frame / (float)videoPlayer.frameCount;
if (!isDownSlider) { slider.UpdateValue(value, false); }
//播放时间
string clockTime = TimeSpan.FromSeconds(videoPlayer.clockTime).ToString(@"mm\:ss");
string length = TimeSpan.FromSeconds(videoPlayer.length).ToString(@"mm\:ss");
Time.text = clockTime + "/" + length;
}
/// <summary> 播放 </summary>
public void Play_clicked() {
if (videoPlayer == null) { return; }
videoPlayer.Play(); showTime = 5;
Play.style.display = DisplayStyle.None;
Pause.style.display = DisplayStyle.Flex;
}
/// <summary> 暂停 </summary>
public void Pause_clicked() {
if (videoPlayer == null) { return; }
videoPlayer.Pause();
Play.style.display = DisplayStyle.Flex;
Pause.style.display = DisplayStyle.None;
}
/// <summary> 更新渲染纹理 </summary>
private void UpdateRenderTexture() {
int width = (int)element.parent.resolvedStyle.width;
int height = (int)element.parent.resolvedStyle.height;
if (renderTexture.width == width && renderTexture.height == height) { return; }
renderTexture.Release();
renderTexture = new RenderTexture(width, height, 0);
Background background = Background.FromRenderTexture(renderTexture);
VideoView.style.backgroundImage = new StyleBackground(background);
}
/// <summary> 全屏 </summary>
private void FullScreen_clicked() {
fullAction?.Invoke();
}
/// <summary> 进度条更新 </summary>
private void Slider_SlidingValueChanged(float obj) {
if (videoPlayer == null) { return; }
videoPlayer.frame = (long)obj;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 00c04ca4ef821d0469a77408648f5ff2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1a20e449063139b4ea0d19bd0677c7d1
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5003b2a36519747449a4b6e4d7e5f56e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,25 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;
using MuHua;
/// <summary>
/// 消息页面1
/// </summary>
public class UIMessage1 : ModuleUIPanel {
public Label Content => Q<Label>("Content");
public UIMessage1(VisualElement element) : base(element) { }
/// <summary>
/// 设置消息内容
/// </summary>
/// <param name="active"></param>
/// <param name="value"></param>
public void Settings(bool active, string value = "") {
element.EnableInClassList("document-page-hide", !active);
Content.text = value;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c0d9cdd61f07fb14a93de29e68c71787
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,31 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;
using MuHua;
/// <summary>
/// 消息页面2
/// </summary>
public class UIMessage2 : ModuleUIPanel {
private Action callback;
public Label Content => Q<Label>("Content");
public Button Button => Q<Button>("Button");
public UIMessage2(VisualElement element) : base(element) {
Button.clicked += () => { callback?.Invoke(); Settings(false); };
}
public void Settings(bool active) {
element.EnableInClassList("document-page-hide", !active);
callback = null;
}
public void Settings(bool active, string value = "", Action callback = null) {
element.EnableInClassList("document-page-hide", !active);
Content.text = value;
this.callback = callback;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d21953f5fb6c41e40b2df711d80a42b3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,31 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;
using MuHua;
/// <summary>
/// 消息页面3
/// </summary>
public class UIMessage3 : ModuleUIPanel {
private Action callback1;
private Action callback2;
public Label Content => Q<Label>("Content");
public Button Button1 => Q<Button>("Button1");
public Button Button2 => Q<Button>("Button2");
public UIMessage3(VisualElement element) : base(element) {
Button1.clicked += () => { callback1?.Invoke(); Settings(false); };
Button2.clicked += () => { callback2?.Invoke(); Settings(false); };
}
public void Settings(bool active, string value = "", Action callback1 = null, Action callback2 = null) {
element.EnableInClassList("document-page-hide", !active);
Content.text = value;
this.callback1 = callback1;
this.callback2 = callback2;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 496a1fe1e90187b45b931ec732c0bde6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class UIBannerTip : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7279e9c7234eb6645b7b1e172b70919d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,132 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;
using MuHua;
/// <summary>
/// 指针提示
/// </summary>
public class UIGuidance : ModuleUIPanel {
private bool isDown;
private Action callback;
private Action<bool> ValueChanged;
private Vector2 offset;
private Vector3 originalPosition;
private Vector3 pointerPosition;
private VisualElement target;
private UIToggle toggle;
public Label Prompt => Q<Label>("Prompt");
public VisualElement Toggle => Q<VisualElement>("Toggle");
public VisualElement Button => Q<VisualElement>("Button");
public VisualElement Pointer => Q<VisualElement>("Pointer");
public UIGuidance(VisualElement element) : base(element) {
toggle = new UIToggle(Toggle);
toggle.ValueChanged += (value) => { ValueChanged?.Invoke(value); };
Button.RegisterCallback<ClickEvent>(ClickEvent);
element.RegisterCallback<MouseDownEvent>(MouseDownEvent);
element.RegisterCallback<MouseUpEvent>(MouseUpEvent);
}
public void Update() {
#if UNITY_EDITOR
if (target == null) { return; }
if (isDown) {
Vector3 mousePosition = UITool.GetMousePosition();
Vector3 differ = new Vector3(mousePosition.x, Screen.height - mousePosition.y) - pointerPosition;
Pointer.transform.position = originalPosition + differ;
}
else {
Pointer.transform.position = target.worldBound.position + offset;
}
#else
if (target == null) { return; }
Pointer.transform.position = target.worldBound.position + offset;
#endif
}
private void ClickEvent(ClickEvent evt) {
element.EnableInClassList("document-page-hide", true);
callback?.Invoke();
}
private void MouseDownEvent(MouseDownEvent evt) {
#if UNITY_EDITOR
isDown = true;
originalPosition = Pointer.transform.position;
Vector3 mousePosition = UITool.GetMousePosition();
pointerPosition = new Vector3(mousePosition.x, Screen.height - mousePosition.y);
#endif
}
private void MouseUpEvent(MouseUpEvent evt) {
isDown = false;
float x = Pointer.transform.position.x - target.worldBound.position.x;
float y = Pointer.transform.position.y - target.worldBound.position.y;
Vector3 offset = new Vector3(x, y);
Debug.Log(offset);
}
/// <summary> 打开提示 </summary>
public void Settings(string content, VisualElement target, Vector2 offset, Action callback) {
this.target = target;
this.offset = offset;
this.callback = callback;
Prompt.text = content;
element.EnableInClassList("document-page-hide", false);
}
/// <summary> 设置提示 </summary>
public void Settings(bool value, Action<bool> ValueChanged) {
this.ValueChanged = ValueChanged;
toggle.UpdateValue(value, false);
}
}
/// <summary>
/// 图案页指引
/// </summary>
public class UIPatternPageGuidance : ModuleUIPanel {
private bool isNot;
public VisualElement Top => Q<VisualElement>("Top");
public Button Button1 => Top.Q<Button>("Button1");// 创建图案
public Button Button4 => Top.Q<Button>("Button4");// 创建元素
public VisualElement Dashboard => Q<VisualElement>("Dashboard");
public VisualElement PatternLibrary => Q<VisualElement>("PatternLibrary");
public VisualElement TemplateLibrary => Q<VisualElement>("TemplateLibrary");
public UIPatternPageGuidance(VisualElement element) : base(element) { }
public void Guidance1() {
if (isNot) { return; }
string content = "第一步 点击【创建图案】按钮,即可新建一个空白画板,开始您的设计。";
Guidance(content, Button1, new Vector2(140, -55), Guidance2);
}
public void Guidance2() {
string content = "第二步 提供两种创作方式 \n1,选用模板:点击【图案模板】,选择模板后参考其结构与配色,进行纹样重构与创新设计。";
Guidance(content, TemplateLibrary, new Vector2(310, 0), Guidance3);
}
public void Guidance3() {
string content = "2,全新创作:点击【创建元素】创建空白图案框,自行选择【图案元素库】内的图案素材进行创新设计。";
Guidance(content, Button4, new Vector2(-530, -65), Guidance4);
}
public void Guidance4() {
string content = "导入个人素材:点击【自定义】-【导入素材】,导入后请点击【自定义】刷新以更新显示。";
Guidance(content, PatternLibrary, new Vector2(310, 0), Guidance5);
}
public void Guidance5() {
string content = "图案编辑功能:选中图案元素,可调整其颜色、位置、大小、镜像、连续排列等操作。\n画布设置:如设计透明背景的图案,可根据图案色彩风格自定义画板颜色,便于更直观地进行设计。";
Guidance(content, Dashboard, new Vector2(-530, 0), null);
}
public void Guidance(string content, VisualElement visual, Vector3 offset, Action action) {
// UIGuidance guidance = ModuleUI.I.popupManager.guidance;
// guidance.Settings(content, visual, offset, action);
// guidance.Settings(isNot, (value) => { isNot = value; });
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8df138b434ab51f40b134f831376120e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,31 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;
using MuHua;
/// <summary>
/// 加载页面
/// </summary>
public class UILoading : ModuleUIPanel {
public UISliderH slider;
public VisualElement Slider => Q<VisualElement>("Slider");
public UILoading(VisualElement element, VisualElement canvas) : base(element) {
slider = new UISliderH(Slider, canvas);
}
/// <summary>
/// 设置加载进度
/// </summary>
/// <param name="active"></param>
/// <param name="value1"></param>
/// <param name="value2"></param>
public void Settings(bool active, float value1, string value2) {
element.EnableInClassList("document-page-hide", !active);
slider.UpdateValue(value1);
slider.Title.text = value2;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 637e7bc032a4bee4aa936fb481495299
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,31 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;
using MuHua;
/// <summary>
/// UI加载管理器
/// </summary>
public class UILoadManager : ModuleUIPage {
// public UIProgres progres;
public override VisualElement Element => root.Q<VisualElement>("Popup");
public VisualElement PopupDialog => Q<VisualElement>("PopupDialog");
private void Awake() {
// progres = new UIProgres(PopupDialog);
}
private void OnDestroy() {
// config.Release();
// configMaterial.Release();
// equipmentSelection.Release();
// paramrInput.Release();
}
private void Update() {
// config.Update();
// configMaterial.Update();
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2da9aad7a772f434080f14bd479de19c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,17 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;
using MuHua;
/// <summary>
/// UI弹出管理器
/// </summary>
public class UIPopupManager : ModuleUISingle<UIPopupManager> {
public override VisualElement Element => root.Q<VisualElement>("Popup");
public VisualElement PopupDialog => Q<VisualElement>("PopupDialog");
protected override void Awake() => NoReplace(false);
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 58ce28d05656cfd498fc2555599e349c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -186,7 +186,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_PanelSettings: {fileID: 11400000, guid: 782028a3ae72af7429ad2ecdce684390, type: 2}
m_ParentUI: {fileID: 0}
sourceAsset: {fileID: 9197481963319205126, guid: 42fc25f5fff9d234ea4e7a8b6d1961a8, type: 3}
sourceAsset: {fileID: 9197481963319205126, guid: dbd43929292199240bd6ff61200e2afb, type: 3}
m_SortingOrder: 0
--- !u!4 &670296964
Transform:
@@ -652,7 +652,7 @@ GameObject:
- component: {fileID: 1922845063}
- component: {fileID: 1922845064}
m_Layer: 5
m_Name: UIShortcutMenu
m_Name: UIMenuManager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@@ -686,8 +686,8 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
document: {fileID: 670296963}
menuTreeAsset: {fileID: 9197481963319205126, guid: 5034a86c1b336b644968fdb3be5f851a, type: 3}
itemTreeAsset: {fileID: 9197481963319205126, guid: 1ee167986f6e9a840a45450b4b6adfc2, type: 3}
MenuPanel: {fileID: 0}
MenuTemplate: {fileID: 0}
--- !u!1 &1937258154
GameObject:
m_ObjectHideFlags: 0
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2153906b297ef8a40aa156d05bb3ec5f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,404 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 9
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 12
m_GIWorkflowMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 0
m_LightmapEditorSettings:
serializedVersion: 12
m_Resolution: 2
m_BakeResolution: 40
m_AtlasSize: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_ExtractAmbientOcclusion: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 1
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 512
m_PVRBounces: 2
m_PVREnvironmentSampleCount: 256
m_PVREnvironmentReferencePointCount: 2048
m_PVRFilteringMode: 1
m_PVRDenoiserTypeDirect: 1
m_PVRDenoiserTypeIndirect: 1
m_PVRDenoiserTypeAO: 1
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVREnvironmentMIS: 1
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 0}
m_LightingSettings: {fileID: 0}
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 3
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
buildHeightMesh: 0
maxJobWorkers: 0
preserveTilesOutsideBounds: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &875921851
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 875921853}
- component: {fileID: 875921852}
- component: {fileID: 875921854}
m_Layer: 5
m_Name: UIDocument
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &875921852
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 875921851}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 19102, guid: 0000000000000000e000000000000000, type: 0}
m_Name:
m_EditorClassIdentifier:
m_PanelSettings: {fileID: 11400000, guid: 782028a3ae72af7429ad2ecdce684390, type: 2}
m_ParentUI: {fileID: 0}
sourceAsset: {fileID: 9197481963319205126, guid: 4e89ef667016a0a43a573b48cb9521ef, type: 3}
m_SortingOrder: 0
--- !u!4 &875921853
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 875921851}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &875921854
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 875921851}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 28e0d9425b52b0d4191cead2eeaf25be, type: 3}
m_Name:
m_EditorClassIdentifier:
document: {fileID: 875921852}
templateAsset: {fileID: 9197481963319205126, guid: 90b68087028f53345aa820b038f0bc8a, type: 3}
--- !u!1 &905563754
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 905563756}
- component: {fileID: 905563755}
- component: {fileID: 905563757}
m_Layer: 0
m_Name: Directional Light
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!108 &905563755
Light:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 905563754}
m_Enabled: 1
serializedVersion: 10
m_Type: 1
m_Shape: 0
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
m_Intensity: 1
m_Range: 10
m_SpotAngle: 30
m_InnerSpotAngle: 21.80208
m_CookieSize: 10
m_Shadows:
m_Type: 2
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 1
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
m_CullingMatrixOverride:
e00: 1
e01: 0
e02: 0
e03: 0
e10: 0
e11: 1
e12: 0
e13: 0
e20: 0
e21: 0
e22: 1
e23: 0
e30: 0
e31: 0
e32: 0
e33: 1
m_UseCullingMatrixOverride: 0
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingLayerMask: 1
m_Lightmapping: 4
m_LightShadowCasterMode: 0
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
m_UseBoundingSphereOverride: 0
m_UseViewFrustumForShadowCasterCull: 1
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!4 &905563756
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 905563754}
serializedVersion: 2
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
m_LocalPosition: {x: 0, y: 3, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!114 &905563757
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 905563754}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 474bcb49853aa07438625e644c072ee6, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Version: 3
m_UsePipelineSettings: 1
m_AdditionalLightsShadowResolutionTier: 2
m_LightLayerMask: 1
m_RenderingLayers: 1
m_CustomShadowLayers: 0
m_ShadowLayerMask: 1
m_ShadowRenderingLayers: 1
m_LightCookieSize: {x: 1, y: 1}
m_LightCookieOffset: {x: 0, y: 0}
m_SoftShadowQuality: 0
--- !u!1 &1541827561
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1541827564}
- component: {fileID: 1541827563}
- component: {fileID: 1541827562}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &1541827562
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1541827561}
m_Enabled: 1
--- !u!20 &1541827563
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1541827561}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_Iso: 200
m_ShutterSpeed: 0.005
m_Aperture: 16
m_FocusDistance: 10
m_FocalLength: 50
m_BladeCount: 5
m_Curvature: {x: 2, y: 11}
m_BarrelClipping: 0.25
m_Anamorphism: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &1541827564
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1541827561}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0
m_Roots:
- {fileID: 1541827564}
- {fileID: 905563756}
- {fileID: 875921853}
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 97eb3c07d40b4124f94aeb41a923ffa3
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+6 -3
View File
@@ -1,5 +1,8 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="True">
<ui:Template name="ShortcutMenu" src="project://database/Assets/ModuleCore/ModuleUISMenu/UI%20Toolkit/ShortcutMenu/ShortcutMenu.uxml?fileID=9197481963319205126&amp;guid=531a74f84d51b5d49a048079629e13e0&amp;type=3#ShortcutMenu" />
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False">
<ui:Template name="BannerTip" src="project://database/Assets/UI%20Toolkit/GamePopup/BannerTip/BannerTip.uxml?fileID=9197481963319205126&amp;guid=e4a01fc5cb705fe4c9bedf1d0c5df107&amp;type=3#BannerTip" />
<Style src="project://database/Assets/UI%20Toolkit/Document/Document.uss?fileID=7433441132597879392&amp;guid=9205939af30a4394f8f2e34232b27890&amp;type=3#Document" />
<ui:Instance template="ShortcutMenu" name="ShortcutMenu" picking-mode="Ignore" class="document-page" />
<ui:VisualElement name="Window" picking-mode="Ignore" class="document-page" style="flex-grow: 1;" />
<ui:VisualElement name="Popup" picking-mode="Ignore" class="document-page" style="flex-grow: 1;">
<ui:Instance template="BannerTip" name="BannerTip" class="document-page document-page-hide" />
</ui:VisualElement>
</ui:UXML>
@@ -0,0 +1,4 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="False">
<Style src="project://database/Assets/UI%20Toolkit/Component/SlideButton/SlideButton.uss?fileID=7433441132597879392&amp;guid=a188682137c1d204a9a873d3ab8a815f&amp;type=3#SlideButton" />
<ui:Button text="按钮" parse-escape-sequences="true" display-tooltip-when-elided="true" name="Button" class="slidebutton-button" style="width: 120px; height: 60px; padding-top: 0; padding-right: 0; padding-bottom: 0; padding-left: 0; color: rgb(81, 120, 136); -unity-font-style: bold; font-size: 24px; background-color: rgba(0, 0, 0, 0);" />
</ui:UXML>
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 90b68087028f53345aa820b038f0bc8a
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
@@ -0,0 +1,13 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="True">
<ui:Template name="SlideButtonTemplate1" src="project://database/Assets/UI%20Toolkit/GamePage/SlideButtonTemplate1.uxml?fileID=9197481963319205126&amp;guid=90b68087028f53345aa820b038f0bc8a&amp;type=3#SlideButtonTemplate1" />
<ui:VisualElement style="height: 100px; background-color: rgb(200, 237, 239); align-items: center; justify-content: center;">
<ui:VisualElement name="SlideButton" class="slidebutton-bg" style="background-color: rgb(124, 169, 182); width: 400px; height: 80px; border-top-left-radius: 30px; border-top-right-radius: 30px; border-bottom-right-radius: 30px; border-bottom-left-radius: 30px; padding-top: 0; padding-right: 0; padding-bottom: 0; padding-left: 0;">
<ui:VisualElement name="Slide" style="position: absolute; background-color: rgb(255, 255, 255); height: 60px; border-top-left-radius: 25px; border-top-right-radius: 25px; border-bottom-right-radius: 25px; border-bottom-left-radius: 25px; width: 120px; top: 10px; left: 10px;" />
<ui:VisualElement name="Container" style="flex-grow: 1; flex-direction: row; align-items: center; justify-content: space-between; padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px;">
<ui:Instance template="SlideButtonTemplate1" name="SlideButtonTemplate1" />
<ui:Instance template="SlideButtonTemplate1" name="SlideButtonTemplate1" />
<ui:Instance template="SlideButtonTemplate1" name="SlideButtonTemplate1" />
</ui:VisualElement>
</ui:VisualElement>
</ui:VisualElement>
</ui:UXML>
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 4e89ef667016a0a43a573b48cb9521ef
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
+16
View File
@@ -0,0 +1,16 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False">
<ui:VisualElement style="flex-grow: 1; flex-direction: row; padding-top: 1px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px;">
<ui:VisualElement style="flex-grow: 1; flex-direction: column; background-color: rgb(0, 0, 0);">
<ui:VisualElement style="height: 540px; background-color: rgb(155, 178, 55); border-top-left-radius: 1px; border-top-right-radius: 1px; border-bottom-right-radius: 1px; border-bottom-left-radius: 1px;" />
<ui:VisualElement name="L" style="height: 1px;" />
<ui:VisualElement style="height: 540px; background-color: rgb(68, 197, 191); border-top-left-radius: 1px; border-top-right-radius: 1px; border-bottom-right-radius: 1px; border-bottom-left-radius: 1px;" />
<ui:VisualElement name="L" style="height: 1px;" />
</ui:VisualElement>
<ui:VisualElement name="L" style="width: 1px;" />
<ui:VisualElement style="width: 400px; background-color: rgb(186, 255, 124); border-top-left-radius: 1px; border-top-right-radius: 1px; border-bottom-right-radius: 1px; border-bottom-left-radius: 1px;" />
<ui:VisualElement name="L" style="width: 1px;" />
<ui:VisualElement style="width: 200px; border-top-left-radius: 1px; border-top-right-radius: 1px; border-bottom-right-radius: 1px; border-bottom-left-radius: 1px; background-color: rgb(71, 255, 195);" />
<ui:VisualElement name="L" style="width: 1px;" />
<ui:VisualElement style="width: 200px; background-color: rgb(157, 86, 188); border-top-left-radius: 1px; border-top-right-radius: 1px; border-bottom-right-radius: 1px; border-bottom-left-radius: 1px;" />
</ui:VisualElement>
</ui:UXML>
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: dbd43929292199240bd6ff61200e2afb
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
@@ -7,6 +7,8 @@
@import url("/Assets/UI Toolkit/Component/ScrollView/ScrollView.uss");
@import url("/Assets/UI Toolkit/Component/Slider/Slider.uss");
@import url("/Assets/UI Toolkit/Component/Toggle/Toggle.uss");
@import url("/Assets/UI Toolkit/Component/SlideButton/SlideButton.uss");
@@ -27,8 +27,9 @@ namespace MuHua {
FromRightToLeft = 1,
}
public float value;
public bool isDrag;
public float value;
public float rolling = 10;
public Vector3 originalPosition;
public Vector3 pointerPosition;
@@ -76,9 +77,10 @@ namespace MuHua {
}
/// <summary> 滚轮滑动 </summary>
private void ViewportWheel(WheelEvent evt) {
float maxHeight = Viewport.resolvedStyle.height - Container.resolvedStyle.height;
float minHeight = Mathf.Min(Viewport.resolvedStyle.height, Container.resolvedStyle.height);
float y = evt.delta.y * minHeight / maxHeight;
// float maxHeight = Viewport.resolvedStyle.height - Container.resolvedStyle.height;
// float minHeight = Mathf.Min(Viewport.resolvedStyle.height, Container.resolvedStyle.height);
// float y = evt.delta.y * minHeight / maxHeight;
float y = evt.delta.y * rolling / 1000;
value = value - y;
UpdateValue(value);
}
@@ -27,8 +27,9 @@ namespace MuHua {
FromBottomToTop = 1,
}
public float value;
public bool isDrag;
public float value;
public float rolling = 10;
public Vector3 originalPosition;
public Vector3 pointerPosition;
@@ -76,9 +77,10 @@ namespace MuHua {
}
/// <summary> 滚轮滑动 </summary>
private void ViewportWheel(WheelEvent evt) {
float maxHeight = Viewport.resolvedStyle.height - Container.resolvedStyle.height;
float minHeight = Mathf.Min(Viewport.resolvedStyle.height, Container.resolvedStyle.height);
float y = evt.delta.y * minHeight / maxHeight;
// float maxHeight = Viewport.resolvedStyle.height - Container.resolvedStyle.height;
// float minHeight = Mathf.Min(Viewport.resolvedStyle.height, Container.resolvedStyle.height);
// float y = evt.delta.y * minHeight / maxHeight;
float y = evt.delta.y * rolling / 1000;
value = value - y;
UpdateValue(value);
}
@@ -44,8 +44,9 @@ namespace MuHua {
/// <summary> 按下Top </summary>
private void TopDown(PointerDownEvent evt) {
isDownMove = true;
pointerPosition = UITool.GetMousePosition();
pointerPosition = UITool.GetMousePosition(canvas);
originalPosition = Window.transform.position;
element.BringToFront();
}
/// <summary> 鼠标松开或离开 </summary>
private void DraggerUpOrLeave(EventBase evt) {
@@ -64,9 +65,9 @@ namespace MuHua {
/// <summary> 更新状态 </summary>
public virtual void Update() {
if (!isDownMove) { return; }
Vector3 mousePosition = UITool.GetMousePosition();
Vector3 mousePosition = UITool.GetMousePosition(canvas);
Vector3 offset = mousePosition - pointerPosition;
Vector3 position = originalPosition + new Vector3(offset.x, -offset.y);
Vector3 position = originalPosition + new Vector3(offset.x, offset.y);
float width = canvas.resolvedStyle.width - Window.resolvedStyle.width;
float height = canvas.resolvedStyle.height - Window.resolvedStyle.height;
+1 -1
View File
@@ -1,4 +1,4 @@
# MuHua-UIElements
## UIToolkit工具包
* https://github.com/MuHua-123/MuHua-UIElements.git?path=Packages/UITool
* https://git.muhua233.com/MuHua/MuHua-UIElements.git?path=Packages/UITool