| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class HomeView_Tip : MonoBehaviour
- {
- [SerializeField] List<GameObject> 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<Canvas>();
- //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<RectTransform>(), centerPos, UICamera, out globalMousePos);
- //Debug.Log("IconConnect:" + _IconConnect.GetComponent<RectTransform>().rect);
- //Rect rect = _IconConnect.GetComponent<RectTransform>().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);
- }
- }
|