public void SetSpriteCfgConfig(UISpriteGifConfig pCfg) { m_SpriteGif.Clear(); if (pCfg == null) { return; } for (int i = 0; i < pCfg.gifList.Count; ++i) { UIGifXMLList gif = pCfg.gifList[i]; #if UNITY_EDITOR if (gif.ID == 0) { continue; Debug.LogError("动画ID不能为零,请检查配置表"); } #endif UISpriteGif uiGif = new UISpriteGif(); uiGif.Set(gif); m_SpriteGif[gif.ID] = uiGif; if (m_nMaxID == 0) { m_nMaxID = gif.ID; } else if (m_nMaxID < gif.ID) { m_nMaxID = gif.ID; } } }
public void LoadXmlEditorMode() { #if UNITY_EDITOR string szCfgPathName = Application.dataPath + "/Xmls/sprite_gif.xml"; if (File.Exists(szCfgPathName)) { try { FileStream stream = new FileStream(szCfgPathName, FileMode.Open, FileAccess.Read); XmlSerializer xs = new XmlSerializer(typeof(UISpriteGifConfig)); UISpriteGifConfig pCfg = (UISpriteGifConfig)xs.Deserialize(stream); stream.Close(); SetSpriteCfgConfig(pCfg); } catch (Exception e) { Debug.LogError(e); } } #endif }