using System.Collections; 
 | 
using System.Collections.Generic; 
 | 
using UnityEngine; 
 | 
using System; 
 | 
  
 | 
public class ConfirmCancel 
 | 
{ 
 | 
    public static Action<bool> OnPopConfirmClickEvent; 
 | 
    public static Action<bool> OnPopConfirmClickExEvent; 
 | 
    public static Action OnPopSingleConfirmEvent; 
 | 
    public static string popConfirmTitle { get; private set; } 
 | 
    public static string popConfirmInfo { get; private set; } 
 | 
    public static bool IsSingleConfirm { get; private set; } 
 | 
    public static string OKName { get; private set; } 
 | 
    public static string CancelName { get; private set; } 
 | 
  
 | 
    //取消/确认弹框 
 | 
    public static void ShowPopConfirm(string title, string info, Action<bool> func) 
 | 
    { 
 | 
        popConfirmTitle = title; 
 | 
        popConfirmInfo = info; 
 | 
        OnPopConfirmClickEvent = func; 
 | 
        OnPopSingleConfirmEvent = null; 
 | 
        IsSingleConfirm = false; 
 | 
        OKName = null; 
 | 
        CancelName = null; 
 | 
        if (!UIManager.Instance.IsOpened<PopConfirmWin>()) 
 | 
        { 
 | 
            UIManager.Instance.OpenWindow<PopConfirmWin>(); 
 | 
        } 
 | 
    } 
 | 
  
 | 
    //取消/确认弹框 func1对应确认按钮旁边的取消按钮 func2对应右上角的圆形取消按钮 
 | 
    public static void ShowPopConfirmEx(string title, string info, Action<bool> func1, Action<bool> func2) 
 | 
    { 
 | 
        popConfirmTitle = title; 
 | 
        popConfirmInfo = info; 
 | 
        OnPopConfirmClickEvent = func1; 
 | 
        OnPopSingleConfirmEvent = null; 
 | 
        OnPopConfirmClickExEvent = func2; 
 | 
        IsSingleConfirm = false; 
 | 
        OKName = null; 
 | 
        CancelName = null; 
 | 
        if (!UIManager.Instance.IsOpened<PopConfirmWin>()) 
 | 
        { 
 | 
            UIManager.Instance.OpenWindow<PopConfirmWin>(); 
 | 
        } 
 | 
    } 
 | 
  
 | 
    //单按钮确认框 
 | 
    public static void ShowPopConfirm(string title, string info, Action func = null) 
 | 
    { 
 | 
        popConfirmTitle = title; 
 | 
        popConfirmInfo = info; 
 | 
        OnPopConfirmClickEvent = null; 
 | 
        OnPopSingleConfirmEvent = func; 
 | 
        IsSingleConfirm = true; 
 | 
        OKName = null; 
 | 
        CancelName = null; 
 | 
        if (!UIManager.Instance.IsOpened<PopConfirmWin>()) 
 | 
        { 
 | 
            UIManager.Instance.OpenWindow<PopConfirmWin>(); 
 | 
        } 
 | 
    } 
 | 
  
 | 
    //带两个按钮的确认框 可改变按钮文字 
 | 
    public static void ShowPopConfirm(string title, string info, string okName, string cancelName, Action<bool> func) 
 | 
    { 
 | 
        popConfirmTitle = title; 
 | 
        popConfirmInfo = info; 
 | 
        OnPopConfirmClickEvent = func; 
 | 
        OnPopSingleConfirmEvent = null; 
 | 
        IsSingleConfirm = false; 
 | 
        OKName = okName; 
 | 
        CancelName = cancelName; 
 | 
        if (!UIManager.Instance.IsOpened<PopConfirmWin>()) 
 | 
        { 
 | 
            UIManager.Instance.OpenWindow<PopConfirmWin>(); 
 | 
        } 
 | 
    } 
 | 
  
 | 
    // //可改变确认按钮文字的单按钮确认框,(命名与境界无关) 
 | 
    // public static void ShowRealmPopConfirm(string title, string info, string okName, Action func = null) 
 | 
    // { 
 | 
    //     popConfirmTitle = title; 
 | 
    //     popConfirmInfo = info; 
 | 
    //     OKName = okName; 
 | 
    //     OnPopConfirmClickEvent = null; 
 | 
    //     OnPopSingleConfirmEvent = func; 
 | 
    //     IsSingleConfirm = true; 
 | 
    //     if (!UIManager.Instance.IsOpened<RealmPopConfirmWin>()) 
 | 
    //     { 
 | 
    //         UIManager.Instance.OpenWindow<RealmPopConfirmWin>(); 
 | 
    //     } 
 | 
    // } 
 | 
  
 | 
    // public static void ShowRuneTowerPopConfirm(string title, string info, Action<bool> func) 
 | 
    // { 
 | 
    //     popConfirmTitle = title; 
 | 
    //     popConfirmInfo = info; 
 | 
    //     OnPopConfirmClickEvent = func; 
 | 
    //     OnPopSingleConfirmEvent = null; 
 | 
    //     IsSingleConfirm = false; 
 | 
    //     UIManager.Instance.OpenWindow<RuneTowerConfirmWin>(); 
 | 
    // } 
 | 
  
 | 
  
 | 
    // public static void CancelAuctionPopConfirm(string title, string info, Action<bool> func) 
 | 
    // { 
 | 
    //     popConfirmTitle = title; 
 | 
    //     popConfirmInfo = info; 
 | 
    //     OnPopConfirmClickEvent = func; 
 | 
    //     OnPopSingleConfirmEvent = null; 
 | 
    //     IsSingleConfirm = false; 
 | 
    //     UIManager.Instance.OpenWindow<CancelAuctionConfirmWin>(); 
 | 
    // } 
 | 
  
 | 
    public static string generalTitle; 
 | 
    public static string generalContent; 
 | 
    public static string toggleContent { get; private set; } 
 | 
    public static bool toggleOpenState { get; private set; } 
 | 
    public static Action<bool, bool> OnToggleConfirmEvent; 
 | 
    public static Action<bool> OnToggleSingleConfirmEvent; 
 | 
    public static Action<bool, bool> OnToggleConfirmEventEx; 
 | 
    //带toggle的确认和取消 
 | 
    public static void ToggleConfirmCancel(string title, string content, string toggleTxt, Action<bool, bool> func, string okName = "", bool _toggle = false) 
 | 
    { 
 | 
        generalTitle = title; 
 | 
        generalContent = content; 
 | 
        toggleContent = toggleTxt; 
 | 
        OnToggleSingleConfirmEvent = null; 
 | 
        OnToggleConfirmEvent = func; 
 | 
        toggleOpenState = _toggle; 
 | 
        OKName = okName; 
 | 
        CancelName = null; 
 | 
        if (!UIManager.Instance.IsOpened<ToggleConfirmWin>()) 
 | 
        { 
 | 
            UIManager.Instance.OpenWindow<ToggleConfirmWin>(); 
 | 
        } 
 | 
    } 
 | 
  
 | 
    //带toggle的只有确认按钮 
 | 
    public static void ToggleConfirmCancel(string title, string content, string toggleTxt, Action<bool> func, bool _toggle = false) 
 | 
    { 
 | 
        generalTitle = title; 
 | 
        generalContent = content; 
 | 
        toggleContent = toggleTxt; 
 | 
        OnToggleConfirmEvent = null; 
 | 
        OnToggleSingleConfirmEvent = func; 
 | 
        toggleOpenState = _toggle; 
 | 
        OKName = null; 
 | 
        CancelName = null; 
 | 
        if (!UIManager.Instance.IsOpened<ToggleConfirmWin>()) 
 | 
        { 
 | 
            UIManager.Instance.OpenWindow<ToggleConfirmWin>(); 
 | 
        } 
 | 
    } 
 | 
  
 | 
    //带toggle的确认和取消 右上角圆形关闭按钮也有回调函数 
 | 
    public static void ToggleConfirmCancelEx(string title, string content, string toggleTxt, Action<bool, bool> func, Action<bool, bool> func1, bool _toggle = false) 
 | 
    { 
 | 
        generalTitle = title; 
 | 
        generalContent = content; 
 | 
        toggleContent = toggleTxt; 
 | 
        OnToggleSingleConfirmEvent = null; 
 | 
        OnToggleConfirmEvent = func; 
 | 
        OnToggleConfirmEventEx = func1; 
 | 
        toggleOpenState = _toggle; 
 | 
        OKName = null; 
 | 
        CancelName = null; 
 | 
        if (!UIManager.Instance.IsOpened<ToggleConfirmWin>()) 
 | 
        { 
 | 
            UIManager.Instance.OpenWindow<ToggleConfirmWin>(); 
 | 
        } 
 | 
    } 
 | 
  
 | 
    //带toggle的确定和取消按钮,且可以改变按钮文字 
 | 
    public static void ToggleConfirmCancel(string title, string content, string toggleTxt, string okName, string cancelName, Action<bool, bool> func, bool _toggle = false) 
 | 
    { 
 | 
        generalTitle = title; 
 | 
        generalContent = content; 
 | 
        toggleContent = toggleTxt; 
 | 
        OnToggleSingleConfirmEvent = null; 
 | 
        OnToggleConfirmEvent = func; 
 | 
        toggleOpenState = _toggle; 
 | 
        OKName = okName; 
 | 
        CancelName = cancelName; 
 | 
        if (!UIManager.Instance.IsOpened<ToggleConfirmWin>()) 
 | 
        { 
 | 
            UIManager.Instance.OpenWindow<ToggleConfirmWin>(); 
 | 
        } 
 | 
    } 
 | 
  
 | 
    //本次登陆不再提示, toggle的确认类型,方便外部调用 
 | 
    public static Dictionary<ToggleCheckType, bool> toggleCheckDict = new Dictionary<ToggleCheckType, bool>(); 
 | 
  
 | 
  
 | 
    public static void ToggleConfirmCancelByType(ToggleCheckType type, string fullTip, Action func) 
 | 
    { 
 | 
        if (toggleCheckDict.ContainsKey(type) && toggleCheckDict[type]) 
 | 
        { 
 | 
            func?.Invoke(); 
 | 
            return; 
 | 
        } 
 | 
  
 | 
        ToggleConfirmCancel(Language.Get("Mail101"), fullTip, 
 | 
            Language.Get("ConfirmCancel102"), (bool isOk, bool isToggle) => 
 | 
            { 
 | 
                if (isOk) 
 | 
                { 
 | 
                    func?.Invoke(); 
 | 
                    toggleCheckDict[type] = isToggle; 
 | 
                } 
 | 
  
 | 
            }); 
 | 
    } 
 | 
  
 | 
  
 | 
  
 | 
  
 | 
    // public static string iconTitle; 
 | 
    // public static string iconTopInfo; 
 | 
    // public static string iconBottomInfo; 
 | 
    // public static int iconItemId; 
 | 
    // public static int iconNeedCnt; 
 | 
    // public static int iconHaveCnt; 
 | 
    // public static string iconToggleText { get; private set; } 
 | 
    // public static Action<bool, bool> OnIconToggleConfirmAct; 
 | 
    // public static void IconConfirmCancel(string title, string topInfo, int id, 
 | 
    //   int haveCnt, int needCnt, string bottomInfo, string toggleTxt, Action<bool, bool> func) 
 | 
    // { 
 | 
    //     iconTitle = title; 
 | 
    //     iconTopInfo = topInfo; 
 | 
    //     iconBottomInfo = bottomInfo; 
 | 
    //     iconItemId = id; 
 | 
    //     iconHaveCnt = haveCnt; 
 | 
    //     iconNeedCnt = needCnt; 
 | 
    //     iconToggleText = toggleTxt; 
 | 
    //     OnIconToggleConfirmAct = func; 
 | 
    //     if (!UIManager.Instance.IsOpened<IconConfirmWin>()) 
 | 
    //     { 
 | 
    //         UIManager.Instance.OpenWindow<IconConfirmWin>(); 
 | 
    //     } 
 | 
    // } 
 | 
  
 | 
  
 | 
    // public static Action<bool> OnFairyLeagueGuideEvent; 
 | 
    // public static void ShowFairyLeagueGuide(Action<bool> func = null) 
 | 
    // { 
 | 
    //     OnFairyLeagueGuideEvent = func; 
 | 
    //     if (!UIManager.Instance.IsOpened<FairyLeagueGuideSelectWin>()) 
 | 
    //     { 
 | 
    //         UIManager.Instance.OpenWindow<FairyLeagueGuideSelectWin>(); 
 | 
    //     } 
 | 
    // } 
 | 
  
 | 
    public static string generalItemTip; 
 | 
    public static string generalItemTip2; 
 | 
  
 | 
    public static List<Item> getItems { get; private set; } 
 | 
    public static string replaceItemName; 
 | 
    /// <summary> 
 | 
    /// 多物品确认框 
 | 
    /// </summary> 
 | 
    /// <param name="items"></param> 
 | 
    /// <param name="tiltle"></param> 
 | 
    /// <param name="info"></param> 
 | 
    /// <param name="func"></param> 
 | 
    /// <param name="info2"></param> 
 | 
    /// <param name="btnText">为空时默认显示确定文字</param> 
 | 
    /// <param name="moneyCnt"></param> 
 | 
    /// <param name="type"></param> 
 | 
    public static void ShowItemsConfirm(List<Item> items, string tiltle, string info, Action<bool> func, 
 | 
        string info2 = "", string btnText = "", int moneyCnt = 0, int type = 0, string itemName = "") 
 | 
    { 
 | 
        getItems = items; 
 | 
        generalTitle = tiltle; 
 | 
        generalItemTip = info; 
 | 
        generalItemTip2 = info2; 
 | 
        OKName = btnText; 
 | 
        OnPopConfirmClickEvent = func; 
 | 
        moneyType = type; 
 | 
        moneyNeedCount = moneyCnt; 
 | 
        replaceItemName = itemName; 
 | 
        if (!UIManager.Instance.IsOpened<ItemsConfirmWin>()) 
 | 
        { 
 | 
            UIManager.Instance.OpenWindow<ItemsConfirmWin>(); 
 | 
        } 
 | 
    } 
 | 
  
 | 
  
 | 
  
 | 
    public static string moneyTitle; 
 | 
    public static string moneyTopInfo; 
 | 
    public static string moneybtnOkText; 
 | 
    public static int moneyType; 
 | 
    public static int moneyNeedCount; 
 | 
    public static ulong moneyHaveCount; 
 | 
    public static string moneyToggleText { get; private set; } 
 | 
    public static bool moneytoggleOpen { get; private set; } 
 | 
    public static bool moneytoggleOpenState { get; private set; } 
 | 
  
 | 
    // public static Action<bool, bool> OnMoneyToggleConfirmAct; 
 | 
    // public static void MoneyIconToggleConfirm(string title, string topInfo,string okTxt, int type, 
 | 
    //  int needCnt, ulong haveCnt, Action<bool, bool> func, bool toggleOpen = false, string toggleTxt = "", bool toggleOpenState = false) 
 | 
    // { 
 | 
    //     moneyTitle = title; 
 | 
    //     moneyTopInfo = topInfo; 
 | 
    //     moneybtnOkText = okTxt; 
 | 
    //     moneyType = type; 
 | 
    //     moneyNeedCount = needCnt; 
 | 
    //     moneyHaveCount = haveCnt; 
 | 
    //     moneyToggleText = toggleTxt; 
 | 
    //     moneytoggleOpen = toggleOpen; 
 | 
    //     moneytoggleOpenState = toggleOpenState; 
 | 
    //     OnMoneyToggleConfirmAct = func; 
 | 
    //     if (!UIManager.Instance.IsOpened<MoneyIconToggleConfirmWin>()) 
 | 
    //     { 
 | 
    //         UIManager.Instance.OpenWindow<MoneyIconToggleConfirmWin>(); 
 | 
    //     } 
 | 
    // } 
 | 
  
 | 
} 
 | 
  
 | 
public enum ToggleCheckType 
 | 
{ 
 | 
    Auction = 0, //拍卖行 
 | 
    WashCancel = 1, //洗练取消 
 | 
} 
 |