/// <summary> /// /// </summary> public void SaveData() { using (XmlTextWriter xml = new XmlTextWriter(xmlFilePath + xmlFileName, System.Text.Encoding.Unicode)) { xml.WriteStartDocument(); xml.WriteStartElement(EFFECT); xml.WriteElementString("length", this.names.Length.ToString()); for (int i = 0; i < this.names.Length; i++) { EffectClip clip = this.effectClips[i]; xml.WriteStartElement(CLIP); xml.WriteElementString("id", i.ToString()); xml.WriteElementString("name", this.names[i]); xml.WriteElementString("effectType", clip.effectType.ToString()); xml.WriteElementString("effectName", clip.effectName); xml.WriteElementString("effectPath", clip.effectPath); xml.WriteElementString("beHitEffectPath", clip.beHitEffect_Path); xml.WriteEndElement(); } xml.WriteEndElement(); xml.WriteEndDocument(); } }
public GameObject EffectOneShot(int index, Vector3 position) { EffectClip clip = DataManager.EffectData().GetClip(index); GameObject effectInstance = clip.Instantiate(position); effectInstance.SetActive(true); return(effectInstance); }
public static void ShowItemQualityFX(ParticleSystemUIComponent qualityFX, EffectClip effectClip, Transform parentTf, int qualityLevel) { if (qualityLevel < 5) { if (qualityFX != null) { qualityFX.gameObject.CustomSetActive(false); } else { if (parentTf.Find("QualityFX") != null) { parentTf.Find("QualityFX").gameObject.CustomSetActive(false); } } return; } if (qualityFX == null) { if (parentTf.Find("QualityFX") == null) { GameObject obj = new GameObject("QualityFX"); obj.transform.SetParent(parentTf); obj.transform.localPosition = Vector3.zero; obj.transform.localEulerAngles = Vector3.zero; obj.transform.localScale = Vector3.one; effectClip = obj.AddComponent <EffectClip>(); qualityFX = obj.AddComponent <ParticleSystemUIComponent>(); UIPanel panel = parentTf.GetComponentInParentEx <UIPanel>(); if (panel != null) { qualityFX.panel = panel; } qualityFX.sortingOrderOffset = 1; NGUITools.SetLayer(qualityFX.gameObject, parentTf.gameObject.layer); } else { qualityFX = parentTf.Find("QualityFX").GetComponent <ParticleSystemUIComponent>(); effectClip = parentTf.Find("QualityFX").GetComponent <EffectClip>(); } } qualityFX.gameObject.CustomSetActive(true); string fxName = qualityLevel == 5 ? "DJ_pingjie5_jin_FX" : "DJ_pingjie6_red_FX"; qualityFX.fx = GetQualityFx(parentTf, fxName); qualityFX.Play(); effectClip.Init(); }
void Update() { if (mFX != null) { #region 延時播放特效 if (mWaitFrame > 0) { mWaitFrame -= 1; if (mWaitFrame == 0) { FxPlayTimer(); mWaitFrame = -1; } } else { if (!mFX.main.loop && !mFX.isPlaying || mFX.isStopped || !mFX.IsAlive(true)) { ClearAllMats(); Destroy(mFX.gameObject); mFX = null; return; } } #endregion if (stopOnDiaphanous && VisibleSyncPanel != null && IsPlaying() && !mFX.isStopped && mFX.IsAlive(true)) { if (VisibleSyncPanel.alpha <= 0.001f) { Stop(); } } } else { if (playOnVisible && VisibleSyncPanel != null && !IsPlaying()) { if (VisibleSyncPanel.alpha >= 0.998f) { Play(); EffectClip clip = transform.GetComponent <EffectClip>(); if (clip != null && !clip.HasInitialized) { clip.Init(); } } } } }
public override void OnInspectorGUI() { base.OnInspectorGUI(); EffectClip effectClip = target as EffectClip; GameObject obj = null; obj = EditorGUILayout.ObjectField("位置物体", obj, typeof(GameObject), true) as GameObject; if (obj != null) { effectClip.pos = obj.transform.position; effectClip.rotation = obj.transform.eulerAngles; effectClip.scale = obj.transform.localScale; } }
public EffectClip GetCopy(int index) { if (index < 0 || index >= this.effectClips.Length) { return(null); } EffectClip clip = new EffectClip(); clip.realID = index; clip.PreLoad(); return(clip); }
public EffectClip GetCopy(int index) { if (index < 0 || index >= this.effectClips.Length) { return(null); } EffectClip original = this.effectClips[index]; EffectClip clip = new EffectClip(); clip.effectFullPath = original.effectFullPath; clip.effectName = original.effectName; clip.effectType = original.effectType; clip.effectPath = original.effectPath; clip.realId = this.effectClips.Length; return(clip); }
public EffectClip GetCopyClip(int index) { if (index < 0 || index >= effectClips.Length) { return(null); } EffectClip original = effectClips[index]; EffectClip clip = new EffectClip(); clip.clipFullPath = original.clipFullPath; clip.clipName = original.clipName; clip.clipPath = original.clipPath; clip.effectType = original.effectType; clip.realID = effectClips.Length; return(clip); }
public void ShowFx() { if (FxObj && Exist(m_Data)) { UIControllerHotfix.Current.CloseCallbacks.Add(() => { FxObj.GetComponent <ParticleSystemUIComponent>().Stop(); }); if (!m_Data.IsFightOut) { FxObj.GetComponent <ParticleSystemUIComponent>().Play(); EffectClip clip = FxObj.GetComponent <EffectClip>(); if (clip != null && !clip.HasInitialized) { clip.Init(); } } } }
/// <summary> /// 해당 index의 EffectClip을 복사해서 반환 /// </summary> public EffectClip GetCopy(int index) { if (index < 0 || index >= this.effectClips.Length) { Debug.LogError("EffectData/GetCopy Out of index! index = " + index); return(null); } EffectClip original = this.effectClips[index]; //deep copy EffectClip clip = new EffectClip(); clip.effectFullPath = original.effectFullPath; clip.effectName = original.effectName; clip.effectType = original.effectType; clip.effectPath = original.effectPath; clip.realId = effectClips.Length; //clip.effectPrefab = original.effectPrefab; return(clip); }
public static ParticleSystemUIComponent ShowCharTypeFX(ParticleSystemUIComponent typeFX, EffectClip effectClip, Transform parentTf, PartnerGrade grade, Hotfix_LT.Data.eRoleAttr charType, int waitFrame = 0) { if ((int)grade < (int)PartnerGrade.SSR) { if (typeFX != null) { typeFX.gameObject.CustomSetActive(false); } else { if (parentTf.Find("TypeFX") != null) { parentTf.Find("TypeFX").gameObject.CustomSetActive(false); } } return(typeFX); } if (typeFX == null) { if (parentTf.Find("TypeFX") == null) { GameObject obj = new GameObject("TypeFX"); obj.transform.SetParent(parentTf); obj.transform.localPosition = Vector3.zero; obj.transform.localEulerAngles = Vector3.zero; obj.transform.localScale = Vector3.one; effectClip = obj.AddComponent <EffectClip>(); typeFX = obj.AddComponent <ParticleSystemUIComponent>(); UIPanel panel = parentTf.GetComponentInParentEx <UIPanel>(); if (panel != null) { typeFX.panel = panel; } typeFX.sortingOrderOffset = 1; NGUITools.SetLayer(typeFX.gameObject, parentTf.gameObject.layer); } else { typeFX = parentTf.Find("TypeFX").GetComponent <ParticleSystemUIComponent>(); effectClip = parentTf.Find("TypeFX").GetComponent <EffectClip>(); } } typeFX.gameObject.CustomSetActive(false); string fxName = null; switch (charType) { case Hotfix_LT.Data.eRoleAttr.Shui: { fxName = "fx_ui_touxiang_ShuiFX"; }; break; case Hotfix_LT.Data.eRoleAttr.Huo: { fxName = "fx_ui_touxiang_HuoFX"; }; break; case Hotfix_LT.Data.eRoleAttr.Feng: { fxName = "fx_ui_touxiang_FengFX"; }; break; } typeFX.needFXScaleMode = true; typeFX.fx = GetQualityFx(parentTf, fxName); typeFX.WaitFrame = waitFrame; typeFX.playOnEnable = true; typeFX.stopOnDisable = true; typeFX.gameObject.CustomSetActive(true); return(typeFX); }
public static ParticleSystemUIComponent ShowUpgradeQualityFX(ParticleSystemUIComponent Fx, Transform parentTf, int Quality, EffectClip effectClip = null, int waitFrame = 0) { if (Quality < 6) { if (Fx != null) { Fx.gameObject.CustomSetActive(false); } else { if (parentTf.Find("Fx") != null) { parentTf.Find("Fx").gameObject.CustomSetActive(false); } } return(Fx); } if (Fx == null) { if (parentTf.Find("Fx") == null) { GameObject obj = new GameObject("Fx"); obj.transform.SetParent(parentTf); obj.transform.localPosition = Vector3.zero; obj.transform.localEulerAngles = Vector3.zero; obj.transform.localScale = Vector3.one; effectClip = obj.AddComponent <EffectClip>(); Fx = obj.AddComponent <ParticleSystemUIComponent>(); UIPanel panel = parentTf.GetComponentInParentEx <UIPanel>(); if (panel != null) { Fx.panel = panel; } Fx.sortingOrderOffset = 1; NGUITools.SetLayer(Fx.gameObject, parentTf.gameObject.layer); } else { Fx = parentTf.Find("Fx").GetComponent <ParticleSystemUIComponent>(); effectClip = parentTf.Find("Fx").GetComponent <EffectClip>(); } } Fx.gameObject.CustomSetActive(false); string fxName; switch (Quality) { case 6: //炫彩 fxName = "fx_t_hb_xuancai_uv"; break; default: fxName = "fx_t_hb_xuancai_uv"; break; } Fx.needFXScaleMode = false; Fx.fx = GetQualityFx(parentTf, fxName); Fx.WaitFrame = waitFrame; Fx.playOnEnable = true; Fx.stopOnDisable = true; Fx.gameObject.CustomSetActive(true); //Fx.Play(); return(Fx); }
private void UpdateUI() { if (null != ItemData) { mDMono.gameObject.GetComponent <BoxCollider>().enabled = true; string templateid = EB.Dot.String(m_EconomyIDPropertyName, ItemData, ""); int num = EB.Dot.Integer(m_NumPropertyName, ItemData, 0); int quality_level = EB.Dot.Integer(m_QualityLevelPropertyName, ItemData, 0); m_Icon.spriteName = Hotfix_LT.Data.EconemyTemplateManager.GetItemIcon(templateid); m_Type = EB.Dot.String(m_TypeName, ItemData, ""); m_LevelBorder.spriteName = UIItemLvlDataLookup.LvlToStr(quality_level + ""); if (quality_level == 7) { m_FrameBG.spriteName = "Ty_Quality_Xuancai_Di"; } else { m_FrameBG.spriteName = "Ty_Di_2"; } m_FrameBG.color = UIItemLvlDataLookup.GetItemFrameBGColor(quality_level + ""); m_LevelBorder.gameObject.CustomSetActive(true); HotfixCreateFX.ShowItemQualityFX(mQualityFX, mEffectClip, mDMono.transform, quality_level); m_Flag.CustomSetActive(m_Type == "HeroShard"); m_EquipSuitIcon.gameObject.CustomSetActive(m_Type == "Equipment"); m_EquipLevel.gameObject.CustomSetActive(m_Type == "Equipment"); if (m_Type == "Equipment") { int equipLevel = EB.Dot.Integer(m_EquipLevelStr, ItemData, 1); if (equipLevel <= 0) { m_EquipLevel.gameObject.CustomSetActive(false); } else { m_EquipLevel.gameObject.CustomSetActive(true); m_EquipLevel.text = m_EuqipLevelShadow.text = "+" + equipLevel; m_EquipLevelBG.spriteName = UIItemLvlDataLookup.GetEquipLevelBGStr(quality_level); } m_EquipSuitIcon.spriteName = Hotfix_LT.Data.EconemyTemplateManager.GetEquipSuitIcon(templateid); } int grade = Hotfix_LT.Data.EconemyTemplateManager.Instance.GetGoodsGradeNum(templateid); m_boxGradeNumLab.gameObject.CustomSetActive(grade != 0); if (grade != 0) { m_boxGradeNumLab.text = string.Format("+{0}", grade); } string suitIcon = Hotfix_LT.Data.EconemyTemplateManager.Instance.GetEquipSuit(templateid); if (!string.IsNullOrEmpty(suitIcon)) { m_EquipSuitIcon.gameObject.CustomSetActive(true); m_EquipSuitIcon.spriteName = suitIcon; } if (m_Count != null) { if (num > 1) { m_Count.text = num + ""; m_Count.gameObject.CustomSetActive(true); } else { m_Count.gameObject.CustomSetActive(false); } } string InventoryId = EB.Dot.String("inventory_id", ItemData, ""); if (LTInventoryAllController._CurrentSelectCellId != null && LTInventoryAllController._CurrentSelectCellId.Contains(InventoryId)) { LTInventoryAllController._CurrentSelectCell = mDMono.transform.GetMonoILRComponentByClassPath <UIInventoryBagCellController>("Hotfix_LT.UI.UIInventoryBagCellController"); Border.CustomSetActive(true); } else { Border.CustomSetActive(false); } //红点判断 string eid = EB.Dot.String("economy_id", ItemData, null); if (eid != null) { var GeneralItem = Hotfix_LT.Data.EconemyTemplateManager.Instance.GetGeneral(eid); RedPoint.CustomSetActive(GeneralItem != null && GeneralItem.CanUse && !LTMainHudManager.Instance.ItemsList.Contains(InventoryId)); } } else { m_Icon.spriteName = ""; m_LevelBorder.gameObject.CustomSetActive(false); m_Flag.CustomSetActive(false); m_EquipSuitIcon.gameObject.CustomSetActive(false); m_EquipLevel.gameObject.CustomSetActive(false); m_boxGradeNumLab.gameObject.CustomSetActive(false); mDMono.gameObject.GetComponent <BoxCollider>().enabled = false; if (m_Count != null) { m_Count.gameObject.CustomSetActive(false); } RedPoint.CustomSetActive(false); Border.CustomSetActive(false); if (mQualityFX != null) { mQualityFX.gameObject.CustomSetActive(false); } else { if (mDMono.transform.Find("QualityFX") != null) { mQualityFX = mDMono.transform.Find("QualityFX").GetComponent <ParticleSystemUIComponent>(); mEffectClip = mDMono.transform.Find("QualityFX").GetComponent <EffectClip>(); mQualityFX.gameObject.CustomSetActive(false); } } } }