コード例 #1
0
        /// <summary>
        /// File のLoadリクエスト
        /// </summary>
        /// <param name="_fileName">ファイル名(CPKのRootからの相対パス)</param>
        /// <param name="_data">対象のBindData</param>
        /// <param name="_onComplete">コールバック</param>
        /// <returns></returns>
        private IEnumerator LoadFile(string _fileName, BinderData _data, OnCompleteLoad _onComplete)
        {
            // Validation
            if (string.IsNullOrEmpty(_fileName) || _data == null)
            {
                if (_onComplete != null)
                {
                    _onComplete.Invoke(false, null);
                }
                yield break;
            }

            CriFsLoadFileRequest req = CriFsUtility.LoadFile(_data.Binder, _fileName);

            // 待機
            yield return(req.WaitForDone(m_manager));

            bool isSucceeded = string.IsNullOrEmpty(req.error);

            if (!isSucceeded)
            {
                Debug.LogError("[Error]" + req.error);
                Debug.LogWarning("Failed to load :" + _fileName);
            }

            if (_onComplete != null)
            {
                _onComplete.Invoke(isSucceeded, req.bytes);
            }
            req.Dispose();
        }