E_ElecCompetition/Electrical_inspectionCompet.../Assets/Adam/Scripts/Utility/ToolUtility.cs

55 lines
1.6 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
//============================================================
//支持中文文件使用UTF-8编码
//@author YangHua
//@create 20230914
//@company QianHuo
//
//@description:
//============================================================
namespace Utility
{
public class ToolUtility
{
/// <summary>
/// 分割字符串
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
public static string[] GetInfo(string info, char t)
{
string[] result = info.Split(t);
return result;
}
/// <summary>
/// 剔除字符串
/// </summary>
/// <param name="info"></param>
/// <param name="eliminate"></param>
/// <returns></returns>
public static string GetEliminateInfo(string info, string eliminate)
{
string result = info.Replace(eliminate, "");
return result;
}
public static bool CheckGuiRaycastObjects()
{
PointerEventData eventData = new PointerEventData(EventSystem.current);
eventData.pressPosition = Input.mousePosition;//touch.position
eventData.position = Input.mousePosition;//touch.position
var results = new List<RaycastResult>();
//gr.Raycast(eventData, results);
EventSystem.current.RaycastAll(eventData, results); //使用此方式也可
return results.Count > 0;
}
}
}