blob: fbf25102b9879ab8f905216bee5762b36954cc05 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
using Impostor.Api.Net.Messages;
namespace Impostor.Server.Net.Inner.Objects
{
internal partial class InnerMeetingHud
{
public class PlayerVoteArea
{
private const byte VoteMask = 15;
private const byte ReportedBit = 32;
private const byte VotedBit = 64;
private const byte DeadBit = 128;
public PlayerVoteArea(InnerMeetingHud parent, byte targetPlayerId)
{
Parent = parent;
TargetPlayerId = targetPlayerId;
}
public InnerMeetingHud Parent { get; }
public byte TargetPlayerId { get; }
public bool IsDead { get; private set; }
public bool DidVote { get; private set; }
public bool DidReport { get; private set; }
public sbyte VotedFor { get; private set; }
internal void SetDead(bool didReport, bool isDead)
{
DidReport = didReport;
IsDead = isDead;
}
public void Deserialize(IMessageReader reader)
{
var num = reader.ReadByte();
VotedFor = (sbyte)((num & VoteMask) - 1);
IsDead = (num & DeadBit) > 0;
DidVote = (num & VotedBit) > 0;
DidReport = (num & ReportedBit) > 0;
}
}
}
}
|