public MyParticleInstance GetParticleInstance(string particleName, Action callback) { GameObject gameObject = GameObjectPoolManager.GetInstance().GetGameObject(mTemplete, rootTrans); MyParticleInstance pi = gameObject.GetComponent <MyParticleInstance>(); pi.load(particleName, callback); pi.gameObject.transform.parent = rootTrans; pi.gameObject.transform.localPosition = Vector3.zero; pi.gameObject.SetActive(true); pi.gameObject.name = particleName; return(pi); }
private void OnGUI() { if (GUI.Button(new Rect(0, 0, 100, 150), "add particle")) { MyParticleInstance particleInstance = MyParticleManager.GetInstance().GetParticleInstance("fx_01_boss_quidola_skill_s_ro", () => { Debug.LogError("load ok"); }); //PanelManager.GetInstance().ShowPanel("StartPanel", true, () => { Debug.LogError("嘿嘿"); }); //particleInstanceList.Add(particleInstance); //Scheduler.Delay(3, () => { // Debug.LogError("嘿嘿"); // MyParticleManager.GetInstance().AddParticleToCache(particleInstance); //}); //List<string> ls = new List<string>(); //ls.Add("apple1"); //ls.Add("apple2.unity"); //ls.Add("apple3"); //ls.Add("apple4"); //ls.Add("apple5"); //if(ls.Exists(IsScene)&&!ls.TrueForAll(IsScene)) //{ // Debug.LogError("1"); //} //else //{ // Debug.LogError("2"); //} //AssetBundleManifest manifest; //string rootPath = "/Users/slade_zhou/Documents/MyProject/LFrameWork/LFrameWork/DataMAC/DataMAC/AssetBundle/AssetBundle"; //AssetBundle ab = AssetBundle.LoadFromFile(rootPath); //if (ab == null) //{ // Debug.LogError("Load Manifest failed." + rootPath); //} //manifest = ab.LoadAsset<AssetBundleManifest>("AssetBundleManifest"); //if (manifest == null) //{ // ab.Unload(true); // Debug.LogError("Load Manifest failed."); //} //AssetBundle ab=AssetBundle.LoadFromFile //particle = ParticleManager.GetInstance().GetParticleInstance("fx_01_boss_quidola_skill_s_ro", EParticleType.KiteTrailEffect); //particle.AddLoadedCallBack((effect) => { // particle.Play(); // Debug.LogError("haha"); //}); } if (GUI.Button(new Rect(150, 0, 100, 150), "delete particle")) { if (particleInstanceList.Count > 0) { MyParticleInstance particleInstance = particleInstanceList[particleInstanceList.Count - 1]; particleInstanceList.RemoveAt(particleInstanceList.Count - 1); MyParticleManager.GetInstance().AddParticleToCache(particleInstance); } else { Debug.LogError("沒啦"); } //PanelManager.GetInstance().ShowPanel("StartPanel", false, () => { Debug.LogError("嘿嘿false"); }); //ParticleManager.GetInstance().AddCache(particle); } if (GUI.Button(new Rect(300, 0, 100, 150), "loading")) { //PanelManager.GetInstance().DestroyPanel("StartPanel"); //ParticleManager.GetInstance().ClearAll(); //ParticleResMgr.GetInstance().ClearAllUseless(); //Resources.UnloadUnusedAssets(); } }
public void AddParticleToCache(MyParticleInstance particleInstance) { GameObjectPoolManager.GetInstance().RecycleGameObject(particleInstance.gameObject); particleInstance.Clear(); }