Пример #1
0
        public object Deserialize(NetDataReader stream)
        {
            var objToSerialize = new ScriptingContext();

            {
                var has = stream.GetBool();

                objToSerialize.TargetPoint = !has ? default : (Vec2)SyncTypesMap.FastSerializerGetter <Vec2> .Serializer.Deserialize(stream);
            }

            {
                var has = stream.GetBool();

                objToSerialize.Parent = !has ? default : (ScriptingContext)SyncTypesMap.FastSerializerGetter <ScriptingContext> .Serializer.Deserialize(stream);
            }

            {
                var has = stream.GetBool();

                objToSerialize.Host = !has ? default : (EntityId)SyncTypesMap.FastSerializerGetter <EntityId> .Serializer.Deserialize(stream);
            }

            {
                var has = stream.GetBool();

                objToSerialize.Target = !has ? default : (EntityId)SyncTypesMap.FastSerializerGetter <EntityId> .Serializer.Deserialize(stream);
            }

            return(objToSerialize);
        }
Пример #2
0
    public override void OnRead(NetDataReader reader, bool initialState)
    {
        base.OnRead(reader, initialState);

        BananaFull.SetActive(reader.GetBool());
        BananaEaten.SetActive(reader.GetBool());
    }
Пример #3
0
 public void Deserialize(NetDataReader reader)
 {
     id     = reader.GetInt();
     name   = reader.GetString(50);
     ready  = reader.GetBool();
     active = reader.GetBool();
 }
Пример #4
0
 public void Deserialize(NetDataReader reader)
 {
     Forward  = reader.GetBool();
     Left     = reader.GetBool();
     Right    = reader.GetBool();
     Backward = reader.GetBool();
 }
Пример #5
0
        public object Deserialize(NetDataReader stream)
        {
            if (!stream.GetBool())
            {
                return(null);
            }

            DefIDFull defId = default;
            var       crcId = stream.GetULong();
            var       root  = stream.GetBool();

            if (root)
            {
                defId = DefsHolder.Instance.NetIDs.GetID(crcId, 0, 0, 0);
            }
            else
            {
                var line  = stream.GetShort();
                var col   = stream.GetShort();
                var proto = stream.GetByte();
                defId = DefsHolder.Instance.NetIDs.GetID(crcId, line, col, proto);
            }

            return(DefsHolder.Instance.LoadResource <IDef>(defId));
        }
Пример #6
0
 public void Pass(NetDataReader reader)
 {
     reader.GetVector3();
     reader.GetBool();
     reader.GetBool();
     reader.GetInt();
     reader.GetVector3();
     reader.GetVector3();
 }
Пример #7
0
 public void Read(NetDataReader reader)
 {
     moveInput          = reader.GetVector3();
     transformDown      = reader.GetBool();
     usePowerDown       = reader.GetBool();
     setPowerDown       = reader.GetInt();
     mouseRay.origin    = reader.GetVector3();
     mouseRay.direction = reader.GetVector3();
 }
Пример #8
0
 public void Deserialize(NetDataReader reader)
 {
     GuildId            = reader.GetInt();
     GuildRole          = reader.GetByte();
     RoleName           = reader.GetString();
     CanInvite          = reader.GetBool();
     CanKick            = reader.GetBool();
     ShareExpPercentage = reader.GetByte();
 }
Пример #9
0
 public override void ReadPayload(NetDataReader message)
 {
     base.ReadPayload(message);
     Key     = message.GetUInt();
     Shift   = message.GetBool();
     Control = message.GetBool();
     Alt     = message.GetBool();
     Mode    = (KeyMode)message.GetInt();
 }
Пример #10
0
 public override void ReadPayload(NetDataReader message)
 {
     base.ReadPayload(message);
     X           = message.GetInt();
     Y           = message.GetInt();
     Button      = (ButtonType)message.GetInt();
     DoubleClick = message.GetBool();
     Down        = message.GetBool();
     Up          = message.GetBool();
 }
        public static NO_Effect GetEffect(this NetDataReader reader)
        {
            short animId     = reader.GetShort();
            bool  isHit      = reader.GetBool();
            bool  isCritical = reader.GetBool();
            int   dHp        = reader.GetInt();
            int   dMp        = reader.GetInt();

            return(new NO_Effect(animId, isHit, isCritical, dHp, dMp));
        }
Пример #12
0
    public void ReceiveAnimation(NetPeer peer, NetDataReader reader)
    {
        var userId       = reader.GetString();
        var HP           = reader.GetFloat();
        var IsGrounded   = reader.GetBool();
        var Movement     = reader.GetFloat();
        var Dir          = reader.GetFloat();
        var Flap         = reader.GetBool();
        var PumpProgress = reader.GetFloat();

        if (OnReceiveAnimationPlayerUpdate != null)
        {
            OnReceiveAnimationPlayerUpdate(userId, HP, IsGrounded, Movement, Dir, Flap, PumpProgress);
        }
    }
        public void Deserialize(NetDataReader reader)
        {
            type = (UpdateType)reader.GetByte();
            id   = reader.GetInt();
            switch (type)
            {
            case UpdateType.Create:
                guildName   = reader.GetString();
                characterId = reader.GetString();
                break;

            case UpdateType.ChangeLeader:
                characterId = reader.GetString();
                break;

            case UpdateType.SetGuildMessage:
                guildMessage = reader.GetString();
                break;

            case UpdateType.SetGuildRole:
                guildRole          = reader.GetByte();
                roleName           = reader.GetString();
                canInvite          = reader.GetBool();
                canKick            = reader.GetBool();
                shareExpPercentage = reader.GetByte();
                break;

            case UpdateType.SetGuildMemberRole:
                characterId = reader.GetString();
                guildRole   = reader.GetByte();
                break;

            case UpdateType.SetSkillLevel:
                dataId = reader.GetInt();
                level  = reader.GetShort();
                break;

            case UpdateType.SetGold:
                gold = reader.GetInt();
                break;

            case UpdateType.LevelExpSkillPoint:
                level      = reader.GetShort();
                exp        = reader.GetInt();
                skillPoint = reader.GetShort();
                break;
            }
        }
Пример #14
0
 public void Deserialize(NetDataReader reader)
 {
     guid        = reader.GetGuid();
     position    = reader.GetVector3();
     eulerAngles = reader.GetVector3();
     ourPlayer   = reader.GetBool();
 }
Пример #15
0
        public UpdateVariableData(NetDataReader reader, NetPeer sender) : base(sender)
        {
            variabeleDataType = (VariableDataType)reader.GetShort();
            variableName      = reader.GetString();
            objectID          = reader.GetLong();
            switch (variabeleDataType)
            {
            case VariableDataType.Bool:
                this.variableDataBool = reader.GetBool();
                break;

            case VariableDataType.Float:
                this.variableDataFloat = reader.GetFloat();
                break;

            case VariableDataType.Long:
                this.variableDataLong = reader.GetLong();
                break;

            case VariableDataType.String:
                this.variableDataString = reader.GetString();
                break;

            case VariableDataType.Vector2:
                this.variableDataVector2 = reader.GetVector2();
                break;
            }
        }
 public void Deserialize(NetDataReader reader)
 {
     horizontal = (float)reader.GetShort() * 0.01f;
     vertical   = (float)reader.GetShort() * 0.01f;
     isJump     = reader.GetBool();
     timestamp  = (float)reader.GetShort() * 0.01f;
 }
Пример #17
0
 public void ReadPlayerData(NetDataReader reader)
 {
     isHost      = reader.GetBool();
     playerName  = reader.GetString();
     characterId = reader.GetInt();
     playerColor = new Color(reader.GetFloat(), reader.GetFloat(), reader.GetFloat());
 }
Пример #18
0
 public SpawnPlayerData(NetDataReader reader, NetPeer sender) : base(reader, sender)
 {
     IsOwner   = reader.GetBool();
     speed     = reader.GetFloat();
     Health    = reader.GetFloat();
     MaxHealth = reader.GetFloat();
 }
Пример #19
0
 public void Deserialize(NetDataReader reader)
 {
     BattleId        = Guid.Parse(reader.GetString());
     RequesterArmyId = reader.GetInt();
     RequesterUnitId = reader.GetInt();
     IsDefend        = reader.GetBool();
 }
        internal override void Deserialize(NetDataReader reader)
        {
            lastCastWord   = reader.GetString();
            timer          = reader.GetFloat();
            shouldReenable = reader.GetBool();
            bool wasMe = reader.GetBool();

            if (wasMe)
            {
                lastCaster = Owner;
            }
            else
            {
                lastCaster = manager.GetEnemyOf(Owner);
            }
        }
 public override void ReadPayload(NetDataReader message)
 {
     base.ReadPayload(message);
     Bounds     = new Rectangle(message.GetInt(), message.GetInt(), message.GetInt(), message.GetInt());
     Fullscreen = message.GetBool();
     Image      = message.GetRemainingBytes();
 }
Пример #22
0
 public void PrepareDeserialize(NetDataReader reader)
 {
     if (reader.GetBool())
     {
         Deserialize(reader);
     }
 }
Пример #23
0
        public void Deserialize(NetDataReader reader)
        {
            TechBonuses      = new PlayerTechBonuses();
            Inventory        = new StorageComponent(4);
            ReactorStorage   = new StorageComponent(4);
            WarpStorage      = new StorageComponent(1);
            Forge            = new MechaForge();
            Forge.tasks      = new List <ForgeTask>();
            Forge.extraItems = new ItemPack();
            TechBonuses.Deserialize(reader);
            SandCount     = reader.GetInt();
            CoreEnergy    = reader.GetDouble();
            ReactorEnergy = reader.GetDouble();
            bool isPayloadPresent = reader.GetBool();

            if (isPayloadPresent)
            {
                int    mechaLength = reader.GetInt();
                byte[] mechaBytes  = new byte[mechaLength];
                reader.GetBytes(mechaBytes, mechaLength);
                using (MemoryStream ms = new MemoryStream(mechaBytes))
                    using (BinaryReader br = new BinaryReader(ms))
                    {
                        Inventory.Import(br);
                        ReactorStorage.Import(br);
                        WarpStorage.Import(br);
                        Forge.Import(br);
                    }
            }
        }
Пример #24
0
 public InputPacket(NetDataReader dataReader)
 {
     CharacterID         = dataReader.GetString();
     InputSequenceNumber = dataReader.GetLong();
     Horizontal          = dataReader.GetFloat();
     Vertical            = dataReader.GetFloat();
     Action = dataReader.GetBool();
 }
Пример #25
0
    public void ReceiveAnimation(NetPeer peer, NetDataReader reader)
    {
        string UserId = reader.GetString();

        if (!animationPool.ContainsKey(UserId))
        {
            animationPool.Add(UserId, new AnimationState()
            {
            });
        }
        animationPool[UserId].HP           = reader.GetFloat();
        animationPool[UserId].IsGrounded   = reader.GetBool();
        animationPool[UserId].Movement     = reader.GetFloat();
        animationPool[UserId].Dir          = reader.GetFloat();
        animationPool[UserId].Flap         = reader.GetBool();
        animationPool[UserId].PumpProgress = reader.GetFloat();
    }
Пример #26
0
    public override void OnRead(NetDataReader reader)
    {
        MatchStarted     = reader.GetBool();
        GoldenGoal       = reader.GetBool();
        ElapsedMatchTime = reader.GetFloat();
        MatchLength      = reader.GetInt();
        MaxPlayers       = reader.GetInt();
        ServerName       = reader.GetString();

        Teams[TEAM_TYPE.TEAM_1].Color = reader.GetColor();
        Teams[TEAM_TYPE.TEAM_1].Name  = reader.GetString();
        Teams[TEAM_TYPE.TEAM_1].Score = reader.GetInt();

        Teams[TEAM_TYPE.TEAM_2].Color = reader.GetColor();
        Teams[TEAM_TYPE.TEAM_2].Name  = reader.GetString();
        Teams[TEAM_TYPE.TEAM_2].Score = reader.GetInt();
    }
Пример #27
0
 public void ReadPayload(NetDataReader reader)
 {
     this.Path      = reader.GetString(100);
     this.Name      = reader.GetString(100);
     this.Directory = reader.GetBool();
     this.Size      = reader.GetLong();
     this.Modified  = reader.GetString(100);
 }
Пример #28
0
 public void Deserialize(NetDataReader reader)
 {
     NetworkId = reader.GetUShort();
     Position  = reader.GetVector3();
     Rotation  = reader.GetQuaternion();
     Velocity  = reader.GetVector3();
     Grounded  = reader.GetBool();
 }
Пример #29
0
 public override void DeserializeData(NetDataReader reader)
 {
     mapId                        = reader.GetString();
     instanceId                   = reader.GetString();
     instanceWarpPosition         = reader.GetVector3();
     instanceWarpOverrideRotation = reader.GetBool();
     instanceWarpRotation         = reader.GetVector3();
 }
Пример #30
0
 public void Deserialize(NetDataReader reader)
 {
     Id                = Guid.Parse(reader.GetString());
     Name              = reader.GetString();
     CurrentUsers      = reader.GetInt();
     MaximumUsers      = reader.GetInt();
     PasswordProtected = reader.GetBool();
 }