Пример #1
0
        private void ProgressChanged(object sender, DownloadProgressChangedEventArgs e)
        {
            //UnityEngine.Debug.Log(e.ProgressPercentage);

            /*
             * UnityEngine.Debug.Log(string.Format("{0} MB's / {1} MB's",
             *  (e.BytesReceived / 1024d / 1024d).ToString("0.00"),
             *  (e.TotalBytesToReceive / 1024d / 1024d).ToString("0.00")));
             */
            //float value = (float)e.ProgressPercentage / 100f;

            string   value = string.Format("{0} kb/s", (e.BytesReceived / 1024d / sw.Elapsed.TotalSeconds).ToString("0.00"));
            NotiData data  = new NotiData(MsgType.TYPE_UPDATE_PROGRESS, value);

            if (m_SyncEvent != null)
            {
                m_SyncEvent(data);
            }

            if (e.ProgressPercentage == 100 && e.BytesReceived == e.TotalBytesToReceive)
            {
                sw.Reset();

                data = new NotiData(MsgType.TYPE_UPDATE_DOWNLOAD, currDownFile);
                if (m_SyncEvent != null)
                {
                    m_SyncEvent(data);
                }
            }
        }
Пример #2
0
        /// <summary>
        /// 通知事件
        /// </summary>
        /// <param name="state"></param>
        private void OnSyncEvent(NotiData data)
        {
            if (this.func != null)
            {
                func(data);                     //回调逻辑层
            }
//            facade.SendMessageCommand(data.evName, data.evParam); //通知View层
        }
Пример #3
0
        /// <summary>
        /// 通知事件
        /// </summary>
        /// <param name="state"></param>
        private void OnSyncEvent(NotiData data)
        {
            if (this.func != null)
            {
                func(data);                     //回调逻辑层
            }
            //GameApp.messageController.SendMessage(null, data.evName, data.evParam);
            //facade.SendMessageCommand(data.evName, data.evParam); //通知View层

            DebugUtil.Log(">>>>>>>线程下载结束>>>>>>>");
        }
Пример #4
0
        /// <summary>
        /// 调用方法
        /// </summary>
        void OnExtractFile(List <object> evParams)
        {
            UnityEngine.Debug.LogWarning("Thread evParams: >>" + evParams.Count);

            ///------------------通知更新面板解压完成--------------------
            NotiData data = new NotiData(MsgType.TYPE_UPDATE_DOWNLOAD, null);

            if (m_SyncEvent != null)
            {
                m_SyncEvent(data);
            }
        }
Пример #5
0
        /// <summary>
        /// 线程完成
        /// </summary>
        /// <param name="data"></param>
        void OnThreadCompleted(NotiData data)
        {
            switch (data.evName)
            {
            case MsgType.TYPE_UPDATE_EXTRACT:      //解压一个完成
                //
                break;

            case MsgType.TYPE_UPDATE_DOWNLOAD:     //下载一个完成
                downloadFiles.Add(data.evParam.ToString());
                break;
            }
        }