Esempio n. 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);
        }
Esempio n. 2
0
        public void                     RemoveProperty(BS_PropertyId id)
        {
            BS_Property prop = GetProperty(id);

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

            _properties.Remove(id);
        }
Esempio n. 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();
        }
Esempio n. 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();
        }
Esempio n. 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();
        }
Esempio n. 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);
        }
Esempio n. 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();
 }
Esempio n. 9
0
        public float                    GetCurValue(BS_PropertyId id)
        {
            BS_Property p = GetProperty(id);

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

        public abstract void Apply(BS_Property property);