public override void HandleNewAttribute(DialogEngine engine, DialogAttribute attrib) { if (attrib is BagDialogAttribute <TData, TElem> ) { //Console.WriteLine($"ADDING BAG ATTRIBUTE {typeof(TData).Name}, {typeof(TElem).Name}"); _attribs.Add(attrib as BagDialogAttribute <TData, TElem>); } base.HandleNewAttribute(engine, attrib); }
public DialogEngine AddAttribute(DialogAttribute attribute) { if (HasAttribute(attribute.Name)) { throw new Exception($"Attribute already exists on dEngine. {attribute.Name}"); } for (var i = 0; i < _onAdditionHandlers.Count; i++) { _onAdditionHandlers[i].HandleNewAttribute(this, attribute); } _attributes.Add(attribute); return(this); }
protected override long FetchValue() { var obj = _target; foreach (var part in _path) { if (obj == null) { return(default(long)); } var type = obj.GetType(); var info = type.GetFields().FirstOrDefault(f => f.Name.ToLower().Equals(part.ToLower())); if (info == null) { return(default(long)); } obj = info.GetValue(obj); _lastFieldInfo = info; } return(DialogAttribute.ValueToLong(obj)); }
public void Add(DialogEngine dEngine, TElem element) { element.name = element.name.Replace(" ", "."); element.name = element.name.ToLower(); var fullyQualifiedName = Name + "." + element.name; Console.WriteLine($"ADDING BAG ELEMENT. NAME {fullyQualifiedName} TYPE {typeof(TElem).Name}"); if (!dEngine.HasAttribute(fullyQualifiedName)) { if (Elements.Contains(element) == false) { Elements.Add(element); } dEngine.AddAttribute(DialogAttribute.New(Name + '.' + element.name, v => element.value = v, () => element.value)); } }
public AttributeCollection AddPrefix(DialogAttribute attribute) { return(this); }
//private Dictionary<string, DialogAttribute> public AttributeCollection AddFullName(DialogAttribute attribute) { // add the attribute return(this); }
public virtual void HandleNewAttribute(DialogEngine engine, DialogAttribute attrib) { }