public void OnHide() { core.LogHelper.LogInfo($"OnHide {IsHide}, {string.Join(", ", HiddenMapObjects)}"); //m_kBattleCharacter.OnRemoteHide(IsHide, HiddenMapObjects); LastHiddenMapObjects = HiddenMapObjects.ToList(); }
public override void Hide(bool isHide, ushort map_object_uid) { //Log.Information($"Hide {isHide}, networkID:{GetNetworkId()}, map_uid:{map_object_uid}, HiddenMapObjects:{string.Join(", ", HiddenMapObjects)}"); if (HiddenMapObjects.Count > 20) { Log.Error($"Hide error {isHide}, networkID:{GetNetworkId()}, map_uid{map_object_uid}"); HiddenMapObjects.Clear(); } if (isHide) { if (HiddenMapObjects.Contains(map_object_uid) == false) { HiddenMapObjects.Add(map_object_uid); } } else { HiddenMapObjects.Remove(map_object_uid); } Dirty((uint)ReplicationState.Hide); }
public override void Read(NetIncomingMessage inInputStream) { bool stateBit = inInputStream.ReadBoolean(); UInt32 readState = 0; if (stateBit) { int playerId = inInputStream.ReadInt32(); SetPlayerId(playerId); Team = (core.Team)inInputStream.ReadUInt32(GameMode.MaxTeamBits); UserId = inInputStream.ReadString(); readState |= (UInt32)ReplicationState.PlayerId; } oldRotation = GetRotation(); oldLocation = GetLocation(); oldVelocity = GetVelocity(); Vector3 replicatedLocation = default(Vector3); Vector3 replicatedVelocity = default(Vector3); stateBit = inInputStream.ReadBoolean(); if (stateBit) { inInputStream.Read(ref replicatedVelocity); //replicatedVelocity.y = GetVelocity().y; SetVelocity(replicatedVelocity); //Debug.Log("replicatedVelocity : " + replicatedVelocity + ", player_id :" + GetPlayerId()); inInputStream.Read(ref replicatedLocation); //replicatedLocation.y = GetLocation().y; SetLocation(replicatedLocation); //LogHelper.LogInfo($"replicatedLocation : {replicatedLocation.x}, {replicatedLocation.y}, {replicatedLocation.z}, player_id : {GetPlayerId()}"); //if (replicatedVelocity.IsZero()) // mThrustDir = 0f; //else // mThrustDir = 1.0f; //is_move = inInputStream.ReadBoolean(); //if (is_move) //{ // degree = inInputStream.ReadUInt32(9); // mDirection = core.MathHelpers.DegreeToVector3Cached((int)degree); //} if (replicatedVelocity.x != 0 || replicatedVelocity.z != 0) { mDirection = new Vector3(replicatedVelocity.x, 0, replicatedVelocity.z); } //Debug.Log($"degree{degree}, mDirection : {mDirection}, player_id :{GetPlayerId()}"); readState |= (UInt32)ReplicationState.Pose; } // Health stateBit = inInputStream.ReadBoolean(); if (stateBit) { IsHealthUp = false; var HP = (int)inInputStream.ReadUInt32(12); if (mHealth <= HP) { IsHealthUp = true; } mLastHealth = mHealth; mHealth = HP; readState |= (UInt32)ReplicationState.Health; } // State stateBit = inInputStream.ReadBoolean(); if (stateBit) { IsInterpolate = true; LastStateServerSide = StateServerSide; StateServerSide = (core.ActorState)inInputStream.ReadInt32(4); LogHelper.LogInfo($"state serverside {StateServerSide}"); inInputStream.Read(ref TargetPos); JumpPower = inInputStream.ReadFloat(); JumpDuration = inInputStream.ReadFloat(); GameModeType mode = (GameModeType)inInputStream.ReadUInt32(GameMode.MaxGameModeTypeBits); switch (mode) { case GameModeType.KillTheKing: { isLastKilled = inInputStream.ReadBoolean(); if (isLastKilled) { killPlayerId = inInputStream.ReadInt32(); //Debug.Log($"public bool ReadState(NetIncomingMessage inOutputStream, Actor actor) killPlayerId : {killPlayerId}"); } } break; default: break; } readState |= (UInt32)ReplicationState.State; } // Character stateBit = inInputStream.ReadBoolean(); if (stateBit) { SelectedCharacter = inInputStream.ReadByte(); CharacterLevel = (int)inInputStream.ReadUInt32(6); SetCharacterData(SelectedCharacter, CharacterLevel); LogHelper.LogInfo($"Setting Character {characterData.Remark}"); readState |= (UInt32)ReplicationState.Character; } // Spawn stateBit = inInputStream.ReadBoolean(); if (stateBit) { degree = inInputStream.ReadUInt32(9); mDirection = core.MathHelpers.DegreeToVector3Cached((int)degree); readState |= (UInt32)ReplicationState.Spawn; } // AI stateBit = inInputStream.ReadBoolean(); if (stateBit) { AIPlayers.Clear(); var cnt = inInputStream.ReadUInt32((int)AIPlayer.MaxAIPlayerBit); //LogHelper.LogInfo($"ai count {cnt}"); for (int i = 0; i < cnt; ++i) { AIPlayers.Add(inInputStream.ReadInt32()); LogHelper.LogInfo($"ai player network_id:{AIPlayers[i]}"); } readState |= (UInt32)ReplicationState.AI; } // Hide stateBit = inInputStream.ReadBoolean(); if (stateBit) { var size = (int)inInputStream.ReadUInt32(4); HiddenMapObjects.Clear(); for (int i = 0; i < size; ++i) { HiddenMapObjects.Add(inInputStream.ReadUInt16()); } if (HiddenMapObjects.Count > 0) { IsHide = true; } else { IsHide = false; } readState |= (UInt32)ReplicationState.Hide; //LogHelper.LogInfo($"hide {IsHide}"); } OnAfterDeserialize(readState); }