예제 #1
0
    /// <summary>
    /// Saves the image.
    /// </summary>
    /// <returns>The image full path .图片保存的全路径,仅在android平台返回有效值,如果返回null,图片保存失败。</returns>
    /// <param name="path">Path.图片保存的子目录,该参数仅对android 有效</param>
    /// <param name="imageBytes">Image bytes.</param>
    /// <param name="length">Length.</param>
    public string SaveImage(string path, byte[] imageBytes, int length)
    {
        // Call plugin only when running on real device
        if (Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.Android)
        {
#if UNITY_ANDROID
            string fullpath = SSCInternalAdapter.getInstance().saveImageToAlbum(path, imageBytes);
            if (!string.IsNullOrEmpty(_gameObjectName) && GameObject.Find(_gameObjectName) != null)
            {
                if (fullpath != null)
                {
                    //直接回调通知
                    GameObject.Find(_gameObjectName).SendMessage("OnSaveImageSuccessed", "saved successfully");
                }
                else
                {
                    GameObject.Find(_gameObjectName).SendMessage("OnSaveImageFailed", "saved failed");
                }
            }
            return(fullpath);
#elif UNITY_IOS
            _SaveImage(path, imageBytes, length);
            return("");
#endif
        }
        return(null);
    }
예제 #2
0
    public void ShareToTwitter(string message, string imagePath)
    {
        // Call plugin only when running on real device
        if (Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.Android)
        {
#if UNITY_ANDROID
            SSCInternalAdapter.getInstance().sendEmailAndFilePic("", message, imagePath);
#elif UNITY_IOS
            _ShareToTwitter(message, imagePath);
#endif
        }
    }
예제 #3
0
    public void popAlertDialog(string message)
    {
        // Call plugin only when running on real device
        if (Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.Android)
        {
#if UNITY_ANDROID
            SSCInternalAdapter.getInstance().popAlertDialog(message);
#elif UNITY_IOS
            _popAlertDialog(message);
#endif
        }
    }
예제 #4
0
    public void removeLoadingView()
    {
        // Call plugin only when running on real device
        if (Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.Android)
        {
#if UNITY_ANDROID
            SSCInternalAdapter.getInstance().removeLoadingView();
#elif UNITY_IOS
            _removeLoadingView();
#endif
        }
    }
예제 #5
0
    public void setGameObjectNameForInternal(string gameObjectName)
    {
        _gameObjectName = gameObjectName;
        // Call plugin only when running on real device
        if (Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.Android)
        {
#if UNITY_ANDROID
            SSCInternalAdapter.getInstance().setGameObjName(gameObjectName);
#elif UNITY_IOS
            _setGameObjectNameForInternal(gameObjectName);
#endif
        }
    }