/// <summary> /// Add a new QuickPoll. /// </summary> /// <param name="id"></param> public void AddQuickPoll(QuickPollModel model) { if (m_VoteCounts.ContainsKey(model.Id)) { m_VoteCounts.Remove(model.Id); } VoteCounter vc = new VoteCounter(model.PollStyle); m_VoteCounts.Add(model.Id, vc); }
public void Init() { voters.Clear(); for (int i = 0; i < 5; i++) { voters.Add(new Voter(i)); } majorityReached = false; nolynch = new Voter(99); counter = new VoteCounter<Voter>(voters, nolynch); counter.MajorityReached += new EventHandler<MajorityReachedEventArgs<Voter>>(OnMajorityReached); }
public BarebonesGame(Bot bot, NetUser creator, string name) : base(bot, creator, name, bot.Config.Descendants("Games").Descendants("Mafia").Descendants("Prefix").First().Value) { Channel.Commands.Add(new Commands.VoteCommand(this)); Channel.Commands.Add(new Commands.UnvoteCommand(this)); Channel.Commands.Add(new Commands.VotecountCommand(this)); votes = new VoteCounter<NetUser>(Players, bot.Master.GetUser("Nolynch")); votes.MajorityReached += new EventHandler<MajorityReachedEventArgs<NetUser>>(OnMajorityReached); IgnoredPlayers.Add(creator); }
private void Awake() { instance = this; Renderers = new List <SpriteRenderer>(GetComponentsInChildren <SpriteRenderer>()); for (int i = 0; i < Renderers.Count; ++i) { OriginalSortOrders.Add(Renderers[i], Renderers[i].sortingOrder); } List <TextMeshPro> textrenderers = new List <TextMeshPro>(GetComponentsInChildren <TextMeshPro>()); for (int i = 0; i < textrenderers.Count; ++i) { OriginalSortOrdersText.Add(textrenderers[i], textrenderers[i].sortingOrder); } OriginalZ = gameObject.transform.localPosition.z; OriginPosition = gameObject.transform.position; }
public bool MergeVotes(string fromVote, string toVote, VoteType voteType) => VoteCounter.Merge(fromVote, toVote, voteType);
public bool VoteExists(string vote, VoteType voteType) => VoteCounter.HasVote(vote, voteType);
public IEnumerable <Origin> GetVoterListForVote(VoteLineBlock vote) => VoteCounter.GetVotersFor(vote);
public bool PartitionChildren(string vote, VoteType voteType) => VoteCounter.PartitionChildren(vote, voteType);
public bool JoinVoters(List <Origin> voters, Origin voterToJoin) => VoteCounter.Join(voters, voterToJoin);
public bool MergeVotes(VoteLineBlock fromVote, VoteLineBlock toVote) => VoteCounter.Merge(fromVote, toVote);
/// <summary> /// Update the observable collection of voters. /// </summary> private void UpdateVotersCollection() { AllVotersCollection.Replace(VoteCounter.GetAllVoters()); OnPropertyChanged(nameof(AllVotersCollection)); }
/// <summary> /// Resets the tasks order. /// </summary> /// <param name="order">The type of ordering to use.</param> public void ResetTasksOrder(TasksOrdering order) => VoteCounter.ResetTasksOrder(order);
/// <summary> /// Adds a new user-defined task to the known collection of tasks. /// </summary> /// <param name="task">The task to add.</param> public void AddUserDefinedTask(string task) => VoteCounter.AddUserDefinedTask(task);
/// <summary> /// Allow manual clearing of the page cache. /// </summary> /// <param name="parameter"></param> private void DoClearTallyCache(object?parameter) { PageCache.Clear(); VoteCounter.ResetUserMerges(); }
public bool JoinVoters(List <string> voters, string voterToJoin, VoteType voteType) => VoteCounter.Join(voters, voterToJoin, voteType);
public bool DeleteVote(string vote, VoteType voteType) => VoteCounter.Delete(vote, voteType);
public bool DeleteVote(VoteLineBlock vote) => VoteCounter.Delete(vote);
public bool UndoVoteModification() => VoteCounter.Undo();
public bool PartitionChildren(VoteLineBlock vote) => VoteCounter.Split(vote, Tally.VoteConstructor.PartitionChildren(vote));
public VoteDriveHub(VoteCounter instance) { this.instance = instance; }
public bool ReplaceTask(VoteLineBlock vote, string task) => VoteCounter.ReplaceTask(vote, task);