Ejemplo n.º 1
0
        /// <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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
    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;
    }
Ejemplo n.º 5
0
 public bool MergeVotes(string fromVote, string toVote, VoteType voteType) => VoteCounter.Merge(fromVote, toVote, voteType);
Ejemplo n.º 6
0
 public bool VoteExists(string vote, VoteType voteType) => VoteCounter.HasVote(vote, voteType);
Ejemplo n.º 7
0
 public IEnumerable <Origin> GetVoterListForVote(VoteLineBlock vote) => VoteCounter.GetVotersFor(vote);
Ejemplo n.º 8
0
 public bool PartitionChildren(string vote, VoteType voteType) => VoteCounter.PartitionChildren(vote, voteType);
Ejemplo n.º 9
0
 public bool JoinVoters(List <Origin> voters, Origin voterToJoin) => VoteCounter.Join(voters, voterToJoin);
Ejemplo n.º 10
0
 public bool MergeVotes(VoteLineBlock fromVote, VoteLineBlock toVote) => VoteCounter.Merge(fromVote, toVote);
Ejemplo n.º 11
0
        /// <summary>
        /// Update the observable collection of voters.
        /// </summary>
        private void UpdateVotersCollection()
        {
            AllVotersCollection.Replace(VoteCounter.GetAllVoters());

            OnPropertyChanged(nameof(AllVotersCollection));
        }
Ejemplo n.º 12
0
 /// <summary>
 /// Resets the tasks order.
 /// </summary>
 /// <param name="order">The type of ordering to use.</param>
 public void ResetTasksOrder(TasksOrdering order) => VoteCounter.ResetTasksOrder(order);
Ejemplo n.º 13
0
 /// <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);
Ejemplo n.º 14
0
 /// <summary>
 /// Allow manual clearing of the page cache.
 /// </summary>
 /// <param name="parameter"></param>
 private void DoClearTallyCache(object?parameter)
 {
     PageCache.Clear();
     VoteCounter.ResetUserMerges();
 }
Ejemplo n.º 15
0
 public bool JoinVoters(List <string> voters, string voterToJoin, VoteType voteType) => VoteCounter.Join(voters, voterToJoin, voteType);
Ejemplo n.º 16
0
 public bool DeleteVote(string vote, VoteType voteType) => VoteCounter.Delete(vote, voteType);
Ejemplo n.º 17
0
 public bool DeleteVote(VoteLineBlock vote) => VoteCounter.Delete(vote);
Ejemplo n.º 18
0
 public bool UndoVoteModification() => VoteCounter.Undo();
Ejemplo n.º 19
0
 public bool PartitionChildren(VoteLineBlock vote) => VoteCounter.Split(vote, Tally.VoteConstructor.PartitionChildren(vote));
Ejemplo n.º 20
0
 public VoteDriveHub(VoteCounter instance)
 {
     this.instance = instance;
 }
Ejemplo n.º 21
0
 public bool ReplaceTask(VoteLineBlock vote, string task) => VoteCounter.ReplaceTask(vote, task);