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

        _2dxFX_Offset _2dxScript = (_2dxFX_Offset)target;

        Texture2D icon = Resources.Load("2dxfxinspector") 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-clip_left") as Texture2D;
            EditorGUILayout.PropertyField(m_object.FindProperty("_OffsetX"), new GUIContent("Offset X", icone, "Change the offset value of X"));

            icone = Resources.Load("2dxfx-icon-clip_right") as Texture2D;
            EditorGUILayout.PropertyField(m_object.FindProperty("_OffsetY"), new GUIContent("Offset Y", icone, "Change the offset value of Y"));

            icone = Resources.Load("2dxfx-icon-clip_up") as Texture2D;
            EditorGUILayout.PropertyField(m_object.FindProperty("_ZoomX"), new GUIContent("Zoom X", icone, "Change the Zoom value of X"));

            icone = Resources.Load("2dxfx-icon-clip_down") as Texture2D;
            EditorGUILayout.PropertyField(m_object.FindProperty("_ZoomY"), new GUIContent("Zoom Y", icone, "Change the Zoom value of Y"));

            icone = Resources.Load("2dxfx-icon-clip_down") as Texture2D;
            EditorGUILayout.PropertyField(m_object.FindProperty("_ZoomXY"), new GUIContent("Zoom XY", icone, "Change the Zoom value of X and Y. Note if you want to change only the X or the Y, you must set Zoom XY to 1"));

            icone = Resources.Load("2dxfx-icon-value") as Texture2D;
            EditorGUILayout.PropertyField(m_object.FindProperty("_AutoScrollX"), new GUIContent("Auto Scroll X", icone, "Change the value of the posterize effect"));
            if (_2dxScript._AutoScrollX)
            {
                icone = Resources.Load("2dxfx-icon-time") as Texture2D;
                EditorGUILayout.PropertyField(m_object.FindProperty("_AutoScrollSpeedX"), new GUIContent("Auto Scroll Speed X", icone, "Change the value of the posterize effect"));
            }

            icone = Resources.Load("2dxfx-icon-value") as Texture2D;
            EditorGUILayout.PropertyField(m_object.FindProperty("_AutoScrollY"), new GUIContent("Auto Scroll Y", icone, "Change the value of the posterize effect"));

            if (_2dxScript._AutoScrollY)
            {
                icone = Resources.Load("2dxfx-icon-time") as Texture2D;
                EditorGUILayout.PropertyField(m_object.FindProperty("_AutoScrollSpeedY"), new GUIContent("Auto Scroll Speed Y", icone, "Change the value of the posterize effect"));
            }


            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();
    }
示例#2
0
 // Use this for initialization
 void Start()
 {
     fadeObj      = GetComponent <_2dxFX_Offset>();
     gotPlayerRef = false;
     myLocation   = new Vector3(transform.position.x, transform.position.y, transform.position.z);
 }