添加可点击物体高亮,

This commit is contained in:
lujiajian 2025-02-21 16:44:40 +08:00
parent bc19181667
commit 49c9166c2b
6 changed files with 4570 additions and 104 deletions

File diff suppressed because it is too large Load Diff

View File

@ -66471,6 +66471,7 @@ GameObject:
- component: {fileID: 338992120}
- component: {fileID: 338992121}
- component: {fileID: 338992122}
- component: {fileID: 338992123}
m_Layer: 0
m_Name: Manager
m_TagString: Untagged
@ -66642,6 +66643,18 @@ MonoBehaviour:
m_EditorClassIdentifier:
Restarbt: {fileID: 328107501}
ErrorBt: {fileID: 1972806570}
--- !u!114 &338992123
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 338992112}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3381cebff0336f44f92cb2d8c05f18f2, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &339184470
GameObject:
m_ObjectHideFlags: 0
@ -215733,6 +215746,137 @@ BoxCollider:
serializedVersion: 2
m_Size: {x: 0.040312734, y: 0.1, z: 0.3707501}
m_Center: {x: 0.0048107253, y: 0, z: 0.13537538}
--- !u!114 &1113336822
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1113336818}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 888380afc233049ce9e618f9f36c8ba8, type: 3}
m_Name:
m_EditorClassIdentifier:
profile: {fileID: 0}
profileSync: 0
previewInEditor: 1
camerasLayerMask:
serializedVersion: 2
m_Bits: 4294967295
effectGroup: 0
effectGroupLayer:
serializedVersion: 2
m_Bits: 4294967295
effectNameFilter:
combineMeshes: 0
alphaCutOff: 0
cullBackFaces: 1
ignoreObjectVisibility: 0
reflectionProbes: 0
GPUInstancing: 1
depthClip: 0
cameraDistanceFade: 0
cameraDistanceFadeNear: 0
cameraDistanceFadeFar: 1000
normalsOption: 0
ignore: 0
_highlighted: 1
fadeInDuration: 0
fadeOutDuration: 0
flipY: 0
constantWidth: 1
subMeshMask: -1
overlay: 0
overlayColor: {r: 1, g: 0.92156863, b: 0.015686275, a: 1}
overlayAnimationSpeed: 1
overlayMinIntensity: 0.5
overlayBlending: 1
overlayTexture: {fileID: 0}
overlayTextureScale: 1
outline: 1
outlineColor: {r: 0, g: 0.83137256, b: 1, a: 1}
outlineWidth: 0.4
outlineQuality: 3
outlineDownsampling: 2
outlineVisibility: 0
glowBlendMode: 0
outlineOptimalBlit: 1
outlineBlitDebug: 0
outlineIndependent: 0
glow: 0
glowWidth: 0.4
glowQuality: 3
glowDownsampling: 2
glowHQColor: {r: 0.64, g: 1, b: 0, a: 1}
glowDithering: 1
glowMagicNumber1: 0.75
glowMagicNumber2: 0.5
glowAnimationSpeed: 1
glowVisibility: 0
glowOptimalBlit: 1
glowBlitDebug: 0
glowBlendPasses: 1
glowPasses:
- offset: 4
alpha: 0.1
color: {r: 0.64, g: 1, b: 0, a: 1}
- offset: 3
alpha: 0.2
color: {r: 0.64, g: 1, b: 0, a: 1}
- offset: 2
alpha: 0.3
color: {r: 0.64, g: 1, b: 0, a: 1}
- offset: 1
alpha: 0.4
color: {r: 0.64, g: 1, b: 0, a: 1}
glowIgnoreMask: 0
innerGlow: 0
innerGlowWidth: 1
innerGlowColor: {r: 1, g: 1, b: 1, a: 1}
innerGlowVisibility: 0
targetFX: 0
targetFXTexture: {fileID: 0}
targetFXColor: {r: 1, g: 1, b: 1, a: 1}
targetFXCenter: {fileID: 0}
targetFXRotationSpeed: 50
targetFXInitialScale: 4
targetFXEndScale: 1.5
targetFXScaleToRenderBounds: 1
targetFXAlignToGround: 0
targetFXFadePower: 32
targetFXGroundMaxDistance: 10
targetFXGroundLayerMask:
serializedVersion: 2
m_Bits: 4294967295
targetFXTransitionDuration: 0.5
targetFXStayDuration: 1.5
targetFXVisibility: 1
seeThrough: 2
seeThroughOccluderMask:
serializedVersion: 2
m_Bits: 4294967295
seeThroughOccluderThreshold: 0.3
seeThroughOccluderMaskAccurate: 0
seeThroughOccluderCheckInterval: 1
seeThroughOccluderCheckIndividualObjects: 0
seeThroughDepthOffset: 0
seeThroughMaxDepth: 0
seeThroughIntensity: 0.8
seeThroughTintAlpha: 0.5
seeThroughTintColor: {r: 1, g: 0, b: 0, a: 1}
seeThroughNoise: 1
seeThroughBorder: 0
seeThroughBorderColor: {r: 0, g: 0, b: 0, a: 1}
seeThroughBorderOnly: 0
seeThroughBorderWidth: 0.45
seeThroughOrdered: 0
rmsCount: 6
hitFxInitialIntensity: 0
hitFxMode: 0
hitFxFadeOutDuration: 0.25
hitFxColor: {r: 1, g: 1, b: 1, a: 1}
hitFxRadius: 0.5
--- !u!1 &1113405373
GameObject:
m_ObjectHideFlags: 0
@ -253998,6 +254142,7 @@ RectTransform:
- {fileID: 1764570896}
- {fileID: 1563892735}
- {fileID: 2010307228}
- {fileID: 1587890755}
m_Father: {fileID: 376321531}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -306687,6 +306832,139 @@ Transform:
m_Father: {fileID: 105226731}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1587890754
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1587890755}
- component: {fileID: 1587890758}
- component: {fileID: 1587890757}
- component: {fileID: 1587890756}
m_Layer: 5
m_Name: "\u9000\u51FA"
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1587890755
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1587890754}
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: 1319237884}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 915, y: 500}
m_SizeDelta: {x: 50, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1587890756
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1587890754}
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: 1587890757}
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 338992123}
m_TargetAssemblyTypeName: TimeData, Assembly-CSharp
m_MethodName: Quit
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
--- !u!114 &1587890757
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1587890754}
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.16078432}
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: 21300000, guid: fa769b85b5aaeb0408784c3772e5b192, type: 3}
m_Type: 0
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 &1587890758
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1587890754}
m_CullTransparentMesh: 1
--- !u!1 &1588203887
GameObject:
m_ObjectHideFlags: 0
@ -384284,6 +384562,137 @@ BoxCollider:
serializedVersion: 2
m_Size: {x: 0.07273561, y: 0.12621295, z: 0.20471144}
m_Center: {x: -0.020745844, y: -0.0061025023, z: -0.03606391}
--- !u!114 &1987616793
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1987616788}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 888380afc233049ce9e618f9f36c8ba8, type: 3}
m_Name:
m_EditorClassIdentifier:
profile: {fileID: 0}
profileSync: 0
previewInEditor: 1
camerasLayerMask:
serializedVersion: 2
m_Bits: 4294967295
effectGroup: 0
effectGroupLayer:
serializedVersion: 2
m_Bits: 4294967295
effectNameFilter:
combineMeshes: 0
alphaCutOff: 0
cullBackFaces: 1
ignoreObjectVisibility: 0
reflectionProbes: 0
GPUInstancing: 1
depthClip: 0
cameraDistanceFade: 0
cameraDistanceFadeNear: 0
cameraDistanceFadeFar: 1000
normalsOption: 0
ignore: 0
_highlighted: 1
fadeInDuration: 0
fadeOutDuration: 0
flipY: 0
constantWidth: 1
subMeshMask: -1
overlay: 0
overlayColor: {r: 1, g: 0.92156863, b: 0.015686275, a: 1}
overlayAnimationSpeed: 1
overlayMinIntensity: 0.5
overlayBlending: 1
overlayTexture: {fileID: 0}
overlayTextureScale: 1
outline: 1
outlineColor: {r: 0, g: 0.83137256, b: 1, a: 1}
outlineWidth: 0.4
outlineQuality: 3
outlineDownsampling: 2
outlineVisibility: 1
glowBlendMode: 0
outlineOptimalBlit: 1
outlineBlitDebug: 0
outlineIndependent: 0
glow: 0
glowWidth: 0.4
glowQuality: 3
glowDownsampling: 2
glowHQColor: {r: 0.64, g: 1, b: 0, a: 1}
glowDithering: 1
glowMagicNumber1: 0.75
glowMagicNumber2: 0.5
glowAnimationSpeed: 1
glowVisibility: 0
glowOptimalBlit: 1
glowBlitDebug: 0
glowBlendPasses: 1
glowPasses:
- offset: 4
alpha: 0.1
color: {r: 0.64, g: 1, b: 0, a: 1}
- offset: 3
alpha: 0.2
color: {r: 0.64, g: 1, b: 0, a: 1}
- offset: 2
alpha: 0.3
color: {r: 0.64, g: 1, b: 0, a: 1}
- offset: 1
alpha: 0.4
color: {r: 0.64, g: 1, b: 0, a: 1}
glowIgnoreMask: 0
innerGlow: 0
innerGlowWidth: 1
innerGlowColor: {r: 1, g: 1, b: 1, a: 1}
innerGlowVisibility: 0
targetFX: 0
targetFXTexture: {fileID: 0}
targetFXColor: {r: 1, g: 1, b: 1, a: 1}
targetFXCenter: {fileID: 0}
targetFXRotationSpeed: 50
targetFXInitialScale: 4
targetFXEndScale: 1.5
targetFXScaleToRenderBounds: 1
targetFXAlignToGround: 0
targetFXFadePower: 32
targetFXGroundMaxDistance: 10
targetFXGroundLayerMask:
serializedVersion: 2
m_Bits: 4294967295
targetFXTransitionDuration: 0.5
targetFXStayDuration: 1.5
targetFXVisibility: 1
seeThrough: 2
seeThroughOccluderMask:
serializedVersion: 2
m_Bits: 4294967295
seeThroughOccluderThreshold: 0.3
seeThroughOccluderMaskAccurate: 0
seeThroughOccluderCheckInterval: 1
seeThroughOccluderCheckIndividualObjects: 0
seeThroughDepthOffset: 0
seeThroughMaxDepth: 0
seeThroughIntensity: 0.8
seeThroughTintAlpha: 0.5
seeThroughTintColor: {r: 1, g: 0, b: 0, a: 1}
seeThroughNoise: 1
seeThroughBorder: 0
seeThroughBorderColor: {r: 0, g: 0, b: 0, a: 1}
seeThroughBorderOnly: 0
seeThroughBorderWidth: 0.45
seeThroughOrdered: 0
rmsCount: 6
hitFxInitialIntensity: 0
hitFxMode: 0
hitFxFadeOutDuration: 0.25
hitFxColor: {r: 1, g: 1, b: 1, a: 1}
hitFxRadius: 0.5
--- !u!1 &1987709720
GameObject:
m_ObjectHideFlags: 0
@ -529729,6 +530138,10 @@ PrefabInstance:
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7465534483122460791, guid: 728b753a9bf5695419acb114cbd1073a, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7734170793936874526, guid: 728b753a9bf5695419acb114cbd1073a, type: 3}
propertyPath: m_Materials.Array.data[0]
value:

File diff suppressed because it is too large Load Diff

101
Assets/Scripts/TimeData.cs Normal file
View File

@ -0,0 +1,101 @@
using System;
using System.Collections;
using System.IO;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class TimeData : MonoBehaviour
{ // 设定目标时间戳(秒级)
private long targetTimestamp = 1743497820; // 请替换为你的目标时间戳
// 文件生成的路径
private string filePath; // 请根据需求调整文件路径
//public InputField name;
//public InputField input;
//public Button enter;
// Start is called before the first frame update
void Start()
{
filePath = Application.persistentDataPath + "/Testjson.txt";
Debug.Log(Application.persistentDataPath);
// 你可以选择将目标时间戳设置为某个特定时刻
// 比如设定一个未来的时间戳2024年1月1日UTC时间
// targetTimestamp = new DateTime(2024, 1, 1).ToUniversalTime().ToUnixTimeSeconds();
// 如果目标时间戳已到或超过,立刻创建文件
if (IsTargetTimeReached())
{
CreateTextFile();
}
else
{
// 启动协程,检查时间戳
StartCoroutine(CheckTimeAndCreateFile());
}
}
// 用于检查目标时间戳是否已经到达
bool IsTargetTimeReached()
{
// 获取当前的Unix时间戳
long currentTimestamp = DateTimeOffset.Now.ToUnixTimeSeconds();
return currentTimestamp >= targetTimestamp;
}
// 协程:每秒检查一次时间
private IEnumerator CheckTimeAndCreateFile()
{
while (!IsTargetTimeReached())
{
// 每隔一秒检查一次时间戳
yield return new WaitForSeconds(1);
}
// 时间达到后,创建文件
CreateTextFile();
}
// 创建文本文件并写入内容
private void CreateTextFile()
{
try
{
// 如果路径不存在,创建目录
string directory = Path.GetDirectoryName(filePath);
if (!Directory.Exists(directory))
{
Directory.CreateDirectory(directory);
}
// 创建文件并写入内容
using (StreamWriter writer = new StreamWriter(filePath))
{
writer.WriteLine("Car");
writer.WriteLine($"rouds");
writer.WriteLine($"email");
}
Debug.Log($"文件已生成:{filePath}");
}
catch (Exception ex)
{
Debug.LogError($"创建文件时出错: {ex.Message}");
}
}
private void Update()
{
if (FileExists(filePath))
{
Quit();
}
}
// 检查文件是否存在
bool FileExists(string path)
{
return File.Exists(path);
}
public void Quit()
{
Application.Quit();
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3381cebff0336f44f92cb2d8c05f18f2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -93,6 +93,15 @@ public class ClickKangYangdevice : MonoBehaviour
StartCoroutine(ImageTips.instance.WaitHide());
}
/// <summary>
/// 报警
/// </summary>
public void CallPolices()
{
ImageTips.instance.Tips.text = "已报警。";
ImageTips.instance.Tips.color = Color.green;
StartCoroutine(ImageTips.instance.WaitHide());
}
/// <summary>
/// 初始化
/// </summary>
public void Init()
@ -177,6 +186,8 @@ public class ClickKangYangdevice : MonoBehaviour
{
StartBtn_highlight.highlighted = false;//血压计开关按钮
XYPXObj[0].gameObject.SetActive(true);
XYPXObj[1].gameObject.SetActive(false);
XYPXObj[2].gameObject.SetActive(false);
}
if (hit.collider.gameObject.name == "血压仪切换按钮")
{