Beispiel #1
0
 /// <summary>
 /// HttpWebRequest:Post
 /// </summary>
 /// <param name="url"></param>
 /// <param name="data"></param>
 public static void SendRequest1(string postData, string url, HttpRequestCallback callback = null)
 {
     if (url == null || url.Equals(""))
     {
         App.logManager.Info("--- httpHelper url is null ---");
         return;
     }
     if (postData == null)
     {
         postData = "";
     }
     if (callback == null)
     {
         PostAsyn(url, postData);
     }
     else
     {
         CoroutineTask task = App.objectPoolManager.GetObject <CoroutineTask>();
         task.routine = PostSyn(url, postData, callback);
         task.Start();
         task.callback = (t) =>
         {
             App.objectPoolManager.ReleaseObject(t);
         };
     }
 }
Beispiel #2
0
        /// <summary>
        /// 播放
        /// </summary>
        public void Play()
        {
            // 音频资源不存在则加载资源
            if (_audioAsset == null)
            {
                AudioAsset asset = App.assetManager.GetAsset <AudioAsset>(_url);
                if (asset != null)
                {
                    audioAsset = asset;
                }
                if (_audioAsset == null)
                {
                    if (_state == AudioState.LOADING)
                    {
                        return;
                    }

                    // 音频资源未正在加载则开始加载资源
                    _state = AudioState.LOADING;
                    Load();
                    return;
                }
            }

            // 音频资源存在,开启协程播放音频
            _state = AudioState.PLAY;
            if (_task == null)
            {
                _task = App.objectPoolManager.GetObject <CoroutineTask>();
            }

            _task.routine = StartPlay();
            _task.Start();
        }
Beispiel #3
0
        /// <summary>
        /// 开始加载
        /// </summary>
        public virtual void Start()
        {
            if (_state != LoadState.STOPED)
            {
                Stop();
            }

            _state = LoadState.STARTED;
            _stats.Start();

            if (_task == null)
            {
                _task = App.objectPoolManager.GetObject <CoroutineTask>();
            }

            _task.routine = InvokeLoading();
            _task.Start();

            if (_startCallback != null)
            {
                _startCallback.Invoke(this);
            }
        }