ui基本完毕,修了一大把的bug
This commit is contained in:
@@ -9,6 +9,9 @@ public class eula_and_warnings : MonoBehaviour
|
||||
{
|
||||
private const string MainSceneName = "Main_main";
|
||||
private const string RankingConsentPrefKey = "before_everything_agree_ranking";
|
||||
private const string FirstLaunchCompletedPrefKey = "before_everything_first_launch_completed";
|
||||
private const string LightWarningAcceptedPrefKey = "before_everything_light_warning_accepted";
|
||||
private const string UserInfoAcceptedPrefKey = "before_everything_user_info_accepted";
|
||||
private const float LightWarningMinimumSeconds = 5f;
|
||||
private const float FadeDuration = 0.3f;
|
||||
private const float RequiredScrollReadThreshold = 0.1f;
|
||||
@@ -44,6 +47,9 @@ public class eula_and_warnings : MonoBehaviour
|
||||
private bool _isTransitioning;
|
||||
private bool _mainScenePreloadRequested;
|
||||
private bool _mainScenePreloadReady;
|
||||
private bool _hasCompletedFirstLaunch;
|
||||
private bool _hasAcceptedLightWarning;
|
||||
private bool _hasAcceptedUserInfoEula;
|
||||
private readonly List<GameObject> _hiddenMainSceneRoots = new List<GameObject>();
|
||||
|
||||
private void Awake()
|
||||
@@ -55,6 +61,14 @@ public class eula_and_warnings : MonoBehaviour
|
||||
|
||||
private void Start()
|
||||
{
|
||||
LoadPersistedConsentState();
|
||||
|
||||
if (ShouldSkipConfirmationFlow())
|
||||
{
|
||||
ActivateMainScene();
|
||||
return;
|
||||
}
|
||||
|
||||
PlayLightWarningIntro();
|
||||
}
|
||||
|
||||
@@ -96,6 +110,18 @@ public class eula_and_warnings : MonoBehaviour
|
||||
_isTransitioning = false;
|
||||
}
|
||||
|
||||
private void LoadPersistedConsentState()
|
||||
{
|
||||
_hasCompletedFirstLaunch = PlayerPrefs.GetInt(FirstLaunchCompletedPrefKey, 0) == 1;
|
||||
_hasAcceptedLightWarning = PlayerPrefs.GetInt(LightWarningAcceptedPrefKey, 0) == 1;
|
||||
_hasAcceptedUserInfoEula = PlayerPrefs.GetInt(UserInfoAcceptedPrefKey, 0) == 1;
|
||||
}
|
||||
|
||||
private bool ShouldSkipConfirmationFlow()
|
||||
{
|
||||
return _hasCompletedFirstLaunch && _hasAcceptedLightWarning && _hasAcceptedUserInfoEula;
|
||||
}
|
||||
|
||||
private void PlayLightWarningIntro()
|
||||
{
|
||||
if (lightWarningObj == null || lightWarningCG == null)
|
||||
@@ -203,6 +229,10 @@ public class eula_and_warnings : MonoBehaviour
|
||||
return;
|
||||
}
|
||||
|
||||
_hasAcceptedLightWarning = true;
|
||||
PlayerPrefs.SetInt(LightWarningAcceptedPrefKey, 1);
|
||||
PlayerPrefs.Save();
|
||||
|
||||
TransitionCanvasGroup(lightWarningObj, lightWarningCG, false, () =>
|
||||
{
|
||||
BeginPreloadMainScene();
|
||||
@@ -235,6 +265,10 @@ public class eula_and_warnings : MonoBehaviour
|
||||
}
|
||||
|
||||
bool agreeRanking = uie_agreeRanking != null && uie_agreeRanking.isOn;
|
||||
_hasAcceptedUserInfoEula = true;
|
||||
_hasCompletedFirstLaunch = true;
|
||||
PlayerPrefs.SetInt(UserInfoAcceptedPrefKey, 1);
|
||||
PlayerPrefs.SetInt(FirstLaunchCompletedPrefKey, 1);
|
||||
PlayerPrefs.SetInt(RankingConsentPrefKey, agreeRanking ? 1 : 0);
|
||||
PlayerPrefs.Save();
|
||||
|
||||
@@ -248,9 +282,6 @@ public class eula_and_warnings : MonoBehaviour
|
||||
|
||||
private static void MarkPolicyRejectedAndQuit()
|
||||
{
|
||||
PlayerPrefs.SetInt(RankingConsentPrefKey, 0);
|
||||
PlayerPrefs.Save();
|
||||
|
||||
#if UNITY_EDITOR
|
||||
UnityEditor.EditorApplication.isPlaying = false;
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user