コード例 #1
0
ファイル: EnergyBar.cs プロジェクト: m4gni2de/DefenderRPG
    public override void OnInspectorGUI()
    {
        m_object.Update();
        DrawDefaultInspector();

        EnergyBar _2dxScript = (EnergyBar)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("ActiveUpdate"), new GUIContent("Active Update", "Active Update, for animation / Animator only")); 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-value") as Texture2D;
            EditorGUILayout.PropertyField(m_object.FindProperty("BarProgress"), new GUIContent("Energy Bar", icone, "Change the energy bar value from 0 to 1"));

            icone = Resources.Load("2dxfx-icon-fade") as Texture2D;
            EditorGUILayout.PropertyField(m_object.FindProperty("_Value2"), new GUIContent("Smooth Line", icone, "Smooth Line"));

            icone = Resources.Load("2dxfx-icon-brightness") as Texture2D;
            EditorGUILayout.PropertyField(m_object.FindProperty("_Value3"), new GUIContent("Darker Value", icone, "Darker Value"));



            icone = Resources.Load("2dxfx-icon-color") as Texture2D;
            EditorGUILayout.PropertyField(m_object.FindProperty("_Value4"), new GUIContent("Energy RED DANGER", icone, "Use the color energy red danger status, 0 = none / 1 = red"));

            icone = Resources.Load("2dxfx-icon-color") as Texture2D;
            EditorGUILayout.PropertyField(m_object.FindProperty("_Value5"), new GUIContent("Transparency Dark", icone, "Fade of the transparency dark"));



            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();
    }