This commit is contained in:
MuHua-123
2025-06-20 17:30:54 +08:00
parent 5a11b86ef6
commit 39d9db9c6d
30 changed files with 740 additions and 47 deletions
@@ -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,31 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;
using MuHua;
/// <summary>
/// UI弹出管理器
/// </summary>
public class UIPopupManager : ModuleUIPage {
public UIPopup dialog;
public override VisualElement Element => root.Q<VisualElement>("Popup");
public VisualElement PopupDialog => Q<VisualElement>("PopupDialog");
private void Awake() {
dialog = new UIPopup(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: 58ce28d05656cfd498fc2555599e349c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+92
View File
@@ -170,6 +170,8 @@ Transform:
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 1021979399} - {fileID: 1021979399}
- {fileID: 1616348624}
- {fileID: 1934900742}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &670296965 --- !u!114 &670296965
@@ -518,6 +520,96 @@ Transform:
m_Children: [] m_Children: []
m_Father: {fileID: 1439912283} m_Father: {fileID: 1439912283}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1616348623
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1616348624}
- component: {fileID: 1616348625}
m_Layer: 5
m_Name: UILoadManager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1616348624
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1616348623}
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: 670296964}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1616348625
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1616348623}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2da9aad7a772f434080f14bd479de19c, type: 3}
m_Name:
m_EditorClassIdentifier:
document: {fileID: 0}
--- !u!1 &1934900741
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1934900742}
- component: {fileID: 1934900743}
m_Layer: 5
m_Name: UIPopupManager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1934900742
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1934900741}
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: 670296964}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1934900743
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1934900741}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 58ce28d05656cfd498fc2555599e349c, type: 3}
m_Name:
m_EditorClassIdentifier:
document: {fileID: 670296963}
--- !u!1660057539 &9223372036854775807 --- !u!1660057539 &9223372036854775807
SceneRoots: SceneRoots:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
File diff suppressed because one or more lines are too long
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6a177d2ab58f14846a6c9258d70c80a8
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 177bfd27cd49a19458347bff2727268f
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
disableValidation: 0
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e75382f2016e24140822934445b9d30d
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,14 @@
<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/GameLoading/GameLoading.uss?fileID=7433441132597879392&amp;guid=177bfd27cd49a19458347bff2727268f&amp;type=3#GameLoading" />
<ui:VisualElement style="flex-grow: 1; background-color: rgba(0, 0, 0, 0.5);">
<ui:VisualElement name="Progress" class="slider-horizontal" style="flex-direction: column; align-items: stretch; height: 70px; position: absolute; bottom: 100px; left: 400px; right: 400px;">
<ui:Label tabindex="-1" text="运行中。。。" parse-escape-sequences="true" display-tooltip-when-elided="true" name="Title" enable-rich-text="true" class="slider-horizontal-title" style="-unity-text-align: middle-center; font-size: 24px;" />
<ui:VisualElement name="Container" class="slider-horizontal-container" style="border-top-left-radius: 10px; border-top-right-radius: 10px; border-bottom-right-radius: 10px; border-bottom-left-radius: 10px;">
<ui:VisualElement name="Tracker" class="slider-horizontal-tracker" style="border-top-left-radius: 8px; border-top-right-radius: 8px; border-bottom-right-radius: 8px; border-bottom-left-radius: 8px; background-color: rgb(19, 190, 190);">
<ui:VisualElement name="Dragger" class="slider-horizontal-dragger" style="display: none;" />
</ui:VisualElement>
</ui:VisualElement>
</ui:VisualElement>
<ui:VisualElement style="flex-grow: 1;" />
</ui:VisualElement>
</ui:UXML>
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 359206062f2fc8f459139627ef20d163
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 031ad432f77d13e4baf1f164bc4be9ea
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+99
View File
@@ -0,0 +1,99 @@
.gamepopup {
flex-grow: 1;
align-items: center;
justify-content: space-around;
}
.gamepopup-bg {
background-color: rgb(19, 190, 190);
border-top-left-radius: 10px;
border-top-right-radius: 10px;
border-bottom-right-radius: 10px;
border-bottom-left-radius: 10px;
border-top-width: 2px;
border-right-width: 2px;
border-bottom-width: 2px;
border-left-width: 2px;
border-left-color: rgb(255, 255, 255);
border-right-color: rgb(255, 255, 255);
border-top-color: rgb(255, 255, 255);
border-bottom-color: rgb(255, 255, 255);
padding-top: 5px;
padding-right: 5px;
padding-bottom: 5px;
padding-left: 5px;
}
.gamepopup-top {
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;
align-items: center;
}
.gamepopup-title {
-unity-text-align: middle-center;
font-size: 32px;
margin-top: 0;
margin-right: 0;
margin-bottom: 0;
margin-left: 0;
padding-top: 0;
padding-right: 0;
padding-bottom: 0;
padding-left: 0;
height: 50px;
}
.gamepopup-container {
}
.gamepopup-bottom {
height: auto;
align-items: center;
justify-content: flex-end;
padding-top: 5px;
padding-right: 5px;
padding-bottom: 5px;
padding-left: 5px;
}
.gamepopup-button {
background-color: rgb(19, 190, 190);
margin-top: 0;
margin-right: 0;
margin-bottom: 0;
margin-left: 0;
padding-top: 0;
padding-right: 0;
padding-bottom: 0;
padding-left: 0;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-left-color: rgb(255, 255, 255);
border-right-color: rgb(255, 255, 255);
border-top-color: rgb(255, 255, 255);
border-bottom-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;
height: 30px;
width: 80px;
color: rgb(255, 255, 255);
font-size: 18px;
transition-duration: 0.2s;
}
.gamepopup-button:hover {
scale: 1.1 1.1;
}
.gamepopup-hide {
opacity: 0;
display: none;
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a05ba4ce7190c214a8a5812a5c58040b
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
disableValidation: 0
@@ -0,0 +1,14 @@
<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/GamePopup/GamePopup.uss?fileID=7433441132597879392&amp;guid=a05ba4ce7190c214a8a5812a5c58040b&amp;type=3#GamePopup" />
<ui:VisualElement name="GamePopup" picking-mode="Ignore" class="gamepopup">
<ui:VisualElement name="Background" class="gamepopup-bg">
<ui:VisualElement name="Top" class="gamepopup-top">
<ui:Label tabindex="-1" text="Label" parse-escape-sequences="true" display-tooltip-when-elided="true" name="Title" class="gamepopup-title" />
<ui:VisualElement name="Container" class="gamepopup-container" />
</ui:VisualElement>
<ui:VisualElement name="Bottom" class="gamepopup-bottom">
<ui:Button text="确认" parse-escape-sequences="true" display-tooltip-when-elided="true" name="Button" class="gamepopup-button" />
</ui:VisualElement>
</ui:VisualElement>
</ui:VisualElement>
</ui:UXML>
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 97a24ba5ca1d7234e93ef1045aad2beb
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3fa07bbece82f4a4fbd93def67a53498
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,14 @@
<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/GamePopup/GamePopup.uss?fileID=7433441132597879392&amp;guid=a05ba4ce7190c214a8a5812a5c58040b&amp;type=3#GamePopup" />
<ui:VisualElement name="GamePopup" picking-mode="Ignore" class="gamepopup gamepopup-hide" style="justify-content: flex-end; padding-top: 50px; padding-right: 50px; padding-bottom: 50px; padding-left: 50px;">
<ui:VisualElement name="Background" class="gamepopup-bg">
<ui:VisualElement name="Top" class="gamepopup-top">
<ui:Label tabindex="-1" text="LabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabel" parse-escape-sequences="true" display-tooltip-when-elided="true" name="Title" class="gamepopup-title" style="min-width: 300px; max-width: 1000px; white-space: normal; -unity-text-align: middle-left; padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; height: auto;" />
<ui:VisualElement name="Container" class="gamepopup-container" />
</ui:VisualElement>
<ui:VisualElement name="Bottom" class="gamepopup-bottom" style="position: absolute; left: 0; top: 0; right: 0; bottom: 0; flex-grow: 0; height: auto;">
<ui:Button parse-escape-sequences="true" display-tooltip-when-elided="true" name="Button" class="gamepopup-button" style="width: 100%; height: 100%; background-color: rgba(19, 190, 190, 0);" />
</ui:VisualElement>
</ui:VisualElement>
</ui:VisualElement>
</ui:UXML>
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 23f846fe02415a24c9124807c12e3618
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
@@ -0,0 +1,14 @@
<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/GamePopup/GamePopup.uss?fileID=7433441132597879392&amp;guid=a05ba4ce7190c214a8a5812a5c58040b&amp;type=3#GamePopup" />
<ui:VisualElement name="GamePopup" picking-mode="Ignore" class="gamepopup gamepopup-hide">
<ui:VisualElement name="Background" class="gamepopup-bg">
<ui:VisualElement name="Top" class="gamepopup-top">
<ui:Label tabindex="-1" text="Label" parse-escape-sequences="true" display-tooltip-when-elided="true" name="Title" class="gamepopup-title" style="min-width: 300px; min-height: 200px;" />
<ui:VisualElement name="Container" class="gamepopup-container" />
</ui:VisualElement>
<ui:VisualElement name="Bottom" class="gamepopup-bottom">
<ui:Button text="确认" parse-escape-sequences="true" display-tooltip-when-elided="true" name="Button" class="gamepopup-button" />
</ui:VisualElement>
</ui:VisualElement>
</ui:VisualElement>
</ui:UXML>
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: dee1b20bc314365459978397be7a5cfa
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3b40698060c8e254aab487e84fd0f2e8
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,42 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;
using MuHua;
/// <summary>
/// 弹出窗口
/// </summary>
public class UIPopup : ModuleUIPanel {
private Action callback;
public VisualElement GamePopup => Q<VisualElement>("GamePopup");
public VisualElement Top => Q<VisualElement>("Top");
public Label Title => Top.Q<Label>("Title");
public VisualElement Container => Top.Q<VisualElement>("Container");
public VisualElement Bottom => Q<VisualElement>("Bottom");
public VisualElement Button => Bottom.Q<VisualElement>("Button");
public UIPopup(VisualElement element) : base(element) {
Button.RegisterCallback<ClickEvent>((evt) => ButtonClick());
}
/// <summary> 按钮点击 </summary>
public virtual void ButtonClick() {
Settings(false);
callback?.Invoke();
callback = null;
}
/// <summary> 设置活动状态 </summary>
public virtual void Settings(bool active, string content = "", Action callback = null) {
GamePopup.EnableInClassList("gamepopup-hide", !active);
if (!active) { return; }
Title.text = content;
this.callback = callback;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ed2066d85ddf89443a608b697b3dbf30
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,30 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;
using MuHua;
/// <summary>
/// 加载进度
/// </summary>
public class UIProgres : ModuleUIPanel {
public UISliderH progress;
public VisualElement Progress => element.Q<VisualElement>("Progress");
public Label Title => Progress.Q<Label>("Title");
public UIProgres(VisualElement element) : base(element) {
progress = new UISliderH(Progress, element);
}
/// <summary>
/// 设置进度(0-1
/// </summary>
/// <param name="value"></param>
public void Settings(bool active, string content = "", float value = 0) {
Title.text = content;
progress.UpdateValue(value, false);
element.EnableInClassList("document-page-hide", !active);
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3691f81ba66e3764d8e341abf37fa35a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -23,7 +23,7 @@ namespace MuHua {
public T value; public T value;
public List<T> list = new List<T>(); public List<T> list = new List<T>();
internal UIScrollView scrollView; internal UIScrollViewV scrollView;
internal ModuleUIItems<UIDropdownItem, T> DropdownItems; internal ModuleUIItems<UIDropdownItem, T> DropdownItems;
/// <summary> 数据操作 </summary /// <summary> 数据操作 </summary
@@ -50,7 +50,7 @@ namespace MuHua {
DropdownScrollView.EnableInClassList("dropdown-hide", false); DropdownScrollView.EnableInClassList("dropdown-hide", false);
DropdownContainer.Add(DropdownScrollView); DropdownContainer.Add(DropdownScrollView);
scrollView = new UIScrollView(DropdownScrollView, DropdownContainer); scrollView = new UIScrollViewV(DropdownScrollView, DropdownContainer);
DropdownItems = new ModuleUIItems<UIDropdownItem, T>(scrollView.Container, TemplateAsset, DropdownItems = new ModuleUIItems<UIDropdownItem, T>(scrollView.Container, TemplateAsset,
(data, element) => new UIDropdownItem(data, element, this)); (data, element) => new UIDropdownItem(data, element, this));