Пример #1
0
    public void Share()
    {
        //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- PHOTO
        // create the texture
        Texture2D screenTexture = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, true);

        // put buffer into texture
        screenTexture.ReadPixels(new Rect(0f, 0f, Screen.width, Screen.height), 0, 0);

        // apply
        screenTexture.Apply();
        //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- PHOTO

        byte[] dataToSave = screenTexture.EncodeToPNG();

        string destination = Path.Combine(Application.persistentDataPath, System.DateTime.Now.ToString("yyyy-MM-dd-HHmmss") + ".png");

        File.WriteAllBytes(destination, dataToSave);

        if (!Application.isEditor)
        {
            string textLang = Lean.Localization.LeanLocalization.CurrentLanguage == "Russian" ?
                              "ShareTextRussian" : "ShareTextEnglish";
            string shareText = RemoteSettings.GetString(textLang, string.Empty);

            NativeShare share = new NativeShare();
            share.AddFile(destination).SetText(shareText).Share();
        }
    }
Пример #2
0
    private bool CheckVersion()
    {
        Version gameVersion;
        Version latestVersion;

        try
        {
            gameVersion   = typeof(VersionManager).Assembly.GetName().Version;
            latestVersion = new Version(RemoteSettings.GetString("LatestVersion"));
        }
        catch (Exception ex)
        {
            if (ex is ArgumentException || ex is ArgumentNullException || ex is ArgumentOutOfRangeException || ex is FormatException || ex is OverflowException)
            {
                Debug.LogError("Cannot parse version.");
                return(false);
            }

            throw;
        }

        if (latestVersion.Major > gameVersion.Major || latestVersion.Minor > gameVersion.Minor)
        {
            // TODO enforce upgrade
            return(false);
        }

        return(true);
    }
    private void SetOAuthCallbackHost()
    {
        string url = RemoteSettings.GetString(OauthCallbackURLSettingName, OauthCallbackURLDefault);
        Uri    tmp = new Uri(url);

        oauthCallbackHost = tmp.Host;
    }
Пример #4
0
    private void HandleRemoteUpdate()
    {
        display_home_ads         = RemoteSettings.GetBool("display_home_ads", true);
        display_banner_ads       = RemoteSettings.GetBool("display_banner_ads", true);
        display_interstitial_ads = RemoteSettings.GetBool("display_interstitial_ads", true);
        display_video_ads        = RemoteSettings.GetBool("display_video_ads", true);

        admob_banner_id       = RemoteSettings.GetString("admob_banner_id", admob_banner_id);
        admob_interstitial_id = RemoteSettings.GetString("admob_interstitial_id", admob_interstitial_id);

        fan_banner_id       = RemoteSettings.GetString("fan_banner_id", fan_banner_id);
        fan_interstitial_id = RemoteSettings.GetString("fan_interstitial_id", fan_interstitial_id);

        delay_interstital_time = RemoteSettings.GetFloat("delay_interstital_time", delay_interstital_time);

        admob_banner_ratio = RemoteSettings.GetInt("admob_banner_ratio", admob_banner_ratio);
        fan_banner_ratio   = RemoteSettings.GetInt("fan_banner_ratio", fan_banner_ratio);

        admob_interstitial_ratio = RemoteSettings.GetInt("admob_interstitial_ratio", admob_interstitial_ratio);
        fan_interstitial_ratio   = RemoteSettings.GetInt("fan_interstitial_ratio", fan_interstitial_ratio);

        //ball_bonus = RemoteSettings.GetInt("ball_bonus", 0);
        moves_reduction = RemoteSettings.GetInt("moves_reduction", moves_reduction);

        ToolsExtend.NotificationSystem.instance.Init();
    }
 private void Start()
 {
     VersionText.text = LimSystem.Version;
     SetLanguageDict();
     SetTexts();
     StartCoroutine(LoadNotification());
     LimSystem.LanotaliumServer = RemoteSettings.GetString("LanotaliumServer", "http://lanotalium.cn");
 }
Пример #6
0
 // Token: 0x060007E2 RID: 2018 RVA: 0x00049060 File Offset: 0x00047260
 private void method_55()
 {
     this.bool_14  = (GlobalVariables.instance.float_0 < RemoteSettings.GetFloat("latestTestBuild", 0f));
     this.bool_13  = RemoteSettings.GetBool("isSupported", true);
     this.string_2 = RemoteSettings.GetString("notSupportedTitle_" + ((GlobalVariables.instance.gclass5_42.CurrentValue == 4) ? "Portuguese" : GlobalVariables.instance.languages[GlobalVariables.instance.gclass5_42.CurrentValue]), "This is a placeholder");
     this.string_1 = RemoteSettings.GetString("notSupportedBody_" + ((GlobalVariables.instance.gclass5_42.CurrentValue == 4) ? "Portuguese" : GlobalVariables.instance.languages[GlobalVariables.instance.gclass5_42.CurrentValue]), "This is a placeholder");
     this.string_3 = RemoteSettings.GetString("notSupportedLink", "This is a placeholder");
 }
Пример #7
0
        private void ApplySettings(bool changedSettings = false)
        {
            var newObj = new T();

            Debug.Log(" Initial :");
            Debug.Log(JsonUtility.ToJson(newObj));

            Dictionary <string, object> fromremote = new Dictionary <string, object>();
            string newOneBuilder;

            foreach (var item in RemoteSettings.GetKeys())
            {
                newOneBuilder = null;
                newOneBuilder = RemoteSettings.GetString(item);

                Debug.Log(" is it : " + newOneBuilder);
                fromremote.Add
                (
                    item,
                    newOneBuilder.StartsWith("[") || newOneBuilder.StartsWith("{") ? Json.Deserialize(newOneBuilder) : newOneBuilder
                );
                Debug.Log(string.Format(" Found Keys : {0} Value : {1}", item, fromremote[item]));
            }
            bool overwrite = true;

            if (fromremote.Keys.Count == 0)
            {
                overwrite = false;
                Debug.Log("  Not yet setted to remote! When in Editor - it always uses Development Remote Settings! (check it on website)");

                OnErrorCallb?.Invoke("Not yet setted to remote!");
            }


            // This part
            // Dictionary<string, object> fromDict = (Dictionary<string, object>)dictStringObject;

            // string jsonToTest = Json.Serialize(fromDict);
            if (overwrite)
            {
                string jsonToTest = Json.Serialize(fromremote);

                Debug.Log(string.Format(" Json string : {0}", jsonToTest));
                JsonUtility.FromJsonOverwrite(jsonToTest, newObj);  // here we need to overwrite the newObj with new remote values!
            }

            remoteData?.Dispose();

            remoteData = newObj;  // new remote values are written into newObj

            Debug.Log(string.Format("From Object {0}", JsonUtility.ToJson(remoteData)));

            status = Status.SUCCESS;

            onCompleteCallb?.Invoke(remoteData);

            ResetCallbacks();
        }
Пример #8
0
    public GameObject patchPanel;       //Shows a Waring that a new Patch is available

    // Start is called before the first frame update
    void Start()
    {
        string lastestPatch = RemoteSettings.GetString("currentPatch", currentPatch);  // Latest Version

        Debug.Log("Remote Server: Newest Patch: " + lastestPatch);

        if (currentPatch != lastestPatch && lastestPatch != null && lastestPatch != "")
        {
            patchPanel.SetActive(true);
        }
    }
Пример #9
0
    private void CheckUpdates()
    {
        int latestVersionInt = RemoteSettings.GetInt("UpdateLatestVersionInt", Global.CurrentVersionInt);

        if (latestVersionInt > Global.CurrentVersionInt)
        {
            string latestVersion = RemoteSettings.GetString("UpdateLatestVersion", Global.CurrentVersion);
            string updateLink    = RemoteSettings.GetString("UpdateLink");
            ShowNewVersionIsAvailable(latestVersion, updateLink);
        }
    }
Пример #10
0
    private void ABTestsRemoteSettingsUpdated()
    {
        Debug.Log("[REMOTE] ***** GOT NEW AB TEST REMOTE SETTINGS ******");

        // get current AB test key - set to default if can't retrieve
        AB_IDstring = RemoteSettings.GetString("ABTestKey", Constants.ABTesting.DefaultAB_IDstring);

        GetCustomABTestKeyValues(); // get current AB test remote setting(s)

        RemoteSettings.Updated -= ABTestsRemoteSettingsUpdated;
        return;
    }
Пример #11
0
    private void CheckUpdateNotification(bool wasUpdatedFromServer, bool settingsChanged, int serverResponse)
    {
        Global.LatestVersionInt = RemoteSettings.GetInt("UpdateLatestVersionInt", Global.CurrentVersionInt);
        if (Global.LatestVersionInt > Global.CurrentVersionInt)
        {
            string latestVersion = RemoteSettings.GetString("UpdateLatestVersion", Global.CurrentVersion);
            string updateLink    = RemoteSettings.GetString("UpdateLink");
            ShowNewVersionIsAvailable(latestVersion, updateLink);
        }

        RemoteSettings.Completed -= CheckUpdateNotification;
    }
Пример #12
0
        private void HandleRemoteSettingsUpdated()
        {
            m_remoteSettings.Add(SHOW_MENU_OPTIONS_ID,
                                 RemoteSettings.GetBool(SHOW_MENU_OPTIONS_ID));



            m_remoteSettings.Add(LOCALIZATION_URL,
                                 RemoteSettings.GetString(LOCALIZATION_URL));

            RegisterService();
            OnRemoteSettingsUpdated?.Invoke();
        }
Пример #13
0
    //remote Settings

    void RemoteSettingsUpdated()
    {
        string newLevelProgression = RemoteSettings.GetString("levelProgression", "");

        if (newLevelProgression != "")
        {
            asteroidInfo.SetLevelProgression(newLevelProgression);
            Debug.Log("Remote Setting mission complete.");
        }
        else
        {
            Debug.Log("Remote Setting mission failed. we'll get them next time..");
        }
    }
Пример #14
0
        /// <summary>
        /// Remote settings might change what we display
        /// </summary>
        private void OnRemoteUpdate()
        {
            //Debug.Log("In remote update");
            //Debug.Log(RemoteSettings.GetString("B3D_NEWS"));
            string remoteNews = RemoteSettings.GetString("B3D_NEWS");

            if (remoteNews != null && remoteNews != "")
            {
                if (NewsText != null)
                {
                    NewsText.text = remoteNews;
                }
            }
        }
Пример #15
0
    // Start is called before the first frame update
    void Start()
    {
        string lastestPatch = RemoteSettings.GetString("currentPatch"); // Latest Version

        txtversion      = GetComponent <Text>();
        txtversion.text = lastestPatch + " " + patchVersionControl.GetCurrentPatch();

        if (lastestPatch == patchVersionControl.GetCurrentPatch())
        {
            txtversion.color = Color.green;
        }
        else
        {
            txtversion.color = Color.red;
        }
    }
    // Create a function to set your variables to their keyed values:
    void ApplyRemoteSettings(bool wasUpdatedFromServer, bool settingsChanged, int serverResponse)
    {
        Debug.Log("New settings loaded this session; update values accordingly.");

        //RemoteSettings側でプラットフォームの判別が機能しない場合があるため端末側で切り分け
#if UNITY_IOS
        latestVer = RemoteSettings.GetString("LatestVer_iOS");
#elif UNITY_ANDROID
        latestVer = RemoteSettings.GetString("LatestVer_Android");
#endif

        rankingName   = RemoteSettings.GetString("RankingName");
        rankingPeriod = RemoteSettings.GetString("RankingPeriod");

        busy = false;
    }
    void RemoteSettingsUpdated()
    {
        string newLevelProgression = RemoteSettings.GetString("levelProgression", "");

        if (newLevelProgression != "")
        {
            levelProgression = newLevelProgression;
            Debug.Log("AsteraX:RemoteSettingsUpdated() - Calling ParseLevelProgression() "
                      + "with levelProgression:\n" + levelProgression);
            ParseLevelProgression();
        }
        else
        {
            Debug.Log("AsteraX:RemoteSettingsUpdated() - Did not receive proper " +
                      "levelProgression from RemoteSettings.");
        }
    }
Пример #18
0
    public void Share()
    {
        //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- PHOTO
        // create the texture
        Texture2D screenTexture = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, true);

        // put buffer into texture
        screenTexture.ReadPixels(new Rect(0f, 0f, Screen.width, Screen.height), 0, 0);

        // apply
        screenTexture.Apply();
        //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- PHOTO

        byte[] dataToSave = screenTexture.EncodeToPNG();

        string destination = Path.Combine(Application.persistentDataPath, System.DateTime.Now.ToString("yyyy-MM-dd-HHmmss") + ".png");

        File.WriteAllBytes(destination, dataToSave);

        if (!Application.isEditor)
        {
            string textLang = Lean.Localization.LeanLocalization.CurrentLanguage == "Russian" ?
                              "ShareTextRussian" : "ShareTextEnglish";
            string shareText = RemoteSettings.GetString(textLang, string.Empty);

            // block to open the file and share it ------------START
            AndroidJavaClass  intentClass  = new AndroidJavaClass("android.content.Intent");
            AndroidJavaObject intentObject = new AndroidJavaObject("android.content.Intent");
            intentObject.Call <AndroidJavaObject>("setAction", intentClass.GetStatic <string>("ACTION_SEND"));
            AndroidJavaClass  uriClass  = new AndroidJavaClass("android.net.Uri");
            AndroidJavaObject uriObject = uriClass.CallStatic <AndroidJavaObject>("parse", "file://" + destination);
            intentObject.Call <AndroidJavaObject>("putExtra", intentClass.GetStatic <string>("EXTRA_STREAM"), uriObject);
            intentObject.Call <AndroidJavaObject>("putExtra", intentClass.GetStatic <string>("EXTRA_TEXT"), shareText);
            //intentObject.Call<AndroidJavaObject>("putExtra", intentClass.GetStatic<string>("EXTRA_SUBJECT"), "SUBJECT");
            intentObject.Call <AndroidJavaObject>("setType", "image/jpeg");
            AndroidJavaClass  unity           = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
            AndroidJavaObject currentActivity = unity.GetStatic <AndroidJavaObject>("currentActivity");

            // option one WITHOUT chooser:
            currentActivity.Call("startActivity", intentObject);



            // block to open the file and share it ------------END
        }
    }
Пример #19
0
    public void HandleRemoteUpdate()
    {
        ItemCost             = RemoteSettings.GetFloat(name + "ItemCost", defaultItemCost);
        ItemCostMultiplier   = RemoteSettings.GetFloat(name + "ItemCostMultiplier", defaultItemCostMultiplier);
        ValueToAddOnPurchase = RemoteSettings.GetFloat(name + "ValueToAddOnPurchase", defaultValueToAddOnPurchase);
        ItemType             = (ItemType)Enum.Parse(typeof(ItemType), RemoteSettings.GetString(name + "ItemType", ItemType.None.ToString()));

        ItemName        = RemoteSettings.GetString(name + "ItemName", defaultItemName);
        ItemDescription = RemoteSettings.GetString(name + "ItemDescription", defaultItemDescription);

        if (onFinishedGettingRemoteSettings != null)
        {
            onFinishedGettingRemoteSettings();
        }
        else
        {
            Debug.Log("The f**k:" + name);
        }
    }
Пример #20
0
 private void SetDeleteUpgradesURL()
 {
     deleteUpgradesUrl = RemoteSettings.GetString(DeleteUpgradesURLSettingName, DefaultDeleteUpgradesURL);
 }
Пример #21
0
 private void SetLevelStartedURL()
 {
     missionStartedAlertUrl = RemoteSettings.GetString(LevelStartedURLSettingName, DefaultLevelStartedURL);
 }
Пример #22
0
    //private void LoadedUserHandler(TwitchLoginUserInfo userData)
    //{
    //    // TODO verify the user's access token with Twitch
    //    if (EventList.TwitchUserLogin != null)
    //    {
    //        EventList.TwitchUserLogin(userData);
    //    }
    //}

    private void VerifyHandler()
    {
        verifyUrl = RemoteSettings.GetString(ValidateURLSettingName, ValidateURLDefault);
    }
Пример #23
0
 private void OnUpdateRemoteSettings()
 {
     BASE_URL = RemoteSettings.GetString("Network_BaseUrl_Test", "");
     LogUtil.PrintWarning(GetType(), "OnUpdateRemoteSettings() BASE url is: " + BASE_URL);
 }
        public void UpdateRemoteSettings()
        {
            Type myType = this.GetType();

            FieldInfo[] fields = myType.GetFields(
                BindingFlags.NonPublic | BindingFlags.Public |
                BindingFlags.Instance);

            foreach (var field in fields)
            {
                Entry entry = GetEntryFromField(this, field);


                if (RemoteSettings.HasKey(entry.key))
                {
                    bool valueChanged = false;

                    //Type doesn't work with a switch, so let's do it this way
                    if (entry.type == "bool")
                    {
                        bool value = RemoteSettings.GetBool(entry.key);

                        if (value != (bool)field.GetValue(this))
                        {
                            valueChanged = true;
                        }

                        field.SetValue(this, value);
                    }
                    else if (entry.type == "float")
                    {
                        float value = RemoteSettings.GetFloat(entry.key);

                        if (value != (float)field.GetValue(this))
                        {
                            valueChanged = true;
                        }

                        field.SetValue(this, value);
                    }
                    else if (entry.type == "int")
                    {
                        int value = RemoteSettings.GetInt(entry.key);

                        if (value != (int)field.GetValue(this))
                        {
                            valueChanged = true;
                        }

                        field.SetValue(this, value);
                    }
                    else if (entry.type == "string")
                    {
                        string value = RemoteSettings.GetString(entry.key);

                        if (value != (string)field.GetValue(this))
                        {
                            valueChanged = true;
                        }

                        field.SetValue(this, value);
                    }

                    if (valueChanged)
                    {
                        Debug.LogFormat("<color=cyan>Remote Settings</color> # Update field {0} of {1}.", entry.key, this.name);
                    }
                }

                else
                {
                    Debug.LogFormat("<color=cyan>Remote Settings</color> # <color=red>No key</color> for field {0} of {1}.", entry.key, this.name);
                }
            }
        }
 private void RemoteSettingsUpdatedHandler()
 {
     validateURL = RemoteSettings.GetString(ValidateURLSettingName, ValidateURLDefault);
     SetOAuthCallbackHost();
 }
Пример #26
0
 private void SetInstallUrl()
 {
     installUrl     = RemoteSettings.GetString(InstallURLSettingName, defaultInstallURL);
     installBitsUrl = RemoteSettings.GetString(InstallBitsURLSettingName, defaultInstallBitsURL);
 }
Пример #27
0
 public string GetTestName()
 {
     return(RemoteSettings.GetString(RemoteSettingKey.TestName, DefaultValue.TestName));
 }
Пример #28
0
    void Start()
    {
        allSprites = Resources.LoadAll <Sprite>(RemoteSettings.GetString("path2"));

        Debug.Log("Hi boyz. We have: " + allSprites.Length);
    }
Пример #29
0
 private void SetTwitchLoginURL()
 {
     twitchLoginURL = RemoteSettings.GetString(TwitchLoginURLSettingName, DefaultTwitchLoginURL);
 }
Пример #30
0
 public string GetString(string key, string defaultValue = default)
 {
     return(RemoteSettings.GetString(key, defaultValue));
 }