using System; using System.Threading.Tasks; using TapTap.AntiAddiction.Model; using TapTap.AntiAddiction.Internal; using TapSDK.UI; namespace TapTap.AntiAddiction { public static class TapTapAntiAddictionUIKit { /// /// 打开健康提醒窗口 /// internal static void OpenVerifyFinishPanel(Action onOk = null) { var path = AntiAddictionConst.GetPrefabPath(AntiAddictionConst.VERIFY_FINISH_PANEL_NAME, false); var verifyFinishPanel = UIManager.Instance.OpenUI(path); verifyFinishPanel.Show(null, onOk); } /// /// 打开健康提醒窗口 /// internal static void OpenHealthReminderPanel(PlayableResult playable, Action onOk = null, Action onSwitchAccount = null) { var path = AntiAddictionConst.GetPrefabPath(AntiAddictionConst.HEALTH_REMINDER_PANEL_NAME, TapTapAntiAddictionManager.IsUseMobileUI()); var healthReminderPanel = UIManager.Instance.OpenUI(path); healthReminderPanel.Show(playable, onOk, onSwitchAccount); } /// /// 打开健康充值提醒窗口 /// /// internal static void OpenHealthPaymentPanel(PayableResult payable) { var path = AntiAddictionConst.GetPrefabPath(AntiAddictionConst.HEALTH_PAYMENT_PANEL_NAME, TapTapAntiAddictionManager.IsUseMobileUI()); var healthPaymentPanel = UIManager.Instance.OpenUI(path); healthPaymentPanel.Show(payable); } /// /// 打开健康充值提醒窗口.填入自定义的文本内容 /// /// /// /// internal static void OpenHealthPaymentPanel(string title, string content, string buttonText, Action onOk = null) { var path = AntiAddictionConst.GetPrefabPath(AntiAddictionConst.HEALTH_PAYMENT_PANEL_NAME, TapTapAntiAddictionManager.IsUseMobileUI()); var healthPaymentPanel = UIManager.Instance.OpenUI(path); healthPaymentPanel.Show(title, content, buttonText, onOk); } /// /// 打开重试对话框 /// private static void ShowRetryDialog(string message, Action onRetry) { var path = AntiAddictionConst.GetPrefabPath(AntiAddictionConst.RETRY_ALERT_PANEL_NAME, TapTapAntiAddictionManager.IsUseMobileUI()); var retryAlert = UIManager.Instance.OpenUI(path); retryAlert.Show(message, onRetry); } internal static Task ShowRetryDialog(string message) { TaskCompletionSource tcs = new TaskCompletionSource(); ShowRetryDialog(message, () => tcs.TrySetResult(null)); return tcs.Task; } } }