Compare commits
13 Commits
c17af4d74b
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 6891f43baa | |||
| 4c5b91c530 | |||
| 6cc52ca4c8 | |||
| 627165e519 | |||
| ef918588f5 | |||
| 7c6acc5fa2 | |||
| 64938f1137 | |||
| 28c121f6d9 | |||
| 089651f7ab | |||
| 21959b46e1 | |||
| 165339172a | |||
| 9be153994f | |||
| f4a07224aa |
@@ -9,7 +9,7 @@ using MuHua;
|
||||
/// </summary>
|
||||
public class InputMenu : InputControl {
|
||||
|
||||
private UIMenuPanel menu;
|
||||
// private UIMenuPanel menu;
|
||||
|
||||
protected override void ModuleInput_OnInputMode(InputMode mode) {
|
||||
// throw new System.NotImplementedException();
|
||||
@@ -19,16 +19,16 @@ public class InputMenu : InputControl {
|
||||
/// <summary> 鼠标左键 </summary>
|
||||
public void OnMouseLeft(InputValue inputValue) {
|
||||
if (inputValue.isPressed) return;
|
||||
UIShortcutMenu.I.Close();
|
||||
// UIShortcutMenu.I.Close();
|
||||
}
|
||||
/// <summary> 鼠标右键 </summary>
|
||||
public void OnMouseRight(InputValue inputValue) {
|
||||
UIShortcutMenu.I.Add("测试1/测试11", () => { Debug.Log("测试1/测试11"); });
|
||||
UIShortcutMenu.I.Add("测试1/测试12", () => { Debug.Log("测试1/测试12"); });
|
||||
// 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.Add("测试2", () => { Debug.Log("测试2"); });
|
||||
|
||||
UIShortcutMenu.I.Open();
|
||||
// UIShortcutMenu.I.Open();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -1,169 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
using MuHua;
|
||||
|
||||
/// <summary>
|
||||
/// UI快捷菜单
|
||||
/// </summary>
|
||||
public class UIShortcutMenu : ModuleUISingle<UIShortcutMenu> {
|
||||
/// <summary> 菜单模板 </summary>
|
||||
public VisualTreeAsset menuTreeAsset;
|
||||
/// <summary> 项目模板 </summary>
|
||||
public VisualTreeAsset itemTreeAsset;
|
||||
|
||||
/// <summary> 数据列表 </summary>
|
||||
public List<DataMenuItem> datas = new List<DataMenuItem>();
|
||||
/// <summary> 控件列表 </summary>
|
||||
public static List<UIControl> controls = new List<UIControl>();
|
||||
|
||||
public override VisualElement Element => root.Q<VisualElement>("ShortcutMenu");
|
||||
|
||||
protected override void Awake() => NoReplace(false);
|
||||
|
||||
private void Update() => controls.ForEach(control => control.Update());
|
||||
|
||||
private void OnDestroy() => controls.ForEach(control => control.Dispose());
|
||||
|
||||
/// <summary> 打开菜单 </summary>
|
||||
public void Open() {
|
||||
Close();
|
||||
Vector3 position = UITool.GetMousePosition(Element);
|
||||
UIMenuPanel menuPanel = Create();
|
||||
menuPanel.Settings(position, datas);
|
||||
}
|
||||
/// <summary> 关闭菜单 </summary>
|
||||
public void Close() {
|
||||
controls.ForEach(control => control.Dispose());
|
||||
controls.Clear();
|
||||
Element.Clear();
|
||||
}
|
||||
/// <summary> 创建子菜单 </summary>
|
||||
public UIMenuPanel Create() {
|
||||
// 创建菜单元素
|
||||
VisualElement element = menuTreeAsset.Instantiate();
|
||||
element.EnableInClassList("menu", true);
|
||||
Element.Add(element);
|
||||
UIMenuPanel menuPanel = new UIMenuPanel(element, itemTreeAsset);
|
||||
controls.Add(menuPanel);
|
||||
return menuPanel;
|
||||
}
|
||||
|
||||
/// <summary> 添加菜单项(方法) </summary>
|
||||
public void Add(string name, Action callback) {
|
||||
string[] names = name.Split('/');
|
||||
|
||||
List<DataMenuItem> datas = this.datas;
|
||||
for (int i = 0; i < names.Length; i++) {
|
||||
string menu = names[i];
|
||||
DataMenuItem item = datas.Find(obj => obj.name == menu);
|
||||
if (item == null) {
|
||||
item = new DataMenuItem { name = menu };
|
||||
if (i == names.Length - 1) { item.callback = callback; }
|
||||
datas.Add(item);
|
||||
}
|
||||
datas = item.items;
|
||||
}
|
||||
}
|
||||
/// <summary> 移除菜单项 </summary>
|
||||
public void Remove(string name) {
|
||||
string[] names = name.Split('/');
|
||||
List<DataMenuItem> datas = this.datas;
|
||||
DataMenuItem parent = null;
|
||||
DataMenuItem target = null;
|
||||
|
||||
for (int i = 0; i < names.Length; i++) {
|
||||
string menu = names[i];
|
||||
target = datas.Find(obj => obj.name == menu);
|
||||
if (target == null) return; // 未找到,直接返回
|
||||
if (i == names.Length - 1) {
|
||||
// 找到要移除的项
|
||||
datas.Remove(target);
|
||||
return;
|
||||
}
|
||||
parent = target;
|
||||
datas = target.items;
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// UI快捷菜单面板
|
||||
/// </summary>
|
||||
public class UIMenuPanel : ModuleUIPanel, UIControl {
|
||||
|
||||
public UIMenuPanel menuPanel;
|
||||
public VisualElement submenu;
|
||||
public ModuleUIItems<UIItem, DataMenuItem> items;
|
||||
|
||||
public VisualElement Container => Q<VisualElement>("Container");
|
||||
|
||||
public UIMenuPanel(VisualElement element, VisualTreeAsset templateAsset) : base(element) {
|
||||
items = new ModuleUIItems<UIItem, DataMenuItem>(Container, templateAsset,
|
||||
(data, element) => new UIItem(data, element, this));
|
||||
}
|
||||
public void Update() {
|
||||
// throw new NotImplementedException();
|
||||
}
|
||||
public void Dispose() {
|
||||
items.Release();
|
||||
}
|
||||
|
||||
public void Settings(Vector3 position, List<DataMenuItem> datas) {
|
||||
items.Create(datas);
|
||||
element.transform.position = position;
|
||||
}
|
||||
|
||||
/// <summary> 打开子菜单 </summary>
|
||||
public void Open(VisualElement submenu, List<DataMenuItem> datas) {
|
||||
if (this.submenu == submenu) { return; }
|
||||
// 更新子菜单
|
||||
this.submenu = submenu;
|
||||
if (menuPanel == null) { menuPanel = UIShortcutMenu.I.Create(); }
|
||||
float x = submenu.worldBound.position.x + submenu.resolvedStyle.width;
|
||||
float y = submenu.worldBound.position.y - 5;
|
||||
Vector3 position = new Vector3(x, y, 0);
|
||||
menuPanel.Settings(position, datas);
|
||||
bool isEnable = datas != null && datas.Count > 0;
|
||||
menuPanel.OpenSubmenu(isEnable);
|
||||
}
|
||||
public void OpenSubmenu(bool open) {
|
||||
element.EnableInClassList("menu-hide", !open);
|
||||
menuPanel?.OpenSubmenu(false);
|
||||
}
|
||||
|
||||
/// <summary> UI项目 </summary>
|
||||
public class UIItem : ModuleUIItem<DataMenuItem> {
|
||||
public readonly UIMenuPanel parent;
|
||||
|
||||
public Label Name => element.Q<Label>("Name");
|
||||
public VisualElement Arrow => element.Q<VisualElement>("Arrow");
|
||||
|
||||
public UIItem(DataMenuItem value, VisualElement element, UIMenuPanel parent) : base(value, element) {
|
||||
this.parent = parent;
|
||||
Name.text = value.name;
|
||||
Arrow.EnableInClassList("menu-arrow-hide", value.items == null || value.items.Count == 0);
|
||||
element.RegisterCallback<MouseDownEvent>(MouseDownEvent);
|
||||
element.RegisterCallback<MouseMoveEvent>(MouseMoveEvent);
|
||||
}
|
||||
private void MouseDownEvent(MouseDownEvent evt) {
|
||||
value.callback?.Invoke();
|
||||
UIShortcutMenu.I.Close();
|
||||
}
|
||||
private void MouseMoveEvent(MouseMoveEvent evt) {
|
||||
parent.Open(element, value.items);
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 菜单项目
|
||||
/// </summary>
|
||||
public class DataMenuItem {
|
||||
/// <summary> 名称 </summary>
|
||||
public string name;
|
||||
/// <summary> 回调 </summary>
|
||||
public Action callback;
|
||||
/// <summary> 子菜单项 </summary>
|
||||
public List<DataMenuItem> items = new List<DataMenuItem>();
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 253123fa56cb88f4e969b587327d3f7f
|
||||
guid: c22eaed15bf06ed44ac6ed66f7a6487c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7b3aa5ae52050524d8a9e0de714dd75c
|
||||
guid: df40a9389111de24a8e95adccd3cb8d3
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
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:
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ed61f5627e04e114eb2c086ae01dc7b4
|
||||
guid: 6477bb920cf3e3a4fbaf3e01082e3ae3
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using MuHua;
|
||||
|
||||
/// <summary>
|
||||
/// 快捷菜单
|
||||
/// </summary>
|
||||
public class ShortcutMenu : Module<ShortcutMenu> {
|
||||
/// <summary> 数据列表 </summary>
|
||||
public List<ShortcutMenuItem> menuItems = new List<ShortcutMenuItem>();
|
||||
|
||||
/// <summary> 打开菜单 </summary>
|
||||
public void Open() => UIShortcutMenu.I?.Open(UIShortcutMenu.I.MousePosition, menuItems);
|
||||
|
||||
/// <summary> 关闭菜单 </summary>
|
||||
public void Close() => UIShortcutMenu.I?.Close();
|
||||
|
||||
/// <summary> 添加菜单项(1级菜单/2级菜单/3级菜单) </summary>
|
||||
public void Add(string name, Action callback) {
|
||||
string[] names = name.Split('/');
|
||||
ShortcutMenuItem item = Find(names[0], menuItems, true);
|
||||
for (int i = 1; i < names.Length; i++) {
|
||||
item = Find(names[i], item.menuItems, true);
|
||||
}
|
||||
item.callback = callback;
|
||||
}
|
||||
/// <summary> 移除菜单项(???/???/子级菜单) </summary>
|
||||
public void Remove(string name) {
|
||||
string[] names = name.Split('/');
|
||||
List<ShortcutMenuItem> menuItems = this.menuItems;
|
||||
ShortcutMenuItem item = Find(names[0], menuItems, false);
|
||||
for (int i = 1; i < names.Length; i++) {
|
||||
if (item == null) return;
|
||||
menuItems = item.menuItems;
|
||||
item = Find(names[i], menuItems, false);
|
||||
}
|
||||
menuItems.Remove(item);
|
||||
}
|
||||
|
||||
/// <summary> 子项目查找 </summary>
|
||||
private ShortcutMenuItem Find(string menu, List<ShortcutMenuItem> menuItems, bool isCreate) {
|
||||
ShortcutMenuItem item = menuItems.Find(obj => obj.name == menu);
|
||||
if (item != null || !isCreate) { return item; }
|
||||
item = new ShortcutMenuItem { name = menu };
|
||||
menuItems.Add(item);
|
||||
return item;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 422a458e7229d6b4a8fff66af1840238
|
||||
guid: 23732e20aab811a4eba63cc0f810d659
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 菜单项目
|
||||
/// </summary>
|
||||
public class ShortcutMenuItem {
|
||||
/// <summary> 名称 </summary>
|
||||
public string name;
|
||||
/// <summary> 回调 </summary>
|
||||
public Action callback;
|
||||
/// <summary> 子菜单项 </summary>
|
||||
public List<ShortcutMenuItem> menuItems = new List<ShortcutMenuItem>();
|
||||
}
|
||||
+2
-3
@@ -1,10 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ccbcb6aee5874ac4ba30fcb269d7c7ba
|
||||
guid: fac2916b09800194a8389027d4b54ce8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences:
|
||||
- m_VisualTreeAsset: {fileID: 9197481963319205126, guid: d23b67a16b48c2243aabe57056dbfbed, type: 3}
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,75 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
using MuHua;
|
||||
|
||||
/// <summary>
|
||||
/// UI快捷菜单面板
|
||||
/// </summary>
|
||||
public class UIMenuPanel : ModuleUIPanel, UIControl {
|
||||
|
||||
public UIMenuPanel menuPanel;
|
||||
public VisualElement submenu;
|
||||
public ModuleUIItems<UIItem, ShortcutMenuItem> items;
|
||||
|
||||
public VisualElement Container => Q<VisualElement>("Container");
|
||||
|
||||
public UIMenuPanel(VisualElement element, VisualTreeAsset templateAsset) : base(element) {
|
||||
items = new ModuleUIItems<UIItem, ShortcutMenuItem>(Container, templateAsset,
|
||||
(data, element) => new UIItem(data, element, this));
|
||||
}
|
||||
public void Update() {
|
||||
// throw new NotImplementedException();
|
||||
}
|
||||
public void Dispose() {
|
||||
items.Release();
|
||||
}
|
||||
|
||||
public void Settings(Vector3 position, List<ShortcutMenuItem> datas) {
|
||||
items.Create(datas);
|
||||
element.transform.position = position;
|
||||
}
|
||||
|
||||
/// <summary> 打开子菜单 </summary>
|
||||
public void Open(VisualElement submenu, List<ShortcutMenuItem> datas) {
|
||||
if (this.submenu == submenu) { return; }
|
||||
// 更新子菜单
|
||||
this.submenu = submenu;
|
||||
if (menuPanel == null) { menuPanel = UIShortcutMenu.I.Create(); }
|
||||
float x = submenu.worldBound.position.x + submenu.resolvedStyle.width;
|
||||
float y = submenu.worldBound.position.y - 4;
|
||||
Vector3 position = new Vector3(x, y, 0);
|
||||
menuPanel.Settings(position, datas);
|
||||
bool isEnable = datas != null && datas.Count > 0;
|
||||
menuPanel.OpenSubmenu(isEnable);
|
||||
}
|
||||
public void OpenSubmenu(bool open) {
|
||||
element.EnableInClassList("menu-hide", !open);
|
||||
menuPanel?.OpenSubmenu(false);
|
||||
}
|
||||
|
||||
/// <summary> UI项目 </summary>
|
||||
public class UIItem : ModuleUIItem<ShortcutMenuItem> {
|
||||
public readonly UIMenuPanel parent;
|
||||
|
||||
public Label Name => element.Q<Label>("Name");
|
||||
public VisualElement Arrow => element.Q<VisualElement>("Arrow");
|
||||
|
||||
public UIItem(ShortcutMenuItem value, VisualElement element, UIMenuPanel parent) : base(value, element) {
|
||||
this.parent = parent;
|
||||
Name.text = value.name;
|
||||
Arrow.EnableInClassList("menu-arrow-hide", value.menuItems == null || value.menuItems.Count == 0);
|
||||
element.RegisterCallback<MouseDownEvent>(MouseDownEvent);
|
||||
element.RegisterCallback<MouseMoveEvent>(MouseMoveEvent);
|
||||
}
|
||||
private void MouseDownEvent(MouseDownEvent evt) {
|
||||
value.callback?.Invoke();
|
||||
UIShortcutMenu.I.Close();
|
||||
}
|
||||
private void MouseMoveEvent(MouseMoveEvent evt) {
|
||||
parent.Open(element, value.menuItems);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cbfff4523d382a14eb835f39d022b39d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
using MuHua;
|
||||
|
||||
/// <summary>
|
||||
/// UI快捷菜单
|
||||
/// </summary>
|
||||
public class UIShortcutMenu : ModuleUISingle<UIShortcutMenu> {
|
||||
/// <summary> 菜单模板 </summary>
|
||||
public VisualTreeAsset MenuPanel;
|
||||
/// <summary> 项目模板 </summary>
|
||||
public VisualTreeAsset MenuTemplate;
|
||||
|
||||
/// <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);
|
||||
|
||||
private void Update() => controls.ForEach(control => control.Update());
|
||||
|
||||
private void OnDestroy() => controls.ForEach(control => control.Dispose());
|
||||
|
||||
/// <summary> 打开菜单 </summary>
|
||||
public void Open(Vector3 position, List<ShortcutMenuItem> datas) {
|
||||
Close();
|
||||
UIMenuPanel menuPanel = Create();
|
||||
menuPanel.Settings(position, datas);
|
||||
}
|
||||
/// <summary> 关闭菜单 </summary>
|
||||
public void Close() {
|
||||
controls.ForEach(control => control.Dispose());
|
||||
controls.Clear();
|
||||
Element.Clear();
|
||||
}
|
||||
/// <summary> 创建子菜单 </summary>
|
||||
public UIMenuPanel Create() {
|
||||
// 创建菜单元素
|
||||
VisualElement element = MenuPanel.Instantiate();
|
||||
element.EnableInClassList("menu", true);
|
||||
Element.Add(element);
|
||||
UIMenuPanel menuPanel = new UIMenuPanel(element, MenuTemplate);
|
||||
controls.Add(menuPanel);
|
||||
return menuPanel;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 422a458e7229d6b4a8fff66af1840238
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences:
|
||||
- document: {instanceID: 0}
|
||||
- MenuPanel: {fileID: 9197481963319205126, guid: 5034a86c1b336b644968fdb3be5f851a, type: 3}
|
||||
- MenuTemplate: {fileID: 9197481963319205126, guid: 1ee167986f6e9a840a45450b4b6adfc2, type: 3}
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 32fa60a7591d8e149b02b5fac56adfb4
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f405743ede2617b4c92bf64862e7402e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,28 @@
|
||||
.menu-unit {
|
||||
flex-direction: row;
|
||||
align-self: flex-start;
|
||||
flex-grow: 0;
|
||||
width: 100%;
|
||||
height: 25px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.menu-unit:hover {
|
||||
background-color: rgba(0, 0, 0, 0.2);
|
||||
border-top-left-radius: 5px;
|
||||
border-top-right-radius: 5px;
|
||||
border-bottom-right-radius: 5px;
|
||||
border-bottom-left-radius: 5px;
|
||||
}
|
||||
|
||||
.menu-arrow {
|
||||
flex-grow: 0;
|
||||
height: 20px;
|
||||
width: 25px;
|
||||
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 {
|
||||
display: none;
|
||||
}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e4abceb9650918a419c073e86d8fc3d6
|
||||
guid: 4b1be5340ef21d843bdd2f0eb2375cfe
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
@@ -0,0 +1,11 @@
|
||||
<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="Item" src="project://database/Assets/ModuleCore/ModuleUISMenu/UI%20Toolkit/MenuPanel/MenuTemplate.uxml?fileID=9197481963319205126&guid=1ee167986f6e9a840a45450b4b6adfc2&type=3#MenuTemplate" />
|
||||
<Style src="project://database/Assets/ModuleCore/ModuleUISMenu/UI%20Toolkit/MenuPanel/MenuPanel.uss?fileID=7433441132597879392&guid=4b1be5340ef21d843bdd2f0eb2375cfe&type=3#MenuPanel" />
|
||||
<ui:VisualElement name="Container" style="background-color: rgb(255, 255, 255); border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; align-self: flex-start; min-width: 150px; 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);">
|
||||
<ui:Instance template="Item" name="Item" />
|
||||
<ui:Instance template="Item" name="Item" />
|
||||
<ui:Instance template="Item" name="Item" />
|
||||
<ui:Instance template="Item" name="Item" />
|
||||
<ui:Instance template="Item" name="Item" />
|
||||
</ui:VisualElement>
|
||||
</ui:UXML>
|
||||
+4
-2
@@ -1,7 +1,9 @@
|
||||
<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">
|
||||
<Style src="project://database/Assets/UI%20Toolkit/GamePanel/ShortcutMenu/ShortcutMenu.uss?fileID=7433441132597879392&guid=a53da9fc389948e40ac96af14dd02c10&type=3#ShortcutMenu" />
|
||||
<Style src="project://database/Assets/ModuleCore/ModuleUISMenu/UI%20Toolkit/MenuPanel/MenuPanel.uss?fileID=7433441132597879392&guid=4b1be5340ef21d843bdd2f0eb2375cfe&type=3#MenuPanel" />
|
||||
<ui:VisualElement class="menu-unit">
|
||||
<ui:Label tabindex="-1" text="Label" parse-escape-sequences="true" display-tooltip-when-elided="true" name="Name" style="-unity-text-align: middle-center; margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; height: 30px;" />
|
||||
<ui:VisualElement style="width: 30px;" />
|
||||
<ui:Label tabindex="-1" text="Label" parse-escape-sequences="true" display-tooltip-when-elided="true" name="Name" style="-unity-text-align: middle-center; margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px;" />
|
||||
<ui:VisualElement style="flex-grow: 1;" />
|
||||
<ui:VisualElement name="Arrow" class="menu-arrow" />
|
||||
</ui:VisualElement>
|
||||
</ui:UXML>
|
||||
@@ -0,0 +1,7 @@
|
||||
.menu {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.menu-hide {
|
||||
display: none;
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
public class TestEditorWindow : EditorWindow {
|
||||
[SerializeField]
|
||||
private VisualTreeAsset m_VisualTreeAsset = default;
|
||||
|
||||
[MenuItem("Window/MuHua/TestEditorWindow")]
|
||||
public static void ShowExample() {
|
||||
TestEditorWindow wnd = GetWindow<TestEditorWindow>();
|
||||
wnd.titleContent = new GUIContent("TestEditorWindow");
|
||||
}
|
||||
|
||||
public void CreateGUI() {
|
||||
// Each editor window contains a root VisualElement object
|
||||
VisualElement root = rootVisualElement;
|
||||
|
||||
// VisualElements objects can contain other VisualElement following a tree hierarchy.
|
||||
VisualElement label = new Label("Hello World! From C#");
|
||||
root.Add(label);
|
||||
|
||||
// Instantiate UXML
|
||||
VisualElement labelFromUXML = m_VisualTreeAsset.Instantiate();
|
||||
root.Add(labelFromUXML);
|
||||
}
|
||||
}
|
||||
@@ -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:
|
||||
@@ -186,7 +186,7 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
m_PanelSettings: {fileID: 11400000, guid: 782028a3ae72af7429ad2ecdce684390, type: 2}
|
||||
m_ParentUI: {fileID: 0}
|
||||
sourceAsset: {fileID: 9197481963319205126, guid: 31e24fa07355f6e42841c8f1d0e77e54, type: 3}
|
||||
sourceAsset: {fileID: 9197481963319205126, guid: dbd43929292199240bd6ff61200e2afb, type: 3}
|
||||
m_SortingOrder: 0
|
||||
--- !u!4 &670296964
|
||||
Transform:
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
@@ -5,7 +5,7 @@
|
||||
<ui:Label tabindex="-1" text="下拉框" parse-escape-sequences="true" display-tooltip-when-elided="true" name="Title" class="dropdown-title" />
|
||||
<ui:VisualElement name="Input" class="dropdown-input">
|
||||
<ui:Label tabindex="-1" text="标签" parse-escape-sequences="true" display-tooltip-when-elided="true" name="Tag" class="dropdown-tag" />
|
||||
<ui:VisualElement name="Icon" class="dropdown-icon" style="background-image: url("project://database/Assets/UI%20Toolkit/DefaultTheme/UnityDefaultRuntimeTheme.tss?fileID=4154780841294389669&guid=05f864e67ee1ecb4bbe67427564d394c&type=3#arrow-down"); -unity-background-image-tint-color: rgb(51, 51, 51);" />
|
||||
<ui:VisualElement name="Icon" class="dropdown-icon" style="background-image: url("project://database/Assets/UI%20Toolkit/UnityThemes/UnityDefaultRuntimeTheme.tss?fileID=4154780841294389669&guid=05f864e67ee1ecb4bbe67427564d394c&type=3#arrow-down"); -unity-background-image-tint-color: rgb(51, 51, 51);" />
|
||||
<ui:VisualElement name="Positioner" class="dropdown-scrollview" />
|
||||
<ui:VisualElement name="DropdownScrollView" class="scrollview dropdown-scrollview dropdown-hide">
|
||||
<ui:VisualElement name="Viewport" class="scrollview-viewport" style="margin-right: 0; margin-bottom: 0; margin-top: 0; margin-left: 0; background-color: rgb(255, 255, 255); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="False">
|
||||
<Style src="project://database/Assets/UI%20Toolkit/Component/Dropdown/Dropdown.uss?fileID=7433441132597879392&guid=1e0657eb9266c804ea6adea1a16c74b2&type=3#Dropdown" />
|
||||
<ui:Button text="Button" parse-escape-sequences="true" display-tooltip-when-elided="true" class="dropdown-unit">
|
||||
<ui:VisualElement name="Check" class="dropdown-hide" style="width: 20px; height: 20px; background-image: url("project://database/Assets/UI%20Toolkit/DefaultTheme/UnityDefaultRuntimeTheme.tss?fileID=-6090568113533005507&guid=05f864e67ee1ecb4bbe67427564d394c&type=3#check"); -unity-background-image-tint-color: rgb(51, 51, 51);" />
|
||||
<ui:VisualElement name="Check" class="dropdown-hide" style="width: 20px; height: 20px; background-image: url("project://database/Assets/UI%20Toolkit/UnityThemes/UnityDefaultRuntimeTheme.tss?fileID=-6090568113533005507&guid=05f864e67ee1ecb4bbe67427564d394c&type=3#check"); -unity-background-image-tint-color: rgb(51, 51, 51);" />
|
||||
</ui:Button>
|
||||
</ui:UXML>
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
<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="LoginPage" src="project://database/Assets/UI%20Toolkit/GamePage/LoginPage/LoginPage.uxml?fileID=9197481963319205126&guid=7ebceaef0e3991040bf96648c85589a4&type=3#LoginPage" />
|
||||
<ui:Template name="BannerTip" src="project://database/Assets/UI%20Toolkit/GamePopup/BannerTip/BannerTip.uxml?fileID=9197481963319205126&guid=e4a01fc5cb705fe4c9bedf1d0c5df107&type=3#BannerTip" />
|
||||
<Style src="project://database/Assets/UI%20Toolkit/Document/Document.uss?fileID=7433441132597879392&guid=9205939af30a4394f8f2e34232b27890&type=3#Document" />
|
||||
<ui:Instance template="LoginPage" name="LoginPage" class="document-page document-page-hide" />
|
||||
<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" />
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
<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="ShortcutMenu" src="project://database/Assets/UI%20Toolkit/GamePanel/ShortcutMenu/ShortcutMenu.uxml?fileID=9197481963319205126&guid=531a74f84d51b5d49a048079629e13e0&type=3#ShortcutMenu" />
|
||||
<Style src="project://database/Assets/UI%20Toolkit/Document/Document.uss?fileID=7433441132597879392&guid=9205939af30a4394f8f2e34232b27890&type=3#Document" />
|
||||
<ui:Instance template="ShortcutMenu" name="ShortcutMenu" picking-mode="Ignore" class="document-page" />
|
||||
</ui:UXML>
|
||||
@@ -1,5 +0,0 @@
|
||||
.custom-label {
|
||||
font-size: 20px;
|
||||
-unity-font-style: bold;
|
||||
color: rgb(68, 138, 255);
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<engine:UXML
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:engine="UnityEngine.UIElements"
|
||||
xmlns:editor="UnityEditor.UIElements"
|
||||
xsi:noNamespaceSchemaLocation="../../../UIElementsSchema/UIElements.xsd"
|
||||
>
|
||||
<Style src="project://database/Assets/UI%20Toolkit/EditorWindow/TestEditorWindow.uss?fileID=7433441132597879392&guid=e4abceb9650918a419c073e86d8fc3d6&type=3#TestEditorWindow" />
|
||||
<engine:Label text="Hello World! From UXML" />
|
||||
<engine:Label class="custom-label" text="Hello World! With Style" />
|
||||
|
||||
</engine: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&guid=a188682137c1d204a9a873d3ab8a815f&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>
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d23b67a16b48c2243aabe57056dbfbed
|
||||
guid: 90b68087028f53345aa820b038f0bc8a
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
@@ -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&guid=90b68087028f53345aa820b038f0bc8a&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>
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 31e24fa07355f6e42841c8f1d0e77e54
|
||||
guid: 4e89ef667016a0a43a573b48cb9521ef
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
@@ -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}
|
||||
@@ -1,11 +0,0 @@
|
||||
<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="Item" src="project://database/Assets/UI%20Toolkit/GamePanel/ShortcutMenu/ItemTemplate.uxml?fileID=9197481963319205126&guid=1ee167986f6e9a840a45450b4b6adfc2&type=3#ItemTemplate" />
|
||||
<Style src="project://database/Assets/UI%20Toolkit/GamePanel/ShortcutMenu/ShortcutMenu.uss?fileID=7433441132597879392&guid=a53da9fc389948e40ac96af14dd02c10&type=3#ShortcutMenu" />
|
||||
<ui:VisualElement name="Container" style="background-color: rgb(255, 255, 255); border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; align-self: flex-start;">
|
||||
<ui:Instance template="Item" name="Item" />
|
||||
<ui:Instance template="Item" name="Item" />
|
||||
<ui:Instance template="Item" name="Item" />
|
||||
<ui:Instance template="Item" name="Item" />
|
||||
<ui:Instance template="Item" name="Item" />
|
||||
</ui:VisualElement>
|
||||
</ui:UXML>
|
||||
@@ -1,32 +0,0 @@
|
||||
.menu {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.menu-hide {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.menu-unit {
|
||||
flex-direction: row;
|
||||
align-self: flex-start;
|
||||
}
|
||||
|
||||
.menu-unit:hover {
|
||||
background-color: rgba(0, 0, 0, 0.2);
|
||||
border-top-left-radius: 5px;
|
||||
border-top-right-radius: 5px;
|
||||
border-bottom-right-radius: 5px;
|
||||
border-bottom-left-radius: 5px;
|
||||
}
|
||||
|
||||
.menu-arrow {
|
||||
flex-grow: 0;
|
||||
height: 30px;
|
||||
width: 30px;
|
||||
background-image: url("project://database/Assets/UI%20Toolkit/DefaultTheme/UnityDefaultRuntimeTheme.tss?fileID=-1087164816274819069&guid=05f864e67ee1ecb4bbe67427564d394c&type=3#arrow-right@2x");
|
||||
-unity-background-image-tint-color: rgb(51, 51, 51);
|
||||
}
|
||||
|
||||
.menu-arrow-hide {
|
||||
display: none;
|
||||
}
|
||||
@@ -9,7 +9,7 @@
|
||||
<ui:VisualElement class="toggle" style="flex-direction: row-reverse;">
|
||||
<ui:Label tabindex="-1" text="不在提示" parse-escape-sequences="true" display-tooltip-when-elided="true" name="Title" class="toggle-title" style="color: rgb(28, 28, 28); padding-bottom: 5px; padding-top: 3px; padding-right: 3px; padding-left: 3px;" />
|
||||
<ui:VisualElement name="Input" class="toggle-input">
|
||||
<ui:VisualElement name="Check" class="toggle-check toggle-check-hide" style="background-image: url("project://database/Assets/UI%20Toolkit/DefaultTheme/UnityDefaultRuntimeTheme.tss?fileID=-6090568113533005507&guid=05f864e67ee1ecb4bbe67427564d394c&type=3#check"); -unity-background-image-tint-color: rgb(51, 51, 51);" />
|
||||
<ui:VisualElement name="Check" class="toggle-check toggle-check-hide" style="background-image: url("project://database/Assets/UI%20Toolkit/UnityThemes/UnityDefaultRuntimeTheme.tss?fileID=-6090568113533005507&guid=05f864e67ee1ecb4bbe67427564d394c&type=3#check"); -unity-background-image-tint-color: rgb(51, 51, 51);" />
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
|
||||
+2
@@ -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");
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f59b127d657274c4e9b94a15b801c1a1
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,65 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using UnityEngine.UIElements;
|
||||
using UnityEditor.UIElements;
|
||||
using MuHua;
|
||||
|
||||
namespace MuHuaEditor {
|
||||
/// <summary>
|
||||
/// 编辑器
|
||||
/// </summary>
|
||||
public abstract class ModuleUIEditor<T> : Editor where T : Object {
|
||||
/// <summary> UXML 资源 </summary>
|
||||
public VisualTreeAsset VisualTreeAsset = default;
|
||||
|
||||
/// <summary> 选中目标 </summary>
|
||||
protected T value;
|
||||
/// <summary> 绑定文档 </summary>
|
||||
public VisualElement Element = null;
|
||||
/// <summary> 控件列表 </summary>
|
||||
public List<UIControl> controls = new List<UIControl>();
|
||||
|
||||
public virtual void Awake() => value = target as T;
|
||||
|
||||
/// <summary> 在OnEnable中注册 </summary>
|
||||
private void OnEnable() => EditorApplication.update += Update;
|
||||
|
||||
/// <summary> 在OnDisable中注销 </summary>
|
||||
private void OnDisable() => EditorApplication.update -= Update;
|
||||
|
||||
public override VisualElement CreateInspectorGUI() {
|
||||
VisualElement root = new VisualElement();
|
||||
// 1. 添加 Script 字段(只读)
|
||||
var scriptProperty = serializedObject.FindProperty("m_Script");
|
||||
if (scriptProperty != null) {
|
||||
var scriptField = new PropertyField(scriptProperty);
|
||||
scriptField.SetEnabled(false); // 只读
|
||||
root.Add(scriptField);
|
||||
}
|
||||
// 实例化 UXML
|
||||
if (VisualTreeAsset != null) {
|
||||
Element = VisualTreeAsset.Instantiate();
|
||||
root.Add(Element);
|
||||
Initial();
|
||||
}
|
||||
// 如果没设置 UXML,返回默认 Inspector
|
||||
return root ?? new IMGUIContainer(() => DrawDefaultInspector());
|
||||
}
|
||||
|
||||
public virtual void Update() => controls.ForEach(control => control.Update());
|
||||
|
||||
public virtual void OnDestroy() => controls.ForEach(control => control.Dispose());
|
||||
|
||||
/// <summary> 初始化 </summary>
|
||||
public abstract void Initial();
|
||||
|
||||
/// <summary> 添加控件 </summary>
|
||||
public void AddControl(UIControl control) => controls.Add(control);
|
||||
/// <summary> 移除控件 </summary>
|
||||
public void RemoveControl(UIControl control) => controls.Remove(control);
|
||||
/// <summary> 查询UI元素 </summary>
|
||||
public VE Q<VE>(string name = null, string className = null) where VE : VisualElement => Element.Q<VE>(name, className);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a8a211ecbf2acb642a002e2ccac32de4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,42 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
using MuHua;
|
||||
|
||||
namespace MuHuaEditor {
|
||||
/// <summary>
|
||||
/// 编辑器窗口
|
||||
/// </summary>
|
||||
public abstract class ModuleUIEditorWindow : EditorWindow {
|
||||
/// <summary> UXML 资源 </summary>
|
||||
public VisualTreeAsset VisualTreeAsset = default;
|
||||
|
||||
/// <summary> 绑定文档 </summary>
|
||||
public VisualElement Element;
|
||||
/// <summary> 控件列表 </summary>
|
||||
public List<UIControl> controls = new List<UIControl>();
|
||||
|
||||
public virtual void CreateGUI() {
|
||||
// Instantiate UXML
|
||||
Element = VisualTreeAsset.Instantiate();
|
||||
Element.style.flexGrow = 1;
|
||||
rootVisualElement.Add(Element);
|
||||
Initial();
|
||||
}
|
||||
|
||||
public virtual void Update() => controls.ForEach(control => control.Update());
|
||||
|
||||
public virtual void OnDestroy() => controls.ForEach(control => control.Dispose());
|
||||
|
||||
/// <summary> 初始化 </summary>
|
||||
public abstract void Initial();
|
||||
|
||||
/// <summary> 添加控件 </summary>
|
||||
public void AddControl(UIControl control) => controls.Add(control);
|
||||
/// <summary> 移除控件 </summary>
|
||||
public void RemoveControl(UIControl control) => controls.Remove(control);
|
||||
/// <summary> 查询UI元素 </summary>
|
||||
public T Q<T>(string name = null, string className = null) where T : VisualElement => Element.Q<T>(name, className);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7a2fd8030b7392643995372e5c88631f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"name": "ModuleEditor",
|
||||
"name": "MuHuaEditor.UITool",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:432b70115e987f44abb984cfe7de384f"
|
||||
"GUID:6206345d516a2bb4a821a7ee90e1b5d5"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user