using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using DG.Tweening; public class GgTanchuang : mount { public Button Ggbtn; public Image hdtxbg; public RectTransform GgPanel; Vector3 Deflate = new Vector3(0.5f, 0.5f, 0.5f); public Sprite GgglDownsp; public Sprite GgglUpsp; public Transform canvas; // Start is called before the first frame update private void Awake() { } void Start() { Ggbtn.onClick.AddListener(Display_pop_up_window); //GgPanel = this.GetComponent(); } private void Display_pop_up_window() { GgPanel.DOScale(Deflate, 0.3f).SetEase(Ease.OutBack); hdtxbg.sprite = GgglDownsp; StartCoroutine(Magnify(GgPanel)); List boxTypes = new List(); boxTypes.Add(new BoxType { Name = "", prompt = "", Type = 9,widthnum =700,WidthHeight =650 ,content = "内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容" }) ; boxTypes.Add(new BoxType { Name = "", prompt = "", Type = 11 }); GameObject gameObject = add_pop_up(); gameObject.transform.position = new Vector3(Screen.width/2,Screen.height/2,0); gameObject.transform.SetParent(canvas); gameObject.GetComponent().minHeight = 800;//设置最低高度 gameObject.GetComponent().setScrollMode(1);//设置滚动模式为滚动 //gameObject.GetComponent().setScrollMode(0);//设置滚动模式为自动填充 List gameObjects = gameObject.GetComponent().updateUI(boxTypes, "公告");//测试输入框回调处理 gameObjects[1].GetComponent().register_click(async (BoxType boxType, int type) =>//登录确定或取消 { if (type == 1) { gameObject.GetComponent().destroy(); } }); } IEnumerator Magnify(RectTransform allpanel) { Debug.Log("执行公告弹窗协程"); allpanel.DOScale(Vector3.one, 0.8f).SetEase(Ease.OutBack).OnComplete(() => { hdtxbg.sprite = GgglUpsp; }); yield return null; } // Update is called once per frame void Update() { } }