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