public ArticleStrength GetConfig(PositionType position) { ArticleStrength data = null; configs.TryGetValue(position, out data); return(data); }
private void SetupBarColors(ArticleStrength config) { int y = 0; foreach (ArticleStrength.Section section in config.sections) { UISprite sprite = NGUITools.AddSprite(_bar.gameObject, atlas, "white_bg"); sprite.pivot = UIWidget.Pivot.Bottom; sprite.color = GameSystem.Instance.ArticleStrengthConfig.GetSectionColor(section.section); sprite.depth = 1; sprite.width = _bar.width; sprite.height = (int)((float)section.end_time * _bar.height - y); sprite.transform.localPosition = new Vector3(0, y); y += sprite.height; } }
public void ReadConfig() { if (isLoadFinish == false) { return; } isLoadFinish = false; lock (LockObject) { GameSystem.Instance.readConfigCnt += 1; } Debug.Log("Config reading " + name); string text = ResourceLoadManager.Instance.GetConfigText(name); if (text == null) { Debug.LogError("LoadConfig failed: " + name); return; } XmlDocument xmlDoc = CommonFunction.LoadXmlConfig(GlobalConst.DIR_XML_ARTICLE_STRENGTH, text); XmlNode node_data = xmlDoc.SelectSingleNode("Data"); foreach (XmlNode node_line in node_data.SelectNodes("Line")) { if (CommonFunction.IsCommented(node_line)) { continue; } ArticleStrength data = new ArticleStrength(); data.position = (PositionType)(int.Parse(node_line.SelectSingleNode("position").InnerText)); for (int i = 1; ; ++i) { XmlNode node_subsection = node_line.SelectSingleNode("subsection_" + i); if (node_subsection == null) { break; } ArticleStrength.Section section = new ArticleStrength.Section(); section.end_time = IM.Number.Parse(node_subsection.InnerText); section.section = uint.Parse(node_line.SelectSingleNode("colour_" + i).InnerText); section.value = IM.Number.Parse(node_line.SelectSingleNode("value_" + i).InnerText); data.sections.Add(section); } configs.Add(data.position, data); } }