Exemplo n.º 1
0
 public void PlayFX()
 {
     if (m_QualityFX != null && m_EffectClip != null)
     {
         m_QualityFX.Play();
         m_EffectClip.Init();
     }
 }
Exemplo n.º 2
0
        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();
        }
Exemplo n.º 3
0
    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();
                    }
                }
            }
        }
    }
Exemplo n.º 4
0
        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();
                    }
                }
            }
        }