using Adam; using System; using System.Threading.Tasks; using UnityEngine; using UnityEngine.EventSystems; //using Vuplex.WebView; public class newfollow : MonoBehaviour { [SerializeField] string _name; //public CanvasWebViewPrefab _focusedPrefab; public GameObject _canvas; public bool isOnce = true; public string url; private void Start() { OnClose(); url = WebIPAdress.Instance.dicAdresses["用采界面"]; } private void Update() { // 鼠标左键按下 if (Input.GetMouseButtonDown(0)) { // 从相机位置发射一条射线经过屏幕上的鼠标点击位置 Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); // 声明一个射线碰撞信息类 RaycastHit hit; // 进行碰撞检测 bool res = Physics.Raycast(ray, out hit) && !EventSystem.current.IsPointerOverGameObject(); if (res) { // 如果产生了碰撞 if (hit.transform.name.Equals(_name)) { Debug.Log(hit.transform.name); OpenWaiBuUrl(url); } } } } /// /// 使用工具打开链接 /// /// //public void OpenToolWeb(string url) //{ // if (_focusedPrefab == null) // CreatView(url); // else // _focusedPrefab.gameObject.SetActive(true); //} /// /// 打开外部链接 /// /// public void OpenWaiBuUrl(string _url) { //Application.OpenURL(url); //_focusedPrefab.InitialUrl = _url; //_canvas.gameObject.SetActive(true); } public void OnClose() { //_canvas.gameObject.SetActive(false); } }