示例#1
0
        public void AddProperty(int offsetProperties, int offsetObjects, NetworkProperty property, int arrayIndex)
        {
            AddPropertyToArray(offsetProperties, offsetObjects, property);

            Properties[offsetProperties].Paths =
                property.AllowCallbacks
              ? new string[] { property.PropertyName }
              : ZeroPaths;

            Properties[offsetProperties].Indices =
                (arrayIndex >= 0) && property.AllowCallbacks
              ? new int[] { arrayIndex }
              : ZeroIndices;

            CallbackPaths.Add(property.PropertyName);
        }
示例#2
0
        public int this[NetworkProperty property]
        {
            get
            {
#if DEBUG
                NetAssert.NotNull(property);

                NetAssert.True(OffsetObjects >= 0);
                NetAssert.True(OffsetObjects < Root.Meta.CountObjects);

                NetAssert.Same(Root.Objects[OffsetObjects], this);
                NetAssert.Same(Root.Objects[OffsetObjects].Meta, property.PropertyMeta);
                NetAssert.Same(Root.Meta.Properties[Root.Objects[OffsetObjects].OffsetProperties + property.OffsetProperties].Property, property);
#endif

                return(this.OffsetStorage + property.OffsetStorage);
            }
        }
示例#3
0
        void AddPropertyToArray(int offsetProperties, int offsetObjects, NetworkProperty property)
        {
            NetAssert.Null(Properties[offsetProperties].Property);

            if (offsetProperties > 0)
            {
                NetAssert.NotNull(Properties[offsetProperties - 1].Property);
            }

            Properties[offsetProperties].Property      = property;
            Properties[offsetProperties].OffsetObjects = offsetObjects;

            for (int i = 0; i < 32; ++i)
            {
                int f = 1 << i;

                // this can't be set
                if (Filters[i] != null)
                {
                    NetAssert.False(Filters[i].IsSet(offsetProperties));
                }

                // if property is included in this filter, flag it
                if ((property.PropertyFilters & f) == f)
                {
                    if (Filters[i] == null)
                    {
                        Filters[i] = new BitSet();
                    }

                    Filters[i].Set(offsetProperties);

                    // now it must be set
                    NetAssert.True(Filters[i].IsSet(offsetProperties));
                }
            }
        }