/* * private static readonly string _cBeginActionTitle = "Begin action"; * private void LoadBeginActions(ConfigReader reader) * { * if (m_BeginActionMap != null) * m_BeginActionMap.Clear (); * for (int i = 0; i < reader.SectionCount; ++i) { * var section = reader.GetSections (i); * if (section != null && !string.IsNullOrEmpty(section.Tile)) { * if (section.Tile.StartsWith (_cBeginActionTitle, StringComparison.CurrentCultureIgnoreCase)) { * string actionnoStr = section.Tile.Substring (_cBeginActionTitle.Length); * if (!string.IsNullOrEmpty (actionnoStr)) { * actionnoStr = actionnoStr.Trim (); * if (!string.IsNullOrEmpty (actionnoStr)) { * int actionno; * if (int.TryParse (actionnoStr, out actionno)) { * BeginAction action = new BeginAction (section); * this.AddBeginAction (actionno, action); * } * } * } * } * } * } * } */ 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); } section = reader.GetSection("Music"); if (section != null) { m_Music = new SceneMusic(); if (!section.GetPropertysValues(m_Music)) { Clear(); return(false); } } else { m_Music = new SceneMusic(); } return(IsVaild); }