Пример #1
0
        internal void UpdateFromState(ChannelState deltaState)
        {
            if (deltaState.ShouldSerializeParent())
            {
                _channelState.Parent = deltaState.Parent;
            }
            if (deltaState.ShouldSerializeDescription())
            {
                _channelState.Description = deltaState.Description;
            }
            if (deltaState.ShouldSerializeName())
            {
                _channelState.Name = deltaState.Name;
            }
            if (deltaState.ShouldSerializeDescriptionHash())
            {
                _channelState.DescriptionHash = deltaState.DescriptionHash;
            }
            if (deltaState.ShouldSerializeMaxUsers())
            {
                _channelState.MaxUsers = deltaState.MaxUsers;
            }
            if (deltaState.ShouldSerializePosition())
            {
                _channelState.Position = deltaState.Position;
            }

            // Link updates happen in a sorta weird way
            if (deltaState.Links != null)
            {
                _channelState.Links = deltaState.Links;
            }
            UpdateLinks(deltaState.LinksAdds, deltaState.LinksRemoves);
            //Debug.LogWarning("Updated channel: " + Name);
            //Debug.Log("Set: " + (deltaState.Links == null ? 0 : deltaState.Links.Length));
            //Debug.Log("Added: " + (deltaState.LinksAdds == null ? 0 : deltaState.LinksAdds.Length));
            //Debug.Log("Removed: " + (deltaState.LinksRemoves == null ? 0 : deltaState.LinksRemoves.Length));
        }