From e9ea621b93fbb58d9edfca8375918791637bbd52 Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 30 Dec 2020 20:59:04 +0800 Subject: +init --- Client/Assembly-CSharp/AdDataCollectScreen.cs | 65 +++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 Client/Assembly-CSharp/AdDataCollectScreen.cs (limited to 'Client/Assembly-CSharp/AdDataCollectScreen.cs') 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().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)); + } +} -- cgit v1.1-26-g67d0