using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using DG.Tweening; public class SettingTanChuang : MonoBehaviour { public GameObject SettingPanel; public Button Settingbtn; public Image hdtxbg; public RectTransform SettingRect; Vector3 Deflate = new Vector3(0.5f, 0.5f, 0.5f); public Sprite SettingDownsp; public Sprite SettingUpsp; public Transform canvas; private void Awake() { } void Start() { Settingbtn.onClick.AddListener(Display_pop_up_window); SettingRect = this.GetComponent(); SettingPanel.gameObject.SetActive(false); } private void Display_pop_up_window() { SettingRect.DOScale(Deflate, 0.3f).SetEase(Ease.OutBack); hdtxbg.sprite = SettingDownsp; StartCoroutine(Magnify(SettingRect)); SettingPanel.gameObject.SetActive(true); } public void CloseClick() { SettingPanel.gameObject.SetActive(false); } IEnumerator Magnify(RectTransform allpanel) { Debug.Log("执行公告弹窗协程"); allpanel.DOScale(Vector3.one, 0.8f).SetEase(Ease.OutBack).OnComplete(() => { hdtxbg.sprite = SettingUpsp; }); yield return null; } }