// public void UpdateUvScale(int nSrcSpriteIndex, Transform targetTrans) // { // Vector3 scale; // if (1 <= m_fTextureRatio) // scale = new Vector3(m_SpriteList[nSrcSpriteIndex].m_UvRect.width * m_fUvScale * m_fTextureRatio, m_SpriteList[nSrcSpriteIndex].m_UvRect.height * m_fUvScale, 1); // else scale = new Vector3(m_SpriteList[nSrcSpriteIndex].m_UvRect.width * m_fUvScale, m_SpriteList[nSrcSpriteIndex].m_UvRect.height * m_fUvScale / m_fTextureRatio, 1); // targetTrans.localScale = Vector3.Scale(targetTrans.localScale, scale); // } public GameObject CreateSpriteEffect(int nSrcSpriteIndex, Transform parentTrans) { GameObject createEffect = null; if (m_SpriteList[nSrcSpriteIndex].m_EffectPrefab != null) { // Create BaseGameObject createEffect = CreateGameObject("Effect_" + m_SpriteList[nSrcSpriteIndex].m_EffectPrefab.name); if (createEffect == null) { return(null); } // Change Parent ChangeParent(parentTrans, createEffect.transform, true, null); NcAttachPrefab attachCom = createEffect.AddComponent <NcAttachPrefab>(); // attachCom.m_fDelayTime = 0; attachCom.m_AttachPrefab = m_SpriteList[nSrcSpriteIndex].m_EffectPrefab; attachCom.m_fPrefabSpeed = m_SpriteList[nSrcSpriteIndex].m_fEffectSpeed; attachCom.m_bDetachParent = m_SpriteList[nSrcSpriteIndex].m_bEffectDetach; attachCom.m_nSpriteFactoryIndex = m_SpriteList[nSrcSpriteIndex].m_nSpriteFactoryIndex; attachCom.UpdateImmediately(); // createEffect.transform.localScale *= ncSpriteNode.m_fEffectScale; // createEffect.transform.Translate(ncSpriteNode.m_EffectPos, Space.Self); // createEffect.transform.Rotate(ncSpriteNode.m_EffectRot, Space.Self); createEffect.transform.localScale *= m_SpriteList[nSrcSpriteIndex].m_fEffectScale; createEffect.transform.localPosition += m_SpriteList[nSrcSpriteIndex].m_EffectPos; createEffect.transform.localRotation *= Quaternion.Euler(m_SpriteList[nSrcSpriteIndex].m_EffectRot); } return(createEffect); }
public GameObject CreateSpriteEffect(int nSrcSpriteIndex, Transform parentTrans) { GameObject gameObject = null; if (this.m_SpriteList.get_Item(nSrcSpriteIndex).m_EffectPrefab != null) { gameObject = base.CreateGameObject("Effect_" + this.m_SpriteList.get_Item(nSrcSpriteIndex).m_EffectPrefab.get_name()); if (gameObject == null) { return(null); } base.ChangeParent(parentTrans, gameObject.get_transform(), true, null); NcAttachPrefab ncAttachPrefab = gameObject.AddComponent <NcAttachPrefab>(); ncAttachPrefab.m_AttachPrefab = this.m_SpriteList.get_Item(nSrcSpriteIndex).m_EffectPrefab; ncAttachPrefab.m_fPrefabSpeed = this.m_SpriteList.get_Item(nSrcSpriteIndex).m_fEffectSpeed; ncAttachPrefab.m_bDetachParent = this.m_SpriteList.get_Item(nSrcSpriteIndex).m_bEffectDetach; ncAttachPrefab.CreateAttachPrefabImmediately(); Transform expr_BA = gameObject.get_transform(); expr_BA.set_localScale(expr_BA.get_localScale() * this.m_SpriteList.get_Item(nSrcSpriteIndex).m_fEffectScale); Transform expr_E1 = gameObject.get_transform(); expr_E1.set_localPosition(expr_E1.get_localPosition() + this.m_SpriteList.get_Item(nSrcSpriteIndex).m_EffectPos); Transform expr_108 = gameObject.get_transform(); expr_108.set_localRotation(expr_108.get_localRotation() * Quaternion.Euler(this.m_SpriteList.get_Item(nSrcSpriteIndex).m_EffectRot)); } return(gameObject); }
public static void Ng_ChangeLayerWithChild(GameObject rootObj, int nLayer) { if (rootObj == null) { return; } rootObj.set_layer(nLayer); for (int i = 0; i < rootObj.get_transform().get_childCount(); i++) { NcAttachPrefab.Ng_ChangeLayerWithChild(rootObj.get_transform().GetChild(i).get_gameObject(), nLayer); } }
public static void Ng_ChangeLayerWithChild(GameObject rootObj, int nLayer) { if (rootObj == null) { return; } rootObj.layer = nLayer; for (int i = 0; i < rootObj.transform.childCount; i++) { NcAttachPrefab.Ng_ChangeLayerWithChild(rootObj.transform.GetChild(i).gameObject, nLayer); } }
void SetAttachPrefab(GameObject attachPrefab, bool bUndo) { if (bUndo == false && m_BaseSelectPrefab is NcAttachPrefab) { if (FXMakerHierarchy.inst.GetSelectedGameObject() != null && m_BaseSelectPrefab.gameObject != FXMakerHierarchy.inst.GetSelectedGameObject()) { NcAttachPrefab ncAttCom = FXMakerHierarchy.inst.GetSelectedGameObject().GetComponent <NcAttachPrefab>(); if (ncAttCom != null) { m_BaseSelectPrefab = ncAttCom; m_OldSelectPrefab = GetAttachPrefab(); } } } if (m_BaseSelectPrefab is NcAttachPrefab) { (m_BaseSelectPrefab as NcAttachPrefab).m_AttachPrefab = attachPrefab; } if (m_BaseSelectPrefab is NcParticleSystem) { (m_BaseSelectPrefab as NcParticleSystem).m_AttachPrefab = attachPrefab; } if (m_BaseSelectPrefab is NcSpriteFactory) { // if (m_SelectnSubArgIndex == 0) (m_BaseSelectPrefab as NcSpriteFactory).m_SpriteList[m_SelectnArgIndex].m_EffectPrefab = attachPrefab; } if (m_BaseSelectPrefab is NcSpriteTexture) { (m_BaseSelectPrefab as NcSpriteTexture).m_NcSpriteFactoryPrefab = attachPrefab; } if (m_BaseSelectPrefab is NcSpriteAnimation) { (m_BaseSelectPrefab as NcSpriteAnimation).m_NcSpriteFactoryPrefab = attachPrefab; } if (m_BaseSelectPrefab is NcParticleSpiral) { (m_BaseSelectPrefab as NcParticleSpiral).m_ParticlePrefab = attachPrefab; } if (m_BaseSelectPrefab is NcParticleEmit) { (m_BaseSelectPrefab as NcParticleEmit).m_ParticlePrefab = attachPrefab; } if (m_BaseSelectPrefab is FxmInfoBackground) { (m_BaseSelectPrefab as FxmInfoBackground).SetReferenceObject(m_SelectnArgIndex, attachPrefab); } return; }
protected void DisableEmit() { NcParticleSystem[] componentsInChildren = base.gameObject.GetComponentsInChildren <NcParticleSystem>(true); NcParticleSystem[] array = componentsInChildren; for (int i = 0; i < array.Length; i++) { NcParticleSystem ncParticleSystem = array[i]; if (ncParticleSystem != null) { ncParticleSystem.SetDisableEmit(); } } NcAttachPrefab[] componentsInChildren2 = base.gameObject.GetComponentsInChildren <NcAttachPrefab>(true); NcAttachPrefab[] array2 = componentsInChildren2; for (int j = 0; j < array2.Length; j++) { NcAttachPrefab ncAttachPrefab = array2[j]; if (ncAttachPrefab != null) { ncAttachPrefab.enabled = false; } } ParticleSystem[] componentsInChildren3 = base.gameObject.GetComponentsInChildren <ParticleSystem>(true); ParticleSystem[] array3 = componentsInChildren3; for (int k = 0; k < array3.Length; k++) { ParticleSystem particleSystem = array3[k]; if (particleSystem != null) { particleSystem.enableEmission = false; } } ParticleEmitter[] componentsInChildren4 = base.gameObject.GetComponentsInChildren <ParticleEmitter>(true); ParticleEmitter[] array4 = componentsInChildren4; for (int l = 0; l < array4.Length; l++) { ParticleEmitter particleEmitter = array4[l]; if (particleEmitter != null) { particleEmitter.emit = false; } } }
public GameObject CreateSpriteEffect(int nSrcSpriteIndex, Transform parentTrans) { GameObject gameObject = null; if (this.m_SpriteList[nSrcSpriteIndex].m_EffectPrefab != null) { gameObject = base.CreateGameObject("Effect_" + this.m_SpriteList[nSrcSpriteIndex].m_EffectPrefab.name); if (gameObject == null) { return(null); } base.ChangeParent(parentTrans, gameObject.transform, true, null); NcAttachPrefab ncAttachPrefab = gameObject.AddComponent <NcAttachPrefab>(); ncAttachPrefab.m_AttachPrefab = this.m_SpriteList[nSrcSpriteIndex].m_EffectPrefab; ncAttachPrefab.m_fPrefabSpeed = this.m_SpriteList[nSrcSpriteIndex].m_fEffectSpeed; ncAttachPrefab.m_bDetachParent = this.m_SpriteList[nSrcSpriteIndex].m_bEffectDetach; ncAttachPrefab.CreateAttachPrefabImmediately(); gameObject.transform.localScale *= this.m_SpriteList[nSrcSpriteIndex].m_fEffectScale; gameObject.transform.localPosition += this.m_SpriteList[nSrcSpriteIndex].m_EffectPos; gameObject.transform.localRotation *= Quaternion.Euler(this.m_SpriteList[nSrcSpriteIndex].m_EffectRot); } return(gameObject); }
// Property ------------------------------------------------------------------------- // Event Function ------------------------------------------------------------------- void OnEnable() { m_Sel = target as NcAttachPrefab; m_UndoManager = new FXMakerUndoManager(m_Sel, "NcAttachPrefab"); }
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 Component GetComponentInChildren(GameObject tarObj, Type findType, List <GameObject> parentPrefabList) { Component[] componentsInChildren = tarObj.GetComponentsInChildren(findType, true); Component[] array = componentsInChildren; for (int i = 0; i < array.Length; i++) { Component component = array[i]; if (component.GetComponent <NcDontActive>() == null) { return(component); } } NcAttachPrefab[] componentsInChildren2 = tarObj.GetComponentsInChildren <NcAttachPrefab>(true); NcAttachPrefab[] array2 = componentsInChildren2; for (int j = 0; j < array2.Length; j++) { NcAttachPrefab ncAttachPrefab = array2[j]; if (ncAttachPrefab.m_AttachPrefab != null) { Component validComponentInChildren = NsEffectManager.GetValidComponentInChildren(ncAttachPrefab.m_AttachPrefab, findType, parentPrefabList, true); if (validComponentInChildren != null) { return(validComponentInChildren); } } } NcParticleSystem[] componentsInChildren3 = tarObj.GetComponentsInChildren <NcParticleSystem>(true); NcParticleSystem[] array3 = componentsInChildren3; for (int k = 0; k < array3.Length; k++) { NcParticleSystem ncParticleSystem = array3[k]; if (ncParticleSystem.m_AttachPrefab != null) { Component validComponentInChildren = NsEffectManager.GetValidComponentInChildren(ncParticleSystem.m_AttachPrefab, findType, parentPrefabList, true); if (validComponentInChildren != null) { return(validComponentInChildren); } } } NcSpriteTexture[] componentsInChildren4 = tarObj.GetComponentsInChildren <NcSpriteTexture>(true); NcSpriteTexture[] array4 = componentsInChildren4; for (int l = 0; l < array4.Length; l++) { NcSpriteTexture ncSpriteTexture = array4[l]; if (ncSpriteTexture.m_NcSpriteFactoryPrefab != null) { Component validComponentInChildren = NsEffectManager.GetValidComponentInChildren(ncSpriteTexture.m_NcSpriteFactoryPrefab, findType, parentPrefabList, false); if (validComponentInChildren != null) { return(validComponentInChildren); } } } NcParticleSpiral[] componentsInChildren5 = tarObj.GetComponentsInChildren <NcParticleSpiral>(true); NcParticleSpiral[] array5 = componentsInChildren5; for (int m = 0; m < array5.Length; m++) { NcParticleSpiral ncParticleSpiral = array5[m]; if (ncParticleSpiral.m_ParticlePrefab != null) { Component validComponentInChildren = NsEffectManager.GetValidComponentInChildren(ncParticleSpiral.m_ParticlePrefab, findType, parentPrefabList, false); if (validComponentInChildren != null) { return(validComponentInChildren); } } } NcParticleEmit[] componentsInChildren6 = tarObj.GetComponentsInChildren <NcParticleEmit>(true); NcParticleEmit[] array6 = componentsInChildren6; for (int n = 0; n < array6.Length; n++) { NcParticleEmit ncParticleEmit = array6[n]; if (ncParticleEmit.m_ParticlePrefab != null) { Component validComponentInChildren = NsEffectManager.GetValidComponentInChildren(ncParticleEmit.m_ParticlePrefab, findType, parentPrefabList, false); if (validComponentInChildren != null) { return(validComponentInChildren); } } } NcSpriteFactory[] componentsInChildren7 = tarObj.GetComponentsInChildren <NcSpriteFactory>(true); NcSpriteFactory[] array7 = componentsInChildren7; for (int num = 0; num < array7.Length; num++) { NcSpriteFactory ncSpriteFactory = array7[num]; if (ncSpriteFactory.m_SpriteList != null) { for (int num2 = 0; num2 < ncSpriteFactory.m_SpriteList.Count; num2++) { if (ncSpriteFactory.m_SpriteList[num2].m_EffectPrefab != null) { Component validComponentInChildren = NsEffectManager.GetValidComponentInChildren(ncSpriteFactory.m_SpriteList[num2].m_EffectPrefab, findType, parentPrefabList, true); if (validComponentInChildren != null) { return(validComponentInChildren); } } } } } return(null); }
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()); }