// Use this for initialization
    void Start()
    {
        gif = GetComponent<AnimatedGIF>();
        activated = false;
        currentActiveTime = 0.0f;

        foreach (GameObject theObject in enableOnStart)
        {
            theObject.SetActive(false);
        }
    }
示例#2
0
 private void img_MouseLeave(object sender, MouseEventArgs e)
 {
     if (sender is AnimatedGIF)
     {
         AnimatedGIF img = sender as AnimatedGIF;
         img.StopAnimation();
     }
     else
     {
         GifImage img = sender as GifImage;
         img.IsActive = false;//.gifAnimation?.StopAnimation();
     }
 }
示例#3
0
 private void img_MouseEnter(object sender, MouseEventArgs e)
 {
     if (sender is AnimatedGIF)
     {
         AnimatedGIF img = sender as AnimatedGIF;
         img.StartAnimation();
     }
     else
     {
         GifImage img = sender as GifImage;
         img.IsActive = true;//.gifAnimation?.StartAnimation();
     }
 }
示例#4
0
        /// <summary>
        /// 保存预览图到文件
        /// </summary>
        /// <param name="silent">静默模式</param>
        /// <param name="path">保存路径</param>
        /// <returns>预览文件类型</returns>
        private string SavePreview(bool silent, string path)
        {
            try
            {
                if (!((imgGrid.Children[imgs[selectedId]] as ScrollViewer).Content as PreviewImg).ImgLoaded)
                {
                    ShowMessage("图片尚未加载完毕", MessageBoxButton.OK, MessageBoxImage.Warning);
                    return("");
                }

                PreviewImg pimg = (PreviewImg)((ScrollViewer)imgGrid.Children[imgs[selectedId]]).Content;
                switch (pimg.ImgType)
                {
                case "bmp":
                case "jpg":
                case "png":
                    Image im = (Image)pimg.prewimg.Children[0];
                    DataHelpers.ImageToFile((BitmapSource)im.Source, pimg.ImgType, path);
                    break;

                case "gif":
                    AnimatedGIF gi = (AnimatedGIF)pimg.prewimg.Children[0];
                    DataHelpers.MemoryStreamToFile((MemoryStream)gi.GIFSource, path);
                    break;

                default:
                    throw new Exception(pimg.ImgType + "类型不支持保存");
                }

                if (!silent)
                {
                    ShowMessage("已成功保存至下载文件夹", MessageBoxButton.OK, MessageBoxImage.Information);
                }

                return(pimg.ImgType);
            }
            catch (Exception ex)
            {
                if (!silent)
                {
                    ShowMessage("保存失败\r\n" + ex.Message, MessageBoxButton.OK, MessageBoxImage.Warning);
                }
                return("");
            }
        }
 // Abstract function callbacks
 public override void onAwake()
 {
     gif = GetComponent<AnimatedGIF>();
 }