예제 #1
0
        protected override int GetPreviewHash()
        {
            if (this.contentPath == null)
            {
                return(0);
            }

            IContentRef contentRef = new ContentRef <Resource>(null, this.contentPath);

            if (!contentRef.IsAvailable)
            {
                return(0);
            }

            ConvertOperation convOp = new ConvertOperation(new[] { contentRef.Res }, ConvertOperation.Operation.Convert);

            if (convOp.CanPerform <Pixmap>())
            {
                Pixmap       basePx      = convOp.Perform <Pixmap>().FirstOrDefault();
                Pixmap.Layer basePxLayer = basePx != null ? basePx.MainLayer : null;
                return(basePxLayer != null?basePxLayer.GetHashCode() : 0);
            }
            else if (convOp.CanPerform <AudioData>())
            {
                AudioData audioData = convOp.Perform <AudioData>().FirstOrDefault();
                return((audioData != null && audioData.OggVorbisData != null) ? audioData.OggVorbisData.GetHashCode() : 0);
            }

            return(this.contentPath.GetHashCode());
        }
예제 #2
0
        protected override int GetPreviewHash()
        {
            Pixmap.Layer basePxLayer = this.value != null ? this.value.MainLayer : null;
            int          hash        = this.value != null && this.value.Atlas != null?this.value.Atlas.GetCombinedHashCode() : 0;

            MathF.CombineHashCode(ref hash, basePxLayer != null ? basePxLayer.GetHashCode() : 0);
            return(hash);
        }