/* 
 | 
 * @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); 
 | 
        } 
 | 
  
 | 
    } 
 | 
  
 | 
  
 | 
} 
 |