public static OnlineMaps GetOnlineMaps(OnlineMapsControlBase control)
    {
        if (control == null)
        {
            return(null);
        }
        OnlineMaps api = control.GetComponent <OnlineMaps>();

        if (api == null)
        {
            EditorGUILayout.BeginVertical(GUI.skin.box);

            EditorGUILayout.HelpBox("Problem detected:\nCan not find OnlineMaps component.", MessageType.Error);

            if (GUILayout.Button("Add OnlineMaps Component"))
            {
                api = control.gameObject.AddComponent <OnlineMaps>();
                UnityEditorInternal.ComponentUtility.MoveComponentUp(api);
                if (control is OnlineMapsTileSetControl)
                {
                    api.target = OnlineMapsTarget.tileset;
                }
            }

            EditorGUILayout.EndVertical();
        }
        return(api);
    }
Exemplo n.º 2
0
    private static OnlineMaps GetOnlineMaps(OnlineMapsControlBase control)
    {
        OnlineMaps map = control.GetComponent <OnlineMaps>();

        if (map == null)
        {
            EditorGUILayout.BeginVertical(GUI.skin.box);

            EditorGUILayout.HelpBox("Problem detected:\nCan not find OnlineMaps component.", MessageType.Error);

            if (GUILayout.Button("Add OnlineMaps Component"))
            {
                map = control.gameObject.AddComponent <OnlineMaps>();
                UnityEditorInternal.ComponentUtility.MoveComponentUp(map);
            }

            EditorGUILayout.EndVertical();
        }
        return(map);
    }
    public static OnlineMaps GetOnlineMaps(OnlineMapsControlBase control)
    {
        if (control == null) return null;
        OnlineMaps api = control.GetComponent<OnlineMaps>();

        if (api == null)
        {
            EditorGUILayout.BeginVertical(GUI.skin.box);

            EditorGUILayout.HelpBox("Problem detected:\nCan not find OnlineMaps component.", MessageType.Error);

            if (GUILayout.Button("Add OnlineMaps Component"))
            {
                api = control.gameObject.AddComponent<OnlineMaps>();
                UnityEditorInternal.ComponentUtility.MoveComponentUp(api);
                if (control is OnlineMapsTileSetControl) api.target = OnlineMapsTarget.tileset;
            }

            EditorGUILayout.EndVertical();
        }
        return api;
    }