修改tips

This commit is contained in:
YangHua 2023-09-17 21:21:36 +08:00
parent 18c89e51f5
commit f1da03ba63
7 changed files with 515 additions and 276 deletions

View File

@ -0,0 +1,46 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
//============================================================
//支持中文文件使用UTF-8编码
//@author YangHua
//@create 20230917
//@company QianHuo
//
//@description:
//============================================================
namespace Components
{
public class ThreeDTips : MonoBehaviour
{
public Camera _camera;
// Use this for initialization
private void Start()
{
}
private void Update()
{
// 从相机位置发射一条射线经过屏幕上的鼠标点击位置
Ray ray = _camera.ScreenPointToRay(Input.mousePosition);
// 声明一个射线碰撞信息类
RaycastHit hit;
// 进行碰撞检测
bool res = Physics.Raycast(ray, out hit);
if (res)
{
// 如果产生了碰撞
if (hit.collider.GetComponent<ToolModelClick>())
{
Debug.Log(hit.collider.name);
}
}
}
}
}

View File

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

View File

@ -61,13 +61,13 @@ public class ToolModelClick : MonoBehaviour
public Highlighter selfHighlighter;
public GameObject tipPrefab;
[ContextMenu("Set")]
public void TTTTT()
{
tipPrefab = Resources.Load<GameObject>("ModelTips");
}
//public GameObject tipPrefab;
//public GameObject tip;
//[ContextMenu("Set")]
//public void TTTTT()
//{
// tipPrefab = Resources.Load<GameObject>("ModelTips");
//}
private void Awake()
{
@ -86,6 +86,13 @@ public class ToolModelClick : MonoBehaviour
if (EventSystem.current.IsPointerOverGameObject())
return;
onEnter?.Invoke();
UIManager.Instance.SetThreeDTip(gameObject.name);
//tip = Instantiate(tipPrefab);
//tip.GetComponentInChildren<TextMesh>().text = gameObject.name;
//tip.transform.localPosition = transform.localPosition;
//tip.transform.localScale = Vector3.one;
//tip.transform.LookAt(Camera.main.transform.position);
//tip.transform.localEulerAngles = new Vector3(90f, 0, 0);
}
private void OnMouseDown()
@ -110,5 +117,7 @@ public class ToolModelClick : MonoBehaviour
if (EventSystem.current.IsPointerOverGameObject())
return;
onExit?.Invoke();
UIManager.Instance.SetThreeDTip("");
//Destroy(tip);
}
}

View File

@ -16,7 +16,7 @@ namespace Adam
{
public class JobCardController : MonoBehaviour
{
public string url = "http://111.229.30.246:10013/Handler/Taiqu.ashx?action=kh&bianhao=";
public string url;
public InputField[] userIDs;
public InputField[] userNames;
public InputField[] workSpace;

View File

@ -22,6 +22,7 @@ public class UIManager : MonoSingleton<UIManager>
public ExitCheckController exitCheckController;
public Button exitBtn;
public Button backToToolBtn;
public Text threeDTip;
// Use this for initialization
private void Start()
{
@ -46,6 +47,19 @@ public class UIManager : MonoSingleton<UIManager>
private void BackToTool()
{
SceneLoad.Instance.SceneChange("工具间场景");
}
public void SetThreeDTip(string name)
{
if (name == "")
{
threeDTip.transform.parent.gameObject.SetActive(false);
}
else
{
threeDTip.transform.parent.gameObject.SetActive(true);
threeDTip.text = name;
}
}
}

View File

@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.91471344, g: 1.0185646, b: 0.94445914, a: 1}
m_IndirectSpecularColor: {r: 0.67866755, g: 0.7565462, b: 0.7109155, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings: