Esempio n. 1
0
    public override void GalleryPicture(string filename, OnNewPictureHandler callback, int maxSize = -1)
    {
        base.GalleryPicture(filename, callback, maxSize);

        using (AndroidJavaObject unityPlayer = new AndroidJavaObject(GALLERY_PACKAGE + GALLERY_CLASS))
        {
            unityPlayer.Call(GALLERY_METHOD_GALLERY_SELECT, gameObject.name, METHOD_PICTURE_CALLBACK, filename);
        }
    }
Esempio n. 2
0
    public override void CameraPicture(string filename, OnNewPictureHandler callback, int maxSize = -1)
    {
        base.CameraPicture(filename, callback, maxSize);

        using (AndroidJavaObject unityPlayer = new AndroidJavaObject(CAMERA_PACKAGE + CAMERA_CLASS))
        {
            unityPlayer.Call(CAMERA_METHOD_TAKE_PICTURE, gameObject.name, filename, METHOD_PICTURE_CALLBACK);
        }
    }
Esempio n. 3
0
    public virtual void GalleryPicture(string filename, OnNewPictureHandler callback, int maxSize = -1)
    {
                #if UNITY_EDITOR || DEVELOPMENT_BUILD
        Debug.Log("Gallery Picture | " + "filename: " + filename + ", " + "maxSize: " + maxSize);
                #endif

        _callback = callback;
        _maxSize  = maxSize;
        _count    = MAX_COUNT;
    }
Esempio n. 4
0
    public override void GalleryPicture(string filename, OnNewPictureHandler callback, int maxSize = -1)
    {
        base.GalleryPicture(filename, callback, maxSize);

        string path = null;

                #if UNITY_EDITOR
        path = UnityEditor.EditorUtility.OpenFilePanel("Open image", "", "jpg,png,bmp");
                #else
        // TODO: implement load file on standalone
                #endif

        PictureCallback(!string.IsNullOrEmpty(path), "file:///" + path);
    }
Esempio n. 5
0
    private void PictureLoaded(bool success, string path, Sprite sprite)
    {
                #if UNITY_EDITOR || DEVELOPMENT_BUILD
        Debug.Log("Picture Loaded | " + "success: " + success + ", " + "path: " + path + ", " + " sprite: " + sprite);
                #endif

        if (_callback != null)
        {
            _callback.Invoke(success, path, sprite);
            _callback = null;
        }
        else
        {
                        #if UNITY_EDITOR || DEVELOPMENT_BUILD
            Debug.Log("Picture Callback is NULL");
                        #endif
        }
    }
Esempio n. 6
0
    public override void CameraPicture(string filename, OnNewPictureHandler callback, int maxSize = -1)
    {
        base.CameraPicture(filename, callback, maxSize);

        // TODO: implement webcam texture
    }
Esempio n. 7
0
    public override void GalleryPicture(string filename, OnNewPictureHandler callback, int maxSize = -1)
    {
        base.GalleryPicture(filename, callback, maxSize);

        Application.ExternalCall(WEB_SELECT_IMAGE, maxSize, gameObject.name, METHOD_PICTURE_CALLBACK);
    }
Esempio n. 8
0
    public override void CameraPicture(string filename, OnNewPictureHandler callback, int maxSize = -1)
    {
        base.CameraPicture(filename, callback, maxSize);

        Application.ExternalCall(WEB_ENABLE_CAMERA, false, maxSize, gameObject.name, METHOD_PICTURE_CALLBACK);
    }
Esempio n. 9
0
    public override void GalleryPicture(string filename, OnNewPictureHandler callback, int maxSize = -1)
    {
        base.GalleryPicture(filename, callback, maxSize);

        _SelectPicture(filename, METHOD_PICTURE_CALLBACK, gameObject.name);
    }