コード例 #1
0
        public void ClearContents(ARGEnum.ContentsType type)
        {
#if UNITY_ANDROID
            pluginClass.Call("clearContent", (int)type);
#elif UNITY_IOS
            ARGearClearContents((int)type);
#endif
        }
コード例 #2
0
    public void SaveFile(ARGEnum.ContentsType type, string uuid, byte[] bytes)
    {
        string destination = Application.persistentDataPath + "/" + uuid;

        if (File.Exists(destination))
        {
            File.Delete(destination);
        }
        File.WriteAllBytes(destination, bytes);

        _onDownloadComplete(type, uuid);
    }
コード例 #3
0
 private void DownloadComplete(ARGEnum.ContentsType type, string uuid)
 {
     ARGearManager.Instance.SetItem(type, Application.persistentDataPath + "/" + uuid, uuid, new ARGearContentsCallback(
                                        success =>
     {
         // success
     },
                                        error =>
     {
         // error
     }
                                        ));
 }
コード例 #4
0
    public IEnumerator DownloadFileRoutine(ARGEnum.ContentsType type, string url, string uuid)
    {
        UnityWebRequest request = UnityWebRequest.Get(url);

        yield return(request.SendWebRequest());

        if (request.isNetworkError)
        {
            Debug.Log("DownloadError");
        }
        else
        {
            SaveFile(type, uuid, request.downloadHandler.data);
        }
    }
コード例 #5
0
        public void SetItem(
            ARGEnum.ContentsType type,
            string path,
            string uuid,
            ARGearContentsCallback callback1        = null,
            ARGearAndroidContentsCallback callback2 = null)
        {
#if UNITY_ANDROID
            if (pluginClass == null)
            {
                return;
            }
            pluginClass.Call("setItem", (int)type, path, uuid, callback2);
#elif UNITY_IOS
            ARGeariOSCallback.argearContentsCallback = callback1;
            ARGearSetItem((int)type, path, uuid, ARGeariOSCallback.contentsLoadingResult);
#endif
        }
コード例 #6
0
        public void SetItem(ARGEnum.ContentsType type, string filePath, string uuid, ARGearContentsCallback callback = null)
        {
#if UNITY_ANDROID
            ARGearNative.SetItem(type, filePath, uuid, null, new ARGearAndroidContentsCallback(
                                     success =>
            {
                if (callback != null)
                {
                    callback.OnSuccess();
                }
            },
                                     error =>
            {
                if (callback != null)
                {
                    callback.OnError(error);
                }
            }
                                     ));
#elif UNITY_IOS
            ARGearNative.SetItem(type, filePath, uuid, callback);
#endif
        }
コード例 #7
0
 public void ClearContents(ARGEnum.ContentsType type)
 {
     ARGearNative.ClearContents(type);
 }
コード例 #8
0
 public void SetItem(ARGEnum.ContentsType type, string filePath, string uuid)
 {
     ARGearNative.SetItem(type, filePath, uuid);
 }
コード例 #9
0
 public void StartDownload(ARGEnum.ContentsType type, string url, string uuid)
 {
     StartCoroutine(DownloadFileRoutine(type, url, uuid));
 }