Cute_demon_attacks/meng_yao/Assets/script/TanChuang/GgTanchuang.cs

94 lines
2.8 KiB
C#
Raw Normal View History

2024-11-07 18:03:20 +08:00
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;
2024-12-25 15:20:43 +08:00
public Transform canvas;
2024-11-07 18:03:20 +08:00
// Start is called before the first frame update
2024-11-07 18:03:20 +08:00
void Start()
{
Ggbtn.onClick.AddListener(Display_pop_up_window);
2024-12-25 15:20:43 +08:00
// canvas = GameObject.Find("MainCanvas").transform;
2024-11-08 16:29:30 +08:00
//GgPanel = this.GetComponent<RectTransform>();
2024-11-07 18:03:20 +08:00
}
private async void Display_pop_up_window()
2024-11-07 18:03:20 +08:00
{
GgPanel.DOScale(Deflate, 0.3f).SetEase(Ease.OutBack);
hdtxbg.sprite = GgglDownsp;
StartCoroutine(Magnify(GgPanel));
NoticeIndfo noticeIndfo = await Scene_main_jiekou.instance.NoticeInfos(1);
string n;
if (noticeIndfo.Data.exist == 0)
{
n = "";
}
else
{
n = noticeIndfo.Data.notice.content;
}
2024-11-07 18:03:20 +08:00
List<BoxType> boxTypes = new List<BoxType>();
boxTypes.Add(new BoxType { Name = "", prompt = "", Type = 9,widthnum =700,WidthHeight =650 ,content = n }) ;
2024-12-23 14:26:13 +08:00
boxTypes.Add(new BoxType { Name = "", prompt = <><C8B7>", Type = 11 });
2024-12-25 12:02:14 +08:00
GameObject gameObject = add_pop_up();
2024-11-07 18:03:20 +08:00
gameObject.transform.SetParent(canvas);
2024-12-25 15:20:43 +08:00
2024-12-25 12:02:14 +08:00
gameObject.transform.position = new Vector3(Screen.width/2,Screen.height/2,0);
2024-12-25 15:20:43 +08:00
RectTransform re = gameObject.GetComponent<RectTransform>();
re.offsetMin = new Vector2(0, 0);
2024-12-29 21:25:01 +08:00
re.offsetMax = new Vector2(0, 0);
re.localScale = Vector3.one;
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>recttransformʹ<6D><CAB9><EFBFBD>ܹ<EFBFBD><DCB9><EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ
2024-12-25 15:20:43 +08:00
2024-11-07 18:03:20 +08:00
gameObject.GetComponent<input_box_pop_up_window>().minHeight = 800;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͸߶<CDB8>
2024-11-15 15:13:21 +08:00
gameObject.GetComponent<input_box_pop_up_window>().setScrollMode(0);//<2F><><EFBFBD>ù<EFBFBD><C3B9><EFBFBD>ģʽΪ<CABD><CEAA><EFBFBD><EFBFBD>
2024-11-07 18:03:20 +08:00
//gameObject.GetComponent<input_box_pop_up_window>().setScrollMode(0);//<2F><><EFBFBD>ù<EFBFBD><C3B9><EFBFBD>ģʽΪ<CABD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>
List<GameObject> gameObjects = gameObject.GetComponent<input_box_pop_up_window>().updateUI(boxTypes, noticeIndfo.Data.notice.title);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD>
2024-11-07 18:03:20 +08:00
gameObjects[1].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//<2F><>¼ȷ<C2BC><C8B7><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1>
{
if (type == 1)
{
gameObject.GetComponent<input_box_pop_up_window>().destroy();
2024-12-25 12:02:14 +08:00
2024-11-07 18:03:20 +08:00
}
});
}
IEnumerator Magnify(RectTransform allpanel)
{
2024-11-08 16:29:30 +08:00
Debug.Log(<>й<EFBFBD><D0B9><EFBFBD><E6B5AF>Э<EFBFBD><D0AD>");
allpanel.DOScale(Vector3.one, 0.8f).SetEase(Ease.OutBack).OnComplete(() =>
{
hdtxbg.sprite = GgglUpsp;
});
2024-11-07 18:03:20 +08:00
yield return null;
2024-11-08 16:29:30 +08:00
2024-11-07 18:03:20 +08:00
}
// Update is called once per frame
void Update()
{
}
}