예제 #1
0
 public AssetDefinition(WrathEdXML.AssetDefinition.AssetDefinition assetDefintion)
 {
     AssetTypes     = new List <BaseAssetType>();
     GameAssetTypes = new List <GameAssetType>();
     if (assetDefintion != null && assetDefintion.Assets != null)
     {
         for (int idx = 0; idx < assetDefintion.Assets.Length; ++idx)
         {
             Type assetType = assetDefintion.Assets[idx].GetType();
             if (assetType == typeof(WrathEdXML.AssetDefinition.AssetType))
             {
                 AssetTypes.Add(new AssetType(assetDefintion.Assets[idx] as WrathEdXML.AssetDefinition.AssetType));
             }
             else if (assetType == typeof(WrathEdXML.AssetDefinition.EnumAssetType))
             {
                 AssetTypes.Add(new EnumAssetType(assetDefintion.Assets[idx] as WrathEdXML.AssetDefinition.EnumAssetType));
             }
             else if (assetType == typeof(WrathEdXML.AssetDefinition.FlagsAssetType))
             {
                 AssetTypes.Add(new FlagsAssetType(assetDefintion.Assets[idx] as WrathEdXML.AssetDefinition.FlagsAssetType));
             }
             else if (assetType == typeof(WrathEdXML.AssetDefinition.GameAssetType))
             {
                 GameAssetTypes.Add(new GameAssetType(assetDefintion.Assets[idx] as WrathEdXML.AssetDefinition.GameAssetType));
             }
         }
     }
 }
예제 #2
0
 public static AssetDefinition Load(string source)
 {
     try
     {
         XmlReader       reader          = XmlReader.Create(source);
         XmlSerializer   serializer      = new XmlSerializer(typeof(AssetDefinition));
         AssetDefinition assetDefinition = serializer.Deserialize(reader) as AssetDefinition;
         reader.Close();
         return(assetDefinition);
     }
     catch
     {
         return(null);
     }
 }