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