123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- using SUIFW;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public enum PopType
- {
- PopOne = 1,
- PopTwo = 2
- }
- public class PopForms : BaseUIForms
- {
- public static PopForms Instance;
- public Text mainText;
- public Button popOneBtn;
- public Text popOneBtnText;
- public Button popTwoOkBtn;
- public Text popTwoOkBtnText;
- public Button popTwoCanelBtn;
- public Text popTwoCanelBtnText;
- private void Awake()
- {
- Instance = this;
- CurrentUIType.UIForms_Type = UIFormsType.PopUp;
- CurrentUIType.UIForms_ShowMode = UIFormsShowMode.ReverseChange;
- }
- public void ShowPublic(PopType popType, string msg, string btnmsg1 = "确定", Action ok = null, string btnmsg2 = "取消", Action cancel = null)
- {
- switch (popType)
- {
- case PopType.PopOne:
- ShowPopOne(btnmsg1, ok);
- break;
- case PopType.PopTwo:
- ShowPopTwo(btnmsg1, ok, btnmsg2, cancel);
- break;
- }
- mainText.text = msg;
- }
- public void ShowPopOne(string btnmsg1, Action ok)
- {
- popOneBtn.gameObject.SetActive(true);
- popOneBtn.onClick.RemoveAllListeners();
- popTwoOkBtn.gameObject.SetActive(false);
- popTwoCanelBtn.gameObject.SetActive(false);
- popOneBtnText.text = btnmsg1;
- popOneBtn.onClick.AddListener(() =>
- {
- CloseOrReturnUIForms();
- ok?.Invoke();
- }
- );
- }
- public void ShowPopTwo(string btnmsg1, Action ok, string btnmsg2, Action cancel)
- {
- popTwoOkBtn.gameObject.SetActive(true);
- popTwoCanelBtn.gameObject.SetActive(true);
- popTwoOkBtn.onClick.RemoveAllListeners();
- popTwoCanelBtn.onClick.RemoveAllListeners();
- popOneBtn.gameObject.SetActive(false);
- popTwoOkBtn.onClick.AddListener(() =>
- {
- CloseOrReturnUIForms();
- ok?.Invoke();
- });
- popTwoOkBtnText.text = btnmsg1;
- popTwoCanelBtn.onClick.AddListener(() =>
- {
- CloseOrReturnUIForms();
- cancel?.Invoke();
- });
- popTwoCanelBtnText.text = btnmsg2;
- }
- #region 窗体生命周期
- public override void Display()
- {
- base.Display();
- }
- public override void Redisplay()
- {
- base.Redisplay();
- }
- public override void Freeze()
- {
- base.Freeze();
- }
- public override void Hiding()
- {
- base.Hiding();
- }
- #endregion
- }
|