Пример #1
0
 public string GetDictionaryString(int dicId)
 {
     return(CustomToolsEditor.GetDictionary(dicId));
 }
Пример #2
0
    public override void OnInspectorGUI()
    {
        GUILayout.Space(6f);
        NGUIEditorTools.SetLabelWidth(86f);

        serializedObject.Update();
        NGUIEditorTools.DrawProperty("Tween Target", serializedObject, "tweenTarget");

        EditorGUILayout.BeginVertical();
        GUILayout.Space(2f);
        SerializedProperty eventidsp = serializedObject.FindProperty("eventId");

        EditorGUILayout.PropertyField(eventidsp, new GUIContent("eventId"));
        EditorGUILayout.EndVertical();

        EditorGUILayout.BeginVertical();
        GUILayout.Space(2f);
        SerializedProperty sp = serializedObject.FindProperty("soundId");

        EditorGUILayout.PropertyField(sp, new GUIContent("SoundId"));
        EditorGUILayout.EndVertical();

        EditorGUILayout.BeginHorizontal();
        GUILayout.Space(2f);
        if (GUILayout.Button("Play", GUILayout.Width(50), GUILayout.Height(20)))
        {
            string    path = "Assets/Res/" + CustomToolsEditor.GetSoundPath(sp.intValue);
            AudioClip a    = Resources.LoadAssetAtPath <AudioClip>(path);
            if (null != a)
            {
                Assembly   unityAssembly  = typeof(AudioImporter).Assembly;
                Type       audioUtilClass = unityAssembly.GetType("UnityEditor.AudioUtil");
                MethodInfo method         = audioUtilClass.GetMethod(
                    "PlayClip",
                    BindingFlags.Static | BindingFlags.Public,
                    null,
                    new System.Type[]
                {
                    typeof(AudioClip)
                },
                    null
                    );
                method.Invoke(null, new object[] { a });
            }
        }
        GUILayout.Label(CustomToolsEditor.GetSoundPath(sp.intValue));
        EditorGUILayout.EndHorizontal();



        DrawProperties();
        serializedObject.ApplyModifiedProperties();

        if (target.GetType() == typeof(UIButtonColor))
        {
            GUILayout.Space(3f);

            if (GUILayout.Button("Upgrade to a Button"))
            {
                NGUIEditorTools.ReplaceClass(serializedObject, typeof(UIButton));
                Selection.activeGameObject = null;
            }
        }
    }