Example #1
0
 // Token: 0x06001062 RID: 4194 RVA: 0x00047F28 File Offset: 0x00046128
 public void SetVote(int ruleIndex, int choiceValue)
 {
     PreGameRuleVoteController.Vote vote = this.votes[ruleIndex];
     if (vote.choiceValue == choiceValue)
     {
         return;
     }
     this.votes[ruleIndex].choiceValue = choiceValue;
     if (!NetworkServer.active && this.networkUserNetworkIdentity && this.networkUserNetworkIdentity.isLocalPlayer)
     {
         this.clientShouldTransmit = true;
     }
     else
     {
         base.SetDirtyBit(2U);
     }
     PreGameRuleVoteController.shouldUpdateGameVotes = true;
 }
Example #2
0
 // Token: 0x0600107A RID: 4218 RVA: 0x00048574 File Offset: 0x00046774
 public static void Serialize(NetworkWriter writer, PreGameRuleVoteController.Vote vote)
 {
     writer.Write(vote.internalValue);
 }
Example #3
0
        // Token: 0x06001065 RID: 4197 RVA: 0x00047FA8 File Offset: 0x000461A8
        private static void UpdateGameVotes()
        {
            int i           = 0;
            int choiceCount = RuleCatalog.choiceCount;

            while (i < choiceCount)
            {
                PreGameRuleVoteController.votesForEachChoice[i] = 0;
                i++;
            }
            int j         = 0;
            int ruleCount = RuleCatalog.ruleCount;

            while (j < ruleCount)
            {
                RuleDef ruleDef = RuleCatalog.GetRuleDef(j);
                int     count   = ruleDef.choices.Count;
                foreach (PreGameRuleVoteController preGameRuleVoteController in PreGameRuleVoteController.instancesList)
                {
                    PreGameRuleVoteController.Vote vote = preGameRuleVoteController.votes[j];
                    if (vote.hasVoted && vote.choiceValue < count)
                    {
                        RuleChoiceDef ruleChoiceDef = ruleDef.choices[vote.choiceValue];
                        PreGameRuleVoteController.votesForEachChoice[ruleChoiceDef.globalIndex]++;
                    }
                }
                j++;
            }
            if (NetworkServer.active)
            {
                int k          = 0;
                int ruleCount2 = RuleCatalog.ruleCount;
                while (k < ruleCount2)
                {
                    RuleDef ruleDef2 = RuleCatalog.GetRuleDef(k);
                    int     count2   = ruleDef2.choices.Count;
                    PreGameController.instance.readOnlyRuleBook.GetRuleChoiceIndex(ruleDef2);
                    int  ruleChoiceIndex = -1;
                    int  num             = 0;
                    bool flag            = false;
                    for (int l = 0; l < count2; l++)
                    {
                        RuleChoiceDef ruleChoiceDef2 = ruleDef2.choices[l];
                        int           num2           = PreGameRuleVoteController.votesForEachChoice[ruleChoiceDef2.globalIndex];
                        if (num2 == num)
                        {
                            flag = true;
                        }
                        else if (num2 > num)
                        {
                            ruleChoiceIndex = ruleChoiceDef2.globalIndex;
                            num             = num2;
                            flag            = false;
                        }
                    }
                    if (num == 0)
                    {
                        ruleChoiceIndex = ruleDef2.choices[ruleDef2.defaultChoiceIndex].globalIndex;
                    }
                    if (!flag || num == 0)
                    {
                        PreGameController.instance.ApplyChoice(ruleChoiceIndex);
                    }
                    k++;
                }
            }
            Action action = PreGameRuleVoteController.onVotesUpdated;

            if (action == null)
            {
                return;
            }
            action();
        }