/// <summary> /// parsing excel data into current format /// </summary> /// <param name="itm">target</param> /// <param name="repItm">source</param> /// <returns> parsed item </returns> public static new AbstractObject Parse(AbstractObject itm, ExcelLoading.AbstractObject repItm) { Localization loc = Localization.GetLocalization(); ExcelLoading.ScienceItem rep = (ExcelLoading.ScienceItem)repItm; Science scs = (Science)itm; scs.m_repItem = rep; scs.m_tooltipCount = loc.m_ui.m_scienceCount; scs.m_tooltipProductivity = loc.m_ui.m_scienceProductivity; Productions.AddProduction(scs, "science"); return(GameAbstractItem.Parse(itm, repItm)); }
/// <summary> /// parsing excel data into current format /// </summary> /// <param name="itm">target</param> /// <param name="repItm">source</param> /// <returns> parsed item </returns> public static new AbstractObject Parse(AbstractObject itm, ExcelLoading.AbstractObject repItm) { ExcelLoading.MaterialItem rep = (ExcelLoading.MaterialItem)repItm; GameMaterial mat = (GameMaterial)itm; mat.m_size = rep.container; mat.m_container = rep.container_type.ParseCont(); string[] prods = rep.production_type.Split('&'); foreach (string prod in prods) { string prodTmp = prod.Trim(); mat.m_productionType.Add(prodTmp); Productions.AddProduction(mat, prodTmp); } mat.m_onWork = mat.WorkComplite; return(GameAbstractItem.Parse(mat, rep)); }
/// <summary> /// Open item at startup. /// Here: getting buildings for living and happy tools for furver using /// Could be called only in Start/Load game /// </summary> public override void OpenItem() { for (int i = 0; i < 30; i++) { m_starved.Enqueue(-m_people.PeopleNumber); } m_isItIterable = false; m_tools = new List <ItemsEffect>(); m_dependencyCount = new DependencyCount[1]; m_dependencyCount[0] = new DependencyCount(); m_dependencyCount[0].m_dependency = new List <AbstractObject>(); foreach (var food in Productions.GetProductions("food")) { m_dependencyCount[0].m_dependency.Add(food as GameMaterial); } foreach (var building in Productions.GetTools("living")) { m_livingPlaces.Add(new ItemsEffect(building)); } m_livingPlaces.Sort((ItemsEffect pair1, ItemsEffect pair2) => { Buildings bld1 = pair1.m_toolLink as Buildings; Buildings bld2 = pair2.m_toolLink as Buildings; return((int)(bld1.m_happyEffect.m_value - bld2.m_happyEffect.m_value)); }); Productions.AddProduction(this, "happy"); m_people = Camera.main.GetComponent <People>(); while (m_people.GetWorker()) { ((GameMaterial)(m_dependencyCount[0].m_dependency[0])).m_workers++; } }
public bool ParseStringArrayList(ArrayList lines) { Match lineMatch; string line; for (int i = 0; i < lines.Count; i++) { line = (string)(lines[i]); lineMatch = comment.Match(line); if (lineMatch.Success) { continue; } lineMatch = parameter.Match(line); if (lineMatch.Success) { Console.WriteLine("parsed parameter rule: " + line); _globalParameters.Add(lineMatch.Groups["parameter"].Value, Double.Parse(lineMatch.Groups["value"].Value)); continue; } lineMatch = axiom.Match(line); if (lineMatch.Success) { Console.WriteLine("parsed axiom rule: " + line); _axiom = Rules.ConvertSuccessorToRuleList(lineMatch.Groups["axiom"].Value); continue; } lineMatch = recursion.Match(line); if (lineMatch.Success) { Console.WriteLine("parsed recursion rule: " + line); _recursion = Int32.Parse(lineMatch.Groups["recursion"].Value); continue; } lineMatch = thickness.Match(line); if (lineMatch.Success) { Console.WriteLine("parsed thickness rule: " + line); _thickness = Double.Parse(lineMatch.Groups["thickness"].Value); continue; } lineMatch = seed.Match(line); if (lineMatch.Success) { Console.WriteLine("parsed seed rule: " + line); _random = new Random(Int32.Parse(lineMatch.Groups["seed"].Value)); continue; } lineMatch = angle.Match(line); if (lineMatch.Success) { Console.WriteLine("parsed angle rule: " + line); _angle = Double.Parse(lineMatch.Groups["angle"].Value); continue; } lineMatch = ignore.Match(line); if (lineMatch.Success) { Console.WriteLine("parsed ignore rule: " + line); String[] ignoreSplit = ((String)(lineMatch.Groups["ignore"].Value)).Split(new Char[] { ' ' }); foreach (String ignoreString in ignoreSplit) { _ignoreHash[ignoreString] = true; Console.WriteLine("Adding to ignore hash: " + ignoreString); } continue; } /* see if its a production */ if (!_productions.AddProduction(line)) { Console.WriteLine("Can not parse rule: " + line); return(false); } else { Console.WriteLine("parsed production rule: " + line); } } if (null == _random) { _random = new Random(); } return(true); }