public object GetValue <T>(string key) where T : NTVariable { if (string.IsNullOrEmpty(key)) { return(default(object)); } Type newVariableType = typeof(T); NTVariableDictionary variableTypeDictionary; if (dictionary.ContainsKey(newVariableType.ToString())) { variableTypeDictionary = dictionary[newVariableType.ToString()]; if (variableTypeDictionary.ContainsKey(key)) { NTVariable ntvar = variableTypeDictionary[key]; return(ntvar.GetValue()); } Debug.Log("No value???" + key + " " + variableTypeDictionary.DictType); } return(default(object)); }
public override bool Evaluate(Operator op, NTVariable value) { Type rightVariableType = value.GetDataType(); if (rightVariableType == typeof(float) || rightVariableType == typeof(int) || rightVariableType == typeof(double)) { float rightValue = (float)value.GetValue(); return(InternalEvaluate(op, rightValue, true)); } else { return(this.value > 0); } }
public override bool Evaluate(Operator op, NTVariable value) { Type rightVariableType = value.GetDataType(); if (rightVariableType == typeof(bool)) { bool rightValue = (bool)value.GetValue(); return(InternalEvaluate(op, rightValue, true)); } else { return(this.value); } }
public override bool Evaluate(Operator op, NTVariable value) { Type rightVariableType = value.GetDataType(); if (rightVariableType == typeof(string)) { string rightValue = (string)value.GetValue(); return(Evaluate(op, rightValue, true)); } else { return(!string.IsNullOrEmpty(this.value)); } }
public object GetValue(string key, Type t) { if (string.IsNullOrEmpty(key)) { return(default(object)); } Type newVariableType = t; NTVariableDictionary variableTypeDictionary; if (dictionary.ContainsKey(newVariableType.ToString())) { variableTypeDictionary = dictionary[newVariableType.ToString()]; if (variableTypeDictionary.ContainsKey(key)) { NTVariable ntvar = variableTypeDictionary[key]; return(ntvar.GetValue()); } } return(default(object)); }