public void ShowGif(string filePath) { if (!System.IO.Path.IsPathRooted(filePath)) { filePath = System.IO.Path.Combine(Application.dataPath, filePath); } GifDecoder decoder = new GifDecoder(); m_Image = new GifImage(); DecodeWorker worker = new DecodeWorker(m_WorkerPriority) { m_Decoder = decoder, m_FilePath = filePath, m_Image = m_Image, OnDecodeFinish = OnDecodeFinish }; m_State = State.Decoding; worker.Start(); }
void OnDecodeFinish(GifImage image) { m_State = State.Decoded; m_Delay = image.timePerFrame / 100.0f; }