Esempio n. 1
0
        public static AppConfig Load()
        {
            var c = new AppConfig();

            c.resVersion  = Version.LoadResVersion();
            c.codeVersion = Version.LoadCodeVersion();
            c.appVersion  = new Version(Application.version);
            return(c);
        }
Esempio n. 2
0
        public static void DownloadFromUrl(string path)
        {
            string urlPath = string.Format("{0}/{1}/{2}/{3}", url, ResSetting.GetChannelRes(), Version.LoadResVersion(), path)
                             + "?time=" + System.DateTime.Now.Ticks + "&r=" + UnityEngine.Random.Range(int.MinValue, int.MaxValue);
            string persistentPath = string.Format("{0}/{1}", Application.persistentDataPath, path);

#if UNITY_EDITOR
            Debug.LogError("DownloadFromUrl -> " + urlPath);
#endif
            CreateFolderForFile(persistentPath);

            WWW www = new WWW(urlPath);
            if (Download(www))
            {
                //下载的什么写什么,不用加解密
                WriteFileInPersistent(path, www.bytes, false);
            }
            else
            {
                return;
            }
        }
Esempio n. 3
0
        public static string LoadStringFromUrl(string path, bool encryt = true)
        {
            string urlForFile = string.Format("{0}/{1}/{2}/{3}", url, ResSetting.GetChannelRes(), Version.LoadResVersion(), path)
                                + "?time=" + System.DateTime.Now.Ticks + "&r=" + UnityEngine.Random.Range(int.MinValue, int.MaxValue);

#if UNITY_EDITOR
            Debug.LogError("LoadStringFromUrl -> " + urlForFile);
#endif
            WWW www = new WWW(urlForFile);
            if (Download(www))
            {
                if (!encryt)
                {
                    return(www.text);
                }
                else
                {
                    return(Decrypt(www.text));
                }
            }
            return(null);
        }