public AudioSource GetSharedAudioSource(AudioClip audioClip, int nPriority, bool bLoop, float fVolume, float fPitch) { int num = this.m_SharedAudioClip.IndexOf(audioClip); if (num >= 0) { foreach (AudioSource current in this.m_SharedAudioSources[num]) { if (current.volume == fVolume && current.pitch == fPitch && current.loop == bLoop && current.priority == nPriority) { return(current); } } return(this.AddAudioSource(this.m_SharedAudioSources[num], audioClip, nPriority, bLoop, fVolume, fPitch)); } if (!NcEffectBehaviour.IsSafe()) { return(null); } List <AudioSource> list = new List <AudioSource>(); this.m_SharedAudioClip.Add(audioClip); this.m_SharedAudioSources.Add(list); return(this.AddAudioSource(list, audioClip, nPriority, bLoop, fVolume, fPitch)); }
// AudioSource public AudioSource GetSharedAudioSource(AudioClip audioClip, int nPriority, bool bLoop, float fVolume, float fPitch) { int nIndex = m_SharedAudioClip.IndexOf(audioClip); if (nIndex < 0) { if (NcEffectBehaviour.IsSafe() == false) { return(null); } List <AudioSource> sourceList = new List <AudioSource>(); m_SharedAudioClip.Add(audioClip); m_SharedAudioSources.Add(sourceList); return(AddAudioSource(sourceList, audioClip, nPriority, bLoop, fVolume, fPitch)); } else { foreach (AudioSource audioSource in m_SharedAudioSources[nIndex]) { if (audioSource.volume == fVolume && audioSource.pitch == fPitch && audioSource.loop == bLoop && audioSource.priority == nPriority) { return(audioSource); } } // add return(AddAudioSource(m_SharedAudioSources[nIndex], audioClip, nPriority, bLoop, fVolume, fPitch)); } }
// AudioSource public AudioSource GetSharedAudioSource(AudioClip audioClip, int nPriority, bool bLoop, float fVolume, float fPitch) { int nIndex = m_SharedAudioClip.IndexOf(audioClip); if (nIndex < 0) { if (!NcEffectBehaviour.IsSafe()) { return(null); } List <AudioSource> sourceList = new List <AudioSource>(); m_SharedAudioClip.Add(audioClip); m_SharedAudioSources.Add(sourceList); return(AddAudioSource(sourceList, audioClip, nPriority, bLoop, fVolume, fPitch)); } else { for (int i = 0; i < m_SharedAudioSources[nIndex].Count; ++i) { if (m_SharedAudioSources[nIndex][i].volume == fVolume && m_SharedAudioSources[nIndex][i].pitch == fPitch && m_SharedAudioSources[nIndex][i].loop == bLoop && m_SharedAudioSources[nIndex][i].priority == nPriority) { return(m_SharedAudioSources[nIndex][i]); } } // add return(AddAudioSource(m_SharedAudioSources[nIndex], audioClip, nPriority, bLoop, fVolume, fPitch)); } }
private void OnDestroy() { if (this.m_bEnabled && NcEffectBehaviour.IsSafe() && this.m_AttachType == NcAttachPrefab.AttachType.Destroy && this.m_AttachPrefab != null) { this.CreateAttachPrefab(); } }
public GameObject CreateGameObject(GameObject original) { if (!NcEffectBehaviour.IsSafe()) { return(null); } return(this.CreateEditorGameObject(Object.Instantiate <GameObject>(original))); }
public GameObject CreateGameObject(GameObject prefabObj, Vector3 position, Quaternion rotation) { if (!NcEffectBehaviour.IsSafe()) { return(null); } return(this.CreateEditorGameObject((GameObject)Object.Instantiate(prefabObj, position, rotation))); }
protected override void OnDestroy() { if (this.m_bEnabled && NcEffectBehaviour.IsSafe() && this.m_AttachType == NcParticleEmit.AttachType.Destroy && this.m_ParticlePrefab != null) { this.CreateAttachPrefab(); } base.OnDestroy(); }
public GameObject CreateGameObject(GameObject original, Vector3 position, Quaternion rotation) { if (!NcEffectBehaviour.IsSafe()) { return(null); } return(this.CreateEditorGameObject((GameObject)UnityEngine.Object.Instantiate(original, position, rotation))); }
public GameObject CreateGameObject(string name) { if (!NcEffectBehaviour.IsSafe()) { return(null); } return(this.CreateEditorGameObject(new GameObject(name))); }
// Property ------------------------------------------------------------------------- // Loop Function -------------------------------------------------------------------- // Control Function ----------------------------------------------------------------- // Particle public GameObject GetSharedParticleGameObject(GameObject originalParticlePrefab) { int nIndex = m_SharedPrefabs.IndexOf(originalParticlePrefab); if (nIndex < 0 || m_SharedGameObjects[nIndex] == null) { if (!NcEffectBehaviour.IsSafe()) { return(null); } GameObject sharedObj = Instantiate(originalParticlePrefab); sharedObj.transform.parent = NcEffectBehaviour.GetRootInstanceEffect().transform; if (0 <= nIndex) { m_SharedGameObjects[nIndex] = sharedObj; } else { m_SharedPrefabs.Add(originalParticlePrefab); m_SharedGameObjects.Add(sharedObj); } // Init sharedObj NcParticleSystem ps = sharedObj.GetComponent <NcParticleSystem>(); if (ps) { ps.enabled = false; } if (sharedObj.GetComponent <ParticleEmitter>()) { sharedObj.GetComponent <ParticleEmitter>().emit = false; sharedObj.GetComponent <ParticleEmitter>().useWorldSpace = true; ParticleAnimator paAni = sharedObj.GetComponent <ParticleAnimator>(); if (paAni) { paAni.autodestruct = false; } } NcParticleSystem ncPsCom = sharedObj.GetComponent <NcParticleSystem>(); if (ncPsCom) { ncPsCom.m_bBurst = false; } ParticleSystem psCom = sharedObj.GetComponent <ParticleSystem>(); if (psCom) { psCom.enableEmission = false; } return(sharedObj); } else { return(m_SharedGameObjects[nIndex]); } }
public GameObject GetSharedParticleGameObject(GameObject originalParticlePrefab) { int num = this.m_SharedPrefabs.IndexOf(originalParticlePrefab); if (num >= 0 && !(this.m_SharedGameObjects[num] == null)) { return(this.m_SharedGameObjects[num]); } if (!NcEffectBehaviour.IsSafe()) { return(null); } GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate(originalParticlePrefab); gameObject.transform.parent = NcEffectBehaviour.GetRootInstanceEffect().transform; if (0 <= num) { this.m_SharedGameObjects[num] = gameObject; } else { this.m_SharedPrefabs.Add(originalParticlePrefab); this.m_SharedGameObjects.Add(gameObject); } NcParticleSystem component = gameObject.GetComponent <NcParticleSystem>(); if (component) { component.enabled = false; } if (gameObject.particleEmitter) { gameObject.particleEmitter.emit = false; gameObject.particleEmitter.useWorldSpace = true; ParticleAnimator component2 = gameObject.GetComponent <ParticleAnimator>(); if (component2) { component2.autodestruct = false; } } NcParticleSystem component3 = gameObject.GetComponent <NcParticleSystem>(); if (component3) { component3.m_bBurst = false; } ParticleSystem component4 = gameObject.GetComponent <ParticleSystem>(); if (component4) { component4.enableEmission = false; } return(gameObject); }
public GameObject CreateGameObject(GameObject parentObj, GameObject prefabObj) { if (!NcEffectBehaviour.IsSafe()) { return(null); } GameObject gameObject = this.CreateGameObject(prefabObj); if (parentObj != null && gameObject != null) { this.ChangeParent(parentObj.transform, gameObject.transform, true, null); } return(gameObject); }
public GameObject CreateGameObject(GameObject parentObj, Transform parentTrans, GameObject prefabObj) { if (!NcEffectBehaviour.IsSafe()) { return(null); } GameObject gameObject = this.CreateGameObject(prefabObj); if (parentObj != null) { this.ChangeParent(parentObj.get_transform(), gameObject.get_transform(), true, parentTrans); } return(gameObject); }
public static GameObject GetRootInstanceEffect() { if (!NcEffectBehaviour.IsSafe()) { return(null); } GameObject gameObject = GameObject.Find("_InstanceObject"); if (gameObject == null) { gameObject = new GameObject("_InstanceObject"); } return(gameObject); }
// Replay Function public static GameObject CreateReplayEffect(GameObject tarPrefab) { if (tarPrefab == null) { return(null); } if (NcEffectBehaviour.IsSafe() == false) { return(null); } GameObject instanceObj = (GameObject)Instantiate(tarPrefab); SetReplayEffect(instanceObj); return(instanceObj); }
public static GameObject CreateReplayEffect(GameObject tarPrefab) { if (tarPrefab == null) { return(null); } if (!NcEffectBehaviour.IsSafe()) { return(null); } GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate(tarPrefab); NsEffectManager.SetReplayEffect(gameObject); return(gameObject); }
public static GameObject GetRootInstanceEffect() { if (!NcEffectBehaviour.IsSafe()) { return(null); } if (NcEffectBehaviour.m_RootInstance == null) { NcEffectBehaviour.m_RootInstance = GameObject.Find("_InstanceObject"); if (NcEffectBehaviour.m_RootInstance == null) { NcEffectBehaviour.m_RootInstance = new GameObject("_InstanceObject"); } } return(NcEffectBehaviour.m_RootInstance); }
// Property ------------------------------------------------------------------------- // Loop Function -------------------------------------------------------------------- // Control Function ----------------------------------------------------------------- // Particle public GameObject GetSharedParticleGameObject(GameObject originalParticlePrefab) { int nIndex = m_SharedPrefabs.IndexOf(originalParticlePrefab); if (nIndex < 0 || m_SharedGameObjects[nIndex] == null) { if (NcEffectBehaviour.IsSafe() == false) { return(null); } GameObject sharedObj = (GameObject)Object.Instantiate(originalParticlePrefab); sharedObj.transform.parent = NcEffectBehaviour.GetRootInstanceEffect().transform; if (0 <= nIndex) { m_SharedGameObjects[nIndex] = sharedObj; } else { m_SharedPrefabs.Add(originalParticlePrefab); m_SharedGameObjects.Add(sharedObj); } // Init sharedObj NcParticleSystem ps = sharedObj.GetComponent <NcParticleSystem>(); if (ps) { ps.enabled = false; } NcParticleSystem ncPsCom = sharedObj.GetComponent <NcParticleSystem>(); if (ncPsCom) { ncPsCom.m_bBurst = false; } ParticleSystem psCom = sharedObj.GetComponent <ParticleSystem>(); if (psCom) { psCom.enableEmission = false; } return(sharedObj); } else { return(m_SharedGameObjects[nIndex]); } }
// AudioSource public AudioSource GetSharedAudioSource(AudioClip audioClip, int nPriority, bool bLoop, float fVolume, float fPitch) { int nIndex = m_SharedAudioClip.IndexOf(audioClip); if (nIndex < 0 || m_SharedAudioSource[nIndex] == null) { if (NcEffectBehaviour.IsSafe() == false) { return(null); } AudioSource audioSource = gameObject.AddComponent <AudioSource>(); if (0 <= nIndex) { m_SharedAudioSource[nIndex] = audioSource; } else { m_SharedAudioClip.Add(audioClip); m_SharedAudioSource.Add(audioSource); } // Init AudioSource audioSource.clip = audioClip; audioSource.priority = nPriority; audioSource.loop = bLoop; audioSource.volume = fVolume; audioSource.pitch = fPitch; audioSource.playOnAwake = false; return(audioSource); } else { return(m_SharedAudioSource[nIndex]); } }
// ---------------------------------------------------------------------------------- protected static Texture[] PreloadResource(GameObject tarObj, List <GameObject> parentPrefabList) { if (NcEffectBehaviour.IsSafe() == false) { return(null); } // texture Renderer[] rens = tarObj.GetComponentsInChildren <Renderer>(true); List <Texture> texList = new List <Texture>(); foreach (Renderer ren in rens) { if (ren.sharedMaterials == null || ren.sharedMaterials.Length <= 0) { continue; } foreach (Material mat in ren.sharedMaterials) { if (mat != null && mat.mainTexture != null) { texList.Add(mat.mainTexture); } } NcSortingLayerMobileFixed sortingLayerFixed = ren.gameObject.GetComponent <NcSortingLayerMobileFixed>(); if (sortingLayerFixed == null) { sortingLayerFixed = ren.gameObject.AddComponent <NcSortingLayerMobileFixed>(); } } // prefab NcAttachPrefab[] prefabs = tarObj.GetComponentsInChildren <NcAttachPrefab>(true); foreach (NcAttachPrefab obj in prefabs) { if (obj.m_AttachPrefab != null) { Texture[] ret = PreloadPrefab(obj.m_AttachPrefab, parentPrefabList, true); if (ret == null) { obj.m_AttachPrefab = null; // clear } else { texList.AddRange(ret); } } } NcParticleSystem[] pss = tarObj.GetComponentsInChildren <NcParticleSystem>(true); foreach (NcParticleSystem ps in pss) { if (ps.m_AttachPrefab != null) { Texture[] ret = PreloadPrefab(ps.m_AttachPrefab, parentPrefabList, true); if (ret == null) { ps.m_AttachPrefab = null; // clear } else { texList.AddRange(ret); } } } NcSpriteTexture[] sts = tarObj.GetComponentsInChildren <NcSpriteTexture>(true); foreach (NcSpriteTexture st in sts) { if (st.m_NcSpriteFactoryPrefab != null) { Texture[] ret = PreloadPrefab(st.m_NcSpriteFactoryPrefab, parentPrefabList, false); if (ret != null) { texList.AddRange(ret); } } } NcParticleSpiral[] sps = tarObj.GetComponentsInChildren <NcParticleSpiral>(true); foreach (NcParticleSpiral sp in sps) { if (sp.m_ParticlePrefab != null) { Texture[] ret = PreloadPrefab(sp.m_ParticlePrefab, parentPrefabList, false); if (ret != null) { texList.AddRange(ret); } } } NcParticleEmit[] ses = tarObj.GetComponentsInChildren <NcParticleEmit>(true); foreach (NcParticleEmit se in ses) { if (se.m_ParticlePrefab != null) { Texture[] ret = PreloadPrefab(se.m_ParticlePrefab, parentPrefabList, false); if (ret != null) { texList.AddRange(ret); } } } // sound NcAttachSound[] ass = tarObj.GetComponentsInChildren <NcAttachSound>(true); foreach (NcAttachSound ncas in ass) { if (ncas.m_AudioClip != null) { continue; } } // prefab & sound NcSpriteFactory[] sprites = tarObj.GetComponentsInChildren <NcSpriteFactory>(true); foreach (NcSpriteFactory sp in sprites) { if (sp.m_SpriteList != null) { for (int n = 0; n < sp.m_SpriteList.Count; n++) { if (sp.m_SpriteList[n].m_EffectPrefab != null) { Texture[] ret = PreloadPrefab(sp.m_SpriteList[n].m_EffectPrefab, parentPrefabList, true); if (ret == null) { sp.m_SpriteList[n].m_EffectPrefab = null; // clear } else { texList.AddRange(ret); } if (sp.m_SpriteList[n].m_AudioClip != null) { continue; } } } } } //Ttig(tarObj.transform) ; return(texList.ToArray()); }
// ---------------------------------------------------------------------------------- protected static Texture[] PreloadResource(GameObject tarObj, List <GameObject> parentPrefabList) { if (!NcEffectBehaviour.IsSafe()) { return(null); } // texture Renderer[] rens = tarObj.GetComponentsInChildren <Renderer>(true); List <Texture> texList = new List <Texture>(); for (int i = 0; i < rens.Length; ++i) { if (rens[i].sharedMaterials == null || rens[i].sharedMaterials.Length <= 0) { continue; } for (int j = 0; j < rens[i].sharedMaterials.Length; ++j) { if (rens[i].sharedMaterials[j] != null && rens[i].sharedMaterials[j].mainTexture != null) { texList.Add(rens[i].sharedMaterials[j].mainTexture); } } } // prefab NcAttachPrefab[] prefabs = tarObj.GetComponentsInChildren <NcAttachPrefab>(true); for (int i = 0; i < prefabs.Length; ++i) { if (prefabs[i].m_AttachPrefab != null) { Texture[] ret = PreloadPrefab(prefabs[i].m_AttachPrefab, parentPrefabList, true); if (ret == null) { prefabs[i].m_AttachPrefab = null; // clear } else { texList.AddRange(ret); } } } NcParticleSystem[] pss = tarObj.GetComponentsInChildren <NcParticleSystem>(true); for (int i = 0; i < pss.Length; ++i) { if (pss[i].m_AttachPrefab != null) { Texture[] ret = PreloadPrefab(pss[i].m_AttachPrefab, parentPrefabList, true); if (ret == null) { pss[i].m_AttachPrefab = null; // clear } else { texList.AddRange(ret); } } } NcSpriteTexture[] sts = tarObj.GetComponentsInChildren <NcSpriteTexture>(true); for (int i = 0; i < sts.Length; ++i) { if (sts[i].m_NcSpriteFactoryPrefab != null) { Texture[] ret = PreloadPrefab(sts[i].m_NcSpriteFactoryPrefab, parentPrefabList, false); if (ret != null) { texList.AddRange(ret); } } } NcParticleSpiral[] sps = tarObj.GetComponentsInChildren <NcParticleSpiral>(true); for (int i = 0; i < sps.Length; ++i) { if (sps[i].m_ParticlePrefab != null) { Texture[] ret = PreloadPrefab(sps[i].m_ParticlePrefab, parentPrefabList, false); if (ret != null) { texList.AddRange(ret); } } } NcParticleEmit[] ses = tarObj.GetComponentsInChildren <NcParticleEmit>(true); for (int i = 0; i < ses.Length; ++i) { if (ses[i].m_ParticlePrefab != null) { Texture[] ret = PreloadPrefab(ses[i].m_ParticlePrefab, parentPrefabList, false); if (ret != null) { texList.AddRange(ret); } } } NcAttachSound[] ass = tarObj.GetComponentsInChildren <NcAttachSound>(true); for (int i = 0; i < ass.Length; ++i) { if (ass[i].m_AudioClip != null) { continue; } } NcSpriteFactory[] sprites = tarObj.GetComponentsInChildren <NcSpriteFactory>(true); for (int i = 0; i < sprites.Length; ++i) { if (sprites[i].m_SpriteList != null) { for (int n = 0; n < sprites[i].m_SpriteList.Count; n++) { if (sprites[i].m_SpriteList[n].m_EffectPrefab != null) { Texture[] ret = PreloadPrefab(sprites[i].m_SpriteList[n].m_EffectPrefab, parentPrefabList, true); if (ret == null) { sprites[i].m_SpriteList[n].m_EffectPrefab = null; // clear } else { texList.AddRange(ret); } if (sprites[i].m_SpriteList[n].m_AudioClip != null) { continue; } } } } } return(texList.ToArray()); }
private static Texture[] PreloadTexture(GameObject tarObj, List <GameObject> parentPrefabList) { if (!NcEffectBehaviour.IsSafe()) { return(null); } Renderer[] componentsInChildren = tarObj.GetComponentsInChildren <Renderer>(true); List <Texture> list = new List <Texture>(); Renderer[] array = componentsInChildren; for (int i = 0; i < array.Length; i++) { Renderer renderer = array[i]; if (renderer.get_sharedMaterials() != null && renderer.get_sharedMaterials().Length > 0) { Material[] sharedMaterials = renderer.get_sharedMaterials(); for (int j = 0; j < sharedMaterials.Length; j++) { Material material = sharedMaterials[j]; if (material != null && material.get_mainTexture() != null) { list.Add(material.get_mainTexture()); } } } } NcAttachPrefab[] componentsInChildren2 = tarObj.GetComponentsInChildren <NcAttachPrefab>(true); NcAttachPrefab[] array2 = componentsInChildren2; for (int k = 0; k < array2.Length; k++) { NcAttachPrefab ncAttachPrefab = array2[k]; if (ncAttachPrefab.m_AttachPrefab != null) { Texture[] array3 = NcEffectBehaviour.PreloadPrefab(ncAttachPrefab.m_AttachPrefab, parentPrefabList, true); if (array3 == null) { ncAttachPrefab.m_AttachPrefab = null; } else { list.AddRange(array3); } } } NcParticleSystem[] componentsInChildren3 = tarObj.GetComponentsInChildren <NcParticleSystem>(true); NcParticleSystem[] array4 = componentsInChildren3; for (int l = 0; l < array4.Length; l++) { NcParticleSystem ncParticleSystem = array4[l]; if (ncParticleSystem.m_AttachPrefab != null) { Texture[] array5 = NcEffectBehaviour.PreloadPrefab(ncParticleSystem.m_AttachPrefab, parentPrefabList, true); if (array5 == null) { ncParticleSystem.m_AttachPrefab = null; } else { list.AddRange(array5); } } } NcSpriteTexture[] componentsInChildren4 = tarObj.GetComponentsInChildren <NcSpriteTexture>(true); NcSpriteTexture[] array6 = componentsInChildren4; for (int m = 0; m < array6.Length; m++) { NcSpriteTexture ncSpriteTexture = array6[m]; if (ncSpriteTexture.m_NcSpriteFactoryPrefab != null) { Texture[] array7 = NcEffectBehaviour.PreloadPrefab(ncSpriteTexture.m_NcSpriteFactoryPrefab, parentPrefabList, false); if (array7 != null) { list.AddRange(array7); } } } NcAttachSound[] componentsInChildren5 = tarObj.GetComponentsInChildren <NcAttachSound>(true); NcAttachSound[] array8 = componentsInChildren5; for (int n = 0; n < array8.Length; n++) { NcAttachSound ncAttachSound = array8[n]; if (ncAttachSound.m_AudioClip != null) { } } NcSpriteFactory[] componentsInChildren6 = tarObj.GetComponentsInChildren <NcSpriteFactory>(true); NcSpriteFactory[] array9 = componentsInChildren6; for (int num = 0; num < array9.Length; num++) { NcSpriteFactory ncSpriteFactory = array9[num]; if (ncSpriteFactory.m_SpriteList != null) { for (int num2 = 0; num2 < ncSpriteFactory.m_SpriteList.get_Count(); num2++) { if (ncSpriteFactory.m_SpriteList.get_Item(num2).m_EffectPrefab != null) { Texture[] array10 = NcEffectBehaviour.PreloadPrefab(ncSpriteFactory.m_SpriteList.get_Item(num2).m_EffectPrefab, parentPrefabList, true); if (array10 == null) { ncSpriteFactory.m_SpriteList.get_Item(num2).m_EffectPrefab = null; } else { list.AddRange(array10); } if (ncSpriteFactory.m_SpriteList.get_Item(num2).m_AudioClip != null) { } } } } } return(list.ToArray()); }
protected static Texture[] PreloadResource(GameObject tarObj, List <GameObject> parentPrefabList) { if (!NcEffectBehaviour.IsSafe()) { return(null); } Renderer[] componentsInChildren = tarObj.GetComponentsInChildren <Renderer>(true); List <Texture> list = new List <Texture>(); Renderer[] array = componentsInChildren; for (int i = 0; i < array.Length; i++) { Renderer renderer = array[i]; if (renderer.sharedMaterials != null && renderer.sharedMaterials.Length > 0) { Material[] sharedMaterials = renderer.sharedMaterials; for (int j = 0; j < sharedMaterials.Length; j++) { Material material = sharedMaterials[j]; if (material != null && material.mainTexture != null) { list.Add(material.mainTexture); } } } } NcAttachPrefab[] componentsInChildren2 = tarObj.GetComponentsInChildren <NcAttachPrefab>(true); NcAttachPrefab[] array2 = componentsInChildren2; for (int k = 0; k < array2.Length; k++) { NcAttachPrefab ncAttachPrefab = array2[k]; if (ncAttachPrefab.m_AttachPrefab != null) { Texture[] array3 = NsEffectManager.PreloadPrefab(ncAttachPrefab.m_AttachPrefab, parentPrefabList, true); if (array3 == null) { ncAttachPrefab.m_AttachPrefab = null; } else { list.AddRange(array3); } } } NcParticleSystem[] componentsInChildren3 = tarObj.GetComponentsInChildren <NcParticleSystem>(true); NcParticleSystem[] array4 = componentsInChildren3; for (int l = 0; l < array4.Length; l++) { NcParticleSystem ncParticleSystem = array4[l]; if (ncParticleSystem.m_AttachPrefab != null) { Texture[] array5 = NsEffectManager.PreloadPrefab(ncParticleSystem.m_AttachPrefab, parentPrefabList, true); if (array5 == null) { ncParticleSystem.m_AttachPrefab = null; } else { list.AddRange(array5); } } } NcSpriteTexture[] componentsInChildren4 = tarObj.GetComponentsInChildren <NcSpriteTexture>(true); NcSpriteTexture[] array6 = componentsInChildren4; for (int m = 0; m < array6.Length; m++) { NcSpriteTexture ncSpriteTexture = array6[m]; if (ncSpriteTexture.m_NcSpriteFactoryPrefab != null) { Texture[] array7 = NsEffectManager.PreloadPrefab(ncSpriteTexture.m_NcSpriteFactoryPrefab, parentPrefabList, false); if (array7 != null) { list.AddRange(array7); } } } NcParticleSpiral[] componentsInChildren5 = tarObj.GetComponentsInChildren <NcParticleSpiral>(true); NcParticleSpiral[] array8 = componentsInChildren5; for (int n = 0; n < array8.Length; n++) { NcParticleSpiral ncParticleSpiral = array8[n]; if (ncParticleSpiral.m_ParticlePrefab != null) { Texture[] array9 = NsEffectManager.PreloadPrefab(ncParticleSpiral.m_ParticlePrefab, parentPrefabList, false); if (array9 != null) { list.AddRange(array9); } } } NcParticleEmit[] componentsInChildren6 = tarObj.GetComponentsInChildren <NcParticleEmit>(true); NcParticleEmit[] array10 = componentsInChildren6; for (int num = 0; num < array10.Length; num++) { NcParticleEmit ncParticleEmit = array10[num]; if (ncParticleEmit.m_ParticlePrefab != null) { Texture[] array11 = NsEffectManager.PreloadPrefab(ncParticleEmit.m_ParticlePrefab, parentPrefabList, false); if (array11 != null) { list.AddRange(array11); } } } NcAttachSound[] componentsInChildren7 = tarObj.GetComponentsInChildren <NcAttachSound>(true); NcAttachSound[] array12 = componentsInChildren7; for (int num2 = 0; num2 < array12.Length; num2++) { NcAttachSound ncAttachSound = array12[num2]; if (ncAttachSound.m_AudioClip != null) { } } NcSpriteFactory[] componentsInChildren8 = tarObj.GetComponentsInChildren <NcSpriteFactory>(true); NcSpriteFactory[] array13 = componentsInChildren8; for (int num3 = 0; num3 < array13.Length; num3++) { NcSpriteFactory ncSpriteFactory = array13[num3]; if (ncSpriteFactory.m_SpriteList != null) { for (int num4 = 0; num4 < ncSpriteFactory.m_SpriteList.Count; num4++) { if (ncSpriteFactory.m_SpriteList[num4].m_EffectPrefab != null) { Texture[] array14 = NsEffectManager.PreloadPrefab(ncSpriteFactory.m_SpriteList[num4].m_EffectPrefab, parentPrefabList, true); if (array14 == null) { ncSpriteFactory.m_SpriteList[num4].m_EffectPrefab = null; } else { list.AddRange(array14); } if (ncSpriteFactory.m_SpriteList[num4].m_AudioClip != null) { } } } } } return(list.ToArray()); }
private static Texture[] PreloadTexture(GameObject tarObj, List <GameObject> parentPrefabList) { if (!NcEffectBehaviour.IsSafe()) { return(null); } Renderer[] componentsInChildren = tarObj.GetComponentsInChildren <Renderer>(true); ListView <Texture> listView = new ListView <Texture>(); Renderer[] array = componentsInChildren; for (int i = 0; i < array.Length; i++) { Renderer renderer = array[i]; if (renderer.sharedMaterials != null && renderer.sharedMaterials.Length > 0) { Material[] sharedMaterials = renderer.sharedMaterials; for (int j = 0; j < sharedMaterials.Length; j++) { Material material = sharedMaterials[j]; if (material != null && material.mainTexture != null) { listView.Add(material.mainTexture); } } } } NcSpriteTexture[] componentsInChildren2 = tarObj.GetComponentsInChildren <NcSpriteTexture>(true); NcSpriteTexture[] array2 = componentsInChildren2; for (int k = 0; k < array2.Length; k++) { NcSpriteTexture ncSpriteTexture = array2[k]; if (ncSpriteTexture.m_NcSpriteFactoryPrefab != null) { Texture[] array3 = NcEffectBehaviour.PreloadPrefab(ncSpriteTexture.m_NcSpriteFactoryPrefab, parentPrefabList, false); if (array3 != null) { listView.AddRange(array3); } } } NcSpriteFactory[] componentsInChildren3 = tarObj.GetComponentsInChildren <NcSpriteFactory>(true); NcSpriteFactory[] array4 = componentsInChildren3; for (int l = 0; l < array4.Length; l++) { NcSpriteFactory ncSpriteFactory = array4[l]; if (ncSpriteFactory.m_SpriteList != null) { for (int m = 0; m < ncSpriteFactory.m_SpriteList.get_Count(); m++) { if (ncSpriteFactory.m_SpriteList.get_Item(m).m_EffectPrefab != null) { Texture[] array5 = NcEffectBehaviour.PreloadPrefab(ncSpriteFactory.m_SpriteList.get_Item(m).m_EffectPrefab, parentPrefabList, true); if (array5 == null) { ncSpriteFactory.m_SpriteList.get_Item(m).m_EffectPrefab = null; } else { listView.AddRange(array5); } if (ncSpriteFactory.m_SpriteList.get_Item(m).m_AudioClip != null) { } } } } } return(LinqS.ToArray <Texture>(listView)); }