add :添加一部分UI预制体的代码内容
parent
73a0b04dee
commit
49071b8ac6
|
@ -0,0 +1,43 @@
|
|||
using System;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace ZC
|
||||
{
|
||||
[UIType(UIType.AnalysisReportUI)]
|
||||
public class AnalysisReportUI : UIBase
|
||||
{
|
||||
private TMP_Text txt_Title;
|
||||
private TMP_Text txt_Content;
|
||||
private Image img_Pic;
|
||||
private Button btn_Close;
|
||||
private Action closeAction;
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
this.txt_Title = self.transform.FindChildDeep<TMP_Text>("txt_Title");
|
||||
this.txt_Content = self.transform.FindChildDeep<TMP_Text>("txt_Content");
|
||||
this.img_Pic = self.transform.FindChildDeep<Image>("img_Pic");
|
||||
this.btn_Close = self.transform.FindChildDeep<Button>("btn_Close");
|
||||
|
||||
btn_Close.onClick.AddListener(ClickClose);
|
||||
}
|
||||
|
||||
private void ClickClose()
|
||||
{
|
||||
ZCGame.UIManager.HideUI(UIType.AnalysisReportUI);
|
||||
closeAction?.Invoke();
|
||||
closeAction = null;
|
||||
}
|
||||
|
||||
public void SetData(string title, Sprite sprite, string content, Action callback = null)
|
||||
{
|
||||
txt_Title.text = title;
|
||||
img_Pic.sprite = sprite;
|
||||
txt_Content.text = content;
|
||||
closeAction = callback;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: bbbe8e7dd2a14e8e883c315c6548fadc
|
||||
timeCreated: 1730441581
|
|
@ -0,0 +1,40 @@
|
|||
using System;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace ZC
|
||||
{
|
||||
[UIType(UIType.IntroduceUI)]
|
||||
public class IntroduceUI : UIBase
|
||||
{
|
||||
private TMP_Text txt_Title;
|
||||
private TMP_Text txt_Content;
|
||||
private Button btn_Close;
|
||||
private Action closeAction;
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
this.txt_Title = self.transform.FindChildDeep<TMP_Text>("txt_Title");
|
||||
this.txt_Content = self.transform.FindChildDeep<TMP_Text>("txt_Content");
|
||||
this.btn_Close = self.transform.FindChildDeep<Button>("btn_Close");
|
||||
|
||||
btn_Close.onClick.AddListener(ClickClose);
|
||||
}
|
||||
|
||||
private void ClickClose()
|
||||
{
|
||||
ZCGame.UIManager.HideUI(UIType.IntroduceUI);
|
||||
closeAction?.Invoke();
|
||||
closeAction = null;
|
||||
}
|
||||
|
||||
public void SetData(string title, string content, Action callback = null)
|
||||
{
|
||||
txt_Title.text = title;
|
||||
txt_Content.text = content;
|
||||
closeAction = callback;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: feafec9a827447d589afa0c665de32a0
|
||||
timeCreated: 1730442480
|
|
@ -0,0 +1,39 @@
|
|||
using System;
|
||||
using TMPro;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace ZC
|
||||
{
|
||||
[UIType(UIType.MinTipsUI)]
|
||||
public class MinTipsUI : UIBase
|
||||
{
|
||||
private TMP_Text txt_Title;
|
||||
private TMP_Text txt_Content;
|
||||
private Button btn_Close;
|
||||
private Action closeAction;
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
this.txt_Title = self.transform.FindChildDeep<TMP_Text>("txt_Title");
|
||||
this.txt_Content = self.transform.FindChildDeep<TMP_Text>("txt_Content");
|
||||
this.btn_Close = self.transform.FindChildDeep<Button>("btn_Close");
|
||||
|
||||
btn_Close.onClick.AddListener(ClickClose);
|
||||
}
|
||||
|
||||
private void ClickClose()
|
||||
{
|
||||
ZCGame.UIManager.HideUI(UIType.IntroduceUI);
|
||||
closeAction?.Invoke();
|
||||
closeAction = null;
|
||||
}
|
||||
|
||||
public void SetData(string title, string content, Action callback = null)
|
||||
{
|
||||
txt_Title.text = title;
|
||||
txt_Content.text = content;
|
||||
closeAction = callback;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f3a6ff210a2c4f5098ef1a728f5021dd
|
||||
timeCreated: 1730442815
|
|
@ -5,6 +5,9 @@
|
|||
LoadingUI,
|
||||
GameUI,
|
||||
AnswerUI,
|
||||
AnalysisReportUI,
|
||||
IntroduceUI,
|
||||
MinTipsUI
|
||||
}
|
||||
|
||||
public enum UILayer
|
||||
|
|
Loading…
Reference in New Issue