示例#1
0
    public void DrawConpomentEvents(FieldInfo[]     infos, UIComponent conpoment)
    {
        GUI.backgroundColor = Color.gray;
        GameObject obj = EditorGUILayout.ObjectField("eventReceiver", conpoment.eventReceiver, typeof(GameObject), true, GUILayout.ExpandWidth(true)) as GameObject;

        if (obj != conpoment.eventReceiver)
        {
            conpoment.eventReceiver = obj;
        }

        DrawPartLine("events");

        for (int i = 0; i < infos.Length; i++)
        {
            if (infos[i].FieldType == typeof(UIConpomentEvent))
            {
                EditorGUILayout.BeginHorizontal();

                if (infos[i] != null)
                {
                    UIConpomentEvent ui_event = (UIConpomentEvent)infos[i].GetValue(conpoment);

                    string str = EditorGUILayout.TextField(infos[i].Name, ui_event.functionName, GUILayout.ExpandWidth(true));
                    if (str != ui_event.functionName)
                    {
                        ui_event.functionName = str;
                    }

                    GUI.backgroundColor = Color.green;

                    if (GUILayout.Button(clearContent, GUILayout.Width(50), min_buttonHeight))
                    {
                        ui_event.functionName = "";
                        GUI.FocusControl("");
                    }
                    GUI.backgroundColor = Color.gray;
                }

                EditorGUILayout.EndHorizontal();
            }
        }
    }