private void Clear() { m_Info = null; m_Cam = null; m_Players = null; m_Scaling = null; m_AirConfig = null; m_BgDef = null; m_BgCfg = null; }
private bool LoadFromStr(string str) { Clear(); if (string.IsNullOrEmpty(str)) { return(false); } ConfigReader reader = new ConfigReader(); reader.LoadString(str); // 1 var section = reader.GetSection("Info"); if (section != null) { m_Info = new StageInfo(); if (!section.GetPropertysValues(m_Info)) { Clear(); return(false); } } else { Clear(); return(false); } // 2 section = reader.GetSection("Camera"); if (section == null) { Clear(); return(false); } m_Cam = new StageCamera(); if (!section.GetPropertysValues(m_Cam)) { Clear(); return(false); } // 3 section = reader.GetSection("PlayerInfo"); if (section == null) { Clear(); return(false); } m_Players = new StagePlayerInfo(); if (!section.GetPropertysValues(m_Players)) { Clear(); return(false); } // 4 section = reader.GetSection("Scaling"); if (section != null) { m_Scaling = new StageScaling(); if (!section.GetPropertysValues(m_Scaling)) { Clear(); return(false); } } else { m_Scaling = new StageScaling(); } // 5 m_AirConfig = new AirConfig(reader); if (!m_AirConfig.IsVaild) { Clear(); return(false); } // 6 section = reader.GetSection("BGdef"); if (section == null) { Clear(); return(false); } m_BgDef = new BgDef(); if (!section.GetPropertysValues(m_BgDef)) { Clear(); return(false); } // 7. m_BgCfg = new BgConfig(); if (!m_BgCfg.LoadFromReader(reader)) { Clear(); return(false); } return(IsVaild); }