コード例 #1
0
 public static void ChooseComponentWithWindow(this GameObject parent, Type componentType,
                                              Action <Component> onSuccess, Action onFailure = null)
 {
     SelectComponentsDialogWindow.ShowWindow("Select component",
                                             "GameObject " + parent.name + " has multiple components of type " + componentType.Name +
                                             " in it's children. Please select suitable.",
                                             parent.GetComponentsExtended(componentType, true),
                                             onSuccess, onFailure);
 }
コード例 #2
0
 public static void ChooseComponentWithWindow <T>(this GameObject parent,
                                                  Action <T> onSuccess, Action onFailure = null) where T : class
 {
     SelectComponentsDialogWindow.ShowWindow("Select component",
                                             "GameObject " + parent.name + " has multiple components of type " + typeof(T).Name +
                                             " in it's children. Please select suitable.",
                                             parent.GetComponentsExtended <T>(true),
                                             onSuccess, onFailure);
 }
コード例 #3
0
    public static void ShowWindow(string title, string caption, Component[] components,
                                  Action <Component> onSuccess, Action onFailure)
    {
        if (components == null || components.Length == 0)
        {
            onFailure();
            return;
        }

        if (components.Length == 1)
        {
            onSuccess(components[0]);
            return;
        }

        SelectComponentsDialogWindow window =
            (SelectComponentsDialogWindow)GetWindow(typeof(SelectComponentsDialogWindow));

        window.Show(title, caption, components, onSuccess, onFailure);
    }