代码合并
This commit is contained in:
@@ -13,8 +13,8 @@ public class MediaPlayer {
|
||||
private Action fullAction;
|
||||
|
||||
private ModuleCore Core => ModuleCore.I;
|
||||
private ModuleVideo ModuleVideo => Core.ModuleVideo;
|
||||
private RenderTexture RenderTexture => ModuleVideo.renderTexture;
|
||||
//private ModuleVideo ModuleVideo => Core.ModuleVideo;
|
||||
//private RenderTexture RenderTexture => ModuleVideo.renderTexture;
|
||||
private VisualElement VideoView => element.Q<VisualElement>("VideoView");
|
||||
private VisualElement VideoController => element.Q<VisualElement>("VideoController");
|
||||
private MUSliderHorizontal Slider => element.Q<MUSliderHorizontal>("Slider");
|
||||
@@ -40,27 +40,27 @@ public class MediaPlayer {
|
||||
Slider.SlidingValueChanged += Slider_SlidingValueChanged;
|
||||
}
|
||||
private void Play_clicked() {
|
||||
ModuleVideo.Play(); showTime = 5;
|
||||
Play.style.display = DisplayStyle.None;
|
||||
Pause.style.display = DisplayStyle.Flex;
|
||||
Slider.MaxValue = ModuleVideo.frameCount;
|
||||
//ModuleVideo.Play(); showTime = 5;
|
||||
//Play.style.display = DisplayStyle.None;
|
||||
//Pause.style.display = DisplayStyle.Flex;
|
||||
//Slider.MaxValue = ModuleVideo.frameCount;
|
||||
}
|
||||
private void Pause_clicked() {
|
||||
ModuleVideo.Pause();
|
||||
Play.style.display = DisplayStyle.Flex;
|
||||
Pause.style.display = DisplayStyle.None;
|
||||
//ModuleVideo.Pause();
|
||||
//Play.style.display = DisplayStyle.Flex;
|
||||
//Pause.style.display = DisplayStyle.None;
|
||||
}
|
||||
private void FullScreen_clicked() {
|
||||
fullAction?.Invoke();
|
||||
}
|
||||
private void Slider_SlidingValueChanged(float obj) {
|
||||
ModuleVideo.frame = (long)obj;
|
||||
//ModuleVideo.frame = (long)obj;
|
||||
}
|
||||
public void Open() {
|
||||
element.style.visibility = Visibility.Visible;
|
||||
//设置渲染纹理
|
||||
Background background = Background.FromRenderTexture(RenderTexture);
|
||||
VideoView.style.backgroundImage = new StyleBackground(background);
|
||||
//Background background = Background.FromRenderTexture(RenderTexture);
|
||||
//VideoView.style.backgroundImage = new StyleBackground(background);
|
||||
//播放视频
|
||||
Play_clicked();
|
||||
}
|
||||
@@ -73,10 +73,10 @@ public class MediaPlayer {
|
||||
Visibility visibility = showTime > 0 ? Visibility.Visible : Visibility.Hidden;
|
||||
VideoController.style.visibility = visibility;
|
||||
|
||||
if (!isDownSlider) { Slider.Value = ModuleVideo.frame; }
|
||||
//if (!isDownSlider) { Slider.Value = ModuleVideo.frame; }
|
||||
|
||||
string clockTime = TimeSpan.FromSeconds(ModuleVideo.time).ToString(@"mm\:ss");
|
||||
string length = TimeSpan.FromSeconds(ModuleVideo.maxTime).ToString(@"mm\:ss");
|
||||
Time.text = clockTime + "/" + length;
|
||||
//string clockTime = TimeSpan.FromSeconds(ModuleVideo.time).ToString(@"mm\:ss");
|
||||
//string length = TimeSpan.FromSeconds(ModuleVideo.maxTime).ToString(@"mm\:ss");
|
||||
//Time.text = clockTime + "/" + length;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 669f2b93f810a404ba0447b36869b3f7
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
.pb-button {
|
||||
height: 30px;
|
||||
background-color: rgb(204, 204, 204);
|
||||
border-top-left-radius: 0;
|
||||
border-top-right-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
margin-top: 2px;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b7cc9cc589f43df40b63ccfcb30fdbb7
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
|
||||
disableValidation: 0
|
||||
@@ -0,0 +1,13 @@
|
||||
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False">
|
||||
<Style src="project://database/Assets/UI%20Toolkit/UIComponent/PlateBaking/PlateBaking.uss?fileID=7433441132597879392&guid=b7cc9cc589f43df40b63ccfcb30fdbb7&type=3#PlateBaking" />
|
||||
<ui:VisualElement style="flex-grow: 1; overflow: hidden; width: 100%; height: 100%;">
|
||||
<ui:VisualElement name="Rendering" style="flex-grow: 1;" />
|
||||
<ui:VisualElement style="position: absolute; height: 162px; width: 40px; left: 10px; top: 10px; background-color: rgb(51, 51, 51); border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; padding-top: 2px; padding-right: 2px; padding-bottom: 2px; padding-left: 2px;">
|
||||
<ui:VisualElement name="Button1" class="pb-button" style="margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; border-top-left-radius: 4px; border-top-right-radius: 4px;" />
|
||||
<ui:VisualElement name="Button2" class="pb-button" />
|
||||
<ui:VisualElement name="Button3" class="pb-button" />
|
||||
<ui:VisualElement name="Button4" class="pb-button" />
|
||||
<ui:VisualElement name="Button5" class="pb-button" style="border-bottom-right-radius: 4px; border-bottom-left-radius: 4px;" />
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:UXML>
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 12f5fe5a3d1c9d84593d412f3c44f9e5
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
|
||||
@@ -0,0 +1,72 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
public class UIPlateBaking {
|
||||
public readonly VisualElement element;
|
||||
public ModuleViewInput viewInput => ModuleCore.I.PlateBakingViewInput;
|
||||
public ModuleViewCamera viewCamera => ModuleCore.I.PlateBakingViewCamera;
|
||||
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");
|
||||
public UIPlateBaking(VisualElement element) {
|
||||
this.element = element;
|
||||
element.generateVisualContent += Element_GenerateVisualContent;
|
||||
Rendering.RegisterCallback<MouseDownEvent>(DownMouse);
|
||||
Rendering.RegisterCallback<MouseMoveEvent>(DragMouse);
|
||||
Rendering.RegisterCallback<MouseUpEvent>(ReleaseMouse);
|
||||
Rendering.RegisterCallback<MouseOutEvent>(ReleaseMouse);
|
||||
Rendering.RegisterCallback<WheelEvent>(ScrollWheel);
|
||||
}
|
||||
private void Element_GenerateVisualContent(MeshGenerationContext context) {
|
||||
ModuleCore.I.ModuleAgent.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;
|
||||
}
|
||||
|
||||
private bool isDownLeftMouse;
|
||||
private bool isDownRightMouse;
|
||||
private bool isDownMiddleMouse;
|
||||
public void DownMouse(MouseDownEvent evt) {
|
||||
DataMouseInput mouseInput = new DataMouseInput(evt);
|
||||
if (evt.button == 0) { viewInput.DownLeftMouse(mouseInput); isDownLeftMouse = true; }
|
||||
if (evt.button == 1) { viewInput.DownRightMouse(mouseInput); isDownRightMouse = true; }
|
||||
if (evt.button == 2) { viewInput.DownMiddleMouse(mouseInput); isDownMiddleMouse = true; }
|
||||
}
|
||||
public void DragMouse(MouseMoveEvent evt) {
|
||||
DataMouseInput mouseInput = new DataMouseInput(evt);
|
||||
if (isDownLeftMouse) { viewInput.DragLeftMouse(mouseInput); }
|
||||
if (isDownRightMouse) { viewInput.DragRightMouse(mouseInput); }
|
||||
if (isDownMiddleMouse) { viewInput.DragMiddleMouse(mouseInput); }
|
||||
if (evt.button == 0) { viewInput.MoveLeftMouse(mouseInput); }
|
||||
if (evt.button == 1) { viewInput.MoveRightMouse(mouseInput); }
|
||||
if (evt.button == 2) { viewInput.MoveMiddleMouse(mouseInput); }
|
||||
}
|
||||
public void ReleaseMouse(MouseUpEvent evt) {
|
||||
DataMouseInput mouseInput = new DataMouseInput(evt);
|
||||
viewInput.ReleaseLeftMouse(mouseInput); isDownLeftMouse = false;
|
||||
viewInput.ReleaseRightMouse(mouseInput); isDownRightMouse = false;
|
||||
viewInput.ReleaseMiddleMouse(mouseInput); isDownMiddleMouse = false;
|
||||
}
|
||||
public void ReleaseMouse(MouseOutEvent evt) {
|
||||
DataMouseInput mouseInput = new DataMouseInput(evt);
|
||||
viewInput.ReleaseLeftMouse(mouseInput); isDownLeftMouse = false;
|
||||
viewInput.ReleaseRightMouse(mouseInput); isDownRightMouse = false;
|
||||
viewInput.ReleaseMiddleMouse(mouseInput); isDownMiddleMouse = false;
|
||||
}
|
||||
public void ScrollWheel(WheelEvent evt) {
|
||||
DataMouseInput mouseInput = new DataMouseInput(evt);
|
||||
viewInput.ScrollWheel(mouseInput);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bcbd4071f1020ce4da59f6aa6aee51ad
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 131e42b2deb90c44faf40f1d99810957
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,17 @@
|
||||
.pd-button {
|
||||
height: 30px;
|
||||
background-color: rgb(204, 204, 204);
|
||||
border-top-left-radius: 0;
|
||||
border-top-right-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
margin-top: 2px;
|
||||
border-top-width: 0;
|
||||
border-right-width: 0;
|
||||
border-bottom-width: 0;
|
||||
border-left-width: 0;
|
||||
}
|
||||
|
||||
.pd-button-s {
|
||||
background-color: rgb(0, 235, 255);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 61655961f50792845ab24ff6cded58d9
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
|
||||
disableValidation: 0
|
||||
@@ -0,0 +1,13 @@
|
||||
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False">
|
||||
<Style src="project://database/Assets/UI%20Toolkit/UIComponent/PlateDesign/PlateDesign.uss?fileID=7433441132597879392&guid=61655961f50792845ab24ff6cded58d9&type=3#PlateDesign" />
|
||||
<ui:VisualElement style="flex-grow: 1; width: 100%; height: 100%; overflow: hidden;">
|
||||
<ui:VisualElement name="Rendering" style="flex-grow: 1;" />
|
||||
<ui:VisualElement style="position: absolute; height: 162px; width: 40px; left: 10px; top: 10px; background-color: rgb(51, 51, 51); border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; padding-top: 2px; padding-right: 2px; padding-bottom: 2px; padding-left: 2px;">
|
||||
<ui:Button parse-escape-sequences="true" display-tooltip-when-elided="true" name="Button1" class="pd-button" style="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-left-radius: 4px; border-top-right-radius: 4px; border-left-color: rgba(0, 0, 0, 0); border-right-color: rgba(0, 0, 0, 0); border-top-color: rgba(0, 0, 0, 0); border-bottom-color: rgba(0, 0, 0, 0);" />
|
||||
<ui:Button parse-escape-sequences="true" display-tooltip-when-elided="true" name="Button2" class="pd-button" style="padding-top: 0; padding-right: 0; padding-bottom: 0; padding-left: 0; border-top-left-radius: 0; border-top-right-radius: 0; border-left-color: rgba(0, 0, 0, 0); border-right-color: rgba(0, 0, 0, 0); border-top-color: rgba(0, 0, 0, 0); border-bottom-color: rgba(0, 0, 0, 0); margin-top: 2px; margin-right: 0; margin-bottom: 0; margin-left: 0; border-bottom-right-radius: 0; border-bottom-left-radius: 0;" />
|
||||
<ui:Button parse-escape-sequences="true" display-tooltip-when-elided="true" name="Button3" class="pd-button" style="padding-top: 0; padding-right: 0; padding-bottom: 0; padding-left: 0; border-top-left-radius: 0; border-top-right-radius: 0; border-left-color: rgba(0, 0, 0, 0); border-right-color: rgba(0, 0, 0, 0); border-top-color: rgba(0, 0, 0, 0); border-bottom-color: rgba(0, 0, 0, 0); margin-top: 2px; margin-right: 0; margin-bottom: 0; margin-left: 0; border-bottom-right-radius: 0; border-bottom-left-radius: 0;" />
|
||||
<ui:Button parse-escape-sequences="true" display-tooltip-when-elided="true" name="Button4" class="pd-button" style="padding-top: 0; padding-right: 0; padding-bottom: 0; padding-left: 0; border-top-left-radius: 0; border-top-right-radius: 0; border-left-color: rgba(0, 0, 0, 0); border-right-color: rgba(0, 0, 0, 0); border-top-color: rgba(0, 0, 0, 0); border-bottom-color: rgba(0, 0, 0, 0); margin-top: 2px; margin-right: 0; margin-bottom: 0; margin-left: 0; border-bottom-right-radius: 0; border-bottom-left-radius: 0;" />
|
||||
<ui:Button parse-escape-sequences="true" display-tooltip-when-elided="true" name="Button5" class="pd-button" style="padding-top: 0; padding-right: 0; padding-bottom: 0; padding-left: 0; border-top-left-radius: 0; border-top-right-radius: 0; border-left-color: rgba(0, 0, 0, 0); border-right-color: rgba(0, 0, 0, 0); border-top-color: rgba(0, 0, 0, 0); border-bottom-color: rgba(0, 0, 0, 0); margin-top: 2px; margin-right: 0; margin-bottom: 0; margin-left: 0; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px;" />
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:UXML>
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ba059349af6076b40b0e35856489786c
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
|
||||
@@ -0,0 +1,96 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
public class UIPlateDesign {
|
||||
public readonly VisualElement element;
|
||||
public ModuleViewInput viewInput => ModuleCore.I.PlateDesignViewInput;
|
||||
public ModuleViewCamera viewCamera => ModuleCore.I.PlateDesignViewCamera;
|
||||
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");
|
||||
public UIPlateDesign(VisualElement element) {
|
||||
this.element = element;
|
||||
viewInput.OnInputType += ViewInput_OnInputType;
|
||||
element.generateVisualContent += Element_GenerateVisualContent;
|
||||
Rendering.RegisterCallback<MouseDownEvent>(DownMouse);
|
||||
Rendering.RegisterCallback<MouseMoveEvent>(DragMouse);
|
||||
Rendering.RegisterCallback<MouseUpEvent>(ReleaseMouse);
|
||||
Rendering.RegisterCallback<MouseOutEvent>(ReleaseMouse);
|
||||
Rendering.RegisterCallback<WheelEvent>(ScrollWheel);
|
||||
//边缘点操作
|
||||
//Button1.clicked += () => { viewInput.SetPrimaryKeyInput(new VIUEdgePointMobile(viewCamera)); };
|
||||
//Button2.clicked += () => { viewInput.SetPrimaryKeyInput(new VIUEdgePointAdd(viewCamera)); };
|
||||
//设计点操作
|
||||
Button1.clicked += () => { viewInput.SetPrimaryKeyInput(new VIUDesignPointMobile(viewCamera)); };
|
||||
Button2.clicked += () => { viewInput.SetPrimaryKeyInput(new VIUDesignPointInsert(viewCamera)); };
|
||||
Button3.clicked += () => { viewInput.SetPrimaryKeyInput(new VIUBezierMobile(viewCamera)); };
|
||||
|
||||
viewInput.SetPrimaryKeyInput(new VIUDesignPointMobile(viewCamera));
|
||||
}
|
||||
private void ViewInput_OnInputType(Type obj) {
|
||||
//边缘点操作
|
||||
//ChangeStyle(obj, typeof(VIUEdgePointMobile), Button1);
|
||||
//ChangeStyle(obj, typeof(VIUEdgePointAdd), Button2);
|
||||
//设计点操作
|
||||
ChangeStyle(obj, typeof(VIUDesignPointMobile), Button1);
|
||||
ChangeStyle(obj, typeof(VIUDesignPointInsert), Button2);
|
||||
ChangeStyle(obj, typeof(VIUBezierMobile), Button3);
|
||||
}
|
||||
private void ChangeStyle(Type obj, Type compare, VisualElement visualElement) {
|
||||
if (obj == compare) { visualElement.AddToClassList("pd-button-s"); }
|
||||
else { visualElement.RemoveFromClassList("pd-button-s"); }
|
||||
}
|
||||
private void Element_GenerateVisualContent(MeshGenerationContext context) {
|
||||
ModuleCore.I.ModuleAgent.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;
|
||||
}
|
||||
|
||||
private bool isDownLeftMouse;
|
||||
private bool isDownRightMouse;
|
||||
private bool isDownMiddleMouse;
|
||||
public void DownMouse(MouseDownEvent evt) {
|
||||
DataMouseInput mouseInput = new DataMouseInput(evt);
|
||||
if (evt.button == 0) { viewInput.DownLeftMouse(mouseInput); isDownLeftMouse = true; }
|
||||
if (evt.button == 1) { viewInput.DownRightMouse(mouseInput); isDownRightMouse = true; }
|
||||
if (evt.button == 2) { viewInput.DownMiddleMouse(mouseInput); isDownMiddleMouse = true; }
|
||||
}
|
||||
public void DragMouse(MouseMoveEvent evt) {
|
||||
DataMouseInput mouseInput = new DataMouseInput(evt);
|
||||
if (isDownLeftMouse) { viewInput.DragLeftMouse(mouseInput); }
|
||||
if (isDownRightMouse) { viewInput.DragRightMouse(mouseInput); }
|
||||
if (isDownMiddleMouse) { viewInput.DragMiddleMouse(mouseInput); }
|
||||
if (evt.button == 0) { viewInput.MoveLeftMouse(mouseInput); }
|
||||
if (evt.button == 1) { viewInput.MoveRightMouse(mouseInput); }
|
||||
if (evt.button == 2) { viewInput.MoveMiddleMouse(mouseInput); }
|
||||
}
|
||||
public void ReleaseMouse(MouseUpEvent evt) {
|
||||
DataMouseInput mouseInput = new DataMouseInput(evt);
|
||||
viewInput.ReleaseLeftMouse(mouseInput); isDownLeftMouse = false;
|
||||
viewInput.ReleaseRightMouse(mouseInput); isDownRightMouse = false;
|
||||
viewInput.ReleaseMiddleMouse(mouseInput); isDownMiddleMouse = false;
|
||||
}
|
||||
public void ReleaseMouse(MouseOutEvent evt) {
|
||||
DataMouseInput mouseInput = new DataMouseInput(evt);
|
||||
viewInput.ReleaseLeftMouse(mouseInput); isDownLeftMouse = false;
|
||||
viewInput.ReleaseRightMouse(mouseInput); isDownRightMouse = false;
|
||||
viewInput.ReleaseMiddleMouse(mouseInput); isDownMiddleMouse = false;
|
||||
}
|
||||
public void ScrollWheel(WheelEvent evt) {
|
||||
DataMouseInput mouseInput = new DataMouseInput(evt);
|
||||
viewInput.ScrollWheel(mouseInput);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c0ce22839c16abf4e8397a948f702523
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5c63c5be481bbfc408f27d84f6ad0fc4
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
public class TopMenu {
|
||||
public Action ClickTopMenu1;
|
||||
public Action ClickTopMenu2;
|
||||
public readonly VisualElement element;
|
||||
public VisualElement TopMenu1 => element.Q<VisualElement>("TopMenu1");
|
||||
public VisualElement TopMenu2 => element.Q<VisualElement>("TopMenu2");
|
||||
public TopMenu(VisualElement element) {
|
||||
this.element = element;
|
||||
TopMenu1.RegisterCallback<ClickEvent>(TopMenu1_ClickEvent);
|
||||
TopMenu2.RegisterCallback<ClickEvent>(TopMenu2_ClickEvent);
|
||||
}
|
||||
private void TopMenu1_ClickEvent(ClickEvent evt) {
|
||||
ClickTopMenu1?.Invoke();
|
||||
}
|
||||
private void TopMenu2_ClickEvent(ClickEvent evt) {
|
||||
ClickTopMenu2?.Invoke();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 925cd7c3a7a4d624fb742687191f086f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,66 @@
|
||||
.top-menu {
|
||||
background-image: url("project://database/Assets/UI%20Toolkit/Assets/%E6%8C%89%E9%92%AE%E9%98%B4%E5%BD%B1.png?fileID=2800000&guid=9ce769a9c36db7048b884f400edd2560&type=3#按钮阴影");
|
||||
width: 130px;
|
||||
height: 90px;
|
||||
align-items: center;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.top-menu-bg {
|
||||
width: 110px;
|
||||
height: 70px;
|
||||
background-color: rgb(255, 255, 255);
|
||||
border-top-left-radius: 10px;
|
||||
border-top-right-radius: 10px;
|
||||
border-bottom-right-radius: 10px;
|
||||
border-bottom-left-radius: 10px;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
border-top-width: 1px;
|
||||
border-right-width: 1px;
|
||||
border-bottom-width: 1px;
|
||||
border-left-width: 1px;
|
||||
border-left-color: rgb(0, 0, 0);
|
||||
border-right-color: rgb(0, 0, 0);
|
||||
border-top-color: rgb(0, 0, 0);
|
||||
border-bottom-color: rgb(0, 0, 0);
|
||||
}
|
||||
|
||||
.top-menu-mask {
|
||||
width: 100%;
|
||||
height: 60px;
|
||||
border-bottom-right-radius: 10px;
|
||||
border-bottom-left-radius: 10px;
|
||||
transition-duration: 0.3s;
|
||||
justify-content: flex-end;
|
||||
flex-grow: 0;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.top-menu-mask:hover {
|
||||
height: 90px;
|
||||
}
|
||||
|
||||
.top-menu-label {
|
||||
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: 0;
|
||||
border-right-width: 0;
|
||||
border-bottom-width: 0;
|
||||
border-left-width: 0;
|
||||
border-top-left-radius: 0;
|
||||
border-top-right-radius: 0;
|
||||
border-bottom-right-radius: 9px;
|
||||
border-bottom-left-radius: 9px;
|
||||
-unity-text-align: middle-center;
|
||||
width: 100%;
|
||||
height: 40%;
|
||||
background-color: rgba(0, 0, 0, 0.3);
|
||||
font-size: 18px;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b7925943dcb7d374181a9db9c7af7481
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
|
||||
disableValidation: 0
|
||||
@@ -0,0 +1,40 @@
|
||||
<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/UIComponent/TopMenu/TopMenu.uss?fileID=7433441132597879392&guid=b7925943dcb7d374181a9db9c7af7481&type=3#TopMenu" />
|
||||
<ui:VisualElement name="VisualElement" style="flex-direction: row; flex-grow: 1; align-items: center; padding-left: 8px;">
|
||||
<ui:VisualElement name="TopMenu1" class="top-menu">
|
||||
<ui:VisualElement name="Top-Menu-BG" class="top-menu-bg">
|
||||
<ui:VisualElement name="Top-Menu-Mask" class="top-menu-mask">
|
||||
<ui:Label tabindex="-1" text="工程文件" parse-escape-sequences="true" display-tooltip-when-elided="true" class="top-menu-label" />
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="TopMenu2" class="top-menu">
|
||||
<ui:VisualElement name="Top-Menu-BG" class="top-menu-bg">
|
||||
<ui:VisualElement name="Top-Menu-Mask" class="top-menu-mask">
|
||||
<ui:Label tabindex="-1" text="预设模板" parse-escape-sequences="true" display-tooltip-when-elided="true" class="top-menu-label" />
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="TopMenu3" class="top-menu" style="display: none;">
|
||||
<ui:VisualElement name="Top-Menu-BG" class="top-menu-bg">
|
||||
<ui:VisualElement name="Top-Menu-Mask" class="top-menu-mask">
|
||||
<ui:Label tabindex="-1" text="Label" parse-escape-sequences="true" display-tooltip-when-elided="true" class="top-menu-label" />
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="TopMenu4" class="top-menu" style="display: none;">
|
||||
<ui:VisualElement name="Top-Menu-BG" class="top-menu-bg">
|
||||
<ui:VisualElement name="Top-Menu-Mask" class="top-menu-mask">
|
||||
<ui:Label tabindex="-1" text="Label" parse-escape-sequences="true" display-tooltip-when-elided="true" class="top-menu-label" />
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="TopMenu5" class="top-menu" style="display: none;">
|
||||
<ui:VisualElement name="Top-Menu-BG" class="top-menu-bg">
|
||||
<ui:VisualElement name="Top-Menu-Mask" class="top-menu-mask">
|
||||
<ui:Label tabindex="-1" text="Label" parse-escape-sequences="true" display-tooltip-when-elided="true" class="top-menu-label" />
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:UXML>
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1740e867b76e16f41ac6871d25bf6317
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
|
||||
Reference in New Issue
Block a user