예제 #1
0
 /// <summary>
 /// 开始事务
 /// </summary>
 /// <param name="ss"></param>
 public void BeginSession(IFSSession ss)
 {
     if (ss==null)
     {
         JW.Common.Log.LogE("IFS Service BeginSession nil Session");
         return;
     }
     //
     for (int i = _sessionProcessors.Count - 1; i >= 0; --i)
     {
         if (_sessionProcessors[i].Name.Equals(ss.Name))
         {
             JW.Common.Log.LogE("Repeat Session:" + ss.Name);
             return;
         }
     }
     //
     IFSSessionProcessor pp = IFSSessionProcessor.Create(ss);
     if (pp != null)
     {
         pp.gameObject.transform.parent = this.transform;
         _sessionProcessors.Add(pp);
         pp.BeginSession();
     }
 }
예제 #2
0
        /// <summary>
        /// 反初始化
        /// </summary>
        public override void Uninitialize()
        {
            if (_updateCheckers != null)
            {
                for(int i = 0; i < _updateCheckers.Count; i++)
                {
                    IFSUpdateChecker.Destory(_updateCheckers[i]);
                }
                _updateCheckers.Clear();
                _updateCheckers = null;
            }

            if (_sessionProcessors != null)
            {
                for (int i = 0; i < _sessionProcessors.Count; i++)
                {
                    IFSSessionProcessor.Destory(_sessionProcessors[i]);
                }
                _sessionProcessors.Clear();
                _sessionProcessors = null;
            }

            if (_localCheckers != null)
            {
                for (int i = 0; i < _localCheckers.Count; i++)
                {
                    IFSLocalChecker.Destory(_localCheckers[i]);
                }
                _localCheckers.Clear();
                _localCheckers = null;
            }
        }
예제 #3
0
        /// <summary>
        /// To Lua
        /// </summary>
        /// <param name="sessionName"></param>
        /// <param name="firstZipName"></param>
        /// <param name="fileListFileName"></param>
        /// <param name="firstZipUrl"></param>
        /// <param name="fileListFileUrl"></param>
        /// <param name="netFileRootUrl"></param>
        /// <param name="handler"></param>
        public void BeginSessionLua(string sessionName, string firstZipName, string fileListFileName, string firstZipUrl, string fileListFileUrl, string netFileRootUrl, IFSSessionDelegate handler)
        {
            if (string.IsNullOrEmpty(sessionName))
            {
                JW.Common.Log.LogE("IFS Service BeginSessionLua Error SessionName");
                return;
            }
            IFSSession ss = new IFSSession();
            ss.Name = sessionName;
            ss.FirstZipName = firstZipName;
            ss.FileListFileName = fileListFileName;
            ss.SessionHandler = handler;
            //
            ss.FirstZipURL = firstZipUrl;
            ss.FileListFileUrl = fileListFileUrl;
            ss.NetFileRootUrl = netFileRootUrl;
            //
            for (int i = _sessionProcessors.Count - 1; i >= 0; --i)
            {
                if (_sessionProcessors[i].Name.Equals(sessionName))
                {
                    JW.Common.Log.LogE("Repeat Session:" + sessionName);
                    return;
                }
            }

            IFSSessionProcessor pp = IFSSessionProcessor.Create(ss);
            if (pp != null)
            {
                pp.gameObject.transform.parent = this.transform;
                _sessionProcessors.Add(pp);
                pp.BeginSession();
            }
        }
 public static void Destory(IFSSessionProcessor cc)
 {
     if (cc != null)
     {
         cc.UnInit();
         cc.gameObject.ExtDestroy();
     }
 }
        public static IFSSessionProcessor Create(IFSSession session)
        {
            IFSSessionProcessor ret = null;
            GameObject          go  = new GameObject("IFSSessionProcessor_" + session.Name);

            ret = go.ExtAddComponent <IFSSessionProcessor>(true);
            ret.Init(session);
            return(ret);
        }
예제 #6
0
        protected void LateUpdate()
        {
            //清理
            if (_updateCheckers != null)
            {
                for (int i = _updateCheckers.Count - 1; i >= 0; --i)
                {
                    if (_updateCheckers[i].IsDone)
                    {
                        IFSUpdateChecker.Destory(_updateCheckers[i]);
                        _updateCheckers.RemoveAt(i);
                    }
                }
            }
            //
            if (_sessionProcessors != null)
            {
                for (int i = _sessionProcessors.Count - 1; i >= 0; --i)
                {
                    if (_sessionProcessors[i].IsDone)
                    {
                        IFSSessionProcessor.Destory(_sessionProcessors[i]);
                        _sessionProcessors.RemoveAt(i);
                    }
                }
            }

            if (_localCheckers != null)
            {
                for (int i = _localCheckers.Count - 1; i >= 0; --i)
                {
                    if (_localCheckers[i].IsDone)
                    {
                        IFSLocalChecker.Destory(_localCheckers[i]);
                        _localCheckers.RemoveAt(i);
                    }
                }
            }
        }