Пример #1
0
 //-------------------------------------------------------------------------------------------------------------
 public void DrawMaster(Rect sRect)
 {
     //if (Event.current.type.Equals(EventType.Repaint))
     //{
     // Do drawing
     if (ColorIsFinished == false)
     {
         ColorPurcent += (Time.deltaTime) / ColorDuration;
         Color tColor = Color.Lerp(OldColor, TintPrimary, ColorPurcent);
         STSDrawQuad.DrawRect(sRect, tColor);
         if (ColorPurcent >= 1)
         {
             ColorIsPlaying  = false;
             ColorIsFinished = true;
         }
     }
     else
     {
         if (AnimIsPlaying == true) // play animation
         {
             // estimate purcent
             EstimatePurcent();
             //EstimateCurvePurcent();
             Draw(sRect);
         }
     }
     //}
 }
Пример #2
0
        //-------------------------------------------------------------------------------------------------------------
        void OnGUI()
        {
            //Debug.Log("OnGUI");
            CheckResize();
            Rect ThisRect = new Rect(0, 0, position.width, position.height);

            if (Background == null)
            {
                //Background = AssetDatabase.LoadAssetAtPath<Texture2D>(STSFindPackage.PathOfPackage("/Scripts/Editor/Resources/STSPreviewA.png"));
                STSDrawQuad.DrawRect(ThisRect, Color.white);
                STSDrawCircle.DrawCircle(ThisRect.center, ThisRect.height / 2.0F, 64, Color.black);
            }
            if (Background != null)
            {
                GUI.DrawTexture(ThisRect, Background);
            }
            if (NoPreview == true)
            {
                GUI.Label(ThisRect, new GUIContent(STSConstants.K_NO_BIG_PREVIEW), tNoPreviewFieldStyle);
            }
            int tSelectedPreviewNew = EditorGUILayout.IntPopup(SelectedPreview, new string[] { "A", "B", "C", "D", "…" }, new int[] { 0, 1, 2, 3, 999 });

            if (tSelectedPreviewNew != SelectedPreview)
            {
                SelectedPreview = tSelectedPreviewNew;
                if (SelectedPreview == 0)
                {
                    Background = AssetDatabase.LoadAssetAtPath <Texture2D>(STSFindPackage.PathOfPackage("/Scripts/Editor/Resources/STSPreviewA.png"));
                }
                else if (SelectedPreview == 1)
                {
                    Background = AssetDatabase.LoadAssetAtPath <Texture2D>(STSFindPackage.PathOfPackage("/Scripts/Editor/Resources/STSPreviewB.png"));
                }
                else if (SelectedPreview == 2)
                {
                    Background = AssetDatabase.LoadAssetAtPath <Texture2D>(STSFindPackage.PathOfPackage("/Scripts/Editor/Resources/STSPreviewC.png"));
                }
                else if (SelectedPreview == 3)
                {
                    Background = AssetDatabase.LoadAssetAtPath <Texture2D>(STSFindPackage.PathOfPackage("/Scripts/Editor/Resources/STSPreviewD.png"));
                }
                else
                {
                    Background = null;
                }
            }
            if (Effect != null)
            {
                //Debug.Log("effect is drawinf with purcent " + Effect.Purcent);
                Effect.EstimateCurvePurcent();
                Effect.Draw(ThisRect);
            }
            else
            {
                //Debug.Log("effect is null");
            }
        }
Пример #3
0
 //-------------------------------------------------------------------------------------------------------------
 public override void Draw(Rect sRect)
 {
     if (Purcent > 0)
     {
         // Do drawing with purcent
         Color tColorLerp      = Color.Lerp(TintSecondary, TintPrimary, Purcent);
         Color tFadeColorAlpha = new Color(tColorLerp.r, tColorLerp.g, tColorLerp.b, Purcent * TintPrimary.a);
         STSDrawQuad.DrawRect(sRect, tFadeColorAlpha);
     }
 }
Пример #4
0
 //-------------------------------------------------------------------------------------------------------------
 public override void Draw(Rect sRect)
 {
     // Add curve percent calculate
     CurvePurcent = Curve.Evaluate(Purcent);
     if (Purcent > 0)
     {
         // Do drawing with purcent
         Color tFadeColorAlpha = new Color(TintPrimary.r, TintPrimary.g, TintPrimary.b, CurvePurcent * TintPrimary.a);
         STSDrawQuad.DrawRect(sRect, tFadeColorAlpha);
     }
 }
Пример #5
0
 //-------------------------------------------------------------------------------------------------------------
 public override void Draw(Rect sRect)
 {
     //STSBenchmark.Start();
     //Debug.Log("Purcent = " + Purcent.ToString("F3"));
     if (Purcent > 0)
     {
         // Do drawing with purcent
         Color tFadeColorAlpha = new Color(TintPrimary.r, TintPrimary.g, TintPrimary.b, Purcent * TintPrimary.a);
         STSDrawQuad.DrawRect(sRect, tFadeColorAlpha);
     }
     //STSBenchmark.Finish();
 }
Пример #6
0
        //-------------------------------------------------------------------------------------------------------------
        public override void Draw(Rect sRect)
        {
            if (Purcent > 0)
            {
                float tPurcent        = Purcent * 2;
                Color tFadeColorAlpha = new Color(TintPrimary.r, TintPrimary.g, TintPrimary.b, tPurcent * TintPrimary.a);
                Color tColorLerp      = Color.Lerp(TintSecondary, TintPrimary, Purcent);

                foreach (STSTile tTile in Matrix.TilesList)
                {
                    STSDrawQuad.DrawRectCenterGradient(tTile.Rectangle, tFadeColorAlpha, tColorLerp);
                }
            }
        }
Пример #7
0
 //-------------------------------------------------------------------------------------------------------------
 public override void Draw(Rect sRect)
 {
     // Do drawing with purcent
     //STSBenchmark.Start();
     if (Purcent > 0)
     {
         float tWidth  = sRect.width * Purcent;
         float tHeight = sRect.height * Purcent;
         float tX      = sRect.position.x + (sRect.width - tWidth) / 2.0F;
         float tY      = sRect.position.y + (sRect.height - tHeight) / 2.0F;
         STSDrawQuad.DrawRect(new Rect(tX, tY, tWidth, tHeight), TintPrimary);
     }
     //STSBenchmark.Finish();
 }
Пример #8
0
 //-------------------------------------------------------------------------------------------------------------
 public override void Draw(Rect sRect)
 {
     //STSBenchmark.Start();
     // Add curve percent calculate
     CurvePurcent = Curve.Evaluate(Purcent);
     if (Purcent > 0)
     {
         // Do drawing with purcent
         Color tColorLerp      = Color.Lerp(TintSecondary, TintPrimary, CurvePurcent);
         Color tFadeColorAlpha = new Color(tColorLerp.r, tColorLerp.g, tColorLerp.b, CurvePurcent * TintPrimary.a);
         STSDrawQuad.DrawRect(sRect, tFadeColorAlpha);
     }
     //STSBenchmark.Finish();
 }
Пример #9
0
        //-------------------------------------------------------------------------------------------------------------
        public override void Draw(Rect sRect)
        {
            //STSBenchmark.Start();
            if (Purcent > 0)
            {
                //Color tColorLerp = Color.Lerp(TintSecondary, TintPrimary, Purcent);
                int tIndex = (int)Mathf.Floor(Purcent * Matrix.TileCount);
                //Debug.Log("tIndex = " + tIndex + " on TileCount) = "+TileCount);
                // draw all fill tiles
                int tLine   = 0;
                int tColumn = 0;
                switch (FiveCross)
                {
                case STSFiveCross.Left:
                {
                    for (int i = 0; i < tIndex; i++)
                    {
                        tColumn = (int)Mathf.Floor((float)i / (float)ParameterOne);
                        tLine   = (int)((float)i % ((float)ParameterOne));
                        //Debug.Log("index = "+i+"/"+tIndex+"/ "+TileCount+" ---> loop tLine ="+tLine +" tColumn = " +tColumn);
                        STSTile tTile = Matrix.GetTile(tLine, tColumn);
                        STSDrawQuad.DrawRect(tTile.Rectangle, TintPrimary);
                    }
                    // Draw Alpha tile
                    if (tIndex < Matrix.TileCount)
                    {
                        tColumn = (int)Mathf.Floor((float)tIndex / (float)ParameterOne);
                        tLine   = (int)((float)tIndex % ((float)ParameterOne));
                        //Debug.Log("index = " + tIndex + "/" + tIndex + "/ " + TileCount + " ---> loop tLineAlpha =" + tLineAlpha + " tColumnAlpha = " + tColumnAlpha);
                        STSTile tTileAlpha = Matrix.GetTile(tLine, tColumn);
                        float   tAlpha     = (Purcent * Matrix.TileCount) - (float)tIndex;
                        //Color tColorLerp = Color.Lerp(TintSecondary, TintPrimary, tAlpha);
                        Color tFadeColorAlpha = new Color(TintPrimary.r, TintPrimary.g, TintPrimary.b, tAlpha);
                        STSDrawQuad.DrawRect(tTileAlpha.Rectangle, tFadeColorAlpha);
                    }
                }
                break;

                case STSFiveCross.Right:
                {
                    for (int i = 0; i < tIndex; i++)
                    {
                        tColumn = (int)Mathf.Ceil(ParameterTwo - (float)i / (float)ParameterOne) - 1;
                        tLine   = (int)((float)i % ((float)ParameterOne));
                        //Debug.Log("index = "+i+"/"+tIndex+"/ "+TileCount+" ---> loop tLine ="+tLine +" tColumn = " +tColumn);
                        STSTile tTile = Matrix.GetTile(tLine, tColumn);
                        STSDrawQuad.DrawRect(tTile.Rectangle, TintPrimary);
                    }
                    // Draw Alpha tile
                    if (tIndex < Matrix.TileCount)
                    {
                        tColumn = (int)Mathf.Ceil(ParameterTwo - (float)tIndex / (float)ParameterOne) - 1;
                        tLine   = (int)((float)tIndex % ((float)ParameterOne));
                        //Debug.Log("index = " + tIndex + "/" + tIndex + "/ " + TileCount + " ---> loop tLineAlpha =" + tLineAlpha + " tColumnAlpha = " + tColumnAlpha);
                        STSTile tTileAlpha = Matrix.GetTile(tLine, tColumn);
                        float   tAlpha     = (Purcent * Matrix.TileCount) - (float)tIndex;
                        //Color tColorLerp = Color.Lerp(TintSecondary, TintPrimary, tAlpha);
                        Color tFadeColorAlpha = new Color(TintPrimary.r, TintPrimary.g, TintPrimary.b, tAlpha);
                        STSDrawQuad.DrawRect(tTileAlpha.Rectangle, tFadeColorAlpha);
                    }
                }
                break;

                case STSFiveCross.Top:
                {
                    for (int i = 0; i < tIndex; i++)
                    {
                        tLine   = (int)Mathf.Floor((float)i / (float)ParameterTwo);
                        tColumn = (int)((float)i % ((float)ParameterTwo));
                        //Debug.Log("index = "+i+"/"+tIndex+"/ "+TileCount+" ---> loop tLine ="+tLine +" tColumn = " +tColumn);
                        STSTile tTile = Matrix.GetTile(tLine, tColumn);
                        STSDrawQuad.DrawRect(tTile.Rectangle, TintPrimary);
                    }
                    // Draw Alpha tile
                    if (tIndex < Matrix.TileCount)
                    {
                        tLine   = (int)Mathf.Floor((float)tIndex / (float)ParameterTwo);
                        tColumn = (int)((float)tIndex % ((float)ParameterTwo));
                        //Debug.Log("index = " + tIndex + "/" + tIndex + "/ " + TileCount + " ---> loop tLineAlpha =" + tLineAlpha + " tColumnAlpha = " + tColumnAlpha);
                        STSTile tTileAlpha = Matrix.GetTile(tLine, tColumn);
                        float   tAlpha     = (Purcent * Matrix.TileCount) - (float)tIndex;
                        //Color tColorLerp = Color.Lerp(TintSecondary, TintPrimary, tAlpha);
                        Color tFadeColorAlpha = new Color(TintPrimary.r, TintPrimary.g, TintPrimary.b, tAlpha);
                        STSDrawQuad.DrawRect(tTileAlpha.Rectangle, tFadeColorAlpha);
                    }
                }
                break;

                case STSFiveCross.Bottom:
                {
                    for (int i = 0; i < tIndex; i++)
                    {
                        tLine   = (int)Mathf.Ceil(ParameterOne - (float)i / (float)ParameterTwo) - 1;
                        tColumn = (int)((float)i % ((float)ParameterTwo));
                        //Debug.Log("index = "+i+"/"+tIndex+"/ "+TileCount+" ---> loop tLine ="+tLine +" tColumn = " +tColumn);
                        STSTile tTile = Matrix.GetTile(tLine, tColumn);
                        STSDrawQuad.DrawRect(tTile.Rectangle, TintPrimary);
                    }
                    // Draw Alpha tile
                    if (tIndex < Matrix.TileCount)
                    {
                        tLine   = (int)Mathf.Ceil(ParameterOne - (float)tIndex / (float)ParameterTwo) - 1;
                        tColumn = (int)((float)tIndex % ((float)ParameterTwo));
                        //Debug.Log("index = " + tIndex + "/" + tIndex + "/ " + TileCount + " ---> loop tLineAlpha =" + tLine + " tColumnAlpha = " + tColumn);
                        STSTile tTileAlpha      = Matrix.GetTile(tLine, tColumn);
                        float   tAlpha          = (Purcent * Matrix.TileCount) - (float)tIndex;
                        Color   tFadeColorAlpha = new Color(TintPrimary.r, TintPrimary.g, TintPrimary.b, tAlpha * TintPrimary.a);
                        STSDrawQuad.DrawRect(tTileAlpha.Rectangle, tFadeColorAlpha);
                    }
                }
                break;
                }
            }
            //STSBenchmark.Finish();
        }
Пример #10
0
        //-------------------------------------------------------------------------------------------------------------
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            float tY = position.y;

            EditorGUI.BeginProperty(position, label, property);
            bool tAutoInstallPreview = false;
            bool tAutoPreparePreview = false;

            EditorGUI.BeginChangeCheck();
            Rect tRect = new Rect(position.x, tY, position.width, tPopupFieldStyle.fixedHeight);
            SerializedProperty tEffectName = property.FindPropertyRelative("EffectName");
            string             tValue      = tEffectName.stringValue;
            int tIndex = STSEffectType.kEffectNameList.IndexOf(tValue);

            if (tIndex < 0 || tIndex >= STSEffectType.kEffectNameList.Count())
            {
                tIndex = 0;
            }
            int tIndexNew = EditorGUI.Popup(tRect, new GUIContent(property.displayName), tIndex, STSEffectType.kEffectContentList.ToArray());

            if (EditorGUI.EndChangeCheck() == true)
            {
                if (tIndexNew != tIndex)
                {
                    tValue = STSEffectType.kEffectNameList[tIndexNew];
                    tEffectName.stringValue = tValue;
                    tEffectName.serializedObject.ApplyModifiedProperties();
                    rSmallPreview = null;
                    rBigPreview   = null;
                }
                tAutoInstallPreview = true;
            }
            tY += tPopupFieldStyle.fixedHeight + kMarge;
            //bool tNewReturn = false;
            if (rSmallPreview == null)
            {
                string tName    = tEffectName.stringValue;
                int    tIndexDD = STSEffectType.kEffectNameList.IndexOf(tName);
                if (tIndexDD < 0 || tIndexDD >= STSEffectType.kEffectNameList.Count())
                {
                    rSmallPreview = new STSEffectFade();
                }
                else
                {
                    Type tEffectTypeDD = STSEffectType.kEffectTypeList[tIndexDD];
                    rSmallPreview = (STSEffect)Activator.CreateInstance(tEffectTypeDD);
                }
                //tNewReturn = true;
            }
            if (rBigPreview == null)
            {
                string tName    = tEffectName.stringValue;
                int    tIndexDD = STSEffectType.kEffectNameList.IndexOf(tName);
                if (tIndexDD < 0 || tIndexDD >= STSEffectType.kEffectNameList.Count())
                {
                    rBigPreview = new STSEffectFade();
                }
                else
                {
                    Type tEffectTypeDD = STSEffectType.kEffectTypeList[tIndexDD];
                    rBigPreview = (STSEffect)Activator.CreateInstance(tEffectTypeDD);
                }
                //tNewReturn = true;
            }
            Type tEffectType = STSEffectType.kEffectTypeList[tIndexNew];

            EditorGUI.indentLevel++;

            // Draw Parameter;

            EditorGUI.BeginChangeCheck();

            // Primary Tint
            if (tEffectType.GetCustomAttributes(typeof(STSTintPrimaryAttribute), true).Length > 0)
            {
                GUIContent tEntitlement = null;
                foreach (STSTintPrimaryAttribute tAtt in tEffectType.GetCustomAttributes(typeof(STSTintPrimaryAttribute), true))
                {
                    tEntitlement = new GUIContent(tAtt.Entitlement);
                }
                Rect tRectTintPrimary           = new Rect(position.x, tY, position.width, tColorFieldStyle.fixedHeight);
                SerializedProperty tTintPrimary = property.FindPropertyRelative("TintPrimary");
                EditorGUI.PropertyField(tRectTintPrimary, tTintPrimary, tEntitlement, false);
                tY += tColorFieldStyle.fixedHeight + kMarge;
                rSmallPreview.TintPrimary = tTintPrimary.colorValue;
                rBigPreview.TintPrimary   = tTintPrimary.colorValue;
            }

            // Secondary Tint
            if (tEffectType.GetCustomAttributes(typeof(STSTintSecondaryAttribute), true).Length > 0)
            {
                GUIContent tEntitlement = null;
                foreach (STSTintSecondaryAttribute tAtt in tEffectType.GetCustomAttributes(typeof(STSTintSecondaryAttribute), true))
                {
                    tEntitlement = new GUIContent(tAtt.Entitlement);
                }
                Rect tRectTintSecondary           = new Rect(position.x, tY, position.width, tColorFieldStyle.fixedHeight);
                SerializedProperty tTintSecondary = property.FindPropertyRelative("TintSecondary");
                EditorGUI.PropertyField(tRectTintSecondary, tTintSecondary, tEntitlement, false);
                tY += tColorFieldStyle.fixedHeight + kMarge;
                rSmallPreview.TintSecondary = tTintSecondary.colorValue;
                rBigPreview.TintSecondary   = tTintSecondary.colorValue;
            }

            // Primary Texture
            if (tEffectType.GetCustomAttributes(typeof(STSTexturePrimaryAttribute), true).Length > 0)
            {
                GUIContent tEntitlement = null;
                foreach (STSTexturePrimaryAttribute tAtt in tEffectType.GetCustomAttributes(typeof(STSTexturePrimaryAttribute), true))
                {
                    tEntitlement = new GUIContent(tAtt.Entitlement);
                }
                Rect tRectTexturePrimary           = new Rect(position.x, tY, position.width, tObjectFieldStyle.fixedHeight);
                SerializedProperty tTexturePrimary = property.FindPropertyRelative("TexturePrimary");
                EditorGUI.PropertyField(tRectTexturePrimary, tTexturePrimary, tEntitlement, false);
                tY += tObjectFieldStyle.fixedHeight + kMarge;
                rSmallPreview.TexturePrimary = (Texture2D)tTexturePrimary.objectReferenceValue;
                rBigPreview.TexturePrimary   = (Texture2D)tTexturePrimary.objectReferenceValue;
            }

            // Secondary Texture
            if (tEffectType.GetCustomAttributes(typeof(STSTextureSecondaryAttribute), true).Length > 0)
            {
                GUIContent tEntitlement = null;
                foreach (STSTextureSecondaryAttribute tAtt in tEffectType.GetCustomAttributes(typeof(STSTextureSecondaryAttribute), true))
                {
                    tEntitlement = new GUIContent(tAtt.Entitlement);
                }
                Rect tRectTextureSecondary           = new Rect(position.x, tY, position.width, tObjectFieldStyle.fixedHeight);
                SerializedProperty tTextureSecondary = property.FindPropertyRelative("TextureSecondary");
                EditorGUI.PropertyField(tRectTextureSecondary, tTextureSecondary, tEntitlement, false);
                tY += tObjectFieldStyle.fixedHeight + kMarge;
                rSmallPreview.TextureSecondary = (Texture2D)tTextureSecondary.objectReferenceValue;
                rBigPreview.TextureSecondary   = (Texture2D)tTextureSecondary.objectReferenceValue;
            }

            // Secondary Texture
            if (tEffectType.GetCustomAttributes(typeof(STSAnimationCurveAttribute), true).Length > 0)
            {
                GUIContent tEntitlement = new GUIContent("Animation curve");
                //foreach (STSAnimationCurveAttribute tAtt in tEffectType.GetCustomAttributes(typeof(STSAnimationCurveAttribute), true))
                //{
                //    tEntitlement = new GUIContent(tAtt.Entitlement);
                //}
                Rect tRectCurve           = new Rect(position.x, tY, position.width, tObjectFieldStyle.fixedHeight);
                SerializedProperty tCurve = property.FindPropertyRelative("Curve");
                EditorGUI.PropertyField(tRectCurve, tCurve, tEntitlement, false);
                tY += tObjectFieldStyle.fixedHeight + kMarge;
                AnimationCurve tCurveAnim = (AnimationCurve)tCurve.animationCurveValue;
                rSmallPreview.Curve = new AnimationCurve(tCurveAnim.keys);
                rBigPreview.Curve   = new AnimationCurve(tCurveAnim.keys);
            }

            // Parameter One
            if (tEffectType.GetCustomAttributes(typeof(STSParameterOneAttribute), true).Length > 0)
            {
                GUIContent tEntitlement = null;
                bool       tSlider      = false;
                int        tSliderMin   = 0;
                int        tSliderMax   = 0;
                foreach (STSParameterOneAttribute tAtt in tEffectType.GetCustomAttributes(typeof(STSParameterOneAttribute), true))
                {
                    tEntitlement = new GUIContent(tAtt.Entitlement);
                    tSlider      = tAtt.Slider;
                    tSliderMin   = tAtt.Min;
                    tSliderMax   = tAtt.Max;
                }
                if (tSlider == true)
                {
                    Rect tRectParameterOne           = new Rect(position.x, tY, position.width, tPopupFieldStyle.fixedHeight);
                    SerializedProperty tParameterOne = property.FindPropertyRelative("ParameterOne");
                    if (tParameterOne.intValue > tSliderMax)
                    {
                        tParameterOne.intValue = tSliderMax;
                    }
                    if (tParameterOne.intValue < tSliderMin)
                    {
                        tParameterOne.intValue = tSliderMin;
                    }
                    EditorGUI.IntSlider(tRectParameterOne, tParameterOne, tSliderMin, tSliderMax, tEntitlement);
                    tY += tPopupFieldStyle.fixedHeight + kMarge;
                    rSmallPreview.ParameterOne = tParameterOne.intValue;
                    rBigPreview.ParameterOne   = tParameterOne.intValue;
                }
                else
                {
                    Rect tRectParameterOne           = new Rect(position.x, tY, position.width, tNumberFieldStyle.fixedHeight);
                    SerializedProperty tParameterOne = property.FindPropertyRelative("ParameterOne");
                    EditorGUI.PropertyField(tRectParameterOne, tParameterOne, tEntitlement, false);
                    tY += tNumberFieldStyle.fixedHeight + kMarge;
                    rSmallPreview.ParameterOne = tParameterOne.intValue;
                    rBigPreview.ParameterOne   = tParameterOne.intValue;
                }
            }

            // Parameter Two
            if (tEffectType.GetCustomAttributes(typeof(STSParameterTwoAttribute), true).Length > 0)
            {
                GUIContent tEntitlement = null;
                bool       tSlider      = false;
                int        tSliderMin   = 0;
                int        tSliderMax   = 0;
                foreach (STSParameterTwoAttribute tAtt in tEffectType.GetCustomAttributes(typeof(STSParameterTwoAttribute), true))
                {
                    tEntitlement = new GUIContent(tAtt.Entitlement);
                    tSlider      = tAtt.Slider;
                    tSliderMin   = tAtt.Min;
                    tSliderMax   = tAtt.Max;
                }
                if (tSlider == true)
                {
                    Rect tRectParameterTwo           = new Rect(position.x, tY, position.width, tPopupFieldStyle.fixedHeight);
                    SerializedProperty tParameterTwo = property.FindPropertyRelative("ParameterTwo");
                    if (tParameterTwo.intValue > tSliderMax)
                    {
                        tParameterTwo.intValue = tSliderMax;
                    }
                    if (tParameterTwo.intValue < tSliderMin)
                    {
                        tParameterTwo.intValue = tSliderMin;
                    }
                    EditorGUI.IntSlider(tRectParameterTwo, tParameterTwo, tSliderMin, tSliderMax, tEntitlement);
                    tY += tPopupFieldStyle.fixedHeight + kMarge;
                    rSmallPreview.ParameterTwo = tParameterTwo.intValue;
                    rBigPreview.ParameterTwo   = tParameterTwo.intValue;
                }
                else
                {
                    Rect tRectParameterTwo           = new Rect(position.x, tY, position.width, tNumberFieldStyle.fixedHeight);
                    SerializedProperty tParameterTwo = property.FindPropertyRelative("ParameterTwo");
                    EditorGUI.PropertyField(tRectParameterTwo, tParameterTwo, tEntitlement, false);
                    tY += tNumberFieldStyle.fixedHeight + kMarge;
                    rSmallPreview.ParameterTwo = tParameterTwo.intValue;
                    rBigPreview.ParameterTwo   = tParameterTwo.intValue;
                }
            }

            // Parameter Three
            if (tEffectType.GetCustomAttributes(typeof(STSParameterThreeAttribute), true).Length > 0)
            {
                GUIContent tEntitlement = null;
                bool       tSlider      = false;
                int        tSliderMin   = 0;
                int        tSliderMax   = 0;
                foreach (STSParameterThreeAttribute tAtt in tEffectType.GetCustomAttributes(typeof(STSParameterThreeAttribute), true))
                {
                    tEntitlement = new GUIContent(tAtt.Entitlement);
                    tSlider      = tAtt.Slider;
                    tSliderMin   = tAtt.Min;
                    tSliderMax   = tAtt.Max;
                }
                if (tSlider == true)
                {
                    Rect tRectParameterThree           = new Rect(position.x, tY, position.width, tPopupFieldStyle.fixedHeight);
                    SerializedProperty tParameterThree = property.FindPropertyRelative("ParameterThree");
                    if (tParameterThree.intValue > tSliderMax)
                    {
                        tParameterThree.intValue = tSliderMax;
                    }
                    if (tParameterThree.intValue < tSliderMin)
                    {
                        tParameterThree.intValue = tSliderMin;
                    }
                    EditorGUI.IntSlider(tRectParameterThree, tParameterThree, tSliderMin, tSliderMax, tEntitlement);
                    tY += tPopupFieldStyle.fixedHeight + kMarge;
                    rSmallPreview.ParameterThree = tParameterThree.intValue;
                    rBigPreview.ParameterThree   = tParameterThree.intValue;
                }
                else
                {
                    Rect tRectParameterThree           = new Rect(position.x, tY, position.width, tNumberFieldStyle.fixedHeight);
                    SerializedProperty tParameterThree = property.FindPropertyRelative("ParameterThree");
                    EditorGUI.PropertyField(tRectParameterThree, tParameterThree, tEntitlement, false);
                    tY += tNumberFieldStyle.fixedHeight + kMarge;
                    rSmallPreview.ParameterThree = tParameterThree.intValue;
                    rBigPreview.ParameterThree   = tParameterThree.intValue;
                }
            }

            // Offset
            if (tEffectType.GetCustomAttributes(typeof(STSOffsetAttribute), true).Length > 0)
            {
                GUIContent tEntitlement = null;
                foreach (STSOffsetAttribute tAtt in tEffectType.GetCustomAttributes(typeof(STSOffsetAttribute), true))
                {
                    tEntitlement = new GUIContent(tAtt.Entitlement);
                }
                Rect tRectOffset           = new Rect(position.x, tY, position.width, tNumberFieldStyle.fixedHeight);
                SerializedProperty tOffset = property.FindPropertyRelative("Offset");
                EditorGUI.PropertyField(tRectOffset, tOffset, tEntitlement, false);
                tY += tNumberFieldStyle.fixedHeight + kMarge;
                rSmallPreview.Offset = tOffset.vector2Value;
                rBigPreview.Offset   = tOffset.vector2Value;
            }

            // TwoCross
            if (tEffectType.GetCustomAttributes(typeof(STSTwoCrossAttribute), true).Length > 0)
            {
                GUIContent tEntitlement = null;
                foreach (STSTwoCrossAttribute tAtt in tEffectType.GetCustomAttributes(typeof(STSTwoCrossAttribute), true))
                {
                    tEntitlement = new GUIContent(tAtt.Entitlement);
                }
                Rect tRectTwoCross           = new Rect(position.x, tY, position.width, tPopupFieldStyle.fixedHeight);
                SerializedProperty tTwoCross = property.FindPropertyRelative("TwoCross");
                EditorGUI.PropertyField(tRectTwoCross, tTwoCross, tEntitlement, false);
                tY += tPopupFieldStyle.fixedHeight + kMarge;
                rSmallPreview.TwoCross = (STSTwoCross)tTwoCross.intValue;
                rBigPreview.TwoCross   = (STSTwoCross)tTwoCross.intValue;
            }

            // FourCross
            if (tEffectType.GetCustomAttributes(typeof(STSFourCrossAttribute), true).Length > 0)
            {
                GUIContent tEntitlement = null;
                foreach (STSFourCrossAttribute tAtt in tEffectType.GetCustomAttributes(typeof(STSFourCrossAttribute), true))
                {
                    tEntitlement = new GUIContent(tAtt.Entitlement);
                }
                Rect tRectFourCross           = new Rect(position.x, tY, position.width, tPopupFieldStyle.fixedHeight);
                SerializedProperty tFourCross = property.FindPropertyRelative("FourCross");
                EditorGUI.PropertyField(tRectFourCross, tFourCross, tEntitlement, false);
                tY += tPopupFieldStyle.fixedHeight + kMarge;
                rSmallPreview.FourCross = (STSFourCross)tFourCross.intValue;
                rBigPreview.FourCross   = (STSFourCross)tFourCross.intValue;
            }

            // FiveCross
            if (tEffectType.GetCustomAttributes(typeof(STSFiveCrossAttribute), true).Length > 0)
            {
                GUIContent tEntitlement = null;
                foreach (STSFiveCrossAttribute tAtt in tEffectType.GetCustomAttributes(typeof(STSFiveCrossAttribute), true))
                {
                    tEntitlement = new GUIContent(tAtt.Entitlement);
                }
                Rect tRectFiveCross           = new Rect(position.x, tY, position.width, tPopupFieldStyle.fixedHeight);
                SerializedProperty tFiveCross = property.FindPropertyRelative("FiveCross");
                EditorGUI.PropertyField(tRectFiveCross, tFiveCross, tEntitlement, false);
                tY += tPopupFieldStyle.fixedHeight + kMarge;
                rSmallPreview.FiveCross = (STSFiveCross)tFiveCross.intValue;
                rBigPreview.FiveCross   = (STSFiveCross)tFiveCross.intValue;
            }

            // EightCross
            if (tEffectType.GetCustomAttributes(typeof(STSEightCrossAttribute), true).Length > 0)
            {
                GUIContent tEntitlement = null;
                foreach (STSEightCrossAttribute tAtt in tEffectType.GetCustomAttributes(typeof(STSEightCrossAttribute), true))
                {
                    tEntitlement = new GUIContent(tAtt.Entitlement);
                }
                Rect tRectEightCross           = new Rect(position.x, tY, position.width, tPopupFieldStyle.fixedHeight);
                SerializedProperty tEightCross = property.FindPropertyRelative("EightCross");
                EditorGUI.PropertyField(tRectEightCross, tEightCross, tEntitlement, false);
                tY += tPopupFieldStyle.fixedHeight + kMarge;
                rSmallPreview.EightCross = (STSEightCross)tEightCross.intValue;
                rBigPreview.EightCross   = (STSEightCross)tEightCross.intValue;
            }

            // NineCross
            if (tEffectType.GetCustomAttributes(typeof(STSNineCrossAttribute), true).Length > 0)
            {
                GUIContent tEntitlement = null;
                foreach (STSNineCrossAttribute tAtt in tEffectType.GetCustomAttributes(typeof(STSNineCrossAttribute), true))
                {
                    tEntitlement = new GUIContent(tAtt.Entitlement);
                }
                Rect tRectNineCross           = new Rect(position.x, tY, position.width, tPopupFieldStyle.fixedHeight);
                SerializedProperty tNineCross = property.FindPropertyRelative("NineCross");
                EditorGUI.PropertyField(tRectNineCross, tNineCross, tEntitlement, false);
                tY += tPopupFieldStyle.fixedHeight + kMarge;
                rSmallPreview.NineCross = (STSNineCross)tNineCross.intValue;
                rBigPreview.NineCross   = (STSNineCross)tNineCross.intValue;
            }

            // Clockwise
            if (tEffectType.GetCustomAttributes(typeof(STSClockwiseAttribute), true).Length > 0)
            {
                GUIContent tEntitlement = null;
                foreach (STSClockwiseAttribute tAtt in tEffectType.GetCustomAttributes(typeof(STSClockwiseAttribute), true))
                {
                    tEntitlement = new GUIContent(tAtt.Entitlement);
                }
                Rect tRectClockwise           = new Rect(position.x, tY, position.width, tPopupFieldStyle.fixedHeight);
                SerializedProperty tClockwise = property.FindPropertyRelative("Clockwise");
                EditorGUI.PropertyField(tRectClockwise, tClockwise, tEntitlement, false);
                tY += tPopupFieldStyle.fixedHeight + kMarge;
                rSmallPreview.Clockwise = (STSClockwise)tClockwise.intValue;
                rBigPreview.Clockwise   = (STSClockwise)tClockwise.intValue;
            }

            if (EditorGUI.EndChangeCheck() == true)
            {
                //tNewReturn = true;
                tAutoInstallPreview = true;
                tAutoPreparePreview = true;
            }
            EditorGUI.BeginChangeCheck();
            // Duration
            Rect tRectDuration           = new Rect(position.x, tY, position.width, tNumberFieldStyle.fixedHeight);
            SerializedProperty tDuration = property.FindPropertyRelative("Duration");

            //EditorGUI.PropertyField(tRectDuration, tDuration, false);
            EditorGUI.Slider(tRectDuration, tDuration, 0.1F, 10.0F);
            tY += tNumberFieldStyle.fixedHeight + kMarge;
            rBigPreview.Duration = tDuration.floatValue;

            // Purcent
            Rect tRectPurcent           = new Rect(position.x, tY, position.width, tNumberFieldStyle.fixedHeight);
            SerializedProperty tPurcent = property.FindPropertyRelative("Purcent");

            EditorGUI.Slider(tRectPurcent, tPurcent, 0.0F, 1.0F, new GUIContent("Preview"));
            tY += tNumberFieldStyle.fixedHeight + kMarge;
            rSmallPreview.Purcent = tPurcent.floatValue;
            rBigPreview.Purcent   = tPurcent.floatValue;

            // Finish sub layput
            EditorGUI.indentLevel--;

            // Select the small background
            SelectedPreview = EditorGUI.IntPopup(new Rect(position.x + position.width - kSizePreviewPopup - kMarge - kSizePreview * 2, tY, kSizePreviewPopup, tPopupFieldStyle.fixedHeight),
                                                 SelectedPreview, new string[] { "A", "B", "C", "D", "…" }, new int[] { 0, 1, 2, 3, 999 });

            if (EditorGUI.EndChangeCheck() == true)
            {
                //tNewReturn = true;
                tAutoInstallPreview = true;
            }

            Rect tPreviewRect = new Rect(position.x + position.width - kSizePreview * 2, tY, kSizePreview * 2, kSizePreview);

            //If rect change redraw effect
            if (OldRect.y != tPreviewRect.y || OldRect.width != tPreviewRect.width || OldRect.x != tPreviewRect.x)
            {
                rSmallPreview.PrepareEffectExit(tPreviewRect);
            }
            OldRect = tPreviewRect;

            // button for big preview
            if (GUI.Button(new Rect(position.x + position.width - kSizePreviewButton - kMarge - kSizePreview * 2, tY + tPopupFieldStyle.fixedHeight + kMarge, kSizePreviewButton, tPopupFieldStyle.fixedHeight), STSConstants.K_SHOW_BIG_PREVIEW, tMiniButtonStyle))
            {
                STSEffectPreview.EffectPreviewShow();
                STSEffectPreview.kEffectPreview.SetEffect(rBigPreview);
                STSEffectPreview.kEffectPreview.EffectPrepare();
            }
            // button to run in big preview
            if (GUI.Button(new Rect(position.x + position.width - kSizePreviewButton - kMarge - kSizePreview * 2, tY + 2 * (tPopupFieldStyle.fixedHeight + kMarge), kSizePreviewButton, tPopupFieldStyle.fixedHeight), STSConstants.K_RUN_BIG_PREVIEW, tMiniButtonStyle))
            {
                STSEffectPreview.EffectPreviewShow();
                STSEffectPreview.kEffectPreview.SetEffect(rBigPreview);
                STSEffectPreview.kEffectPreview.EffectPrepare();
                STSEffectPreview.kEffectPreview.EffectRun(tDuration.floatValue);
            }

            if (string.IsNullOrEmpty(STSConstants.K_ASSET_STORE_URL) == false)
            {
                // Get More effects
                Color tOldColor = GUI.contentColor;
                GUI.backgroundColor = Color.red;
                if (GUI.Button(new Rect(position.x + position.width - kSizePreviewButton - kMarge - kSizePreview * 2, tY + 3 * (tPopupFieldStyle.fixedHeight + kMarge), kSizePreviewButton, tPopupFieldStyle.fixedHeight), STSConstants.K_ASSET_STORE, tMiniButtonStyle))
                {
                    //AssetStore.Open(STSConstants.K_ASSET_STORE_URL);
                    Application.OpenURL(STSConstants.K_ASSET_STORE_URL);
                }
                GUI.backgroundColor = tOldColor;
            }

            // If AutoInstallPreview?
            if (tAutoInstallPreview == true)
            {
                rSmallPreview.PrepareEffectExit(tPreviewRect);
                if (STSEffectPreview.kEffectPreview != null)
                {
                    STSEffectPreview.kEffectPreview.SetEffect(rBigPreview);
                }
            }
            if (tAutoPreparePreview == true)
            {
                if (STSEffectPreview.kEffectPreview != null)
                {
                    STSEffectPreview.kEffectPreview.EffectPrepare();
                }
            }
            // Draw big preview
            if (STSEffectPreview.kEffectPreview != null)
            {
                if (tEffectType.GetCustomAttributes(typeof(STSNoBigPreviewAttribute), true).Length == 0)
                {
                    STSEffectPreview.kEffectPreview.NoPreview = false;
                    STSEffectPreview.kEffectPreview.Repaint();
                }
                else
                {
                    STSEffectPreview.kEffectPreview.NoPreview = true;
                }
            }
            //Draw local small preview
            if (SelectedPreview == 0)
            {
                GUI.DrawTexture(tPreviewRect, kImagePreviewA);
            }
            else if (SelectedPreview == 1)
            {
                GUI.DrawTexture(tPreviewRect, kImagePreviewB);
            }
            else if (SelectedPreview == 2)
            {
                GUI.DrawTexture(tPreviewRect, kImagePreviewC);
            }
            else if (SelectedPreview == 3)
            {
                GUI.DrawTexture(tPreviewRect, kImagePreviewD);
            }
            else
            {
                STSDrawQuad.DrawRect(tPreviewRect, Color.white);
                STSDrawCircle.DrawCircle(tPreviewRect.center, tPreviewRect.height / 2.0F, 64, Color.black);
            }
            // TODO : Add image in background
            // draw preview

            if (tEffectType.GetCustomAttributes(typeof(STSNoSmallPreviewAttribute), true).Length == 0)
            {
                rSmallPreview.EstimateCurvePurcent();
                rSmallPreview.Draw(tPreviewRect);
            }
            else
            {
                GUI.Label(tPreviewRect, new GUIContent(STSConstants.K_NO_LITTLE_PREVIEW), tNoPreviewFieldStyle);
            }


            EditorGUI.EndProperty();
        }