private void OwningNetWorker_rawDataRead(NetworkingPlayer sender, BMSByte data) { // In this test we are just writing a string across the network string message = System.Text.Encoding.UTF8.GetString(data.byteArr, data.StartIndex(), data.Size); Debug.Log("Hello " + message); }
protected override void ReadDirtyFields(BMSByte data, ulong timestep) { if (readDirtyFlags == null) { Initialize(); } Buffer.BlockCopy(data.byteArr, data.StartIndex(), readDirtyFlags, 0, readDirtyFlags.Length); data.MoveStartIndex(readDirtyFlags.Length); if ((0x1 & readDirtyFlags[0]) != 0) { if (positionInterpolation.Enabled) { positionInterpolation.target = UnityObjectMapper.Instance.Map <Vector3>(data); positionInterpolation.Timestep = timestep; } else { _position = UnityObjectMapper.Instance.Map <Vector3>(data); RunChange_position(timestep); } } if ((0x2 & readDirtyFlags[0]) != 0) { if (rotationInterpolation.Enabled) { rotationInterpolation.target = UnityObjectMapper.Instance.Map <Quaternion>(data); rotationInterpolation.Timestep = timestep; } else { _rotation = UnityObjectMapper.Instance.Map <Quaternion>(data); RunChange_rotation(timestep); } } if ((0x4 & readDirtyFlags[0]) != 0) { if (hpInterpolation.Enabled) { hpInterpolation.target = UnityObjectMapper.Instance.Map <int>(data); hpInterpolation.Timestep = timestep; } else { _hp = UnityObjectMapper.Instance.Map <int>(data); RunChange_hp(timestep); } } if ((0x8 & readDirtyFlags[0]) != 0) { if (hpMaxInterpolation.Enabled) { hpMaxInterpolation.target = UnityObjectMapper.Instance.Map <int>(data); hpMaxInterpolation.Timestep = timestep; } else { _hpMax = UnityObjectMapper.Instance.Map <int>(data); RunChange_hpMax(timestep); } } if ((0x10 & readDirtyFlags[0]) != 0) { if (staminaInterpolation.Enabled) { staminaInterpolation.target = UnityObjectMapper.Instance.Map <int>(data); staminaInterpolation.Timestep = timestep; } else { _stamina = UnityObjectMapper.Instance.Map <int>(data); RunChange_stamina(timestep); } } if ((0x20 & readDirtyFlags[0]) != 0) { if (staminaMaxInterpolation.Enabled) { staminaMaxInterpolation.target = UnityObjectMapper.Instance.Map <int>(data); staminaMaxInterpolation.Timestep = timestep; } else { _staminaMax = UnityObjectMapper.Instance.Map <int>(data); RunChange_staminaMax(timestep); } } if ((0x40 & readDirtyFlags[0]) != 0) { if (playerNetworkIdInterpolation.Enabled) { playerNetworkIdInterpolation.target = UnityObjectMapper.Instance.Map <uint>(data); playerNetworkIdInterpolation.Timestep = timestep; } else { _playerNetworkId = UnityObjectMapper.Instance.Map <uint>(data); RunChange_playerNetworkId(timestep); } } }
protected override void ReadDirtyFields(BMSByte data, ulong timestep) { if (readDirtyFlags == null) { Initialize(); } Buffer.BlockCopy(data.byteArr, data.StartIndex(), readDirtyFlags, 0, readDirtyFlags.Length); data.MoveStartIndex(readDirtyFlags.Length); if ((0x1 & readDirtyFlags[0]) != 0) { if (GameStartedInterpolation.Enabled) { GameStartedInterpolation.target = UnityObjectMapper.Instance.Map <bool>(data); GameStartedInterpolation.Timestep = timestep; } else { _GameStarted = UnityObjectMapper.Instance.Map <bool>(data); RunChange_GameStarted(timestep); } } if ((0x2 & readDirtyFlags[0]) != 0) { if (LoggedPlayersInterpolation.Enabled) { LoggedPlayersInterpolation.target = UnityObjectMapper.Instance.Map <int>(data); LoggedPlayersInterpolation.Timestep = timestep; } else { _LoggedPlayers = UnityObjectMapper.Instance.Map <int>(data); RunChange_LoggedPlayers(timestep); } } if ((0x4 & readDirtyFlags[0]) != 0) { if (WaitingPlayersInterpolation.Enabled) { WaitingPlayersInterpolation.target = UnityObjectMapper.Instance.Map <bool>(data); WaitingPlayersInterpolation.Timestep = timestep; } else { _WaitingPlayers = UnityObjectMapper.Instance.Map <bool>(data); RunChange_WaitingPlayers(timestep); } } if ((0x8 & readDirtyFlags[0]) != 0) { if (GameEndedInterpolation.Enabled) { GameEndedInterpolation.target = UnityObjectMapper.Instance.Map <bool>(data); GameEndedInterpolation.Timestep = timestep; } else { _GameEnded = UnityObjectMapper.Instance.Map <bool>(data); RunChange_GameEnded(timestep); } } if ((0x10 & readDirtyFlags[0]) != 0) { if (WinnerInterpolation.Enabled) { WinnerInterpolation.target = UnityObjectMapper.Instance.Map <uint>(data); WinnerInterpolation.Timestep = timestep; } else { _Winner = UnityObjectMapper.Instance.Map <uint>(data); RunChange_Winner(timestep); } } }
protected override void ReadDirtyFields(BMSByte data, ulong timestep) { if (readDirtyFlags == null) { Initialize(); } Buffer.BlockCopy(data.byteArr, data.StartIndex(), readDirtyFlags, 0, readDirtyFlags.Length); data.MoveStartIndex(readDirtyFlags.Length); if ((0x1 & readDirtyFlags[0]) != 0) { if (fieldByteInterpolation.Enabled) { fieldByteInterpolation.target = UnityObjectMapper.Instance.Map <byte>(data); fieldByteInterpolation.Timestep = timestep; } else { _fieldByte = UnityObjectMapper.Instance.Map <byte>(data); RunChange_fieldByte(timestep); } } if ((0x2 & readDirtyFlags[0]) != 0) { if (fieldCharInterpolation.Enabled) { fieldCharInterpolation.target = UnityObjectMapper.Instance.Map <char>(data); fieldCharInterpolation.Timestep = timestep; } else { _fieldChar = UnityObjectMapper.Instance.Map <char>(data); RunChange_fieldChar(timestep); } } if ((0x4 & readDirtyFlags[0]) != 0) { if (fieldShortInterpolation.Enabled) { fieldShortInterpolation.target = UnityObjectMapper.Instance.Map <short>(data); fieldShortInterpolation.Timestep = timestep; } else { _fieldShort = UnityObjectMapper.Instance.Map <short>(data); RunChange_fieldShort(timestep); } } if ((0x8 & readDirtyFlags[0]) != 0) { if (fieldUShortInterpolation.Enabled) { fieldUShortInterpolation.target = UnityObjectMapper.Instance.Map <ushort>(data); fieldUShortInterpolation.Timestep = timestep; } else { _fieldUShort = UnityObjectMapper.Instance.Map <ushort>(data); RunChange_fieldUShort(timestep); } } if ((0x10 & readDirtyFlags[0]) != 0) { if (fieldBoolInterpolation.Enabled) { fieldBoolInterpolation.target = UnityObjectMapper.Instance.Map <bool>(data); fieldBoolInterpolation.Timestep = timestep; } else { _fieldBool = UnityObjectMapper.Instance.Map <bool>(data); RunChange_fieldBool(timestep); } } if ((0x20 & readDirtyFlags[0]) != 0) { if (fieldIntInterpolation.Enabled) { fieldIntInterpolation.target = UnityObjectMapper.Instance.Map <int>(data); fieldIntInterpolation.Timestep = timestep; } else { _fieldInt = UnityObjectMapper.Instance.Map <int>(data); RunChange_fieldInt(timestep); } } if ((0x40 & readDirtyFlags[0]) != 0) { if (fieldUIntInterpolation.Enabled) { fieldUIntInterpolation.target = UnityObjectMapper.Instance.Map <uint>(data); fieldUIntInterpolation.Timestep = timestep; } else { _fieldUInt = UnityObjectMapper.Instance.Map <uint>(data); RunChange_fieldUInt(timestep); } } if ((0x80 & readDirtyFlags[0]) != 0) { if (fieldFloatInterpolation.Enabled) { fieldFloatInterpolation.target = UnityObjectMapper.Instance.Map <float>(data); fieldFloatInterpolation.Timestep = timestep; } else { _fieldFloat = UnityObjectMapper.Instance.Map <float>(data); RunChange_fieldFloat(timestep); } } if ((0x1 & readDirtyFlags[1]) != 0) { if (fieldFloatInterpolateInterpolation.Enabled) { fieldFloatInterpolateInterpolation.target = UnityObjectMapper.Instance.Map <float>(data); fieldFloatInterpolateInterpolation.Timestep = timestep; } else { _fieldFloatInterpolate = UnityObjectMapper.Instance.Map <float>(data); RunChange_fieldFloatInterpolate(timestep); } } if ((0x2 & readDirtyFlags[1]) != 0) { if (fieldLongInterpolation.Enabled) { fieldLongInterpolation.target = UnityObjectMapper.Instance.Map <long>(data); fieldLongInterpolation.Timestep = timestep; } else { _fieldLong = UnityObjectMapper.Instance.Map <long>(data); RunChange_fieldLong(timestep); } } if ((0x4 & readDirtyFlags[1]) != 0) { if (fieldULongInterpolation.Enabled) { fieldULongInterpolation.target = UnityObjectMapper.Instance.Map <ulong>(data); fieldULongInterpolation.Timestep = timestep; } else { _fieldULong = UnityObjectMapper.Instance.Map <ulong>(data); RunChange_fieldULong(timestep); } } if ((0x8 & readDirtyFlags[1]) != 0) { if (fieldDoubleInterpolation.Enabled) { fieldDoubleInterpolation.target = UnityObjectMapper.Instance.Map <double>(data); fieldDoubleInterpolation.Timestep = timestep; } else { _fieldDouble = UnityObjectMapper.Instance.Map <double>(data); RunChange_fieldDouble(timestep); } } }
protected override void ReadDirtyFields(BMSByte data, ulong timestep) { Buffer.BlockCopy(data.byteArr, data.StartIndex(), readDirtyFlags, 0, readDirtyFlags.Length); data.MoveStartIndex(readDirtyFlags.Length); }
protected override void ReadDirtyFields(BMSByte data, ulong timestep) { if (readDirtyFlags == null) { Initialize(); } Buffer.BlockCopy(data.byteArr, data.StartIndex(), readDirtyFlags, 0, readDirtyFlags.Length); data.MoveStartIndex(readDirtyFlags.Length); if ((0x1 & readDirtyFlags[0]) != 0) { if (positionInterpolation.Enabled) { positionInterpolation.target = UnityObjectMapper.Instance.Map <Vector3>(data); positionInterpolation.Timestep = timestep; } else { _position = UnityObjectMapper.Instance.Map <Vector3>(data); RunChange_position(timestep); } } if ((0x2 & readDirtyFlags[0]) != 0) { if (rotationInterpolation.Enabled) { rotationInterpolation.target = UnityObjectMapper.Instance.Map <Quaternion>(data); rotationInterpolation.Timestep = timestep; } else { _rotation = UnityObjectMapper.Instance.Map <Quaternion>(data); RunChange_rotation(timestep); } } if ((0x4 & readDirtyFlags[0]) != 0) { if (velocityInterpolation.Enabled) { velocityInterpolation.target = UnityObjectMapper.Instance.Map <Vector2>(data); velocityInterpolation.Timestep = timestep; } else { _velocity = UnityObjectMapper.Instance.Map <Vector2>(data); RunChange_velocity(timestep); } } if ((0x8 & readDirtyFlags[0]) != 0) { if (rotvelocityInterpolation.Enabled) { rotvelocityInterpolation.target = UnityObjectMapper.Instance.Map <float>(data); rotvelocityInterpolation.Timestep = timestep; } else { _rotvelocity = UnityObjectMapper.Instance.Map <float>(data); RunChange_rotvelocity(timestep); } } }
protected override void ReadDirtyFields(BMSByte data, ulong timestep) { if (readDirtyFlags == null) { Initialize(); } Buffer.BlockCopy(data.byteArr, data.StartIndex(), readDirtyFlags, 0, readDirtyFlags.Length); data.MoveStartIndex(readDirtyFlags.Length); if ((0x1 & readDirtyFlags[0]) != 0) { if (positionInterpolation.Enabled) { positionInterpolation.target = UnityObjectMapper.Instance.Map <Vector3>(data); positionInterpolation.Timestep = timestep; } else { _position = UnityObjectMapper.Instance.Map <Vector3>(data); RunChange_position(timestep); } } if ((0x2 & readDirtyFlags[0]) != 0) { if (rotationInterpolation.Enabled) { rotationInterpolation.target = UnityObjectMapper.Instance.Map <Quaternion>(data); rotationInterpolation.Timestep = timestep; } else { _rotation = UnityObjectMapper.Instance.Map <Quaternion>(data); RunChange_rotation(timestep); } } if ((0x4 & readDirtyFlags[0]) != 0) { if (axisDeltaInterpolation.Enabled) { axisDeltaInterpolation.target = UnityObjectMapper.Instance.Map <Vector2>(data); axisDeltaInterpolation.Timestep = timestep; } else { _axisDelta = UnityObjectMapper.Instance.Map <Vector2>(data); RunChange_axisDelta(timestep); } } if ((0x8 & readDirtyFlags[0]) != 0) { if (vertVelocityInterpolation.Enabled) { vertVelocityInterpolation.target = UnityObjectMapper.Instance.Map <float>(data); vertVelocityInterpolation.Timestep = timestep; } else { _vertVelocity = UnityObjectMapper.Instance.Map <float>(data); RunChange_vertVelocity(timestep); } } if ((0x10 & readDirtyFlags[0]) != 0) { if (groundedInterpolation.Enabled) { groundedInterpolation.target = UnityObjectMapper.Instance.Map <bool>(data); groundedInterpolation.Timestep = timestep; } else { _grounded = UnityObjectMapper.Instance.Map <bool>(data); RunChange_grounded(timestep); } } if ((0x20 & readDirtyFlags[0]) != 0) { if (weaponIndexInterpolation.Enabled) { weaponIndexInterpolation.target = UnityObjectMapper.Instance.Map <int>(data); weaponIndexInterpolation.Timestep = timestep; } else { _weaponIndex = UnityObjectMapper.Instance.Map <int>(data); RunChange_weaponIndex(timestep); } } if ((0x40 & readDirtyFlags[0]) != 0) { if (skillIndexInterpolation.Enabled) { skillIndexInterpolation.target = UnityObjectMapper.Instance.Map <int>(data); skillIndexInterpolation.Timestep = timestep; } else { _skillIndex = UnityObjectMapper.Instance.Map <int>(data); RunChange_skillIndex(timestep); } } if ((0x80 & readDirtyFlags[0]) != 0) { if (blockedInterpolation.Enabled) { blockedInterpolation.target = UnityObjectMapper.Instance.Map <bool>(data); blockedInterpolation.Timestep = timestep; } else { _blocked = UnityObjectMapper.Instance.Map <bool>(data); RunChange_blocked(timestep); } } if ((0x1 & readDirtyFlags[1]) != 0) { if (lookatDirInterpolation.Enabled) { lookatDirInterpolation.target = UnityObjectMapper.Instance.Map <Vector3>(data); lookatDirInterpolation.Timestep = timestep; } else { _lookatDir = UnityObjectMapper.Instance.Map <Vector3>(data); RunChange_lookatDir(timestep); } } }
protected override void ReadDirtyFields(BMSByte data, ulong timestep) { if (readDirtyFlags == null) { Initialize(); } Buffer.BlockCopy(data.byteArr, data.StartIndex(), readDirtyFlags, 0, readDirtyFlags.Length); data.MoveStartIndex(readDirtyFlags.Length); if ((0x1 & readDirtyFlags[0]) != 0) { if (ownerNetworkIdInterpolation.Enabled) { ownerNetworkIdInterpolation.target = UnityObjectMapper.Instance.Map <uint>(data); ownerNetworkIdInterpolation.Timestep = timestep; } else { _ownerNetworkId = UnityObjectMapper.Instance.Map <uint>(data); RunChange_ownerNetworkId(timestep); } } if ((0x2 & readDirtyFlags[0]) != 0) { if (positionInterpolation.Enabled) { positionInterpolation.target = UnityObjectMapper.Instance.Map <Vector3>(data); positionInterpolation.Timestep = timestep; } else { _position = UnityObjectMapper.Instance.Map <Vector3>(data); RunChange_position(timestep); } } if ((0x4 & readDirtyFlags[0]) != 0) { if (rotationInterpolation.Enabled) { rotationInterpolation.target = UnityObjectMapper.Instance.Map <Quaternion>(data); rotationInterpolation.Timestep = timestep; } else { _rotation = UnityObjectMapper.Instance.Map <Quaternion>(data); RunChange_rotation(timestep); } } if ((0x8 & readDirtyFlags[0]) != 0) { if (healthInterpolation.Enabled) { healthInterpolation.target = UnityObjectMapper.Instance.Map <float>(data); healthInterpolation.Timestep = timestep; } else { _health = UnityObjectMapper.Instance.Map <float>(data); RunChange_health(timestep); } } if ((0x10 & readDirtyFlags[0]) != 0) { if (shieldInterpolation.Enabled) { shieldInterpolation.target = UnityObjectMapper.Instance.Map <float>(data); shieldInterpolation.Timestep = timestep; } else { _shield = UnityObjectMapper.Instance.Map <float>(data); RunChange_shield(timestep); } } }
protected override void ReadDirtyFields(BMSByte data, ulong timestep) { if (readDirtyFlags == null) { Initialize(); } Buffer.BlockCopy(data.byteArr, data.StartIndex(), readDirtyFlags, 0, readDirtyFlags.Length); data.MoveStartIndex(readDirtyFlags.Length); if ((0x1 & readDirtyFlags[0]) != 0) { if (positionInterpolation.Enabled) { positionInterpolation.target = UnityObjectMapper.Instance.Map <Vector3>(data); positionInterpolation.Timestep = timestep; } else { _position = UnityObjectMapper.Instance.Map <Vector3>(data); RunChange_position(timestep); } } if ((0x2 & readDirtyFlags[0]) != 0) { if (rotationInterpolation.Enabled) { rotationInterpolation.target = UnityObjectMapper.Instance.Map <Quaternion>(data); rotationInterpolation.Timestep = timestep; } else { _rotation = UnityObjectMapper.Instance.Map <Quaternion>(data); RunChange_rotation(timestep); } } if ((0x4 & readDirtyFlags[0]) != 0) { if (charTypeInterpolation.Enabled) { charTypeInterpolation.target = UnityObjectMapper.Instance.Map <int>(data); charTypeInterpolation.Timestep = timestep; } else { _charType = UnityObjectMapper.Instance.Map <int>(data); RunChange_charType(timestep); } } if ((0x8 & readDirtyFlags[0]) != 0) { if (isGroundedInterpolation.Enabled) { isGroundedInterpolation.target = UnityObjectMapper.Instance.Map <bool>(data); isGroundedInterpolation.Timestep = timestep; } else { _isGrounded = UnityObjectMapper.Instance.Map <bool>(data); RunChange_isGrounded(timestep); } } if ((0x10 & readDirtyFlags[0]) != 0) { if (animationTypeInterpolation.Enabled) { animationTypeInterpolation.target = UnityObjectMapper.Instance.Map <int>(data); animationTypeInterpolation.Timestep = timestep; } else { _animationType = UnityObjectMapper.Instance.Map <int>(data); RunChange_animationType(timestep); } } if ((0x20 & readDirtyFlags[0]) != 0) { if (damageInterpolation.Enabled) { damageInterpolation.target = UnityObjectMapper.Instance.Map <int>(data); damageInterpolation.Timestep = timestep; } else { _damage = UnityObjectMapper.Instance.Map <int>(data); RunChange_damage(timestep); } } if ((0x40 & readDirtyFlags[0]) != 0) { if (livesInterpolation.Enabled) { livesInterpolation.target = UnityObjectMapper.Instance.Map <int>(data); livesInterpolation.Timestep = timestep; } else { _lives = UnityObjectMapper.Instance.Map <int>(data); RunChange_lives(timestep); } } }
private void PrimarySocket_rawDataRead(NetworkingPlayer sender, BMSByte data) { // Print out the id and the convert the bytes to a string to print Debug.Log("Received message from " + sender.NetworkId + ", payload to string says: " + System.Text.Encoding.UTF8.GetString(data.byteArr, data.StartIndex(), data.Size)); }