public RuleBase(RuleBaseType ruleBase) { int ruleCount = ruleBase.GetRulesCount(); for (int i = 0; i < ruleCount; i++) { Rule thisRule = new Rule(ruleBase.GetRulesAt(i)); AddRule(thisRule); } }
public bool Save(ref RuleBaseType ruleBase) { foreach (KeyValuePair<string, Variable> pair in m_Variables) { Variable variable = pair.Value; XMLRules.VariableType xmlVariable = new XMLRules.VariableType(); variable.Save(ref xmlVariable); ruleBase.AddVariables(xmlVariable); } return true; }
public bool Load(RuleBaseType ruleBase) { Clear(); int variableCount = ruleBase.GetVariablesCount(); for (int i = 0; i < variableCount; i++) { Variable variable = new Variable(gameObject, ruleBase.GetVariablesAt(i)); AddVariable(variable); } return true; }
public bool Load(RuleBaseType ruleBase) { m_Rules.Clear(); int ruleCount = ruleBase.GetRulesCount(); for (int i = 0; i < ruleCount; i++) { Rule thisRule = new Rule(ruleBase.GetRulesAt(i)); AddRule(thisRule); } return Validate(); }
public bool Save(ref RuleBaseType ruleBase) { try { int ruleCount = m_Rules.Count(); for (int i = 0; i < ruleCount; i++) { ruleBase.AddRules(m_Rules[i].m_Rule); } } catch (Exception e) { Debug.Log("Error in Save RuleBase " + e.ToString()); return false; } return true; }
public void ReplaceRuleBaseAt(RuleBaseType newValue, int index) { ReplaceDomElementAt("", "RuleBase", index, newValue); }
public void InsertRuleBaseAt(RuleBaseType newValue, int index) { InsertDomElementAt("", "RuleBase", index, newValue); }
public void AddRuleBase(RuleBaseType newValue) { AppendDomElement("", "RuleBase", newValue); }
public RulesEnumerator(RuleBaseType par) { parent = par; nIndex = -1; }
public bool Save(string fileName) { try { XMLRulesDoc document = new XMLRulesDoc(); XMLRulesType root = new XMLRulesType(); RuleBaseType ruleBase = new RuleBaseType(); m_State.Save(ref ruleBase); m_RuleBase.Save(ref ruleBase); root.AddRuleBase(ruleBase); document.SetRootElementName("", "XMLRules"); document.SetSchemaLocation("XMLRules.xsd"); // optional document.Save(fileName, root); } catch (Exception e) { Debug.Log("Error in Save " + e.ToString()); return false; } return true; }