1
This commit is contained in:
@@ -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:
|
||||
File diff suppressed because one or more lines are too long
@@ -1,6 +1,7 @@
|
||||
<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/Menu/Menu.uss?fileID=7433441132597879392&guid=a53da9fc389948e40ac96af14dd02c10&type=3#Menu" />
|
||||
<ui:Label tabindex="-1" text="Label" parse-escape-sequences="true" display-tooltip-when-elided="true" name="Label" class="menu-label">
|
||||
<ui:VisualElement name="Arrow" style="flex-grow: 1; position: absolute; right: 0; height: 30px; width: 30px; top: 0; bottom: 0; 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);" />
|
||||
</ui:Label>
|
||||
<ui:VisualElement class="menu-unit" style="flex-grow: 0; flex-direction: row; align-self: flex-start;">
|
||||
<ui:Label tabindex="-1" text="Label" parse-escape-sequences="true" display-tooltip-when-elided="true" name="Label" class="menu-label" 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 name="Arrow" style="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);" />
|
||||
</ui:VisualElement>
|
||||
</ui:UXML>
|
||||
|
||||
@@ -1,17 +1,7 @@
|
||||
.menu-label {
|
||||
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;
|
||||
-unity-text-align: middle-left;
|
||||
.menu-unit {
|
||||
}
|
||||
|
||||
.menu-label:hover {
|
||||
.menu-unit:hover {
|
||||
background-color: rgba(0, 0, 0, 0.2);
|
||||
border-top-left-radius: 5px;
|
||||
border-top-right-radius: 5px;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<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/Menu/Item.uxml?fileID=9197481963319205126&guid=1ee167986f6e9a840a45450b4b6adfc2&type=3#Item" />
|
||||
<Style src="project://database/Assets/UI%20Toolkit/GamePanel/Menu/Menu.uss?fileID=7433441132597879392&guid=a53da9fc389948e40ac96af14dd02c10&type=3#Menu" />
|
||||
<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; width: 200px;">
|
||||
<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" />
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 91776b8426e091246ae2122b48e4b927
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,30 @@
|
||||
.guidance {
|
||||
border-top-left-radius: 40px;
|
||||
border-top-right-radius: 40px;
|
||||
border-bottom-right-radius: 40px;
|
||||
border-bottom-left-radius: 40px;
|
||||
margin-top: 0;
|
||||
margin-right: 0;
|
||||
margin-bottom: 0;
|
||||
margin-left: 0;
|
||||
padding-top: 10px;
|
||||
padding-right: 10px;
|
||||
padding-bottom: 10px;
|
||||
padding-left: 10px;
|
||||
transform-origin: center;
|
||||
transition-duration: 0.2s;
|
||||
position: absolute;
|
||||
flex-shrink: 0;
|
||||
flex-grow: 1;
|
||||
align-items: stretch;
|
||||
width: 500px;
|
||||
background-color: rgb(255, 255, 255);
|
||||
border-left-color: rgb(243, 88, 239);
|
||||
border-right-color: rgb(243, 88, 239);
|
||||
border-top-color: rgb(243, 88, 239);
|
||||
border-bottom-color: rgb(243, 88, 239);
|
||||
border-top-width: 1px;
|
||||
border-right-width: 1px;
|
||||
border-bottom-width: 1px;
|
||||
border-left-width: 1px;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fda0d75350465b344915192b3cd6a449
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
|
||||
disableValidation: 0
|
||||
@@ -0,0 +1,20 @@
|
||||
<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/Guidance/Guidance.uss?fileID=7433441132597879392&guid=fda0d75350465b344915192b3cd6a449&type=3#Guidance" />
|
||||
<ui:VisualElement name="Pointer" style="position: absolute;">
|
||||
<ui:VisualElement class="guidance">
|
||||
<ui:Label tabindex="-1" text="LabelLabelLabelLabelLabelLabLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabel elLabelLabelLabelLabelLabelLabel" parse-escape-sequences="true" display-tooltip-when-elided="true" name="Prompt" picking-mode="Ignore" style="margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; font-size: 24px; white-space: normal;" />
|
||||
<ui:VisualElement style="flex-grow: 1; flex-direction: row; align-items: center; justify-content: space-between; padding-top: 10px; padding-right: 10px; padding-bottom: 0; padding-left: 10px;">
|
||||
<ui:VisualElement name="Toggle">
|
||||
<Style src="project://database/Assets/UI%20Toolkit/Component/Toggle/Toggle.uss?fileID=7433441132597879392&guid=9110c01e0b68bd9429ca5de756897be0&type=3#Toggle" />
|
||||
<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>
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
<ui:Label tabindex="-1" text="<u>下一步" parse-escape-sequences="true" display-tooltip-when-elided="true" name="Button" style="font-size: 24px; margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; padding-top: 0; padding-right: 0; padding-bottom: 0; padding-left: 0;" />
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:UXML>
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2317be6da4c8d8541b81d990bc3b6911
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
|
||||
Reference in New Issue
Block a user