Пример #1
0
        void Update()
        {
            if (_state == null)
            {
                return;
            }

            var option1Votes = _state.Results[_option1];
            var option2Votes = _state.Results[_option2];
            var totalVotes   = option1Votes + option2Votes;

            if (Option1Votes != null)
            {
                Option1Votes.text = option1Votes.ToString();
            }

            if (Option2Votes != null)
            {
                Option2Votes.text = option2Votes.ToString();
            }

            if (ProgressBar != null)
            {
                var progress = 0.5f;
                if (totalVotes >= 1)
                {
                    progress = (float)option1Votes / totalVotes;
                }

                ProgressBar.SetTarget(progress);
            }
        }