Exemple #1
0
    private void CheckVersion()
    {
#if UNITY_EDITOR
        if (Tracking)
        {
            PrintTrack(MethodBase.GetCurrentMethod().Name);
        }
#endif

        string sign                 = Utility.GetMd5Hash(_currentToken + _currentApiClientId + _secret);
        string authString           = "?apiclientid=" + _currentApiClientId + "&token=" + _currentToken + "&sign=" + sign;
        CheckVersionMessage message = new CheckVersionMessage(_domainName, authString);
        _checkVersionMessageRef = BaseOnline.Instance.WWWCoroutine(message.Url,
                                                                   OnCheckVersionMessageResponse);
        StartCoroutine(_checkVersionMessageRef);
    }
Exemple #2
0
    /// <summary>
    ///     Check dlc version then update to latest version
    /// </summary>
    /// <param name="domainName"></param>
    /// <param name="authString"></param>
    /// <param name="password"></param>
    /// <param name="dlcPath"></param>
    /// <param name="onDownloading">return percent of downloading</param>
    /// <param name="onCheckAndDownloadFinish">success or not</param>
    public void CheckAndDownload(string domainName,
                                 string authString,
                                 string password,
                                 string dlcPath,
                                 Action <float> onDownloading           = null,
                                 Action <bool> onCheckAndDownloadFinish = null)
    {
#if UNITY_EDITOR
        if (Tracking)
        {
            PrintTrack(MethodBase.GetCurrentMethod().Name);
            PrintTrack("domainName: " + domainName);
            PrintTrack("authString: " + authString);
            PrintTrack("password: "******"dlcPath: " + dlcPath);
        }
#endif

        if (_updating)
        {
            Debug.LogError("Many update DLC request, call ForceStopUpdate in case you want");
            return;
        }

        _updating = true;

        _domainName               = domainName;
        _authString               = authString;
        _password                 = password;
        _dlcPath                  = dlcPath;
        _onDownloading            = onDownloading;
        _onCheckAndDownloadFinish = onCheckAndDownloadFinish;

        CheckVersionMessage message = new CheckVersionMessage(_domainName, _authString);
        _checkVersionMessageRef = BaseOnline.Instance.WWWCoroutine(message.Url,
                                                                   OnCheckVersionMessageResponse);
        StartCoroutine(_checkVersionMessageRef);
    }
Exemple #3
0
    private void OnUpdateFullFinish(bool success)
    {
#if UNITY_EDITOR
        if (Tracking)
        {
            PrintTrack(MethodBase.GetCurrentMethod().Name);
            PrintTrack("success: " + success);
        }
#endif

        _downloadAndUnzipRef = null;

        if (success)
        {
            CheckVersionMessage message = new CheckVersionMessage(_domainName, _authString);
            _checkVersionMessageRef2 = BaseOnline.Instance.WWWCoroutine(message.Url,
                                                                        OnCheckVersionMessageResponseAfterUpdateFull);
            StartCoroutine(_checkVersionMessageRef2);
        }
        else
        {
            FinishUpdate(false);
        }
    }