//加载本地 UpdateConif.txt IEnumerator LoadlocalUpdateConif() { // string path = AssetPath.AssetBundlePath() + "UpdataConfig.txt"; My_debugNet.SendDebugLog(" LoadlocalUpdateConif-111111111111111"); string path = "file:///" + AppConfig.GetpersistentDataPath() + AppConfig.path + AppConfig.UpdataConfigName; WWW www = new WWW(path); yield return(www); if (www.error == null) { string[] Arrys = www.text.Split(new char[2] { '\n', '|' }); for (int i = 0; i < Arrys.Length - 1; i++) { string key = Arrys[i]; i++; string value = Arrys[i]; m_localupdataConifDic.Add(key, value); } StartCoroutine(LoadwwwUpdateConif()); } else { My_debugNet.SendDebugLog(" LoadlocalUpdateConif-11111111ww.error-1111111" + www.error); Debug.Log(" ------www.error--------" + www.error); } }
protected override void OnOpen(Callback <bool> callback) { GameObject[] obj = new GameObject[10]; for (int i = 0; i < 10; i++) { AssetBundle ad = assetBundleManager.GetAssetBundle("cube.myab"); obj[i] = MonoBehaviour.Instantiate(ad.LoadAsset("cube")) as GameObject; obj[i].transform.SetParent(this.transform); obj[i].transform.localPosition = new Vector3(0, i, 5); } //AssetBundle ad = assetBundleManager.GetAssetBundle("cube.myab"); //GameObject ob = MonoBehaviour.Instantiate(ad.LoadAsset("cube")) as GameObject; //ob.transform.SetParent(this.transform); //ob.transform.localPosition = new Vector3(0, 0, 5); AssetBundle ad1 = assetBundleManager.GetAssetBundle("tlua.myab"); TextAsset t = ad1.LoadAsset("tlua") as TextAsset; // Debug.Log("lua------------" + t.text); string text = System.IO.File.ReadAllText(AppConfig.GetpersistentDataPath() + AppConfig.path + "1234.lua"); // Debug.Log("AppStart text===" + text); My_debugNet.SendDebugLog("AppStart text===" + text); LuaMag.luaEnv.DoString(t.text); LuaMag.luaEnv.Global.Set("CSTestScene", this); LuaMag.luaEnv.Global.Get("luaInit", out testobj01); }
IEnumerator LoadwwwUpdateConif() { My_debugNet.SendDebugLog("LoadwwwUpdateConif==============="); string path = AppConfig.AppHttp + AppConfig.AppUpdataConfig; My_debugNet.SendDebugLog("LoadwwwUpdateConif=======path========" + path); WWW www = new WWW(path); yield return(www); if (www.error == null) { UpdataConfig = www.text; string[] Arrys = www.text.Split(new char[2] { '\n', '|' }); for (int i = 0; i < Arrys.Length - 1; i++) { string key = Arrys[i]; i++; string value = Arrys[i]; m_wwwupdataConifDic.Add(key, value); } UpdataContrast(); } else { My_debugNet.SendDebugLog("LoadwwwUpdateConif=======www.error========" + www.error); Debug.Log(" ------www.error--------" + www.error); } }
public StreamingTopersistent(AppUpdata _appUpdata) { try { m_appUpdata = _appUpdata; _appUpdata.StartCoroutine(LoadlocalUpdateConif()); } catch (System.Exception e) { My_debugNet.SendDebugLog(" m_StreamingTopersistent--3--" + e); throw; } }
private void onfenxiangButton(GameObject go) { string shareurl = PlayerPrefs.GetString("shareurl"); string shareimagepath = PlayerPrefs.GetString("shareimagepath"); string title = "快来参加AR夺宝,好东西免费抢了!"; string view_title = "这么多宝贝免费抢!\n赶快告诉小伙伴们来抢宝贝了~"; string content = "我用AR夺宝抢到了好多好东西,你也快来跟我一起抢吧!"; string weibo_content = "我用AR夺宝抢到了好多好东西,你也快来跟我一起抢吧!请点击" + " " + shareurl; My_debugNet.SendDebugLog("onfenxiangButton----" + shareurl + shareimagepath); MsgBase.SendMsg <string, string, string, string, string, string, Callback <bool, string> > ("U2N_U_OpenShare", shareurl, title, view_title, content, weibo_content, shareimagepath, null); My_debugNet.SendDebugLog("onfenxiangButton--122--" + shareurl + shareimagepath); }
public void OnCilck() { //if (m_AssetBundle==null) //{ // string Path3 = "file://" + Application.streamingAssetsPath + "/Android/cube.myab // StartCoroutine(LoadAssetBundle1(Path3, "cube")); // return; //} Debug.Log("OnCilck!!!"); StartCoroutine(LoadAssetBundle001()); My_debugNet.SendDebugLog("cop"); // AssetBundle ab = GetAssetBundle("cube01.myab"); //GameObject o = Instantiate(ab.LoadAsset("cube01")) as GameObject; // o.transform.position = new Vector3(0, 0, 5); }
public void Init() { My_debugNet.SendDebugLog("------AppStart----Init---"); assetBundleManager = new BundleManager(); assetBundleManager.loadAssetBundle01.Init(); // TextAsset luaAppstart = assetBundleManager.GetAssetBundle("AppStart.myab").LoadAsset("AppStart") as TextAsset; TextAsset luaAppstart = Resources.Load("AppStart") as TextAsset; Debug.Log("lua------------" + luaAppstart.text); LuaMag.luaEnv.DoString(luaAppstart.text); LuaMag.luaEnv.Global.Set("CSAppstart", this); LuaMag.luaEnv.Global.Get("Init", out AppStartluaInit); ac = LuaMag.luaEnv.Global.Get <Action>("start"); ac(); }
public static void CreateFile(string path, string name, string jd, Callback _callback = null) { try { string s1 = path + name; string filename = Path.GetFileName(s1); string tSt = s1.Replace(filename, ""); while (Directory.Exists(tSt) == false) { Directory.CreateDirectory(tSt); } Debug.Log("---jd---" + jd); My_debugNet.SendDebugLog(" jd 2---------------" + jd); string p = path + name; Debug.Log("---p---" + p); My_debugNet.SendDebugLog("---p---" + p); StreamWriter sw; FileInfo t = new FileInfo(p); My_debugNet.SendDebugLog("---FileInfo---"); if (!t.Exists) { My_debugNet.SendDebugLog("---Exists---"); sw = t.CreateText(); } else { My_debugNet.SendDebugLog("---12wqeqweqweq--"); FileStream fs = new FileStream(path + name, FileMode.Create, FileAccess.Write); sw = new StreamWriter(fs); } My_debugNet.SendDebugLog("--- sw.Flush();--"); sw.Flush(); sw.Write(jd); sw.Close(); sw.Dispose(); My_debugNet.SendDebugLog("--- _callback--"); if (_callback != null) { My_debugNet.SendDebugLog("---p222222222222---"); _callback(); } } catch (System.Exception e) { My_debugNet.SendDebugLog("---System.Exception--" + e.ToString()); } }
IEnumerator LoadlocalUpdateConif() { My_debugNet.SendDebugLog(" LoadlocalUpdateConif----"); string path = AppConfig.GetstreamingAssetsPath() + AppConfig.path + AppConfig.UpdataConfigName; WWW www = new WWW(path); yield return(www); if (www.error == null) { UpdataConfig = www.text; string[] Arrys = www.text.Split(new char[2] { '\n', '|' }); for (int i = 0; i < Arrys.Length - 1; i++) { string key = Arrys[i]; i++; string value = Arrys[i]; m_localupdataConifDic.Add(key, value); } foreach (var item in m_localupdataConifDic) { if (item.Key == "version") { continue; } LoadData load = new LoadData(); My_debugNet.SendDebugLog(" load.LoadDatawww2--" + item.Value); AppUpdata.Instance.StartCoroutine(load.LoadDatawww2(item.Value, loadDataCallback)); } if (m_localupdataConifDic.Count == 1) { loadDataCallback(); } } else { Debug.Log(" ------www.error--------" + www.error); My_debugNet.SendDebugLog(" LoadlocalUpdateConif--www.erro--" + www.error); } }
public void Loadbegin(Callback <string> _msgCallback, string activity_id) { msgCallback = _msgCallback; string Activity_id = "activity_id=" + activity_id; Messenger.Broadcast <string, string[], Callback <string, JsonData>, bool, int> ("U2N_U_HTTP", beginjson, new string[] { Activity_id }, delegate(string err, JsonData js) { if (err == null || err.Equals("")) { Getactivity_begin(js); My_debugNet.SendDebugLog("Loadbegin-----" + js.ToJson()); } else { Debug.Log("beginjson请求 失败"); } }, false, 1); }
private void UpdataContrast() { if (!m_wwwupdataConifDic.ContainsKey("version") || !m_localupdataConifDic.ContainsKey("version")) { My_debugNet.SendDebugLog("----更新 配置文件出错!!!未找到 version"); Debug.LogError("更新 配置文件出错!!!未找到 version"); return; } if (m_wwwupdataConifDic["version"] == m_localupdataConifDic["version"]) { Debug.Log(" ------版本号相同-------"); My_debugNet.SendDebugLog("------版本号相同-------"); //版本号相同 不做更新 直接进入程序 调用 开启程序方法 AppStart.Instance.Init(); My_debugNet.SendDebugLog("------ AppStart.Instance.Init();-------"); DicClear(); return; } //查找不同 foreach (var item in m_wwwupdataConifDic) { //把不相同的配置放进 更新字典里 if (item.Key == "version") { if (m_localupdataConifDic["version"] != item.Value) { // m_updataConifDic.Add(item.Key, item.Value); } } if (!m_localupdataConifDic.ContainsKey(item.Key)) { m_updataConifDic.Add(item.Key, item.Value); } } foreach (var item in m_updataConifDic) { LoadData load = new LoadData(); StartCoroutine(load.LoadDatawww(item.Value)); } }
public void Init() { My_debugNet.SendDebugLog(" Start"); Debug.Log("Start"); string p = AppConfig.GetpersistentDataPath() + AppConfig.path + AppConfig.UpdataConfigName; Debug.Log("Start1111111111111"); My_debugNet.SendDebugLog(" 124444"); FileInfo t = new FileInfo(p); if (t.Exists) { InitUpdata(); Debug.Log("2222222222"); My_debugNet.SendDebugLog("InitUpdata"); } else { Debug.Log("33333333333"); m_StreamingTopersistent = new StreamingTopersistent(this); My_debugNet.SendDebugLog(" m_StreamingTopersistent = new"); } }
private void loadDataCallback() { My_debugNet.SendDebugLog(" loadDataCallback--33333333333333-" + m_appUpdata.coypSum + "====" + m_localupdataConifDic.Count); string path = AppConfig.GetpersistentDataPath() + AppConfig.path; if (m_appUpdata == null) { return; } if (m_localupdataConifDic.Count == 1) { My_debugNet.SendDebugLog("m_localupdataConifDic.Count ===1"); SavedText.CreateFile(path, AppConfig.UpdataConfigName, UpdataConfig); m_localupdataConifDic.Clear(); m_appUpdata.InitUpdata(); Debug.Log("复制完成"); My_debugNet.SendDebugLog(" LoadlocalUpdateConif---复制完成-"); return; } if (m_localupdataConifDic.Count != 0) { My_debugNet.SendDebugLog(" m_localupdataConifDic.Count != 0"); m_appUpdata.coypSum++; if (m_appUpdata.coypSum == m_localupdataConifDic.Count - 1) { My_debugNet.SendDebugLog("m_appUpdata.coypSum == m_localupdataConifDic.Count-1"); SavedText.CreateFile(path, AppConfig.UpdataConfigName, UpdataConfig, loadDataCallback); } if (m_appUpdata.coypSum == m_localupdataConifDic.Count) { m_localupdataConifDic.Clear(); m_appUpdata.InitUpdata(); Debug.Log("复制完成"); My_debugNet.SendDebugLog(" LoadlocalUpdateConif---复制完成-"); } } }
public IEnumerator LoadDatawww2(string _config, Callback _callback) { // string path = @"file://E:/StreamingAssets/" + _config; Debug.Log("_config----" + _config); My_debugNet.SendDebugLog(" load._config--" + _config); string path = AppConfig.GetstreamingAssetsPath() + _config; Debug.Log("path----" + path); My_debugNet.SendDebugLog(" load.path--" + path); WWW www = new WWW(path); yield return(www); if (www.error == null) { string s1 = Application.persistentDataPath + "/" + _config; string filename = Path.GetFileName(s1); string tSt = s1.Replace(filename, ""); while (Directory.Exists(tSt) == false) { Directory.CreateDirectory(tSt); } Debug.Log("Application.persistentDataPath--------" + Application.persistentDataPath); My_debugNet.SendDebugLog(" Application.persistentDataPath----" + Application.persistentDataPath + "/" + _config); Stream outStream = File.Create(Application.persistentDataPath + "/" + _config); My_debugNet.SendDebugLog(" Applicatio--222222222222-"); byte[] buffer = www.bytes; outStream.Write(buffer, 0, buffer.Length); outStream.Close(); _callback(); } else { Debug.Log("LoadData ------www.error--------" + www.error.ToString() + "---" + path); My_debugNet.SendDebugLog(" LoadData ------www.error------" + www.error.ToString()); } }