55 lines
1.6 KiB
C#
55 lines
1.6 KiB
C#
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;
|
||
}
|
||
}
|
||
}
|