Exemple #1
0
    // 로컬에 저장된 json 다 읽기
    void Local_LoadJsonFileCo()
    {
        string JsonPath = nativeAppSddatapath + "/json/";

        string[] FileNames = System.IO.Directory.GetFiles(JsonPath);
        for (int i = 0; i < FileNames.Length; ++i)
        {
            string pathName = FileNames[i];
            if (string.IsNullOrEmpty(pathName))
            {
                continue;
            }

            string[] splitName1 = pathName.Split(new char[] { '/', '\\' });
            if (splitName1.Length <= 0)
            {
                continue;
            }

            string[] splitName2 = splitName1[splitName1.Length - 1].Split('^');

            ++file_count;
            TempUtil.StartCoroutine(SetWWWtext(pathName, splitName2[0] + ".json"));
        }
    }
Exemple #2
0
    /// <summary>
    /// 서버로부터 다운 받아야할 Json파일 리스트 목록을 얻어와서 검사한다.
    /// </summary>
    public IEnumerator JsonCount()
    {
        WWW www = new WWW(Auth.GetAssetUrl(ASSETS.json));

        yield return(www);

        string strHtml = "";

        if (www.isDone)
        {
            strHtml = www.text;
            Dictionary <string, string> serverJosnCountDic = GetHtmlString(strHtml);

            foreach (KeyValuePair <string, string> pair in serverJosnCountDic)
            {
                if (pair.Key.CompareTo("crossdomain.xml") == 0 || pair.Key.CompareTo("") == 0)
                {
                    continue;
                }

                NativeManager.instance.jsonAssetcount++;
            }

            NativeManager.instance.jsoncount = NativeManager.instance.jsonAssetcount;
            TempUtil.StartCoroutine(AssetCount());
            www.Dispose();
        }
    }
Exemple #3
0
    public void GetAuthJson()
    {
        nativeAppdatapath = NativeManager.instance.AppDataPath;

#if !UNITY_EDITOR && UNITY_ANDROID
        nativeAppSddatapath = NativeManager.instance.AppSdDataPath;
#elif !UNITY_EDITOR && UNITY_IPHONE
        nativeAppSddatapath = NativeManager.instance.AppDataPath;
#elif UNITY_EDITOR
        nativeAppSddatapath = NativeManager.instance.AppDataPath;
#endif
        if (!Directory.Exists(nativeAppSddatapath))
        {
            Directory.CreateDirectory(nativeAppdatapath);
        }
        if (!Directory.Exists(nativeAppdatapath + "/json"))
        {
            Directory.CreateDirectory(nativeAppdatapath + "/json");
        }
        if (!Directory.Exists(nativeAppdatapath + "/texture"))
        {
            Directory.CreateDirectory(nativeAppdatapath + "/texture");
        }
        string fullfileName = "auth.json";

        TempUtil.StartCoroutine(GetAuthVersionCo(fullfileName, 0));
    }
Exemple #4
0
    IEnumerator JsonlistDownSet()
    {
        yield return(new WaitForFixedUpdate());

        foreach (string json in jsonlist)
        {
            if (json.CompareTo("crossdomain.xml") == 0 || json.CompareTo("") == 0)
            {
                continue;
            }

            string[] dates = json.Split('^');
            if (dates.Length > 1)
            {
                string realdate = "";
                string date     = dates[1];
                realdate = date.Split('.')[0];
                string[] files = Directory.GetFiles(nativeAppdatapath + "/json", dates[0] + "^*");
                foreach (string file in files)
                {
                    if (!file.Contains(realdate))
                    {
                        File.Delete(file);
                    }
                }
            }
            TempUtil.StartCoroutine(DownJsonFileCo(json));
            jsonlist.Remove(json);
            TempUtil.StartCoroutine(JsonlistDownSet());
            break;
        }
    }
Exemple #5
0
    void LoadJsonFileCo(string text)
    {
        string[] jsonstrs = text.Replace("\"", "").Split(',');
        for (int i = 0; i < jsonstrs.Length; i++)
        {
            NativeManager.instance.jsonAssetcount++;
            jsonlist.Add(jsonstrs[i]);
        }
        NativeManager.instance.jsoncount = NativeManager.instance.jsonAssetcount;

        TempUtil.StartCoroutine(GetAuthVersionCo(file_list_json, 2));
    }
    public void Local_LoadAssetFileCo()
    {
        nativeAppdatapath = NativeManager.instance.AppDataPath;
        //nativeAppSddatapath = NativeManager.instance.AppSdDataPath;
#if !UNITY_EDITOR && UNITY_ANDROID
        nativeAppdatapath = NativeManager.instance.AppDataPath;
#endif

#if !UNITY_EDITOR || UNITY_IPHONE
        //nativeAppSddatapath = NativeManager.instance.AppDataPath;
#endif

        folderName = "/asset";
#if UNITY_STANDALONE_WIN
        folderName = "/asset_Pc";
#endif

        string longPath = nativeAppdatapath + folderName;
        if (!System.IO.Directory.Exists(nativeAppdatapath + folderName))
        {
            Debug.LogError("Can't find Assetbundle folder!!!");
            return;
        }

        string[] FileNames = System.IO.Directory.GetFiles(longPath);
        for (int i = 0; i < FileNames.Length; ++i)
        {
            string pathName = FileNames[i];
            if (string.IsNullOrEmpty(pathName))
            {
                continue;
            }

            string[] splitName1 = pathName.Split(new char[] { '/', '\\' });
            if (splitName1.Length <= 0)
            {
                continue;
            }

            //string[] splitName2 = splitName1[splitName1.Length - 1].Split('#');

            ++file_count;

            assetlist.Add(splitName1[splitName1.Length - 1]);
        }

        foreach (string key in assetlist)
        {
            TempUtil.StartCoroutine(DownAssetFileCo(key));
            break;
        }
    }
Exemple #7
0
    void LoadAssetFileCo(string text)
    {
        string[] jsonstrs = text.Replace("\"", "").Split(',');
        for (int i = 0; i < jsonstrs.Length; i++)
        {
            NativeManager.instance.jsonAssetcount++;
            Assetlist.Add(jsonstrs[i]);
        }

        CompareToLocalVersion();

        TempUtil.StartCoroutine(GetAuthVersionCo(file_list_json, 3));
    }
Exemple #8
0
    private void CompareToLocalVersion()
    {
        foreach (string json in jsonlist)
        {
            if (json.CompareTo("crossdomain.xml") == 0 || json.CompareTo("") == 0)
            {
                continue;
            }
            file_count++;
        }
#if UNITY_IPHONE
        // auth.json add
        //file_count++;
#endif

        TempUtil.StartCoroutine(JsonlistDownSet());

        isDone = true;
    }
Exemple #9
0
    private IEnumerator DownJsonFileCo(string filename)
    {
        string url = Auth.GetAssetUrl(ASSETS.json);

        url += WWW.EscapeURL(filename);
        string[] dates = filename.Split('^');

        string savefile = dates[0] + ".json";

        if (File.Exists(nativeAppdatapath + "/json/" + filename))
        {
            yield return(null);

            localCount++;

            TempUtil.StartCoroutine(SetWWWtext(nativeAppdatapath + "/json/" + filename, savefile));
        }
        else
        {
            WWW www = new WWW(url);
            yield return(www);

            if (www.isDone)
            {
                if (www.error != null)
                {
                }

                localCount++;

                string[] savefilenames = filename.Split('^');
                SaveJsonFile(www.text, nativeAppdatapath + "/json/" + filename);
                TempUtil.StartCoroutine(SetWWWtext(nativeAppdatapath + "/json/" + filename, savefilenames[0] + ".json"));
                www.Dispose();
                JsonLowDataSet();
            }
            else
            {
                //Debug.Log("www not load : " + filename);
            }
        }
    }
Exemple #10
0
    private void AssetbundmgrSet()
    {
        if (assetlist.Count > 0)
        {
            //AssetbundleLoader.AddRealAssetName(assetlist[0], System.Text.RegularExpressions.Regex.Replace(assetlist[0], "[#][0-9]{10,}", ""));

            string firstStr = assetlist[0].Split('^')[0];
            AssetbundleLoader.AddRealAssetName(firstStr.Substring(0, firstStr.LastIndexOf(".")), assetlist[0]);

            assetlist.RemoveAt(0);
            if (assetlist.Count > 0)
            {
                TempUtil.StartCoroutine(DownAssetFileCo(assetlist[0]));
            }
        }

        if ((file_count == localcount) && isLoad == false)
        {
            isLoad = true;
            //foreach (string tem in soundassetlist)
            //{
            //Debug.Log(tem);
            //}

            //for (int a_nn = 0; a_nn < Rc_SoundMgr.instance.g_SoundABNameList.Count; a_nn++)
            //{
            //    if (Rc_SoundMgr.instance.g_SoundABNameList[a_nn] == null)
            //        continue;

            //    Debug.Log(Rc_SoundMgr.instance.g_SoundABNameList[a_nn]);
            //}

            if (www != null)
            {
                www.Dispose();
            }
        }
    }
Exemple #11
0
    void LoadAuthFileCo(string text)
    {
        JSONObject jsonObject   = new JSONObject(text);
        string     platformName = "";
        string     version      = "";
        string     redirectUrl  = string.Empty;

        //Debug.Log(jsonObject);
#if UNITY_EDITOR || UNITY_STANDALONE
        platformName = "Unity";
        version      = GameDefine.BuildVersion;
        redirectUrl  = "http://www.google.com/";
#elif !UNITY_EDITOR && UNITY_IPHONE
        platformName = "iPhone";
        version      = GameDefine.BuildVersion;
        redirectUrl  = "http://www.apple.com/";
#elif !UNITY_EDITOR && UNITY_ANDROID
        platformName = "Android";
        version      = GameDefine.BuildVersion;
        redirectUrl  = "http://www.google.com/";
#elif UNITY_STANDALONE
        platformName = "windows";
        version      = GameDefine.BuildVersion;
        redirectUrl  = "http://www.google.com/";
#endif
        if (jsonObject[platformName][version] == null)
        {
            Debug.LogWarning("notfound version platformName " + platformName + " version " + version + " file: " + jsonObject.ToString());
            Application.OpenURL(redirectUrl);
        }
        else
        {
            if (jsonObject[platformName][version]["act"] != null)
            {
                Auth.SetActionUrl(jsonObject[platformName][version]["act"].str);
            }

            if (jsonObject[platformName][version]["asset_d"] != null)
            {
                Auth.SetAssetUrl(jsonObject[platformName][version]["asset_d"].str);

#if UNITY_IPHONE
                //EtceteraBinding.SetUrl(Auth.GetAssetUrl(ASSETS.photo));
#endif
            }

            if (jsonObject[platformName][version]["chatting"] != null)
            {
                //ChattingClientSender.instance.SetChattingUrl(jsonObject[platformName][version]["chatting"].str);
            }

            if (jsonObject[platformName][version]["use_crypt"] != null)
            {
                //Debug.Log(platformName);
            }
            else
            {
                // 암호화 기본값
                //Auth.SetUseCrypt(jsonObject[platformName][version]["use_crypt"].b);
            }

            //TempUtil.StartCoroutine(JsonCount());

            if (!GameDefine.DownloadJson)
            {
                // 로컬에 저장된 json 다 읽기
                Local_LoadJsonFileCo();
            }
            else
            {
                TempUtil.StartCoroutine(GetAuthVersionCo(file_list_json, 1));
            }
        }
    }
Exemple #12
0
    private void CompareToLocalVersion()
    {
        file_count = 0;
        foreach (string assetstr in JsonLoader.instance.Assetlist)
        {
            if (assetstr.CompareTo("crossdomain.xml") == 0 || assetstr.CompareTo("") == 0)
            {
                continue;
            }

            file_count++;

            string realfilename = "";
            if (assetstr.Contains(".anim"))
            {
                realfilename = assetstr.Split('.')[0] + ".anim";
            }
            else if (assetstr.Contains(".sound"))
            {
                realfilename = assetstr.Split('.')[0] + ".sound";
            }
            else
            {
#if UNITY_STANDALONE_WIN
                realfilename = assetstr.Split('.')[0] + ".assetwin";
#elif UNITY_ANDROID
                realfilename = assetstr.Split('.')[0] + ".assetand";
#elif UNITY_IOS
                realfilename = assetstr.Split('.')[0] + ".assetios";
#endif
            }

            string[] savefiles = realfilename.Split('^');
            string   savefile  = "";
            string   realdate  = "";
            if (savefiles.Length > 1)
            {
                if (realfilename.Contains(".anim"))
                {
                    savefile = savefiles[0] + ".anim";
                }
                else if (realfilename.Contains(".sound"))
                {
                    savefile = savefiles[0] + ".sound";

                    soundassetlist.Add(savefile);
                }
                else
                {
#if UNITY_STANDALONE_WIN
                    savefile = savefiles[0] + ".assetwin";
#elif UNITY_ANDROID
                    savefile = savefiles[0] + ".assetand";
#elif UNITY_IOS
                    savefile = savefiles[0] + ".assetios";
#endif

                    if (savefile.Contains("_snd."))
                    {
                        //Debug.Log(savefiles[0]);
                        //Rc_SoundMgr.instance.g_SoundABNameList.Add(savefiles[0]);
                    }
                }

                string date = savefiles[1];
                realdate = date.Split('.')[0];
            }
            else
            {
                savefile = realfilename;
            }

            //Debug.Log(savefile);
            string[] files = Directory.GetFiles(nativeAppdatapath + folderName, savefiles[0] + "^*");
            foreach (string file in files)
            {
                if (!file.Contains(realdate))
                {
                    File.Delete(file);
                }
            }
            assetlist.Add(realfilename);
        }

        if (assetlist.Count > 0)
        {
            foreach (string key in assetlist)
            {
                TempUtil.StartCoroutine(DownAssetFileCo(key));
                break;
            }
        }
    }
Exemple #13
0
 public void LoadResourcesFile()
 {
     TempUtil.StartCoroutine(GetAuthVersionCo(file_list_json, 2));
 }
Exemple #14
0
    void LoadAuthFileCo(string text)
    {
        JSONObject jsonObject   = new JSONObject(text);
        string     platformName = "";

        //Debug.Log(jsonObject);
#if UNITY_EDITOR || UNITY_STANDALONE
        platformName = "Unity";
        redirectUrl  = "http://www.google.com/";
#elif !UNITY_EDITOR && UNITY_IPHONE
        platformName = "iPhone";
        version      = GameDefine.BuildVersion;
        redirectUrl  = "http://www.apple.com/";
#elif !UNITY_EDITOR && UNITY_ANDROID
        platformName = "Android";
        redirectUrl  = "http://www.google.com/";
#elif UNITY_STANDALONE
        platformName = "windows";
        version      = GameDefine.BuildVersion;
        redirectUrl  = "http://www.google.com/";
#endif
        if (jsonObject[platformName][Auth.Version] == null)
        {
            Debug.LogWarning("notfound version platformName " + platformName + " version " + Auth.Version + " file: " + jsonObject.ToString());
            //UIManager.instance.OpenPopup( E_UIPOPUP_TYPE.CheckPopup ).GetComponent<CheckPopup>().SetCheckPopupDesc( E_CHECK_POPUP_TYPE.YorN, "업데이트", "업데이트가 있습니다.\n마켓으로 바로 연결 하시겠습니까?", VersionDownload, VersionDownloadNo );
            UIManager.instance.OpenPopup(E_UIPOPUP_TYPE.CheckPopup).GetComponent <CheckPopup>().SetCheckPopupDesc(E_CHECK_POPUP_TYPE.YorN, "업데이트", "업데이트가 있습니다.\n스토어에서 업데이트 해주세요", VersionDownload, VersionDownloadNo);
        }
        else
        {
            if (jsonObject[platformName][Auth.Version]["act"] != null)
            {
                Auth.SetActionUrl(jsonObject[platformName][Auth.Version]["act"].str);
            }

            if (jsonObject[platformName][Auth.Version]["asset_d"] != null)
            {
                Auth.SetAssetUrl(jsonObject[platformName][Auth.Version]["asset_d"].str);

#if UNITY_IPHONE
                //EtceteraBinding.SetUrl(Auth.GetAssetUrl(ASSETS.photo));
#endif
            }

            if (jsonObject[platformName][Auth.Version]["chatting"] != null)
            {
                //ChattingClientSender.instance.SetChattingUrl(jsonObject[platformName][version]["chatting"].str);
            }

            if (jsonObject[platformName][Auth.Version]["use_crypt"] != null)
            {
                //Debug.Log(platformName);
            }
            else
            {
                // 암호화 기본값
                //Auth.SetUseCrypt(jsonObject[platformName][version]["use_crypt"].b);
            }

            //TempUtil.StartCoroutine(JsonCount());

            //if (!GameDefine.DownloadJson)
            //{
            //    // 로컬에 저장된 json 다 읽기
            //    Local_LoadJsonFileCo();
            //}
            //else
            TempUtil.StartCoroutine(GetAuthVersionCo(file_list_json, 1));
        }
    }