合并代码
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 739c91aa6278a1d42ac00a82ac36616c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,18 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class UIPanelBaking : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4a1ee2e53bd64f2449c39cdf466cf48f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,68 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
public class UIPanelDesign : ModuleUIPanel {
|
||||
|
||||
#region UI元素
|
||||
public override VisualElement Element => ModuleUIPage.Q<VisualElement>("PlateDesign");
|
||||
public VisualElement Rendering => Element.Q<VisualElement>("Rendering");
|
||||
public Button Button1 => Element.Q<Button>("Button1");
|
||||
public Button Button2 => Element.Q<Button>("Button2");
|
||||
public Button Button3 => Element.Q<Button>("Button3");
|
||||
public Button Button4 => Element.Q<Button>("Button4");
|
||||
public Button Button5 => Element.Q<Button>("Button5");
|
||||
#endregion
|
||||
|
||||
#region 引用模块
|
||||
/// <summary> 设计视图相机模块 </summary>
|
||||
public ModuleViewCamera ViewCamera => ModuleCore.ViewCameraDesign;
|
||||
/// <summary> 设计UI输入模块 </summary>
|
||||
public ModuleUIInput<UIInputDesignUnit> UIInputDesign => ModuleCore.UIInputDesign;
|
||||
#endregion
|
||||
|
||||
public override void Awake() {
|
||||
Element.generateVisualContent += Element_GenerateVisualContent;
|
||||
Button1.clicked += () => { UIInputDesign.ChangeInput(new IDesignMobile()); };
|
||||
Button2.clicked += () => { UIInputDesign.ChangeInput(new IDesignInsert()); };
|
||||
Button3.clicked += () => { UIInputDesign.ChangeInput(new IDesignBezier()); };
|
||||
Button4.clicked += () => { UIInputDesign.ChangeInput(new IDesignSelect()); };
|
||||
Button5.clicked += () => { UIInputDesign.ChangeInput(new IDesignSelect()); };
|
||||
}
|
||||
private void Start() {
|
||||
UIInputDesign.Binding(Rendering);
|
||||
UIInputDesign.OnChangeInput += UIInputDesign_OnChangeInput;
|
||||
UIInputDesign.ChangeInput(new IDesignMobile());
|
||||
}
|
||||
|
||||
#region 更新视图
|
||||
private void Element_GenerateVisualContent(MeshGenerationContext context) {
|
||||
StartCoroutine(UpdateRenderTexture());
|
||||
}
|
||||
private IEnumerator UpdateRenderTexture() {
|
||||
yield return null;
|
||||
int width = (int)Element.resolvedStyle.width;
|
||||
int height = (int)Element.resolvedStyle.height;
|
||||
ViewCamera.UpdateRenderTexture(width, height);
|
||||
Background background = Background.FromRenderTexture(ViewCamera.RenderTexture);
|
||||
StyleBackground style = new StyleBackground(background);
|
||||
Rendering.style.backgroundImage = style;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 输入功能
|
||||
private void UIInputDesign_OnChangeInput(UIInputDesignUnit obj) {
|
||||
Type type = obj.GetType();
|
||||
ButtonStyleChange(type, typeof(IDesignMobile), Button1);
|
||||
ButtonStyleChange(type, typeof(IDesignInsert), Button2);
|
||||
ButtonStyleChange(type, typeof(IDesignBezier), Button3);
|
||||
}
|
||||
private void ButtonStyleChange(Type obj, Type compare, Button button) {
|
||||
if (obj == compare) { button.AddToClassList("pd-button-s"); }
|
||||
else { button.RemoveFromClassList("pd-button-s"); }
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 141e3035b49c87441bdd757f6d978c1e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,63 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
using MuHua;
|
||||
|
||||
public class UIPanelInspect : ModuleUIPanel {
|
||||
|
||||
#region UI元素
|
||||
public override VisualElement Element => ModuleUIPage.Q<VisualElement>("Inspect");
|
||||
public VisualElement PlateSettings => Element.Q<VisualElement>("PlateSettings");
|
||||
public VisualElement PointSettings => Element.Q<VisualElement>("PointSettings");
|
||||
#endregion
|
||||
|
||||
#region 引用模块
|
||||
/// <summary> 广播查询数据模块 </summary>
|
||||
public ModuleSending<DataFindPoint> SendingFindPoint => ModuleCore.SendingFindPoint;
|
||||
#endregion
|
||||
|
||||
private DataPlate Plate => SendingFindPoint.Current.plate;
|
||||
private DataPoint Point => SendingFindPoint.Current.point;
|
||||
|
||||
private UIPlateSettings uiPlateSettings;
|
||||
private UIPointSettings uiPointSettings;
|
||||
public override void Awake() {
|
||||
uiPlateSettings = new UIPlateSettings(PlateSettings);
|
||||
|
||||
uiPointSettings = new UIPointSettings(PointSettings);
|
||||
uiPointSettings.Toggle1.OnChange += (value) => { Point.isCurveFront = value; Plate.UpdateVisual(); };
|
||||
uiPointSettings.Toggle2.OnChange += (value) => { Point.isCurveAfter = value; Plate.UpdateVisual(); };
|
||||
}
|
||||
|
||||
private void Start() {
|
||||
SendingFindPoint.OnChange += SendingFindPoint_OnChange;
|
||||
}
|
||||
|
||||
private void SendingFindPoint_OnChange(DataFindPoint obj) {
|
||||
PointSettings.style.display = DisplayStyle.None;
|
||||
PlateSettings.style.display = DisplayStyle.None;
|
||||
if (obj.IsValidPoint) { UpdateUIPointSettings(); return; }
|
||||
if (obj.IsValidPlate) { UpdateUIPlateSettings(); return; }
|
||||
}
|
||||
private void UpdateUIPlateSettings() {
|
||||
PlateSettings.style.display = DisplayStyle.Flex;
|
||||
}
|
||||
private void UpdateUIPointSettings() {
|
||||
PointSettings.style.display = DisplayStyle.Flex;
|
||||
uiPointSettings.Toggle1.SetValue(Point.isCurveFront);
|
||||
uiPointSettings.Toggle2.SetValue(Point.isCurveAfter);
|
||||
}
|
||||
|
||||
public class UIPlateSettings {
|
||||
public readonly VisualElement element;
|
||||
public UIPlateSettings(VisualElement element) => this.element = element;
|
||||
}
|
||||
public class UIPointSettings {
|
||||
public readonly VisualElement element;
|
||||
public VisualElement Bezier => element.Q<VisualElement>("Bezier");
|
||||
public MUToggle Toggle1 => element.Q<MUToggle>("Toggle1");
|
||||
public MUToggle Toggle2 => element.Q<MUToggle>("Toggle2");
|
||||
public UIPointSettings(VisualElement element) => this.element = element;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e19ef8edf7b1d7844838898350516ef8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 112b83d554c0b1c47b6654c490c692b7
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,7 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class UIPageGlobal : ModuleUIPage {
|
||||
protected override void Awake() => ModuleCore.GlobalPage = this;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b8b1855b5fed0e041878548696f2afbe
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user