新增UI显示隐藏功能按钮

HDRP
Yogi 2025-01-10 11:52:52 +08:00
parent b046d6a924
commit 4bccfba407
2 changed files with 149 additions and 0 deletions

View File

@ -270,6 +270,11 @@ MonoBehaviour:
target: {fileID: 223334192} target: {fileID: 223334192}
rotateSpeed: -30 rotateSpeed: -30
FreeTime: 30 FreeTime: 30
--- !u!224 &241816543 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 5626654763991164890, guid: fbd98df1f6ab257439fff069ae185281, type: 3}
m_PrefabInstance: {fileID: 495605761}
m_PrefabAsset: {fileID: 0}
--- !u!1 &251978103 --- !u!1 &251978103
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -641,6 +646,14 @@ PrefabInstance:
propertyPath: m_Value propertyPath: m_Value
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 4392250051589012096, guid: fbd98df1f6ab257439fff069ae185281, type: 3}
propertyPath: uiCanvas
value:
objectReference: {fileID: 1277526996}
- target: {fileID: 4392250051589012096, guid: fbd98df1f6ab257439fff069ae185281, type: 3}
propertyPath: uiTriggerBtn
value:
objectReference: {fileID: 1299667255}
- target: {fileID: 4392250051589012096, guid: fbd98df1f6ab257439fff069ae185281, type: 3} - target: {fileID: 4392250051589012096, guid: fbd98df1f6ab257439fff069ae185281, type: 3}
propertyPath: typewriterPrefab propertyPath: typewriterPrefab
value: value:
@ -776,6 +789,9 @@ PrefabInstance:
m_RemovedComponents: [] m_RemovedComponents: []
m_RemovedGameObjects: [] m_RemovedGameObjects: []
m_AddedGameObjects: m_AddedGameObjects:
- targetCorrespondingSourceObject: {fileID: 5626654763991164890, guid: fbd98df1f6ab257439fff069ae185281, type: 3}
insertIndex: 1
addedObject: {fileID: 1299667254}
- targetCorrespondingSourceObject: {fileID: 6461988665235398496, guid: fbd98df1f6ab257439fff069ae185281, type: 3} - targetCorrespondingSourceObject: {fileID: 6461988665235398496, guid: fbd98df1f6ab257439fff069ae185281, type: 3}
insertIndex: -1 insertIndex: -1
addedObject: {fileID: 1311624461} addedObject: {fileID: 1311624461}
@ -1455,11 +1471,136 @@ MonoBehaviour:
target: {fileID: 668196392} target: {fileID: 668196392}
rotateSpeed: 0.1 rotateSpeed: 0.1
FreeTime: 1 FreeTime: 1
--- !u!1 &1277526996 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 8092749453836692299, guid: fbd98df1f6ab257439fff069ae185281, type: 3}
m_PrefabInstance: {fileID: 495605761}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1288110412 stripped --- !u!1 &1288110412 stripped
GameObject: GameObject:
m_CorrespondingSourceObject: {fileID: 2881457540606939832, guid: 741d148cf7fe4db4aa6687915c30f4ca, type: 3} m_CorrespondingSourceObject: {fileID: 2881457540606939832, guid: 741d148cf7fe4db4aa6687915c30f4ca, type: 3}
m_PrefabInstance: {fileID: 6664335491598370550} m_PrefabInstance: {fileID: 6664335491598370550}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
--- !u!1 &1299667253
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1299667254}
- component: {fileID: 1299667257}
- component: {fileID: 1299667256}
- component: {fileID: 1299667255}
m_Layer: 5
m_Name: UITriggerBtn
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1299667254
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1299667253}
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: 241816543}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: -39.4, y: 124.9}
m_SizeDelta: {x: 112, y: 53.6451}
m_Pivot: {x: 1, y: 0}
--- !u!114 &1299667255
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1299667253}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 1299667256}
m_OnClick:
m_PersistentCalls:
m_Calls: []
--- !u!114 &1299667256
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1299667253}
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: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 10905, 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!222 &1299667257
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1299667253}
m_CullTransparentMesh: 1
--- !u!1 &1311624460 --- !u!1 &1311624460
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using TMPro; using TMPro;
using UnityEngine; using UnityEngine;
using UnityEngine.UI;
using YogiGameCore.ComponentEx; using YogiGameCore.ComponentEx;
using YogiGameCore.Utils; using YogiGameCore.Utils;
@ -27,6 +28,9 @@ public class GamePanel : MonoBehaviour
/// </summary> /// </summary>
private string componentConfigName; private string componentConfigName;
[SerializeField] private Button uiTriggerBtn;
[SerializeField] private GameObject uiCanvas;
private void ClearAllComponentDisplayText() private void ClearAllComponentDisplayText()
{ {
Debug.Log("清空车辆所有文本信息"); Debug.Log("清空车辆所有文本信息");
@ -65,6 +69,10 @@ public class GamePanel : MonoBehaviour
this.main.OnCarChanged += OnMainOnOnCarChanged; this.main.OnCarChanged += OnMainOnOnCarChanged;
this.main.OnCarComponentConfigChanged += OnCarComponentConfigChanged; this.main.OnCarComponentConfigChanged += OnCarComponentConfigChanged;
this.main.OnSwitchComponent += OnSwitchComponent; this.main.OnSwitchComponent += OnSwitchComponent;
uiTriggerBtn.onClick.AddListener(() =>
{
uiCanvas.SetActive(!uiCanvas.activeSelf);
});
} }
private void Start() private void Start()