/// <summary>
 /// Create map serialized data from xml file
 /// </summary>
 /// <param name="_filePath"></param>
 /// <returns></returns>
 public static AutoTileMapSerializeData LoadFromFile(string _filePath)
 {
     #if false //XML
     var serializer = new XmlSerializer(typeof(AutoTileMapSerializeData));
     var stream     = new FileStream(_filePath, FileMode.Open);
     var obj        = serializer.Deserialize(stream) as AutoTileMapSerializeData;
     stream.Close();
     return(obj);
     #else // JSON
     // var obj = JsonUtility.FromJson<AutoTileMapSerializeData>(File.ReadAllText(_filePath));
     AutoTileMapSerializeData mapData = UtilsAON.DeserializeObject <AutoTileMapSerializeData>(File.ReadAllText(_filePath));
     return(mapData);
     #endif
 }
Пример #2
0
        public bool LoadDataWorld(string data, bool isIncludeMap)
        {
            dataGame = UtilsAON.DeserializeObject <SerializableGame>(data);

            if (dataGame == null)
            {
                return(false);
            }
            if (isIncludeMap)
            {
                if (dataGame.Map == null || dataGame.Map.Count <= 0)
                {
                    return(false);
                }
                Maps = dataGame.Map;
            }
            ApplyRaw();
            return(true);
        }