internal static Skin FromJsonSkin(IGameContext ctx, JsonSkinData data, string root = null) { GameUtils.Log($"About to load skin: {data.Metadata.Name} by {data.Metadata.Author}"); var skin = new Skin(); skin.Metadata = SkinMetadata.FromJson(data.Metadata); if (data.ColorSchemes == null) { data.ColorSchemes = new Dictionary <string, JsonColorScheme>(); } if (!data.ColorSchemes.ContainsKey("light")) { data.ColorSchemes.Add("light", JsonColorScheme.DefaultLight); } if (!data.ColorSchemes.ContainsKey("dark")) { data.ColorSchemes.Add("dark", JsonColorScheme.DefaultDark); } skin.LightColorScheme = ColorScheme.FromJsonColors(data.ColorSchemes["light"], JsonColorScheme.DefaultLight); skin.DarkColorScheme = ColorScheme.FromJsonColors(data.ColorSchemes["dark"], JsonColorScheme.DefaultDark); skin.LoadFontsFromJson(ctx, data.Fonts ?? new JsonFontList(), root); skin.Textures = SkinTextureList.FromJsonTextures(ctx, data.Textures, root); skin.LayoutInfo = SkinLayoutInfo.FromJsonData(data.LayoutInfo); GameUtils.Log("Skin loaded."); return(skin); }
internal static SkinLayoutInfo FromJsonData(JsonLayoutInfo info) { var skn = new SkinLayoutInfo(); skn.ProgressBarHeight = info.ProgressBarHeight; return(skn); }