Пример #1
0
        CustomReplicatedPropertyActivation[] GetCustomReplicationList()
        {
            var activationInfo = new List <CustomReplicatedPropertyActivation>();

            foreach (var propInfo in GetType().GetProperties(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance))
            {
                ReplicatedAttribute attr = (ReplicatedAttribute)Attribute.GetCustomAttribute(propInfo, typeof(ReplicatedAttribute));
                if (attr != null && attr.Condition == LifetimeCondition.Custom)
                {
                    activationInfo.Add(new CustomReplicatedPropertyActivation(GetRepIndex(propInfo), attr.ShouldReplicate(this)));
                }
            }

            return(activationInfo.ToArray());
        }
Пример #2
0
        private LifetimeReplicatedProperty[] GetLifetimeReplicationList()
        {
            var lifetimeProperties = new List <LifetimeReplicatedProperty>();

            foreach (var propInfo in GetType().GetProperties(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance))
            {
                ReplicatedAttribute attr = (ReplicatedAttribute)Attribute.GetCustomAttribute(propInfo, typeof(ReplicatedAttribute));
                if (attr != null)
                {
                    lifetimeProperties.Add(new LifetimeReplicatedProperty(GetRepIndex(propInfo), attr.Condition));
                }
            }

            return(lifetimeProperties.ToArray());
        }