Ejemplo n.º 1
0
 public void CheckGameVersion(GameVersionInfo gameVersion)
 {
     if (gameVersionText != null && gameVersion != null && gameVersion.latest != Application.version && IsBiggerVersion(gameVersion.latest))
     {
         gameVersionText.text = m_LanguageManagerInstance.GetTextValue("Main.UpdateAvailable");
     }
 }
Ejemplo n.º 2
0
    IEnumerator GetLatestVersion(string apiCall, Action <GameVersionInfo> onSuccess)
    {
        using (UnityWebRequest req = UnityWebRequest.Get(String.Format(apiCall)))
        {
            yield return(req.Send());

            while (!req.isDone)
            {
                yield return(null);
            }
            byte[]          result      = req.downloadHandler.data;
            string          versionJSON = System.Text.Encoding.Default.GetString(result);
            GameVersionInfo info        = JsonUtility.FromJson <GameVersionInfo>(versionJSON);
            onSuccess(info);
        }
    }
Ejemplo n.º 3
0
    private void Init()
    {
        oldGUIColor = GUI.color;
        if (!Directory.Exists(assetPath))
        {
            Directory.CreateDirectory(assetPath);
        }

        settingData = ScriptableObjectUtils.LoadCreateScriptableObject <AssetBundleSettingData>(assetPath + settingDataPath);
        settingData.Init();

        UpdateFileExtension();
        UpdatePackageController.Init();
        gameVersionInfo = UpdatePackageController.GetGameVersionInfo(PlayerSettings.productName);
        if (gameVersionInfo == null)
        {
            gameVersionInfo = new GameVersionInfo();
            gameVersionInfo.forceUpdateVersion = PlayerSettings.bundleVersion;
            gameVersionInfo.latestVersion      = PlayerSettings.bundleVersion;
        }

        versionControlInfo = UpdatePackageController.GetVersionControlInfo(PlayerSettings.productName, PlayerSettings.bundleVersion);
        if (versionControlInfo == null)
        {
            versionControlInfo = new VersionControlInfo();
        }
        int num = GetMaxNumber(versionControlInfo.assetBundleVersions);

        if (num == -1)
        {
            assetBundleInfo                    = new AssetBundleInfo();
            assetBundleInfo.gameName           = PlayerSettings.productName;
            assetBundleInfo.gameVersion        = PlayerSettings.bundleVersion;
            assetBundleInfo.assetBundleVersion = 0;
        }
        else
        {
            assetBundleInfo = UpdatePackageController.GetAssetBundleInfo(PlayerSettings.productName, PlayerSettings.bundleVersion, num);
            assetBundleInfo.assetBundleVersion = assetBundleInfo.assetBundleVersion + 1;
        }
    }