public static GameActorInfoDeltaView Deserialize(Stream bytes)
        {
            int  mask = Int32Proxy.Deserialize(bytes);
            byte id   = ByteProxy.Deserialize(bytes);

            var view = new GameActorInfoDeltaView();

            view.Id = id;
            if (mask != 0)
            {
                if ((mask & 1) != 0)
                {
                    view.Changes[GameActorInfoDeltaView.Keys.AccessLevel] = EnumProxy <MemberAccessLevel> .Deserialize(bytes);
                }
                if ((mask & 2) != 0)
                {
                    view.Changes[GameActorInfoDeltaView.Keys.ArmorPointCapacity] = ByteProxy.Deserialize(bytes);
                }
                if ((mask & 4) != 0)
                {
                    view.Changes[GameActorInfoDeltaView.Keys.ArmorPoints] = ByteProxy.Deserialize(bytes);
                }
                if ((mask & 8) != 0)
                {
                    view.Changes[GameActorInfoDeltaView.Keys.Channel] = EnumProxy <ChannelType> .Deserialize(bytes);
                }
                if ((mask & 16) != 0)
                {
                    view.Changes[GameActorInfoDeltaView.Keys.ClanTag] = StringProxy.Deserialize(bytes);
                }
                if ((mask & 32) != 0)
                {
                    view.Changes[GameActorInfoDeltaView.Keys.Cmid] = Int32Proxy.Deserialize(bytes);
                }
                if ((mask & 64) != 0)
                {
                    view.Changes[GameActorInfoDeltaView.Keys.CurrentFiringMode] = EnumProxy <FireMode> .Deserialize(bytes);
                }
                if ((mask & 128) != 0)
                {
                    view.Changes[GameActorInfoDeltaView.Keys.CurrentWeaponSlot] = ByteProxy.Deserialize(bytes);
                }
                if ((mask & 256) != 0)
                {
                    view.Changes[GameActorInfoDeltaView.Keys.Deaths] = Int16Proxy.Deserialize(bytes);
                }
                if ((mask & 512) != 0)
                {
                    view.Changes[GameActorInfoDeltaView.Keys.FunctionalItems] = ListProxy <int> .Deserialize(bytes, Int32Proxy.Deserialize);
                }
                if ((mask & 1024) != 0)
                {
                    view.Changes[GameActorInfoDeltaView.Keys.Gear] = ListProxy <int> .Deserialize(bytes, Int32Proxy.Deserialize);
                }
                if ((mask & 2048) != 0)
                {
                    view.Changes[GameActorInfoDeltaView.Keys.Health] = Int16Proxy.Deserialize(bytes);
                }
                if ((mask & 4096) != 0)
                {
                    view.Changes[GameActorInfoDeltaView.Keys.Kills] = Int16Proxy.Deserialize(bytes);
                }
                if ((mask & 8192) != 0)
                {
                    view.Changes[GameActorInfoDeltaView.Keys.Level] = Int32Proxy.Deserialize(bytes);
                }
                if ((mask & 16384) != 0)
                {
                    view.Changes[GameActorInfoDeltaView.Keys.Ping] = UInt16Proxy.Deserialize(bytes);
                }
                if ((mask & 32768) != 0)
                {
                    view.Changes[GameActorInfoDeltaView.Keys.PlayerId] = ByteProxy.Deserialize(bytes);
                }
                if ((mask & 65536) != 0)
                {
                    view.Changes[GameActorInfoDeltaView.Keys.PlayerName] = StringProxy.Deserialize(bytes);
                }
                if ((mask & 131072) != 0)
                {
                    view.Changes[GameActorInfoDeltaView.Keys.PlayerState] = EnumProxy <PlayerStates> .Deserialize(bytes);
                }
                if ((mask & 262144) != 0)
                {
                    view.Changes[GameActorInfoDeltaView.Keys.QuickItems] = ListProxy <int> .Deserialize(bytes, Int32Proxy.Deserialize);
                }
                if ((mask & 524288) != 0)
                {
                    view.Changes[GameActorInfoDeltaView.Keys.Rank] = ByteProxy.Deserialize(bytes);
                }
                if ((mask & 1048576) != 0)
                {
                    view.Changes[GameActorInfoDeltaView.Keys.SkinColor] = ColorProxy.Deserialize(bytes);
                }
                if ((mask & 2097152) != 0)
                {
                    view.Changes[GameActorInfoDeltaView.Keys.StepSound] = EnumProxy <SurfaceType> .Deserialize(bytes);
                }
                if ((mask & 4194304) != 0)
                {
                    view.Changes[GameActorInfoDeltaView.Keys.TeamID] = EnumProxy <TeamID> .Deserialize(bytes);
                }
                if ((mask & 8388608) != 0)
                {
                    view.Changes[GameActorInfoDeltaView.Keys.Weapons] = ListProxy <int> .Deserialize(bytes, Int32Proxy.Deserialize);
                }
            }
            return(view);
        }
예제 #2
0
        public static GameActorInfoView Deserialize(Stream bytes)
        {
            int mask = Int32Proxy.Deserialize(bytes);
            var view = new GameActorInfoView();

            view.AccessLevel = EnumProxy <MemberAccessLevel> .Deserialize(bytes);

            view.ArmorPointCapacity = ByteProxy.Deserialize(bytes);
            view.ArmorPoints        = ByteProxy.Deserialize(bytes);
            view.Channel            = EnumProxy <ChannelType> .Deserialize(bytes);

            if ((mask & 1) != 0)
            {
                view.ClanTag = StringProxy.Deserialize(bytes);
            }

            view.Cmid = Int32Proxy.Deserialize(bytes);
            view.CurrentFiringMode = EnumProxy <FireMode> .Deserialize(bytes);

            view.CurrentWeaponSlot = ByteProxy.Deserialize(bytes);
            view.Deaths            = Int16Proxy.Deserialize(bytes);

            if ((mask & 2) != 0)
            {
                view.FunctionalItems = ListProxy <int> .Deserialize(bytes, new ListProxy <int> .Deserializer <int>(Int32Proxy.Deserialize));
            }
            if ((mask & 4) != 0)
            {
                view.Gear = ListProxy <int> .Deserialize(bytes, new ListProxy <int> .Deserializer <int>(Int32Proxy.Deserialize));
            }

            view.Health   = Int16Proxy.Deserialize(bytes);
            view.Kills    = Int16Proxy.Deserialize(bytes);
            view.Level    = Int32Proxy.Deserialize(bytes);
            view.Ping     = UInt16Proxy.Deserialize(bytes);
            view.PlayerId = ByteProxy.Deserialize(bytes);

            if ((mask & 8) != 0)
            {
                view.PlayerName = StringProxy.Deserialize(bytes);
            }

            view.PlayerState = EnumProxy <PlayerStates> .Deserialize(bytes);

            if ((mask & 16) != 0)
            {
                view.QuickItems = ListProxy <int> .Deserialize(bytes, new ListProxy <int> .Deserializer <int>(Int32Proxy.Deserialize));
            }

            view.Rank      = ByteProxy.Deserialize(bytes);
            view.SkinColor = ColorProxy.Deserialize(bytes);
            view.StepSound = EnumProxy <SurfaceType> .Deserialize(bytes);

            view.TeamID = EnumProxy <TeamID> .Deserialize(bytes);

            if ((mask & 32) != 0)
            {
                view.Weapons = ListProxy <int> .Deserialize(bytes, new ListProxy <int> .Deserializer <int>(Int32Proxy.Deserialize));
            }

            return(view);
        }