| 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, bool _toggle = false) | 
|     { | 
|         generalTitle = title; | 
|         generalContent = content; | 
|         toggleContent = toggleTxt; | 
|         OnToggleSingleConfirmEvent = null; | 
|         OnToggleConfirmEvent = func; | 
|         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, 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的确认类型,方便外部调用 | 
|     static Dictionary<int, bool> toggleCheckDict = new Dictionary<int, bool>(); | 
|     public enum ToggleCheckType | 
|     { | 
|         Auction = 0, //拍卖行 | 
|     } | 
|   | 
|     public static void ToggleConfirmCancelByType(int 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 int generalItemId; | 
|     // public static int generalItemCnt; | 
|     // public static Action ItemConfirmEvent; | 
|     // public static void ShowItemConfirm(string info, int _itemId, int _itemCnt, Action func) | 
|     // { | 
|     //     generalItemTip = info; | 
|     //     generalItemId = _itemId; | 
|     //     generalItemCnt = _itemCnt; | 
|     //     ItemConfirmEvent = func; | 
|     //     if (!UIManager.Instance.IsOpened<ItemConfirmWin>()) | 
|     //     { | 
|     //         UIManager.Instance.OpenWindow<ItemConfirmWin>(); | 
|     //     } | 
|     // } | 
|   | 
|     // public static List<Item> getItems { get; private set; } | 
|     // //多物品确认框 | 
|     // public static void ShowItemsConfirm(List<Item> items, string tiltle, string info, string btnText, Action func, int moneyCnt = 0, int type = 0) | 
|     // { | 
|     //     getItems = items; | 
|     //     generalTitle = tiltle; | 
|     //     generalItemTip = info; | 
|     //     ItemConfirmEvent = func; | 
|     //     OKName = btnText; | 
|     //     ItemConfirmEvent = func; | 
|     //     moneyType = type; | 
|     //     moneyNeedCount = moneyCnt; | 
|     //     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>(); | 
|     //     } | 
|     // } | 
|   | 
| } |