diff options
author | chai <chaifix@163.com> | 2020-12-30 20:59:04 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2020-12-30 20:59:04 +0800 |
commit | e9ea621b93fbb58d9edfca8375918791637bbd52 (patch) | |
tree | 19ce3b1c1f2d51eda6878c9d0f2c9edc27f13650 /Client/Assembly-CSharp/AdDataCollectScreen.cs |
+init
Diffstat (limited to 'Client/Assembly-CSharp/AdDataCollectScreen.cs')
-rw-r--r-- | Client/Assembly-CSharp/AdDataCollectScreen.cs | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/Client/Assembly-CSharp/AdDataCollectScreen.cs b/Client/Assembly-CSharp/AdDataCollectScreen.cs new file mode 100644 index 0000000..35212f6 --- /dev/null +++ b/Client/Assembly-CSharp/AdDataCollectScreen.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections; +using UnityEngine; + +public class AdDataCollectScreen : MonoBehaviour +{ + public ToggleButtonBehaviour PersonalizedAdsButton; + + private void Start() + { + this.UpdateButtons(); + } + + public IEnumerator Show() + { + if (!SaveManager.ShowAdsScreen.HasFlag(ShowAdsState.Accepted) && !SaveManager.BoughtNoAds) + { + base.gameObject.SetActive(true); + while (base.gameObject.activeSelf) + { + yield return null; + } + } + yield break; + } + + public void Close() + { + SaveManager.ShowAdsScreen |= ShowAdsState.Accepted; + } + + public void Update() + { + if (SaveManager.BoughtNoAds) + { + base.GetComponent<TransitionOpen>().Close(); + } + } + + public void TogglePersonalizedAd() + { + ShowAdsState showAdsState = SaveManager.ShowAdsScreen & (ShowAdsState)127; + if (showAdsState != ShowAdsState.Personalized) + { + if (showAdsState == ShowAdsState.NonPersonalized) + { + SaveManager.ShowAdsScreen = ShowAdsState.Personalized; + goto IL_34; + } + if (showAdsState == ShowAdsState.Purchased) + { + SaveManager.ShowAdsScreen = ShowAdsState.Purchased; + goto IL_34; + } + } + SaveManager.ShowAdsScreen = ShowAdsState.NonPersonalized; + IL_34: + this.UpdateButtons(); + } + + public void UpdateButtons() + { + this.PersonalizedAdsButton.UpdateText(!SaveManager.ShowAdsScreen.HasFlag(ShowAdsState.NonPersonalized)); + } +} |