Exemple #1
0
        // Token: 0x0600238B RID: 9099 RVA: 0x000A750C File Offset: 0x000A570C
        public void OnClick()
        {
            if (!this.canVote)
            {
                return;
            }
            NetworkUser networkUser = this.FindNetworkUser();

            Debug.Log(networkUser);
            if (networkUser)
            {
                PreGameRuleVoteController preGameRuleVoteController = PreGameRuleVoteController.FindForUser(networkUser);
                if (preGameRuleVoteController)
                {
                    int choiceValue = this.currentChoiceDef.localIndex;
                    if (preGameRuleVoteController.IsChoiceVoted(this.currentChoiceDef))
                    {
                        choiceValue = -1;
                    }
                    preGameRuleVoteController.SetVote(this.currentChoiceDef.ruleDef.globalIndex, choiceValue);
                    Debug.LogFormat("voteController.SetVote({0}, {1})", new object[]
                    {
                        this.currentChoiceDef.ruleDef.globalIndex,
                        this.currentChoiceDef.localIndex
                    });
                    return;
                }
                Debug.Log("voteController=null");
            }
        }
Exemple #2
0
        // Token: 0x06002388 RID: 9096 RVA: 0x000A7378 File Offset: 0x000A5578
        public void UpdateFromVotes()
        {
            int  num = PreGameRuleVoteController.votesForEachChoice[this.currentChoiceDef.globalIndex];
            bool isInSinglePlayer = RoR2Application.isInSinglePlayer;

            if (num > 0 && !isInSinglePlayer)
            {
                this.voteCounter.enabled = true;
                this.voteCounter.text    = num.ToString();
            }
            else
            {
                this.voteCounter.enabled = false;
            }
            bool        enabled     = false;
            NetworkUser networkUser = this.FindNetworkUser();

            if (networkUser)
            {
                PreGameRuleVoteController preGameRuleVoteController = PreGameRuleVoteController.FindForUser(networkUser);
                if (preGameRuleVoteController)
                {
                    enabled = preGameRuleVoteController.IsChoiceVoted(this.currentChoiceDef);
                }
            }
            this.selectionDisplayPanel.enabled = enabled;
        }