Esempio n. 1
0
        void Load(ConfigNode cfgNode)
        {
            if (cfgNode.HasNode("DefaultImageConfig"))
            {
                DefaultImageSettings = ImageSettings.Combine(ImageSettings.FromConfigNode(cfgNode.GetNode("DefaultImageConfig")), DefaultImageSettings);
            }
            if (cfgNode.HasNode("ActivityInterface"))
            {
                var uiNode = cfgNode.GetNode("ActivityInterface");
                Current.UI_DelayBeforeShowingActivityUI = uiNode.GetValue("SecondsBeforeShowing", s => TimeSpan.FromSeconds(int.Parse(s)), Current.UI_DelayBeforeShowingActivityUI);
                Current.UI_DelayBeforeHidingActivityUI  = uiNode.GetValue("SecondsBeforeHiding", s => TimeSpan.FromSeconds(int.Parse(s)), Current.UI_DelayBeforeHidingActivityUI);
            }


            UI_TryUseToolbarForDebugUI = cfgNode.GetValue("TryUseToolbarForDebugUI", text => bool.Parse(text), UI_TryUseToolbarForDebugUI);
            UI_DisplayDebugUI          = cfgNode.GetValue("ShowDebugUI", text => bool.Parse(text), UI_DisplayDebugUI);
            Debug_DontLoadEditorCatalogThumbnailParts = cfgNode.GetValue("DontLoadEditorCatalogParts", text => bool.Parse(text), Debug_DontLoadEditorCatalogThumbnailParts);

            if (cfgNode.HasNode("Cache"))
            {
                var cache = cfgNode.GetNode("Cache");
                foreach (ConfigNode node in cache.nodes)
                {
                    var el = ImageConfigItem.FromConfigNode(node);
                    Current.CachedDataPerResUrl[el.FileUrl] = el;
                    if (el.CacheKey != null)
                    {
                        Current.CachedDataPerKey[el.CacheKey] = el;
                    }
                }
            }
        }
Esempio n. 2
0
 public ImageConfigItem(string cacheKey, UrlDir.UrlFile fromFile)
 {
     ImageSettings = new ImageSettings();
     CacheKey      = cacheKey;
     FileUrl       = fromFile.url + "." + fromFile.fileExtension;
     updateVerificationData(fromFile);
 }
Esempio n. 3
0
        private Config()
        {
            // defaults:

            DefaultImageSettings = ImageSettings.CreateDefaults();

            UI_DelayBeforeHidingActivityUI  = TimeSpan.FromSeconds(3);
            UI_DelayBeforeShowingActivityUI = TimeSpan.FromSeconds(3);

            UI_TryUseToolbarForDebugUI = true;
            UI_DisplayDebugUI          = false;
            Debug_DontLoadEditorCatalogThumbnailParts = false; // notimplementedexception, debug, todo: default to false once we got DXT!
        }
Esempio n. 4
0
        public static ImageSettings Combine(ImageSettings first, ImageSettings second)
        {
            var result = new ImageSettings()
            {
                ThumbnailEnabled  = first.ThumbnailEnabled.HasValue ? first.ThumbnailEnabled : second.ThumbnailEnabled,
                ThumbnailWidth    = first.ThumbnailWidth.HasValue ? first.ThumbnailWidth : second.ThumbnailWidth,
                ThumbnailHeight   = first.ThumbnailHeight.HasValue ? first.ThumbnailHeight : second.ThumbnailHeight,
                ThumbnailCompress = first.ThumbnailCompress.HasValue ? first.ThumbnailCompress : second.ThumbnailCompress,
                HighResEnabled    = first.HighResEnabled.HasValue ? first.HighResEnabled : second.HighResEnabled,
                HighResCompress   = first.HighResCompress.HasValue ? first.HighResCompress : second.HighResCompress
            };

            /*("Combining: {"
             + Environment.NewLine + "  ThumbnailEnabled: " + first.ThumbnailEnabled + "#" + second.ThumbnailEnabled + "=>" + result.ThumbnailEnabled + ","
             + Environment.NewLine + "  ThumbnailWidth: " + first.ThumbnailWidth + "#" + second.ThumbnailWidth + "=>" + result.ThumbnailWidth + ","
             + Environment.NewLine + "  ThumbnailHeight: " + first.ThumbnailHeight + "#" + second.ThumbnailHeight + "=>" + result.ThumbnailHeight + ","
             + Environment.NewLine + "  ThumbnailCompress: " + first.ThumbnailCompress + "#" + second.ThumbnailCompress + "=>" + result.ThumbnailCompress + ","
             + Environment.NewLine + "  HighResCompress: " + first.HighResCompress + "#" + second.HighResCompress + "=>" + result.HighResCompress
             + Environment.NewLine + "}").Log();*/
            return(result);
        }
Esempio n. 5
0
 public unsafe static int RegisterTextureAndRequestThumbLoad(string source_file, string cacheId, /*IntPtr thumbTextureTarget,*/ bool isNormalMap, ImageSettings imageSettings)
 {
     PInvokeDelegates.ImageConfig ic = new PInvokeDelegates.ImageConfig()
     {
         ThumbnailCompress = imageSettings.ThumbnailCompress.Value ? (byte)1 : (byte)0,
         ThumbnailEnabled  = imageSettings.ThumbnailEnabled.Value ? (byte)1 : (byte)0,
         ThumbnailHeight   = imageSettings.ThumbnailHeight.Value,
         ThumbnailWidth    = imageSettings.ThumbnailWidth.Value,
         CompressHighRes   = imageSettings.HighResCompress.Value ? (byte)1 : (byte)0
     };
     //fixed(PInvokeDelegates.ImageConfig* fic = ic){
     try
     {
         // Todo: this looks crap, find out a better way, probably proper mashalling with ref types here!
         return(NlodRegisterTexture(
                    source_file,
                    cacheId,
                    //thumbTextureTarget.ToPointer(),
                    isNormalMap,
                    ref ic
                    ));
     }
     finally
     {
         GC.KeepAlive(ic);
     }
 }
Esempio n. 6
0
 public ImageConfigItem()
 {
     ImageSettings = new ImageSettings();
 }