From 37873427e383ec318b671f451a02880134d3c6d2 Mon Sep 17 00:00:00 2001 From: lishuo Date: Tue, 25 Jan 2022 11:17:42 +0800 Subject: [PATCH] =?UTF-8?q?PC=E7=82=B9=E5=87=BB=E5=8C=BA=E5=9F=9F&PFbutton?= =?UTF-8?q?=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UI/Prefab/Device/DeviceItem.prefab | 85 +++++++++++++++++-- Assets/Scripts/UI/Control/PfUIButton.cs | 48 ++++++----- 2 files changed, 106 insertions(+), 27 deletions(-) diff --git a/Assets/Resources/UI/Prefab/Device/DeviceItem.prefab b/Assets/Resources/UI/Prefab/Device/DeviceItem.prefab index 1428b6ed..1759a974 100644 --- a/Assets/Resources/UI/Prefab/Device/DeviceItem.prefab +++ b/Assets/Resources/UI/Prefab/Device/DeviceItem.prefab @@ -30,7 +30,7 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 189965521107699628} - m_RootOrder: 1 + m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0.5} m_AnchorMax: {x: 1, y: 0.5} @@ -74,6 +74,80 @@ MonoBehaviour: m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 +--- !u!1 &5083574894189849385 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2937272512562187578} + - component: {fileID: 721626668066490155} + - component: {fileID: 2932644569775562883} + m_Layer: 5 + m_Name: Panel + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2937272512562187578 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5083574894189849385} + 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_Children: [] + m_Father: {fileID: 189965521107699628} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &721626668066490155 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5083574894189849385} + m_CullTransparentMesh: 0 +--- !u!114 &2932644569775562883 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5083574894189849385} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 0} + m_RaycastTarget: 1 + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 --- !u!1 &5362620512280803541 GameObject: m_ObjectHideFlags: 0 @@ -102,6 +176,7 @@ RectTransform: m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: + - {fileID: 2937272512562187578} - {fileID: 4347642619387382541} - {fileID: 5333104648953487716} - {fileID: 6514089965287851756} @@ -153,7 +228,7 @@ MonoBehaviour: m_SelectedTrigger: Selected m_DisabledTrigger: Disabled m_Interactable: 1 - m_TargetGraphic: {fileID: 0} + m_TargetGraphic: {fileID: 2932644569775562883} --- !u!1 &6092777681612193971 GameObject: m_ObjectHideFlags: 0 @@ -184,7 +259,7 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 189965521107699628} - m_RootOrder: 2 + m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0.5} m_AnchorMax: {x: 0, y: 0.5} @@ -259,7 +334,7 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 189965521107699628} - m_RootOrder: 0 + m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} @@ -350,7 +425,7 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 189965521107699628} - m_RootOrder: 3 + m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 1, y: 0.5} m_AnchorMax: {x: 1, y: 0.5} diff --git a/Assets/Scripts/UI/Control/PfUIButton.cs b/Assets/Scripts/UI/Control/PfUIButton.cs index 39ae7035..3d1aaca9 100644 --- a/Assets/Scripts/UI/Control/PfUIButton.cs +++ b/Assets/Scripts/UI/Control/PfUIButton.cs @@ -136,7 +136,7 @@ namespace Assets.Scripts.UI.Control { Debug.Log(131); timer.Stop(); - + group.DOFade(1, 1f); }; //鼠标进入 @@ -151,26 +151,28 @@ namespace Assets.Scripts.UI.Control if (!string.IsNullOrWhiteSpace(Tooltips) && showTooltip) { #endif - + //tooltips.SetActive(true); //tooltips.GetComponent().DOFade(1, 0.5f); //tooltips.GetComponent().DOFade(1, 0.5f); //DOTween.CompleteAll(true); - se = DOTween.Sequence(); - se.SetDelay(1); - se.AppendCallback(() => - { - if(a!=null) a.Complete(true); - if (b != null) b.Complete(true); - tooltips.SetActive(true); - tooltips.GetComponent().alpha = 0f; - c = tooltips.GetComponent().DOFade(1, 0.5f); - }); - a = se.Play(); + //se = DOTween.Sequence(); + //se.SetDelay(1); + //se.AppendCallback(() => + //{ + // if(a!=null) a.Complete(true); + // if (b != null) b.Complete(true); + // tooltips.SetActive(true); + // tooltips.GetComponent().alpha = 0f; + // c = tooltips.GetComponent().DOFade(1, 0.5f); + //}); + //a = se.Play(); + tooltips.SetActive(true); + tooltips.GetComponent().alpha = 0f; //StartCoroutine(DelayShowTooltip()); - //timer.Start(); + timer.Start(); } switch (mType) { @@ -207,10 +209,7 @@ namespace Assets.Scripts.UI.Control if (!string.IsNullOrWhiteSpace(Tooltips) && showTooltip) { #endif - if (a != null) a.Complete(true); - if (c != null) c.Complete(true); - b = group.DOFade(0, 1f); - b.onComplete += () => { + group.DOFade(0, 1f).onComplete += () => { tooltips.SetActive(false); }; } @@ -242,9 +241,9 @@ namespace Assets.Scripts.UI.Control UIManager.AddEvent(this.gameObject, EventTriggerType.PointerDown, new UnityEngine.Events.UnityAction(e => { if (!this.isActiveAndEnabled) return; - if (a != null) a.Complete(true); - if (b != null) b.Complete(true); - if (c != null) c.Complete(true); + //if (a != null) a.Complete(true); + //if (b != null) b.Complete(true); + //if (c != null) c.Complete(true); tooltips.SetActive(false); //else @@ -273,6 +272,11 @@ namespace Assets.Scripts.UI.Control image.color = ConvertColor("#BD2255"); } break; + case Type.Image: + { + tooltips.SetActive(tooltips.activeSelf); + } + break; default: break; } @@ -304,7 +308,7 @@ namespace Assets.Scripts.UI.Control break; case Type.Image: { - //tooltips.SetActive(false); + tooltips.SetActive(false); } break; default: