using System; // using DG.Tweening; using Unity.VisualScripting; using UnityEngine; using UnityEngine.UI; namespace Plugins.CxShine.page { public class PageComp : MonoBehaviour { public delegate void onPageClosingListener(); public GameObject playAnimBackGround; public string pageName; private bool _isShowAnim; private Action _onClose; private onPageClosingListener _onPageClosing; public Action OnPause; public Action OnResume; // Start is called before the first frame update private void Start() { if (playAnimBackGround == null) // 如果播放动画的背景go没有设置,就是自己 playAnimBackGround = gameObject; //Debug.Log("启动页面" + pageName); _initClickEvents(); if (_isShowAnim) _playOpenAnim(); } // Update is called once per frame private void Update() { } public void setOnPageCloseListener(Action action) { _onClose = action; } private void _initClickEvents() { // find all 'ClosePageButton' tag add closePageEvent var trans = gameObject.GetComponentsInChildren(); foreach (var t in trans) if ("ClosePageButton".Equals(t.gameObject.tag)) t.gameObject.GetOrAddComponent