private void Start()
    {
#if UNITY_ANDROID
        MonoInstancePool.getInstance <SDK_Orientation>(true).ShowBar();
#endif
        Screen.fullScreen = true;
        MonoInstancePool.getInstance <AntiScriptSplit>(true);
        MonoInstancePool.getInstance <SDK_WeChat>(true);

        trUIAlert   = UStaticFuncs.FindChildComponent <Transform>(transform, "UIAlert");
        fprocessing = 0.1f;
#if UNITY_IOS
        MonoInstancePool.getInstance <SDK_AppleInApp>(true);
#endif

        gameObject.AddComponent <UConsoleDebug>();
#if !UNITY_WEBGL
        var fa = "fa" + Utils_Plugins.Util_GetBundleVersion();
        if (!PlayerPrefs.HasKey(fa))
        {
            AOutput.Log($"start copy files {fa}");
            MonoInstancePool.getInstance <UCopyFilesFromStreamingAssets>().OnCopy("versions.txt", UStaticFuncs.ConfigSaveDir, () =>
            {
                InitRemoteConfig();
                PlayerPrefs.SetInt("fa" + Utils_Plugins.Util_GetBundleVersion(), 1);
            });
        }
        else
        {
#endif
        InitRemoteConfig();
#if !UNITY_WEBGL
    }
#endif
    }
 public string OnGetValue(string skey)
 {
     if (dKeyValue.ContainsKey(skey + Utils_Plugins.Util_GetBundleVersion()))
     {
         return(dKeyValue[skey + Utils_Plugins.Util_GetBundleVersion()]);
     }
     if (dKeyValue.ContainsKey(skey))
     {
         return(dKeyValue[skey]);
     }
     return("");
 }
Beispiel #3
0
 public string OnGetValue(string skey)
 {
     if (dKeyValue.ContainsKey($"{skey}{UStaticFuncs.GetPlatformFolder(Application.platform)}{Utils_Plugins.Util_GetBundleVersion()}"))
     {
         return(dKeyValue[$"{skey}{UStaticFuncs.GetPlatformFolder(Application.platform)}{Utils_Plugins.Util_GetBundleVersion()}"]);
     }
     if (dKeyValue.ContainsKey($"{skey}{UStaticFuncs.GetPlatformFolder(Application.platform)}"))
     {
         return(dKeyValue[$"{skey}{UStaticFuncs.GetPlatformFolder(Application.platform)}"]);
     }
     if (dKeyValue.ContainsKey($"{skey}{Utils_Plugins.Util_GetBundleVersion()}"))
     {
         return(dKeyValue[$"{skey}{Utils_Plugins.Util_GetBundleVersion()}"]);
     }
     if (dKeyValue.ContainsKey(skey))
     {
         return(dKeyValue[skey]);
     }
     return("");
 }
Beispiel #4
0
    private void Start()
    {
        gameObject.AddComponent <UConsoleDebug>();

        var fa = "fa" + Utils_Plugins.Util_GetBundleVersion();

        AOutput.Log($"local version {fa}");
        if (!PlayerPrefs.HasKey(fa))
        {
            AOutput.Log($"start copy files {fa}");
            MonoInstancePool.getInstance <UCopyFilesFromStreamingAssets>().OnCopy("versions.txt", UStaticFuncs.ConfigSaveDir, () =>
            {
                InitRemoteConfig();
                PlayerPrefs.SetInt("fa" + Utils_Plugins.Util_GetBundleVersion(), 1);
            });
        }
        else
        {
            InitRemoteConfig();
        }
    }
    void CheckNewVersion()
    {
        var newversionkey         = "";
        var newversionmustdownkey = "";
        var newversionurlkey      = "";
        var nvandignorekey        = "";

#if UNITY_IOS
        newversionkey         = "nvios";
        newversionmustdownkey = "nviosm";
        newversionurlkey      = "nviosurl";
#elif UNITY_ANDROID
        newversionkey         = "nvand";
        newversionmustdownkey = "nvandm";
        newversionurlkey      = "nvandurl";
        nvandignorekey        = "nvandignore";
#elif UNITY_STANDALONE
        newversionkey         = "nvwin";
        newversionmustdownkey = "nvwinm";
        newversionurlkey      = "nvwinurl";
#endif
        var remoteVersion = ConfigDownloader.Instance.OnGetValue(newversionkey);
        if (!string.IsNullOrEmpty(remoteVersion))
        {
            if (VersionIsSmall(Utils_Plugins.Util_GetBundleVersion(), remoteVersion))
            {
                var anvandignore       = ConfigDownloader.Instance.OnGetValue(nvandignorekey).Split(',');
                var newversionmustdown = ConfigDownloader.Instance.OnGetIntValue(newversionmustdownkey);
                var newversionurl      = ConfigDownloader.Instance.OnGetValue(newversionurlkey);
                if (anvandignore.Contains(Utils_Plugins.Util_GetBundleVersion()))
                {
                    if (PlayerPrefs.GetString("ignore") == remoteVersion)
                    {
                        ParseConfig(true);
                        return;
                    }
                    UIAlert.Show($"有新版本可更新,本版本({Utils_Plugins.Util_GetBundleVersion()})配置为可忽略更新,点击“确定”按钮更新,点击“取消”按钮跳过版本{remoteVersion}更新。", () =>
                    {
                        Application.OpenURL(newversionurl);
                        Invoke("ShowUIAlert", 0.2f);
                    }, false, false, () =>
                    {
                        PlayerPrefs.SetString("ignore", remoteVersion);
                        ParseConfig(true);
                    }, trUIAlert, true);
                    return;
                }
                if (newversionmustdown == 1)
                {
                    UIAlert.Show(string.Format("发现最新版本{0},本版本有重要更新,请更新后重试。", remoteVersion), () =>
                    {
                        Application.OpenURL(newversionurl);
                        Invoke("ShowUIAlert", 0.2f);
                    }, false, false, () => { Application.Quit(); }, trUIAlert, true);
                }
                else
                {
                    UIAlert.Show(string.Format("发现最新版本{0},是否要更新?", remoteVersion), () =>
                    {
                        Application.OpenURL(newversionurl);
                    }, false, false, () =>
                    {
                        ParseConfig(true);
                    }, trUIAlert);
                }
            }
            else
            {
                ParseConfig(true);
            }
        }
        else
        {
            ParseConfig(true);
        }
    }