chore(m2): 保存功能验收及后续清理前检查点
This commit is contained in:
@@ -8,10 +8,8 @@ public class SettingNotificationsGradePopupPanel : MonoBehaviour
|
||||
{
|
||||
public Button btn_ok;
|
||||
public Button btn_cancel;
|
||||
ISettingService settings;
|
||||
ILocalNotificationService notifications;
|
||||
bool handling;
|
||||
bool completed;
|
||||
private ISettingService settings;
|
||||
private ILocalNotificationService notifications;
|
||||
private void Start()
|
||||
{
|
||||
settings = GContext.container.Resolve<ISettingService>();
|
||||
@@ -21,34 +19,24 @@ public class SettingNotificationsGradePopupPanel : MonoBehaviour
|
||||
}
|
||||
private void OnBtnOk()
|
||||
{
|
||||
HandlePrompt(true);
|
||||
if (this == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
(settings as DefaultSettingService)?.RequirePromptOwner();
|
||||
(notifications as LocalNotificationService)?.RequirePromptOwner(settings);
|
||||
DestroyUI();
|
||||
notifications.OpenSettings();
|
||||
}
|
||||
void DestroyUI()
|
||||
{
|
||||
HandlePrompt(false);
|
||||
}
|
||||
async void HandlePrompt(bool openSettings)
|
||||
{
|
||||
if (this == null || handling || completed) return;
|
||||
handling = true;
|
||||
try
|
||||
if (this == null)
|
||||
{
|
||||
(settings as DefaultSettingService)?.RequirePromptOwner();
|
||||
(notifications as LocalNotificationService)?.RequirePromptOwner(settings);
|
||||
settings.ShowNotice = true;
|
||||
if (openSettings && settings is DefaultSettingService bound && bound.HasKVPromptOwner)
|
||||
{
|
||||
await ((LocalNotificationService)notifications).OpenSettingsAsync();
|
||||
if (this == null) return;
|
||||
bound.RequirePromptOwner();
|
||||
}
|
||||
(settings as DefaultSettingService)?.RequirePromptOwner();
|
||||
completed = true;
|
||||
UIManager.Instance.DestroyUI(gameObject.name);
|
||||
if (openSettings && !(settings is DefaultSettingService kv && kv.HasKVPromptOwner))
|
||||
notifications.OpenSettings();
|
||||
return;
|
||||
}
|
||||
catch (System.Exception ex) { game.DefaultSettingService.LogPromptFailure(ex); }
|
||||
finally { handling = false; }
|
||||
(settings as DefaultSettingService)?.RequirePromptOwner();
|
||||
(notifications as LocalNotificationService)?.RequirePromptOwner(settings);
|
||||
settings.ShowNotice = true;
|
||||
UIManager.Instance.DestroyUI(gameObject.name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,48 +7,30 @@ public class SettingNotificationsPopupPanel : MonoBehaviour
|
||||
{
|
||||
public Button btn_ok;
|
||||
public Button btn_cancel;
|
||||
ILocalNotificationService notifications;
|
||||
bool handling;
|
||||
bool completed;
|
||||
private ILocalNotificationService notifications;
|
||||
private void Start()
|
||||
{
|
||||
notifications = GContext.container.Resolve<ILocalNotificationService>();
|
||||
btn_ok.onClick.AddListener(OnBtnOk);
|
||||
btn_cancel.onClick.AddListener(DestroyUI);
|
||||
}
|
||||
private async void OnBtnOk()
|
||||
private void OnBtnOk()
|
||||
{
|
||||
if (this == null || handling || completed) return;
|
||||
handling = true;
|
||||
try
|
||||
if (this == null)
|
||||
{
|
||||
if (notifications is LocalNotificationService local && local.HasKVPromptOwner)
|
||||
{
|
||||
local.RequirePromptOwner();
|
||||
await local.OpenSettingsAsync();
|
||||
if (this == null) return;
|
||||
local.RequirePromptOwner();
|
||||
}
|
||||
else
|
||||
{
|
||||
DestroyUI();
|
||||
notifications.OpenSettings();
|
||||
return;
|
||||
}
|
||||
DestroyUI();
|
||||
return;
|
||||
}
|
||||
catch (System.Exception ex) { game.DefaultSettingService.LogPromptFailure(ex); }
|
||||
finally { handling = false; }
|
||||
(notifications as LocalNotificationService)?.RequirePromptOwner();
|
||||
DestroyUI();
|
||||
notifications.OpenSettings();
|
||||
}
|
||||
void DestroyUI()
|
||||
{
|
||||
if (this == null || completed) return;
|
||||
try
|
||||
if (this == null)
|
||||
{
|
||||
(notifications as LocalNotificationService)?.RequirePromptOwner();
|
||||
completed = true;
|
||||
UIManager.Instance.DestroyUI(gameObject.name);
|
||||
return;
|
||||
}
|
||||
catch (System.Exception ex) { game.DefaultSettingService.LogPromptFailure(ex); }
|
||||
(notifications as LocalNotificationService)?.RequirePromptOwner();
|
||||
UIManager.Instance.DestroyUI(gameObject.name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@ using UnityEngine.UI;
|
||||
|
||||
public class SettingPopupPanel : MonoBehaviour
|
||||
{
|
||||
ISettingService settingService;
|
||||
ILocalNotificationService notificationService;
|
||||
private ISettingService settingService;
|
||||
private ILocalNotificationService notificationService;
|
||||
public Button btn_close;
|
||||
public Button btn_mask;
|
||||
public BtnSwitch music;
|
||||
@@ -216,15 +216,20 @@ public class SettingPopupPanel : MonoBehaviour
|
||||
}
|
||||
private void OnToggleNotification(bool isOn)
|
||||
{
|
||||
try
|
||||
if (this == null)
|
||||
{
|
||||
if (this == null) return;
|
||||
(settingService as DefaultSettingService)?.RequirePromptOwner();
|
||||
(notificationService as LocalNotificationService)?.RequirePromptOwner(settingService);
|
||||
if (isOn) notificationService.OpenSettings();
|
||||
else UIManager.Instance.ShowUI(new UIType("SettingNotificationsPopupPanel"));
|
||||
return;
|
||||
}
|
||||
(settingService as DefaultSettingService)?.RequirePromptOwner();
|
||||
(notificationService as LocalNotificationService)?.RequirePromptOwner(settingService);
|
||||
if (isOn)
|
||||
{
|
||||
notificationService.OpenSettings();
|
||||
}
|
||||
else
|
||||
{
|
||||
UIManager.Instance.ShowUI(new UIType("SettingNotificationsPopupPanel"));
|
||||
}
|
||||
catch (System.Exception ex) { game.DefaultSettingService.LogPromptFailure(ex); }
|
||||
}
|
||||
|
||||
private void OnChangeLanguage(ChangeLanguageEvent changeLanguageEvent = null)
|
||||
|
||||
Reference in New Issue
Block a user