using MoleMole.Config; using UnityEngine; using UnityEngine.UI; namespace MoleMole { public class MonoSettingPushTab : MonoBehaviour { public Transform staminaSettingBtn; public Transform skillPointSettingBtn; public Transform expeditionEndSettingBtn; public Transform cabinLevelUpSettingBtn; public Transform activitySettingBtn; private ConfigNotificationSetting _modifiedSettingConfig; public void SetupView() { _modifiedSettingConfig = new ConfigNotificationSetting(); RecoverOriginState(); Transform settingTrans = base.gameObject.transform.Find("Content/NotificationSetting/ThirdLine/ActivityNotification").transform; SetSettingEnable(settingTrans, false); } public bool CheckNeedSave() { return !NotificationSettingData.IsValueEqualToPersonalNotificationConfig(_modifiedSettingConfig); } public void OnNoSaveBtnClick() { RecoverOriginState(); } public void OnSaveBtnClick() { NotificationSettingData.SavePersonalNotificationConfig(_modifiedSettingConfig); Singleton.Instance.ShowDialog(new GeneralHintDialogContext(LocalizationGeneralLogic.GetText("Menu_SettingSaveSuccess"))); } public void OnEnergyFullNotificationClick(bool willBeOn) { _modifiedSettingConfig.StaminaFullNotificaltion = willBeOn; SetChoiceBtn(staminaSettingBtn, _modifiedSettingConfig.StaminaFullNotificaltion); } public void OnSkillPointFullNotificationClick(bool willBeOn) { _modifiedSettingConfig.SkillPointFullNotification = willBeOn; SetChoiceBtn(skillPointSettingBtn, _modifiedSettingConfig.SkillPointFullNotification); } public void OnExpeditionEndNotificationClick(bool willBeOn) { _modifiedSettingConfig.VentureDoneNotification = willBeOn; SetChoiceBtn(expeditionEndSettingBtn, _modifiedSettingConfig.VentureDoneNotification); } public void OnCabinLevelUpNotificationClick(bool willBeOn) { _modifiedSettingConfig.CabinLevelUpNotification = willBeOn; SetChoiceBtn(cabinLevelUpSettingBtn, _modifiedSettingConfig.CabinLevelUpNotification); } public void OnActivityNotificationClick(bool willBeOn) { _modifiedSettingConfig.ActivityNotification = willBeOn; SetChoiceBtn(activitySettingBtn, _modifiedSettingConfig.ActivityNotification); } private void RecoverOriginState() { NotificationSettingData.ApplyNotificationSettingConfig(); NotificationSettingData.CopyPersonalNotificationConfig(ref _modifiedSettingConfig); SetChoiceBtn(staminaSettingBtn, _modifiedSettingConfig.StaminaFullNotificaltion); SetChoiceBtn(skillPointSettingBtn, _modifiedSettingConfig.SkillPointFullNotification); SetChoiceBtn(expeditionEndSettingBtn, _modifiedSettingConfig.VentureDoneNotification); SetChoiceBtn(cabinLevelUpSettingBtn, _modifiedSettingConfig.CabinLevelUpNotification); SetChoiceBtn(activitySettingBtn, _modifiedSettingConfig.ActivityNotification); } private void SetChoiceBtn(Transform btn, bool active) { if (!(btn == null)) { Transform transform = btn.Find("Choice/On"); Transform transform2 = btn.Find("Choice/Off"); transform.gameObject.SetActive(active); transform2.gameObject.SetActive(!active); } } private void SetSettingEnable(Transform settingTrans, bool enable) { Transform transform = settingTrans.Find("Choice/On"); Transform transform2 = settingTrans.Find("Choice/Off"); Transform transform3 = settingTrans.Find("Label"); Transform transform4 = transform.Find("Text"); Transform transform5 = transform2.Find("Text"); if (!enable) { transform.Find("Blue").gameObject.SetActive(false); transform.Find("Grey").gameObject.SetActive(false); transform.Find("Disable").gameObject.SetActive(true); transform2.Find("Grey").gameObject.SetActive(false); transform2.Find("Disable").gameObject.SetActive(true); transform3.GetComponent().color = MiscData.GetColor("NotificationSettingDisableText"); transform4.GetComponent().color = MiscData.GetColor("GraphicsSettingDisableText"); transform5.GetComponent().color = MiscData.GetColor("GraphicsSettingDisableText"); } else { transform.Find("Blue").gameObject.SetActive(true); transform.Find("Grey").gameObject.SetActive(true); transform2.Find("Grey").gameObject.SetActive(true); transform.Find("Disable").gameObject.SetActive(false); transform2.Find("Disable").gameObject.SetActive(false); transform3.GetComponent().color = Color.white; transform4.GetComponent().color = Color.white; transform5.GetComponent().color = Color.white; } transform.GetComponent