Cute_demon_attacks/meng_yao/Assets/script/GgTanchuang.cs
2024-11-12 21:10:56 +08:00

78 lines
2.5 KiB
C#

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<RectTransform>();
}
private void Display_pop_up_window()
{
GgPanel.DOScale(Deflate, 0.3f).SetEase(Ease.OutBack);
hdtxbg.sprite = GgglDownsp;
StartCoroutine(Magnify(GgPanel));
List<BoxType> boxTypes = new List<BoxType>();
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<input_box_pop_up_window>().minHeight = 800;//设置最低高度
gameObject.GetComponent<input_box_pop_up_window>().setScrollMode(1);//设置滚动模式为滚动
//gameObject.GetComponent<input_box_pop_up_window>().setScrollMode(0);//设置滚动模式为自动填充
List<GameObject> gameObjects = gameObject.GetComponent<input_box_pop_up_window>().updateUI(boxTypes, "公告");//测试输入框回调处理
gameObjects[1].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//登录确定或取消
{
if (type == 1)
{
gameObject.GetComponent<input_box_pop_up_window>().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()
{
}
}