private void Awake()
 {
     manager = GetComponent <UIManager>();
     FirebaseApp.CheckAndFixDependenciesAsync().ContinueWithOnMainThread <DependencyStatus>((task) =>
     {
         DependencyStatus status = task.Result;
         if (status == DependencyStatus.Available)
         {
             App               = FirebaseApp.DefaultInstance;
             Auth              = FirebaseAuth.DefaultInstance;
             functions         = FirebaseFunctions.DefaultInstance;
             functionReference = functions.GetHttpsCallable("RequestMessage");
             manager.TurnOff(manager.AuthBlocker);
             manager.TurnOff(manager.AnalyticsBlocker);
             App.SetEditorDatabaseUrl("https://fir-n-ix.firebaseio.com/");
             dbReference = FirebaseDatabase.DefaultInstance.RootReference;
             FirebaseMessaging.TokenReceived   += OnTokenReceived;
             FirebaseMessaging.MessageReceived += OnMessageReceived;
             FirebaseMessaging.TokenRegistrationOnInitEnabled = true;
             defaults.Add("RemoteTest", 25);
             FirebaseRemoteConfig.SetDefaults(defaults);
             FirebaseRemoteConfig.FetchAsync(TimeSpan.Zero).ContinueWithOnMainThread((remoteConfigTask) =>
             {
                 FirebaseRemoteConfig.ActivateFetched();
                 RemoteConfigResult = FirebaseRemoteConfig.GetValue("RemoteTest").StringValue;
                 manager.TurnOff(manager.RemoteConfigBlocker);
             });
             storage = FirebaseStorage.DefaultInstance;
         }
         else
         {
             Debug.Log(string.Format("Can't resolve all Firebase dependencies: {0}", status));
         }
     });
 }
예제 #2
0
    private void ArrangeCollectButtons()
    {
        string a = string.Empty;

        try
        {
            a = FirebaseRemoteConfig.GetValue("daily_double").StringValue;
        }
        catch
        {
        }
        if (a == "1" && reward != 0 && !PlayerPrefsManager.GetPro())
        {
            rewardedButton.gameObject.SetActive(value: true);
            Vector3 v = collectButton.GetComponent <RectTransform>().anchoredPosition;
            v.x = -140f;
            collectButton.GetComponent <RectTransform>().anchoredPosition = v;
            v.x = 140f;
            rewardedButton.GetComponent <RectTransform>().anchoredPosition = v;
        }
        else
        {
            rewardedButton.gameObject.SetActive(value: false);
            Vector3 v2 = collectButton.GetComponent <RectTransform>().anchoredPosition;
            v2.x = 0f;
            collectButton.GetComponent <RectTransform>().anchoredPosition = v2;
        }
        collectButton.GetComponent <Button>().interactable  = true;
        rewardedButton.GetComponent <Button>().interactable = true;
    }
예제 #3
0
    private float GetFloat(string valName)
    {
#if FIREBASE_CONFIGS
        return(float.Parse(FirebaseRemoteConfig.GetValue(valName).StringValue));
#else
        return(0);
#endif
    }
예제 #4
0
 private void Start()
 {
     ExplosionForce = (float)FirebaseRemoteConfig.GetValue(
         StringConstants.RemoteConfigMineTileForce).DoubleValue;
     ExplosionRadius = (float)FirebaseRemoteConfig.GetValue(
         StringConstants.RemoteConfigMineTileRadius).DoubleValue;
     UpwardsModifier = (float)FirebaseRemoteConfig.GetValue(
         StringConstants.RemoteConfigMineTileUpwardsMod).DoubleValue;
 }
예제 #5
0
    private static uint GetCRC(string[] keys)
    {
        StringBuilder stringBuilder = new StringBuilder();

        foreach (string key in keys)
        {
            stringBuilder.Append(FirebaseRemoteConfig.GetValue(key).StringValue);
        }
        return(Crc32.Compute(Encoding.ASCII.GetBytes(stringBuilder.ToString())));
    }
예제 #6
0
        private void Start()
        {
            ExplosionForce = (float)FirebaseRemoteConfig.GetValue(
                StringConstants.RemoteConfigSpikesTileForce).DoubleValue;
            ExplosionRadius = (float)FirebaseRemoteConfig.GetValue(
                StringConstants.RemoteConfigSpikesTileRadius).DoubleValue;
            ExplosionUpwardsModifier = (float)FirebaseRemoteConfig.GetValue(
                StringConstants.RemoteConfigSpikesTileUpwardsMod).DoubleValue;

            ForceState(EnabledAtStart);
        }
예제 #7
0
 public static string FetchRemoteValue(string key)
 {
     try
     {
         return(FirebaseRemoteConfig.GetValue(key).StringValue);
     }
     catch
     {
         return(string.Empty);
     }
 }
예제 #8
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
         UnityEngine.Object.DontDestroyOnLoad(base.gameObject);
         string a     = string.Empty;
         string text  = string.Empty;
         string text2 = string.Empty;
         try
         {
             a     = FirebaseRemoteConfig.GetValue("rewarded_status").StringValue;
             text  = FirebaseRemoteConfig.GetValue("interstitial_interval").StringValue;
             text2 = FirebaseRemoteConfig.GetValue("interstitial_firstlevel").StringValue;
         }
         catch (Exception)
         {
         }
         if (a == "1")
         {
             rewardedEnabled = true;
         }
         else
         {
             rewardedEnabled = false;
         }
         if (text != string.Empty)
         {
             float.TryParse(text, out interstitialTime);
         }
         else
         {
             interstitialTime = 300f;
         }
         if (text2 != string.Empty)
         {
             int.TryParse(text2, out firstLevel);
             firstLevel--;
         }
         else
         {
             firstLevel = 13;
         }
         adTimer = interstitialTime;
         lastInterstitialTime = 99999f;
         Init();
     }
     else
     {
         UnityEngine.Object.Destroy(base.gameObject);
     }
 }
예제 #9
0
        public static OwnInterstitialData GetOwnInterstitialData()
        {
            var fetchedData = new OwnInterstitialData
            {
                showOwnInterstitial = FirebaseRemoteConfig.GetValue(FrameworkValues.FIREBASE_REMOTE_CONFIG_SHOW_OWN_INTERSTITIAL_KEY_B).BooleanValue,
                imageURL            = FirebaseRemoteConfig.GetValue(FrameworkValues.FIREBASE_REMOTE_CONFIG_OWN_INTERSTITIAL_IMAGE_URL_KEY_S).StringValue,
                storeURL            = FirebaseRemoteConfig.GetValue(FrameworkValues.FIREBASE_REMOTE_CONFIG_OWN_INTERSTITIAL_STORE_URL_KEY_S).StringValue,
                title       = FirebaseRemoteConfig.GetValue(FrameworkValues.FIREBASE_REMOTE_CONFIG_OWN_INTERSTITIAL_TITLE_KEY_S).StringValue,
                description = FirebaseRemoteConfig.GetValue(FrameworkValues.FIREBASE_REMOTE_CONFIG_OWN_INTERSTITIAL_DESCRIPTION_KEY_S).StringValue
            };

            return(fetchedData);
        }
예제 #10
0
    public void UpdateConfigs()
    {
#if FIREBASE_CONFIGS
        try
        {
            GameConfig =
                JsonUtility.FromJson <GameConfig>(FirebaseRemoteConfig.GetValue(nameof(GameConfig)).StringValue);
        }
        catch (Exception e)
        {
            Debug.LogException(e);
        }
#endif
    }
예제 #11
0
 public static ConfigValue GetValueInternal(string key)
 {
     try
     {
         return(FirebaseRemoteConfig.GetValue(key));
     }
     catch (InitializationException e)
     {
         return(new ConfigValue());
     }
     catch (InvalidOperationException e)
     {
         return(new ConfigValue());
     }
 }
예제 #12
0
    private static List <KeyValuePair <string, string> > ParseConfigsFromFirebase()
    {
        FirebaseRemoteConfig.ActivateFetched();
        IEnumerable <string> keys = FirebaseRemoteConfig.Keys;

        string[] array = (from key in keys
                          where FirebaseRemoteConfig.GetValue(key).StringValue != string.Empty
                          select key).ToArray();
        m_crc32 = GetCRC(array);
        List <JSONObject> messages = (from key in array
                                      select FirebaseRemoteConfig.GetValue(key).StringValue into raw
                                      select JSONObject.Create(raw)).ToList();

        return(GetConfigs(messages).Concat(GetGameSettings(messages)).ToList());
    }
예제 #13
0
 /// <summary>
 /// Target syncing done as a coroutine, breaking between each sourceObject with field targets,
 /// to prevent attempting to set too many fields at once.
 /// </summary>
 public IEnumerator SyncFieldsCR()
 {
     if (flattenedTargets == null)
     {
         Debug.LogWarning($"No sync targets found for {name}");
         yield break;
     }
     foreach (var kv in flattenedTargets)
     {
         var sourceObject = kv.Key;
         var targets      = kv.Value;
         foreach (var target in targets)
         {
             var value = FirebaseRemoteConfig.GetValue(target.FullKeyString);
             if (value.Source == ValueSource.RemoteValue)
             {
                 if (target.Field.GetValue(sourceObject)?.ToString() == value.StringValue)
                 {
                     continue;
                 }
                 object typedValue = value.StringValue;
                 if (typeof(bool).IsAssignableFrom(target.Field.FieldType))
                 {
                     typedValue = value.BooleanValue;
                 }
                 else if (typeof(double).IsAssignableFrom(target.Field.FieldType))
                 {
                     typedValue = value.DoubleValue;
                 }
                 else if (typeof(int).IsAssignableFrom(target.Field.FieldType))
                 {
                     typedValue = (int)value.LongValue;
                 }
                 target.Field.SetValue(sourceObject, typedValue);
             }
             else
             {
                 Debug.Log($"No RemoteConfig value found for key {target.FullKeyString}");
             }
             yield return(0);
         }
     }
     SyncComplete?.Invoke(this, null);
 }
    public void LoadAndShowData()
    {
        var unityAdsManager = FindObjectOfType <UnityADSManager>();

        if (unityAdsManager != null)
        {
            bool value = FirebaseRemoteConfig.GetValue("Banner").BooleanValue;
            Debug.Log("<b><color=red>" + value + "</color></b>");

            if (value == true)
            {
                unityAdsManager.SetBannerVariable(true);
            }
            if (value == false)
            {
                unityAdsManager.SetBannerVariable(false);
            }
        }
    }
예제 #15
0
        void TryGetRemoteConfigValues()
        {
            var configValue = FirebaseRemoteConfig.GetValue(ID);

            try
            {
                if (configValue.Source.Equals(ValueSource.DefaultValue))
                {
                    Debug.LogWarning("[Remote config] Trying to get default value from the remote config");
                    return;
                }

                DeserialiseJson(configValue.StringValue);
                Debug.Log("[Remote config] deserialised successfuly: " + ID);
            }
            catch (ArgumentException e)
            {
                Debug.LogWarning(e.Message);
            }
        }
예제 #16
0
        private void setValues()
        {
            var rewardType = FirebaseRemoteConfig.GetValue("reward_type").StringValue;

            switch (rewardType)
            {
            case "fluct":
                _rewardType = RewardType.FLUCT;
                break;

            case "admob":
                _rewardType = RewardType.ADMOB;
                break;

            default:
                _rewardType = RewardType.FLUCT;
                break;
            }

            Debug.Log("remote config reward type:    " + rewardType);
        }
예제 #17
0
    private static bool RemoteSettingsSaveLate()
    {
        bool hasValues = false;

        if (!setupReady)
        {
            return(false);
        }

        //save the latest remote settings
        var keys = FirebaseRemoteConfig.Keys;

        foreach (string key in keys)
        {
            string value = FirebaseRemoteConfig.GetValue(key).StringValue;
            SGStorage.SetGenericPref(rsPreference + key, value);
            Debug.Log("Remote Settings: Save data to PlayerPrefab: " + rsPreference + key + "=" + value);
        }

        hasValues = rsActivateFetched;

        return(hasValues);
    }
예제 #18
0
 private void Start()
 {
     Drag = (float)FirebaseRemoteConfig.GetValue(
         StringConstants.RemoteConfigSandTileDrag).DoubleValue;
 }
 static ConfigValue GetConfig(string key)
 {
     return(FirebaseRemoteConfig.GetValue(key));
 }
예제 #20
0
 public long GetLong(string name)
 {
     return(FirebaseRemoteConfig.GetValue(name).LongValue);
 }
 private void Start()
 {
     Acceleration = (float)FirebaseRemoteConfig.GetValue(
         StringConstants.RemoteConfigAccelerationTileForce).DoubleValue;
 }
예제 #22
0
 private void Start()
 {
     JumpVelocity = (float)FirebaseRemoteConfig.GetValue(
         StringConstants.RemoteConfigJumpTileVelocity).DoubleValue;
 }
 private void Update()
 {
     _text.text = $"{Key}: {FirebaseRemoteConfig.GetValue(Key).StringValue}";
 }
예제 #24
0
 public bool GetBool(string name)
 {
     return(FirebaseRemoteConfig.GetValue(name).BooleanValue);
 }