示例#1
0
 void SavePicToGalleryMsg(string errorStr)
 {
     if (string.IsNullOrEmpty(errorStr))
     {
         LogView.Add("Save picture to gallery success!");
         SavePicToGallery.CallBackFun(true);
     }
     else
     {
         string msg = string.Format("Save picture to gallery failed! error msg:{0}", errorStr);
         LogView.Add(msg);
         SavePicToGallery.CallBackFun(false);
     }
 }
示例#2
0
 private void OnGUI()
 {
     if (View.instance.GUIButton("ScreenShot", 200, 60))
     {
         // 注意 android 不能带路径
         ScreenCapture.CaptureScreenshot(FILE_NAME);
         LogView.Add("ScreenShot Success!");
     }
     if (View.instance.GUIButton("SaveToGallery", 200, 60))
     {
         SavePicToGallery.SaveFinished += SavePictureFinished;
         StartCoroutine(SavePicToGallery.Save(Application.persistentDataPath + "/" + FILE_NAME));
         LogView.Add("SaveToGallery Complete!");
     }
     if (View.instance.GUIButton("Check", 200, 60))
     {
         foreach (string s in permissionArray)
         {
             if (Permission.HasUserAuthorizedPermission(s))
             {
                 LogView.Add(string.Format("{0} permission has been granted.", s));
             }
             else
             {
                 LogView.Add(string.Format("{0} permission has not been granted.", s));
             }
         }
     }
     if (View.instance.GUIButton("Request", 200, 60))
     {
         foreach (string s in permissionArray)
         {
             if (Permission.HasUserAuthorizedPermission(s))
             {
                 LogView.Add(string.Format("{0} permission has been granted.", s));
             }
             else
             {
                 LogView.Add(string.Format("Request {0} permission ...", s));
                 Permission.RequestUserPermission(s);
             }
         }
     }
 }