示例#1
0
        void StopMaterialControl()
        {
            //清空动画
            if (FadeInOutMaterialColor)
            {
                //如果运行模式不是外部指定的
                if (FadeInOutMaterialColor.RunMode == EffectRunMode.OutSiedePointed)
                {
                    FadeInOutMaterialColor.ClearMaterialInstance();
                    FadeInOutMaterialColor.Stop();
                }
            }

            if (FadeInOutMaterialFloat)
            {
                //如果运行模式不是外部指定的
                if (FadeInOutMaterialFloat.RunMode == EffectRunMode.OutSiedePointed)
                {
                    FadeInOutMaterialFloat.ClearMaterialInstance();
                    FadeInOutMaterialFloat.Stop();
                }
            }

            if (UVTextureAnimator)
            {
                //如果运行模式不是外部指定的
                if (UVTextureAnimator.RunMode == EffectRunMode.OutSiedePointed)
                {
                    UVTextureAnimator.ClearMaterialInstance();
                    UVTextureAnimator.Stop();
                }
            }

            if (UVScroll)
            {
                //如果运行模式不是外部指定的
                if (UVScroll.RunMode == EffectRunMode.OutSiedePointed)
                {
                    UVScroll.ClearMaterialInstance();
                    UVScroll.Stop();
                }
            }

            if (GradientColor)
            {
                //如果运行模式不是外部指定的
                if (GradientColor.RunMode == EffectRunMode.OutSiedePointed)
                {
                    GradientColor.ClearMaterialInstance();
                    GradientColor.Stop();
                }
            }
        }
        public override void OnInspectorGUI()
        {
            EditorGUILayout.HelpBox("Effect_UVScroll脚本不能和Effect_UVTextureAnimator同时作用于同一张贴图", MessageType.Warning);

            pa.RunMode = (EffectRunMode)EditorGUILayout.EnumPopup("运行模式:", pa.RunMode);

            serializedObject.Update();

            EditorGUI.BeginChangeCheck();
            pa.TexturePropertyName = EditorGUILayout.TextField("属性名:", pa.TexturePropertyName);
            if (pa.RunMode == EffectRunMode.Self)
            {
                pa.UseSharedMaterial = EditorGUILayout.Toggle("使用共享材质:", pa.UseSharedMaterial);
            }
            pa.fStartDelay = EditorGUILayout.FloatField("延迟开始(小于0.03无延迟):", pa.fStartDelay);
            pa.Rows        = EditorGUILayout.IntField("行:", pa.Rows);
            pa.Columns     = EditorGUILayout.IntField("列:", pa.Columns);
            pa.Fps         = EditorGUILayout.FloatField("帧数:", pa.Fps);
            pa.SelfTiling  = EditorGUILayout.Vector2Field("密度:", pa.SelfTiling);
            pa.AniTimes    = EditorGUILayout.IntField("播放次数(小于等于0无限次):", pa.AniTimes);
            pa.IsReverse   = EditorGUILayout.Toggle("逆向:", pa.IsReverse);

            pa.UseModelUV = EditorGUILayout.Toggle("使用模型UV:", pa.UseModelUV);

            if (GUILayout.Button("Play"))
            {
                pa.Play();
            }
            if (GUILayout.Button("Stop"))
            {
                pa.Stop();
            }
            if (GUI.changed)
            {
                EditorUtility.SetDirty(pa);
            }
        }
示例#3
0
        void Finish()
        {
            if (!bInit)
            {
                return;
            }

            if (EffectNode.UseTestModel)
            {
                return;
            }

            if (matInstances.Count <= 0)
            {
                return;
            }


            //结束的时候,还原材质球
            foreach (Renderer r in m_Renders)
            {
                if (!r)
                {
                    continue;
                }
                //只还原第0个材质球
                if (OrginalmatMap.ContainsKey(r))
                {
                    Material[] mats = r.sharedMaterials;
                    EffectUtily.GabageRender(r, mats[0]);
                    mats[0]     = OrginalmatMap[r];
                    r.materials = mats;
                }
            }

            matInstances.Clear();

            //清空动画
            if (FadeInOutMaterialColor)
            {
                //如果运行模式不是外部指定的
                if (FadeInOutMaterialColor.RunMode == EffectRunMode.OutSiedePointed)
                {
                    FadeInOutMaterialColor.SetMaterialInstance(matInstances);
                    FadeInOutMaterialColor.Stop();
                }
            }

            if (FadeInOutMaterialFloat)
            {
                //如果运行模式不是外部指定的
                if (FadeInOutMaterialFloat.RunMode == EffectRunMode.OutSiedePointed)
                {
                    FadeInOutMaterialFloat.SetMaterialInstance(matInstances);
                    FadeInOutMaterialFloat.Stop();
                }
            }

            if (UVTextureAnimator)
            {
                //如果运行模式不是外部指定的
                if (UVTextureAnimator.RunMode == EffectRunMode.OutSiedePointed)
                {
                    UVTextureAnimator.SetMaterialInstance(matInstances);
                    UVTextureAnimator.Stop();
                }
            }

            if (UVScroll)
            {
                //如果运行模式不是外部指定的
                if (UVScroll.RunMode == EffectRunMode.OutSiedePointed)
                {
                    UVScroll.SetMaterialInstance(matInstances);
                    UVScroll.Stop();
                }
            }

            if (GradientColor)
            {
                //如果运行模式不是外部指定的
                if (GradientColor.RunMode == EffectRunMode.OutSiedePointed)
                {
                    GradientColor.SetMaterialInstance(matInstances);
                    GradientColor.Stop();
                }
            }
        }
示例#4
0
        void Finish()
        {
            if (!bInit)
            {
                return;
            }

            if (EffectNode.UseTestModel)
            {
                return;
            }
            if (matInstances.Count <= 0)
            {
                return;
            }

            List <Material> TempList = new List <Material>();

            //结束的时候,清楚新增的材质球
            foreach (Renderer r in m_Renders)
            {
                if (!r)
                {
                    continue;
                }
                if (matInstancesMap.ContainsKey(r))
                {
                    TempList.Clear();
                    Material[] materials = r.sharedMaterials;
                    TempList.AddRange(r.sharedMaterials);
                    TempList.Remove(matInstancesMap[r]);
                    r.sharedMaterials = TempList.ToArray();

                    EffectUtily.GabageRender(r, matInstancesMap[r]);
                    var temp1 = matInstancesMap[r];
                    ResNode.DestroyRes(ref temp1);
                }
            }

            matInstances.Clear();
            matInstancesMap.Clear();

            //清空动画
            if (FadeInOutMaterialColor)
            {
                //如果运行模式不是外部指定的
                if (FadeInOutMaterialColor.RunMode == EffectRunMode.OutSiedePointed)
                {
                    FadeInOutMaterialColor.SetMaterialInstance(matInstances);
                    FadeInOutMaterialColor.Stop();
                }
            }

            if (FadeInOutMaterialFloat)
            {
                //如果运行模式不是外部指定的
                if (FadeInOutMaterialFloat.RunMode == EffectRunMode.OutSiedePointed)
                {
                    FadeInOutMaterialFloat.SetMaterialInstance(matInstances);
                    FadeInOutMaterialFloat.Stop();
                }
            }

            if (UVTextureAnimator)
            {
                //如果运行模式不是外部指定的
                if (UVTextureAnimator.RunMode == EffectRunMode.OutSiedePointed)
                {
                    UVTextureAnimator.SetMaterialInstance(matInstances);
                    UVTextureAnimator.Stop();
                }
            }

            if (UVScroll)
            {
                //如果运行模式不是外部指定的
                if (UVScroll.RunMode == EffectRunMode.OutSiedePointed)
                {
                    UVScroll.SetMaterialInstance(matInstances);
                    UVScroll.Stop();
                }
            }

            if (GradientColor)
            {
                //如果运行模式不是外部指定的
                if (GradientColor.RunMode == EffectRunMode.OutSiedePointed)
                {
                    GradientColor.SetMaterialInstance(matInstances);
                    GradientColor.Stop();
                }
            }
        }