Beispiel #1
0
        /// <summary>
        /// 禁用特效
        /// </summary>
        /// <param name="cam"></param>
        private void DisableImageEffect(Type t)
        {
            if (NormalTypeEffectTable.ContainsKey(t))
            {
                ImageEffectNodeList effectnodelist = NormalTypeEffectTable[t];

                AllEffectEnabledTable[t] = false;
                effectnodelist.enable    = false;
                foreach (ImageEffectNode nod in effectnodelist.list)
                {
                    nod.OnDeActive();
                }
                UpdateEnabled();
            }
            else if (OpaqueTypeEffectTable.ContainsKey(t))
            {
                ImageEffectNodeList effectnodelist = OpaqueTypeEffectTable[t];

                AllEffectEnabledTable[t] = false;
                effectnodelist.enable    = false;
                foreach (ImageEffectNode nod in effectnodelist.list)
                {
                    nod.OnDeActive();
                }
                UpdateEnabled();
            }
            else
            {
                Debug.LogWarning("在Table中找不到特效类型:" + t.ToString() + ",是否忘记在Init中添加进去?");
            }
        }
Beispiel #2
0
        private T Add <T>() where T : ImageEffectNode
        {
            T    node = null;
            Type t    = typeof(T);

            if (NormalTypeEffectTable.ContainsKey(t))
            {
                node = HostCam.gameObject.GetComponent <T>();
                if (node == null)
                {
                    node = HostCam.gameObject.AddComponent <T>();
                    ImageEffectNodeList effectnodelist = NormalTypeEffectTable[t];
                    effectnodelist.list.Add(node);
                    effectnodelist.enable    = false;
                    AllEffectEnabledTable[t] = false;
                }
            }
            else if (OpaqueTypeEffectTable.ContainsKey(t))
            {
                node = HostCam.gameObject.GetComponent <T>();
                if (node == null)
                {
                    node = HostCam.gameObject.AddComponent <T>();
                    ImageEffectNodeList effectnodelist = OpaqueTypeEffectTable[t];
                    effectnodelist.list.Add(node);
                    effectnodelist.enable    = false;
                    AllEffectEnabledTable[t] = false;
                }
            }
            return(node);
        }
Beispiel #3
0
        private void Remove <T>() where T : ImageEffectNode
        {
            T node = HostCam.gameObject.GetComponent <T>();

            if (node != null)
            {
                Type t = typeof(T);
                if (NormalTypeEffectTable.ContainsKey(t))
                {
                    ImageEffectNodeList effectnodelist = NormalTypeEffectTable[t];
                    effectnodelist.list.Remove(node);
                    effectnodelist.enable    = effectnodelist.CorrectEnabled();
                    AllEffectEnabledTable[t] = effectnodelist.enable;
                }
                else if (OpaqueTypeEffectTable.ContainsKey(t))
                {
                    ImageEffectNodeList effectnodelist = NormalTypeEffectTable[t];
                    effectnodelist.list.Remove(node);
                    effectnodelist.enable    = effectnodelist.CorrectEnabled();
                    AllEffectEnabledTable[t] = effectnodelist.enable;
                }
            }
        }
Beispiel #4
0
        /// <summary>
        /// 启用特效
        /// </summary>
        /// <param name="cam"></param>
        private void EnableImageEffect(Type t)
        {
            if (NormalTypeEffectTable.ContainsKey(t))
            {
                ImageEffectNodeList effectnodelist = NormalTypeEffectTable[t];
                if (effectnodelist.CorrectEnabled())
                {
                    effectnodelist.enable = true;
                    if (effectnodelist.list[0].IsOnValidLOD())
                    {
                        foreach (ImageEffectNode nod in effectnodelist.list)
                        {
                            nod.OnActive();
                        }

                        AllEffectEnabledTable[t] = true;
                        UpdateEnabled();
                    }
                    else
                    {
                        AllEffectEnabledTable[t] = false;
                        UpdateEnabled();
                    }
                }
                else
                {
                    AllEffectEnabledTable[t] = false;
                    UpdateEnabled();
                }
            }
            else if (OpaqueTypeEffectTable.ContainsKey(t))
            {
                ImageEffectNodeList effectnodelist = OpaqueTypeEffectTable[t];
                if (effectnodelist.CorrectEnabled())
                {
                    effectnodelist.enable = true;
                    if (effectnodelist.list[0].IsOnValidLOD())
                    {
                        foreach (ImageEffectNode nod in effectnodelist.list)
                        {
                            nod.OnActive();
                        }

                        AllEffectEnabledTable[t] = true;
                        UpdateEnabled();
                    }
                    else
                    {
                        AllEffectEnabledTable[t] = false;
                        UpdateEnabled();
                    }
                }
                else
                {
                    AllEffectEnabledTable[t] = false;
                    UpdateEnabled();
                }
            }
            else
            {
                Debug.LogWarning("在Table中找不到特效类型:" + t.ToString() + ",是否忘记在Init中添加进去?");
            }
        }
Beispiel #5
0
        private void Refresh()
        {
            m_AllImageEffeNodeList.Clear();
            foreach (ImageEffectNodeList effectnodelist in NormalTypeEffectTable.Values)
            {
                foreach (ImageEffectNode nod in effectnodelist.list)
                {
                    nod.OnDeActive();
                }
                effectnodelist.Clear();
            }
            foreach (ImageEffectNodeList effectnodelist in OpaqueTypeEffectTable.Values)
            {
                foreach (ImageEffectNode nod in effectnodelist.list)
                {
                    nod.OnDeActive();
                }
                effectnodelist.Clear();
            }
            ResetEffectEnabledTable();
            ImageEffectNode[] effts = HostCam.GetComponents <ImageEffectNode>();
            m_AllImageEffeNodeList.AddRange(effts);
            foreach (ImageEffectNode effectnode in effts)
            {
                Type t = effectnode.GetType();
                if (NormalTypeEffectTable.ContainsKey(t))
                {
                    ImageEffectNodeList lis = NormalTypeEffectTable[t];
                    lis.list.Add(effectnode);
                }
                else if (OpaqueTypeEffectTable.ContainsKey(t))
                {
                    ImageEffectNodeList lis = OpaqueTypeEffectTable[t];
                    lis.list.Add(effectnode);
                }
            }

            foreach (ImageEffectNodeList effectnodelist in NormalTypeEffectTable.Values)
            {
                if (effectnodelist.CorrectEnabled() && effectnodelist.enable)
                {
                    if (effectnodelist.list[0].IsOnValidLOD())
                    {
                        AllEffectEnabledTable[effectnodelist.list[0].GetType()] = true;
                        foreach (ImageEffectNode nod in effectnodelist.list)
                        {
                            nod.OnActive();
                        }
                    }
                }
            }
            foreach (ImageEffectNodeList effectnodelist in OpaqueTypeEffectTable.Values)
            {
                if (effectnodelist.CorrectEnabled() && effectnodelist.enable)
                {
                    if (effectnodelist.list[0].IsOnValidLOD())
                    {
                        AllEffectEnabledTable[effectnodelist.list[0].GetType()] = true;
                        foreach (ImageEffectNode nod in effectnodelist.list)
                        {
                            nod.OnActive();
                        }
                    }
                }
            }
            UpdateEnabled();
        }