Beispiel #1
0
        public static BasicAssetConfig Extract(FullAssetConfig full)
        {
            var min = new BasicAssetConfig();

            foreach (var kvp in full.Xlds)
            {
                var old    = kvp.Value;
                var newXld = new BasicXldInfo(old);

                foreach (var asset in old.Assets.Values)
                {
                    var newAsset = new BasicAssetInfo(asset)
                    {
                        Parent = newXld
                    };
                    if (newAsset.ContainsData)
                    {
                        newXld.Assets[asset.Id] = newAsset;
                    }
                }

                min.Xlds[kvp.Key] = newXld;
            }

            return(min);
        }
Beispiel #2
0
        public static FullAssetConfig Load(string basePath)
        {
            var             configPath = Path.Combine(basePath, "data", Filename);
            FullAssetConfig config     = new FullAssetConfig();

            if (File.Exists(configPath))
            {
                var configText = File.ReadAllText(configPath);
                var xlds       = JsonConvert.DeserializeObject <IDictionary <string, FullXldInfo> >(configText);

                foreach (var xld in xlds)
                {
                    xld.Value.Name = xld.Key;
                    foreach (var o in xld.Value.Assets)
                    {
                        o.Value.Parent = xld.Value;
                        o.Value.Id     = o.Key;
                        o.Value.PaletteHints ??= new List <int>();
                    }

                    config.Xlds[xld.Key] = xld.Value;
                }
            }
            return(config);
        }