Пример #1
0
    void FetchComplete(Task fetchTask)
    {
        if (fetchTask.IsCompleted)
        {
            if (Firebase.RemoteConfig.FirebaseRemoteConfig.Info.LastFetchStatus == Firebase.RemoteConfig.LastFetchStatus.Success)
            {
                Debug.Log("Fetch completed successfully on: " + Firebase.RemoteConfig.FirebaseRemoteConfig.Info.FetchTime.ToLocalTime());

                if (Firebase.RemoteConfig.FirebaseRemoteConfig.ActivateFetched())
                {
                    // "blockUser"
                    Firebase.RemoteConfig.ConfigValue cv = Firebase.RemoteConfig.FirebaseRemoteConfig.GetValue("blockUser");

                    // Verify that this value exists
                    if ((cv.Source != Firebase.RemoteConfig.ValueSource.StaticValue) && !string.IsNullOrEmpty(cv.StringValue))
                    {
                        bool blockUser = cv.BooleanValue;

                        if (blockUser)
                        {
                            EventManagerScript.Instance.TriggerEvent(EventManagerScript.EVENT__BLOCK_USER, null);
                        }
                    }
                }
            }
        }
    }
Пример #2
0
    private IEnumerator LoadScene()
    {
        yield return(null);


        while (true)
        {
            CheckFirebaseTimeout();
            yield return(null);

            if (!fetchFirbaseCompleted && firebaseInitialized)
            {
                //string loadingText = "Loading";
                //loadingViewController.UpdateLoadingText(loadingText);
                //Debug.Log("fetchFirebase completed");

                Firebase.RemoteConfig.FirebaseRemoteConfig.ActivateFetched();
                fetchFirbaseCompleted = true;

                string oldMetaVersion = Configs.GetFireBaseMetaDataVersion();
                SetFirebaseFetchedValues();

                // Get values
                Firebase.RemoteConfig.ConfigValue metadata_path        = Firebase.RemoteConfig.FirebaseRemoteConfig.GetValue(GameConstants.metadata_path);
                Firebase.RemoteConfig.ConfigValue metadata_version     = Firebase.RemoteConfig.FirebaseRemoteConfig.GetValue(GameConstants.metadata_version);
                Firebase.RemoteConfig.ConfigValue languagefile_path    = Firebase.RemoteConfig.FirebaseRemoteConfig.GetValue(GameConstants.languagefile_path);
                Firebase.RemoteConfig.ConfigValue languagefile_version = Firebase.RemoteConfig.FirebaseRemoteConfig.GetValue(GameConstants.languagefile_version);

                string metaName            = metadata_path.StringValue;
                string metaVersion         = metadata_version.StringValue;
                string languageFileName    = languagefile_path.StringValue;
                string languageFileVersion = languagefile_version.StringValue;
                Debug.Log("Firebase fetched Value languagefile_path:" + languagefile_path.StringValue);
                Debug.Log("Firebase fetched Value languagefile_version:" + languagefile_version.StringValue);

                if (metaVersion.Equals(Configs.GetFireBaseMetaDataVersion()) || string.IsNullOrEmpty(metaVersion))
                {
                    metaFileSynced = true;
                }
                else
                {
                    ServerController.SharedInstance.DownloadMetaFile(metaName, metaVersion, MetaFileSyncSuccessfull, MetaFileSyncFailed, UpdateServerProgress, this);
                }

                if (languageFileVersion.Equals(Configs.GetFireBaseLanguageFileVersion()) || string.IsNullOrEmpty(languageFileVersion))
                {
                    languageFileSynced = true;
                }
                else
                {
                    ServerController.SharedInstance.DownloadLanguageFile(languageFileName, languageFileVersion, LanguageFileSyncSuccessfull, LanguageFileSyncFailed, UpdateServerProgress, this);
                }
                LogFirebaseToken();
            }
            else if (languageFileSynced && metaFileSynced && fetchFirbaseCompleted && firebaseInitialized)
            {
                Debug.Log(" Language & Meta file Synced");
                break;
            }
        }

        Debug.Log(" LoadScene");

        SceneManager.LoadScene("Gameplay");
        //async = SceneManager.LoadSceneAsync("Gameplay");
        //async.allowSceneActivation = false;

        //yield return new WaitForSeconds(0.5f);
        //while (async.progress < 0.9f)
        //{
        //    yield return null;
        //}
        //async.allowSceneActivation = true;
    }