yyl
3 天以前 1614a7b16b521225c98c507f92d6c5a43b49211c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
 * @Author: 玩个游戏
 * @Date: 2025-09-25 15:16:21
 */
 
using UnityEngine;
using UnityEngine.UI;
 
// 显示货币的勾选确认框,按钮标题等信息需要更改的话 后续补充
public class MoneyIconToggleConfirmWin : UIBase
{
    [SerializeField] Text m_Content;
    [SerializeField] Text m_ToggleTxt;
    [SerializeField] Toggle m_Toggle;
    [SerializeField] Button m_ConfirmBtn;
    [SerializeField] Button m_CancelBtn;
    [SerializeField] Text moneyText;
    [SerializeField] Image moneyIcon;
    protected override void InitComponent()
    {
        m_ConfirmBtn.AddListener(OnConfirm);
        m_CancelBtn.AddListener(OnCancel);
    }
 
    protected override void OnPreOpen()
    {
        m_Content.text = ConfirmCancel.generalContent;
        m_ToggleTxt.text = ConfirmCancel.toggleContent;
        m_Toggle.isOn = ConfirmCancel.toggleOpenState;
 
        moneyText.text = UIHelper.ShowUseMoney(ConfirmCancel.moneyType, ConfirmCancel.moneyNeedCount);
        moneyIcon.SetIconWithMoneyType(ConfirmCancel.moneyType);
        // m_CancelBtn.SetActive(ConfirmCancel.OnToggleConfirmEvent != null);
 
        // if (string.IsNullOrEmpty(ConfirmCancel.OKName))
        //     (m_ConfirmBtn.FindComponent("Text", "Text") as Text).text = Language.Get("PopConfirmWin_OK");
        // else
        //     (m_ConfirmBtn.FindComponent("Text", "Text") as Text).text = ConfirmCancel.OKName;
        // if (string.IsNullOrEmpty(ConfirmCancel.CancelName))
        //     (m_CancelBtn.FindComponent("Text", "Text") as Text).text = Language.Get("PopConfirmWin_Cancel");
        // else
        //     (m_CancelBtn.FindComponent("Text", "Text") as Text).text = ConfirmCancel.CancelName;
    }
 
 
    private void OnConfirm()
    {
        CloseWindow();
        if (ConfirmCancel.OnToggleConfirmEvent != null)
        {
            ConfirmCancel.OnToggleConfirmEvent(true, m_Toggle.isOn);
        }
    }
 
    private void OnCancel()
    {
        CloseWindow();
        if (ConfirmCancel.OnToggleConfirmEvent != null)
        {
            ConfirmCancel.OnToggleConfirmEvent(false, m_Toggle.isOn);
        }
 
    }
 
 
}