Beispiel #1
0
    public override void OnInspectorGUI()
    {
        m_object.Update();
        DrawDefaultInspector();

        _2dxFX_Liquify _2dxScript = (_2dxFX_Liquify)target;

        Texture2D icon = Resources.Load("2dxfxinspector-anim") as Texture2D;

        if (icon)
        {
            Rect  r;
            float ih     = icon.height;
            float iw     = icon.width;
            float result = ih / iw;
            float w      = Screen.width;
            result = result * w;
            r      = GUILayoutUtility.GetRect(ih, result);
            EditorGUI.DrawTextureTransparent(r, icon);
        }

        EditorGUILayout.PropertyField(m_object.FindProperty("ForceMaterial"), new GUIContent("Shared Material", "Use a unique material, reduce drastically the use of draw call"));

        if (_2dxScript.ForceMaterial == null)
        {
            _2dxScript.ActiveChange = true;
        }
        else
        {
            if (GUILayout.Button("Remove Shared Material"))
            {
                _2dxScript.ForceMaterial = null;
                _2dxScript.ShaderChange  = 1;
                _2dxScript.ActiveChange  = true;
                _2dxScript.CallUpdate();
            }

            EditorGUILayout.PropertyField(m_object.FindProperty("ActiveChange"), new GUIContent("Change Material Property", "Change The Material Property"));
        }

        if (_2dxScript.ActiveChange)
        {
            EditorGUILayout.BeginVertical("Box");

            Texture2D icone = Resources.Load("2dxfx-icon-distortion") as Texture2D;
            EditorGUILayout.PropertyField(m_object.FindProperty("TurnToLiquid"), new GUIContent("Turn To Liquid", icone, "Turn to liquid = 0 = normal sprite : 1 = Liquify"));
            icone = Resources.Load("2dxfx-icon-time") as Texture2D;
            EditorGUILayout.PropertyField(m_object.FindProperty("Heat"), new GUIContent("Liquid Distortion", icone, "Change the distortion of the liquid"));

            EditorGUILayout.BeginVertical("Box");

            icone = Resources.Load("2dxfx-icon-fade") as Texture2D;
            EditorGUILayout.PropertyField(m_object.FindProperty("_Alpha"), new GUIContent("Fading", icone, "Fade from nothing to showing"));

            EditorGUILayout.EndVertical();
            EditorGUILayout.EndVertical();
        }

        m_object.ApplyModifiedProperties();
    }
Beispiel #2
0
    public override void onLastItem(int select)
    {
        base.onLastItem(select);
        if (select == 0 || select > 8)
        {
            return;
        }

        if (select == 3)
        {
            c.two(this);
        }
        else if (select == 6)
        {
            c.three(this);
        }
        else
        {
            Image child = scrollSnap.transform.GetChild(0).GetChild(select).GetChild(0).GetComponent <Image>();
            canvas.blocksRaycasts = false;

            switch (select)
            {
            //set left
            case 1:
                left.sprite = child.sprite;
                _2dxFX_realVHS vhs = left.GetComponent <_2dxFX_realVHS>();
                vhs.enabled = true;
                LeanTween.value(gameObject, (float val) =>
                {
                    vhs.changeParam(val * 0.21f, val * 0.634f, val * 1, 1 + val * 0.2f);
                }, 0, 1, 1f).setEaseInOutQuad().setOnComplete(() =>
                {
                    canvas.blocksRaycasts = true;
                });

                break;

            case 4:
                left.sprite = child.sprite;
                Destroy(left.GetComponent <_2dxFX_realVHS>());
                _2DxFX_BrokenScreen bs = left.GetComponent <_2DxFX_BrokenScreen>();
                bs.enabled = true;

                LeanTween.value(gameObject, (float val) =>
                {
                    bs.setFade(val * 0.2f);
                }, 0, 1, 3f).setEaseInOutQuad().setOnComplete(() =>
                {
                    canvas.blocksRaycasts = true;
                });
                break;

            case 7:
                left.sprite = child.sprite;
                Destroy(left.GetComponent <_2DxFX_BrokenScreen>());
                // glow_Color.enabled = true;
                _2dxFX_Liquify liq2 = right.GetComponent <_2dxFX_Liquify>();
                LeanTween.value(gameObject, (float val) =>
                {
                    //  glow_Color.setAmountThres(val * 2.27f, 1 - (val * 0.5f));
                    liq2.setAlpha(1 - val);
                    liq2.setTurnToLiquid(val + 0.02f);
                }, 0, 1, 4f).setEaseInOutQuad().setOnComplete(() =>
                {
                    right.color = Color.clear;
                    Destroy(liq2);
                    canvas.blocksRaycasts = true;
                });
                break;

            //set right
            case 2:
                right.sprite = child.sprite;
                _2dxFX_Rain rain = right.GetComponent <_2dxFX_Rain>();
                rain.enabled = true;
                LeanTween.value(gameObject, (float val) =>
                {
                    rain.setFade(val);
                }, 0, 1, 2f).setEaseInOutQuad().setOnComplete(() =>
                {
                    canvas.blocksRaycasts = true;
                });
                break;

            case 5:
                right.sprite = child.sprite;
                Destroy(right.GetComponent <_2dxFX_Rain>());
                _2dxFX_Liquify liq = right.GetComponent <_2dxFX_Liquify>();
                liq.enabled = true;
                LeanTween.value(gameObject, (float val) =>
                {
                    liq.setAlpha(val);
                    liq.setTurnToLiquid(val * 0.02f);
                }, 0, 1, 2.5f).setEaseInOutQuad().setOnComplete(() =>
                {
                    canvas.blocksRaycasts = true;
                });
                break;

            case 8:
                right.sprite       = child.sprite;
                right.color        = Color.white;
                glow_Color.enabled = true;
                LeanTween.value(gameObject, (float val) =>
                {
                    glow_Color.setAmountThres(val * 2.27f, 1 - (val * 0.5f));
                }, 0, 1, 4f).setEaseInOutQuad().setOnComplete(() =>
                {
                    canvas.blocksRaycasts = true;
                });
                break;
            }
            child.color = Color.clear;
        }
    }