Exemple #1
0
        private void LoadLocalRootInfo(string path)
        {
            var fileStream = ResourcesManager.LoadStream(path);

            using (StreamReader sr = new StreamReader(fileStream))
            {
                string        s;
                StringBuilder str = new StringBuilder();
                while ((s = sr.ReadLine()) != null)
                {
                    str.Clear();
                    string categoryName = "";
                    int    index        = 0;
                    for (int i = 0, j = 0; i < s.Length; i++)
                    {
                        char c = s[i];
                        if (c == ',' || i == s.Length - 1)
                        {
                            if (j == 0)
                            {
                                categoryName = str.ToString();
                            }
                            else if (j == 1)
                            {
                                str.Append(c);
                                index = Convert.ToInt32(str.ToString());
                            }
                            str.Clear();
                            j++;
                        }
                        else
                        {
                            str.Append(c);
                        }
                    }
                    m_localRootInfos.Add(categoryName, index);
                }
            }
            fileStream.Close();
            fileStream.Dispose();
        }
Exemple #2
0
        public async Task CheckVersion()
        {
            if (!ResourcesManager.Exists("version"))
            {
                await Task.Run(() => { UncompressFirstPackage(); });
            }
            m_localVersion = ResourcesManager.LoadFile("version");
            m_localVersion = m_localVersion.TrimEnd();
            var split = m_localVersion.Split('.');

            m_major = Convert.ToInt32(split[0]);
            string url = Core.Define.host + "/" + Core.Define.platform + "/" + m_major + "/version";

            UnityEngine.Debug.Log("localVersion:" + m_localVersion);
            var www = UnityWebRequest.Get(url);

            www.disposeDownloadHandlerOnDispose = true;
            www.chunkedTransfer = true;
            var request = www.SendWebRequest();

            request.completed += OnRemoteVersion;
        }
Exemple #3
0
        private AssetInfos LoadLocalAssetInfo(string category)
        {
            var bytes = ResourcesManager.LoadBytes(category + "/info");

            return(ProtobufUtility.Deserialize <AssetInfos>(bytes));
        }