public GameEvent() { GameEventAttribute attribute = Utils.GetAttribute <GameEventAttribute>(GetType()); if (attribute != null) { Name = attribute.Name; } BaseRound baseRound = Gamemode.Game.Instance.Round; CreatedAt = baseRound.RoundEndTime - baseRound.StartedAt - baseRound.TimeLeft; }
private void FireRoundChange(BaseRound _, BaseRound newRound) { switch (newRound) { case PreRound: RoundPreparation.Fire(this); break; case InProgressRound: RoundStart.Fire(this); break; case PostRound: RoundEnd.Fire(this); break; } }
public override void Tick() { base.Tick(); BaseRound currRound = HSGame.Instance.CurrentRound; if (currRound is null) { return; } roundName.Text = currRound.RoundText; BaseTeam currTeam = (Local.Pawn as HSPlayer).Team; teamPanel.SetClass("hidden", currTeam is null); if (currTeam is not null) { teamName.Text = currTeam.TeamName; teamName.Style.FontColor = currTeam.TeamColor; teamName.Style.Dirty(); } }
private BaseRound[] CreateRounds(IPlayer[] players) { if (players == null) { throw new ArgumentNullException(); } if (players.Length > 1) { throw new ArgumentException("Count of players should be greater than one", nameof(players)); } var cardsCount = (int)Math.Ceiling(36 / (double)players.Length); var simpleCount = cardsCount + (players.Length - 1) + cardsCount - 1; var nonTrumpNumber = simpleCount - 1 + players.Length; var shadowNumber = nonTrumpNumber + players.Length; var goldNumber = shadowNumber + players.Length; var miseryNumber = goldNumber + players.Length; var roundCounts = (int)simpleCount + (Players.Length * 4); var rounds = new BaseRound[roundCounts]; for (int i = 0; i < roundCounts; i++) { BaseRound round; var roundNumber = i + 1; if (i <= simpleCount) { round = CreateRound(RoundKind.Simple, roundNumber); } else if (i <= nonTrumpNumber) { round = CreateRound(RoundKind.NonTrump, roundNumber); } else if (i <= shadowNumber) { round = CreateRound(RoundKind.Shadow, roundNumber); } else if (i <= goldNumber) { round = CreateRound(RoundKind.Gold, roundNumber); } else { round = CreateRound(RoundKind.Misery, roundNumber); } round.Bets = players.Select(p => new PlayerBet(p) { Round = round }).ToArray(); rounds[i] = round; } return(rounds); }
/// <summary> /// Called everytime the round changes. /// <para>Event is passed the <strong><see cref="BaseRound"/></strong> instance of the old round.</para> /// <para>Event is passed the <strong><see cref="BaseRound"/></strong> instance of the new round.</para> /// </summary> public RoundChangeEvent(BaseRound oldRound, BaseRound newRound) : base() { OldRound = oldRound; NewRound = newRound; }