public void Clear() { GameText.Clear(); CategoryText.Clear(); RunnerNamesText.Clear(); PlatformText.Clear(); EstimateText.Clear(); TimeText.Clear(); if (curRun != null) { curRun.PropertyChanged -= Run_PropertyChanged; curRun = null; } }
public bool LoadFromResource(string resourcePath) { TextAsset textAsset = null; string textContent = null; if (gameText != null) { gameText.Clear(); gameText = null; } if (!String.IsNullOrEmpty(resourcePath)) { textAsset = Resources.Load <TextAsset>(resourcePath); if (textAsset != null) { textContent = textAsset.text; LoadFromXmlString(textContent); } Resources.UnloadAsset(textAsset); } return(gameText != null); }
private void LoadFromXmlString(string xmlFileText) { XmlSerializer serializer = null; StringReader reader = null; if (!String.IsNullOrEmpty(xmlFileText)) { try { serializer = new XmlSerializer(typeof(GameText)); reader = new StringReader(xmlFileText); gameText = (GameText)serializer.Deserialize(reader); } catch (Exception e) { Debug.Log("Debug : GameTextDatabase : load from xml file text failed. Exception message \"" + e.Message + "\"."); if (gameText != null) { gameText.Clear(); gameText = null; } } } }