Esempio n. 1
0
        public static IgnitorResource FromString(string str)
        {
            IgnitorResource ir = new IgnitorResource();
            int             indexL = str.LastIndexOf('('); int indexR = str.LastIndexOf(')');

            ir.Name   = str.Substring(0, indexL);
            ir.Amount = float.Parse(str.Substring(indexL + 1, indexR - indexL - 1));
            return(ir);
        }
        public override void OnLoad(ConfigNode node)
        {
            base.OnLoad(node);
            IgnitorResourcesStr = new List <string>();
            IgnitorResources    = new List <IgnitorResource>();

            foreach (ConfigNode subNode in node.GetNodes("IGNITOR_RESOURCE"))
            {
                if (subNode.HasValue("name") == false || subNode.HasValue("amount") == false)
                {
                    continue;
                }
                IgnitorResource newIgnitorResource = new IgnitorResource();
                newIgnitorResource.Load(subNode);
                IgnitorResources.Add(newIgnitorResource);
                IgnitorResourcesStr.Add(newIgnitorResource.ToString());
            }
        }