示例#1
0
        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);
        }
示例#2
0
        public void                     RemoveProperty(BS_PropertyId id)
        {
            BS_Property prop = GetProperty(id);

            if (prop != null)
            {
                _propertyList.Remove(prop);
            }

            _properties.Remove(id);
        }
示例#3
0
        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();
        }
示例#4
0
        public void                     SetPropertyBase(BS_PropertyId id, float value)
        {
            BS_Property prop = GetProperty(id);

            if (Dbg.Assert(prop != null))
            {
                return;
            }

            prop.BaseValue = value;
            prop.Recompute();
        }
示例#5
0
        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();
        }
示例#6
0
        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);
        }
示例#7
0
        //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();
 }
示例#9
0
        public float                    GetCurValue(BS_PropertyId id)
        {
            BS_Property p = GetProperty(id);

            return(p != null ? p.CurValue : float.MinValue);
        }
示例#10
0
 public override void Apply(BS_Property property)
 {
     property.CurValue += Value;
 }
示例#11
0
        public string PropertyName; // what property this modifies

        public abstract void Apply(BS_Property property);