public void AddProperty(BS_PropertyId id, float value = float.MinValue) { BS_Property ip = new BS_Property(); ip.BaseValue = value; ip.Id = id; ip.Recompute(); _properties.Add(id, ip); _propertyList.Add(ip); }
public void RemoveProperty(BS_PropertyId id) { BS_Property prop = GetProperty(id); if (prop != null) { _propertyList.Remove(prop); } _properties.Remove(id); }
public void RemovePropertyKeywords(BS_PropertyId id, BS_KeywordSet flags) { BS_Property prop = GetProperty(id); if (Dbg.Assert(prop != null)) { return; } prop.Flags.Remove(flags); prop.Recompute(); }
public void SetPropertyBase(BS_PropertyId id, float value) { BS_Property prop = GetProperty(id); if (Dbg.Assert(prop != null)) { return; } prop.BaseValue = value; prop.Recompute(); }
public void AddPropertyKeyword(BS_PropertyId id, BS_Keyword flags) { BS_Property prop = GetProperty(id); if (Dbg.Assert(prop != null)) { return; } prop.Flags.Add(flags); prop.Recompute(); }
public BS_Property GetProperty(BS_PropertyId id) { BS_Property p = null; bool ok = _properties.TryGetValue(id, out p); if (Dbg.Assert(ok, "Failed to find property " + id)) { return(null); } return(p); }
//public bool IsPropertyViewed( BS_PropertyId id) //{ // return false; //### TODO: Fix this before spammage //} void Refresh() { base.ClearAll(); // ### TODO : this will probably flicker, should fix // we use the property ids and keywords as rejection criteria. IEnumerable <BS_Property> enumerable = _properties.GetEnumerable(); using (var s = enumerable.GetEnumerator()) { while (s.MoveNext()) { BS_Property prop = s.Current; // if keywords were specified, see if this prop has them if (this._keywords != null && this._keywords.Count > 0) { if (!prop.Flags.HasFlags(_flags)) { continue; } } // if only certain properties were specified, check for them. if (_propertyIds.Count != 0) { bool found = false; for (int i = 0; !found && (i < _propertyIds.Count); i++) { if (_propertyIds[i] == prop.Id) { found = true; } } if (found == false) { continue; } } // we are either easy, or we passed our tests GameObject newListElement = AddElement(); UI_PropertyListPanelElement ele = newListElement.GetComponent <UI_PropertyListPanelElement>(); Dbg.Assert(ele != null); ele.Set(prop); newListElement.SetActive(true); } } }
public virtual void Set(BS_Property property) { Events.RemoveGlobalListener <BS_PropertyChangedEvent>(OnPropertyChanged); Property = property; UpdateFields(); }
public float GetCurValue(BS_PropertyId id) { BS_Property p = GetProperty(id); return(p != null ? p.CurValue : float.MinValue); }
public override void Apply(BS_Property property) { property.CurValue += Value; }
public string PropertyName; // what property this modifies public abstract void Apply(BS_Property property);