using System.Collections; using System.Collections.Generic; using UnityEngine; public class HomeView_Tip : MonoBehaviour { [SerializeField] List tipObjList; [SerializeField] GameObject connectObj; // Start is called before the first frame update void Start() { } public void setHomeTip(int index) { if (index == 0) { GameObject _IconConnect = GameObject.Find("IconConnect"); //Debug.Log("IconConnect:" + _IconConnect.transform.position); ////position x,127.5f,left 30 //Camera UICamera = null; //Canvas canvas = GameObject.Find("ViewMgr").GetComponent(); //if (canvas.renderMode == RenderMode.ScreenSpaceCamera // || canvas.renderMode == RenderMode.WorldSpace) //{ // UICamera = canvas.worldCamera; //} //else if (canvas.renderMode == RenderMode.ScreenSpaceOverlay) //{ // UICamera = null; //} //Vector3 centerPos = RectTransformUtility.WorldToScreenPoint(UICamera, _IconConnect.transform.position); //Debug.Log("IconConnect:" + centerPos + " == " + _IconConnect.transform.position); //Vector3 globalMousePos; ////UI屏幕坐标转换为世界坐标 //RectTransformUtility.ScreenPointToWorldPointInRectangle(connectObj.GetComponent(), centerPos, UICamera, out globalMousePos); //Debug.Log("IconConnect:" + _IconConnect.GetComponent().rect); //Rect rect = _IconConnect.GetComponent().rect; connectObj.transform.position = new Vector3(_IconConnect.transform.position.x, _IconConnect.transform.position.y, 0); } for (int i = 0; i < tipObjList.Count; i++) { tipObjList[i].SetActive(index == i); } } public void OnClick_Back() { //AudioMgr.ins.PlayBtn(); ViewManager2.HideView(ViewManager2.Path_HomeViewTip); } }