コード例 #1
0
 public override void Uninitialize()
 {
     if (_prepareSessions != null)
     {
         for (int i = 0; i < _prepareSessions.Count; i++)
         {
             NetAssetSession session = _prepareSessions[i];
             session.StopSession();
             _prepareSessions[i] = session;
         }
         _prepareSessions.Clear();
     }
     this.RemoveTimer();
     if (_cachedNetAssetInfoSet != null)
     {
         //保存记录
         int offset = 0;
         _cachedNetAssetInfoSet.Write(S_Buffer, ref offset);
         if (!JW.Res.FileUtil.IsFileExist(S_CachedNetAssetInfoSetFileFullPath))
         {
             JW.Res.FileUtil.WriteFile(S_CachedNetAssetInfoSetFileFullPath, S_Buffer, 0, offset);
         }
         _cachedNetAssetInfoSet = null;
     }
 }
コード例 #2
0
 //反注册
 public void UnPrepareNetAssets(uint sid)
 {
     for (int i = 0; i < _prepareSessions.Count; i++)
     {
         NetAssetSession session = _prepareSessions[i];
         if (session.SessionId == sid)
         {
             _prepareSessions[i] = session;
             session.StopSession();
             break;
         }
     }
     CleanSession();
 }
コード例 #3
0
        //------------------准备网络资源--------------------------
        public uint PrepareNetAssets(LuaTable prepareUrls, System.Action <float> progresHandler)
        {
            if (prepareUrls == null)
            {
                return(0);
            }
            NetAssetSession ss = new NetAssetSession();

            ss.SessionId = _currentId++;

            ss.PrepareNetAsset(prepareUrls, progresHandler);
            if (ss != null && (ss.IsOver == false))
            {
                _prepareSessions.Add(ss);
            }
            return(ss.SessionId);
        }