| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 | using DG.Tweening;using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEngine.UI;public class ThreeDNav : MonoBehaviour{    public Vector2[] targetPos;    public Image s_image;    public List<Button> btns;    public List<RectTransform> layers;    public GameObject content;    public RectTransform znz;    public GCJKLayer gCJK;    public ObsPlayerPanel obsPlayerPanel;    public static ThreeDNav instance;    private void Awake()    {        instance = this;    }    private void Start()    {        CameraManager.SwitchCamera(0);        InitButton();        StaticLod.instance.OnFoucusStatic("TaoKou");    }    void InitButton()    {        btns = new List<Button>();        Button[] bts = this.GetComponentsInChildren<Button>();        for (int i = 0; i < bts.Length; i++)        {            btns.Add(bts[i]);        }        layers = new List<RectTransform>();        for (int i = 0; i < content.transform.childCount; i++)        {            layers.Add(content.transform.GetChild(i).GetComponent<RectTransform>());        }        for (int i = 0; i < btns.Count; i++)        {            int index = i;            btns[index].onClick.AddListener(() =>            {                for (int j = 0; j < layers.Count; j++)                {                    layers[j].gameObject.SetActive(false);                }                for (int j = 0; j < btns.Count; j++)                {                    btns[j].GetComponentInChildren<Text>().color = new Color32(137, 147, 173, 255);                }                obsPlayerPanel.gameObject.SetActive(false);                btns[index].GetComponentInChildren<Text>().color = Color.white;                Tweener tw = s_image.GetComponent<RectTransform>().DOLocalMoveX(targetPos[index].x, 0.3f);                tw.SetEase(Ease.OutBack);                if (index < layers.Count)                {                    layers[index].gameObject.SetActive(true);                }                if (index == 4)                {                    StaticLod.instance.OnFoucusStatic("Bird0");                }                else if (index == 1)                {                    gCJK.OnBuYuanClick();                }                else                {                    StaticLod.instance.OnFoucusStatic("TaoKou");                }            });        }    }    public void ShowObsPanel(ObsData _data)    {        obsPlayerPanel.gameObject.SetActive(true);        obsPlayerPanel.SetObsData(_data);        obsPlayerPanel.SetTitle(_data.name);    }    private void Update()    {        znz.transform.rotation = Quaternion.Lerp(znz.transform.rotation, Quaternion.Euler(0, 0, CameraManager.instance.mainCamera.transform.localEulerAngles.y), Time.deltaTime * 4);    }}
 |