public override void DoTextureLoad(EntityName textureEntityName, AssetType typ, DownloadFinishedCallback finishCall)
        {
            EntityNameLL textureEnt = new EntityNameLL(textureEntityName);
            string worldID = textureEnt.EntityPart;
            OMV.UUID binID = new OMV.UUID(worldID);

            if (m_basePath == null) return;

            // do we already have the file?
            string textureFilename = Path.Combine(CacheDirBase, textureEnt.CacheFilename);
            lock (FileSystemAccessLock) {
            if (File.Exists(textureFilename)) {
                m_log.Log(LogLevel.DTEXTUREDETAIL, "DoTextureLoad: Texture file already exists for " + worldID);
                bool hasTransparancy = CheckTextureFileForTransparancy(textureFilename);
                // make the callback happen on a new thread so things don't get tangled (caller getting the callback)
                Object[] finishCallParams = { finishCall, textureEntityName.Name, hasTransparancy };
                m_completionWork.DoLater(FinishCallDoLater, finishCallParams);
                // m_completionWork.DoLater(new FinishCallDoLater(finishCall, textureEntityName.Name, hasTransparancy));
            }
            else {
                bool sendRequest = false;
                lock (m_waiting) {
                    // if this is already being requested, don't waste our time
                    if (m_waiting.ContainsKey(binID)) {
                        m_log.Log(LogLevel.DTEXTUREDETAIL, "DoTextureLoad: Already waiting for " + worldID);
                    }
                    else {
                        WaitingInfo wi = new WaitingInfo(binID, finishCall);
                        wi.filename = textureFilename;
                        wi.type = typ;
                        m_waiting.Add(binID, wi);
                        sendRequest = true;
                    }
                }
                if (sendRequest) {
                    // this is here because RequestTexture might immediately call the callback
                    //   and we should be outside the lock
                    m_log.Log(LogLevel.DTEXTUREDETAIL, "DoTextureLoad: Requesting: " + textureEntityName);
                    // m_texturePipe.RequestTexture(binID, OMV.ImageType.Normal, 50f, 0, 0, OnACDownloadFinished, false);
                    // m_comm.GridClient.Assets.RequestImage(binID, OMV.ImageType.Normal, 101300f, 0, 0, OnACDownloadFinished, false);
                    // m_comm.GridClient.Assets.RequestImage(binID, OMV.ImageType.Normal, 50f, 0, 0, OnACDownloadFinished, false);
                    ThrottleTextureRequests(binID);
                }
            }
            }
            return;
        }
예제 #2
0
        public override void DoTextureLoad(EntityName textureEntityName, AssetType typ, DownloadFinishedCallback finishCall)
        {
            EntityNameLL textureEnt = new EntityNameLL(textureEntityName);
            string       worldID    = textureEnt.EntityPart;

            OMV.UUID binID = new OMV.UUID(worldID);

            // do we already have the file?
            string textureFilename = Path.Combine(CacheDirBase, textureEnt.CacheFilename);

            lock (FileSystemAccessLock) {
                if (File.Exists(textureFilename))
                {
                    m_log.Log(LogLevel.DTEXTUREDETAIL, "DoTextureLoad: Texture file already exists for " + worldID);
                    bool hasTransparancy = CheckTextureFileForTransparancy(textureFilename);
                    // make the callback happen on a new thread so things don't get tangled (caller getting the callback)
                    Object[] finishCallParams = { finishCall, textureEntityName.Name, hasTransparancy };
                    m_completionWork.DoLater(FinishCallDoLater, finishCallParams);
                    // m_completionWork.DoLater(new FinishCallDoLater(finishCall, textureEntityName.Name, hasTransparancy));
                }
                else
                {
                    bool sendRequest = false;
                    lock (m_waiting) {
                        // if this is already being requested, don't waste our time
                        if (m_waiting.ContainsKey(binID))
                        {
                            m_log.Log(LogLevel.DTEXTUREDETAIL, "DoTextureLoad: Already waiting for " + worldID);
                        }
                        else
                        {
                            WaitingInfo wi = new WaitingInfo(binID, finishCall);
                            wi.filename = textureFilename;
                            wi.type     = typ;
                            m_waiting.Add(binID, wi);
                            sendRequest = true;
                        }
                    }
                    if (sendRequest)
                    {
                        // this is here because RequestTexture might immediately call the callback
                        //   and we should be outside the lock
                        m_log.Log(LogLevel.DTEXTUREDETAIL, "DoTextureLoad: Requesting: " + textureEntityName);
                        ThrottleTextureRequests(binID);
                    }
                }
            }
            return;
        }
예제 #3
0
 public WaitingInfo(OMV.UUID wid, DownloadFinishedCallback cback)
 {
     worldID  = wid;
     callback = cback;
 }
예제 #4
0
 public void StartDownload(string url, DownloadFinishedCallback _callback)
 {
     www      = new WWW(url);
     callback = _callback;
     EditorApplication.update += Download;
 }
예제 #5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="songHash"></param>
 /// <param name="songName"></param>
 /// <param name="songKey"></param>
 /// <param name="mapperName"></param>
 /// <param name="container"></param>
 /// <param name="jobFinishedCallback"></param>
 /// <exception cref="ArgumentNullException"></exception>
 /// <exception cref="ArgumentException"></exception>
 public DownloadJob(string songHash, string songName, string songKey, string mapperName, DownloadContainer container, DownloadFinishedCallback jobFinishedCallback = null)
     : this(container, jobFinishedCallback)
 {
     if (string.IsNullOrEmpty(songHash))
     {
         throw new ArgumentNullException();
     }
     SongHash        = songHash;
     SongKey         = songKey;
     SongName        = songName;
     LevelAuthorName = mapperName;
 }