Beispiel #1
0
        public MoneyVotingPopup ShowMoneyVotingPopup(EventInfo eventInfo, MoneyVotingState state)
        {
            var popupObj         = ShowPopup(MoneyVotingPopup);
            var moneyVotingPopup = popupObj.GetComponent <MoneyVotingPopup>();

            moneyVotingPopup.Setup(eventInfo, state);
            return(moneyVotingPopup);
        }
        public override void StateStarted()
        {
            /*
             *  1. Открываем MoneyVoting и ставим таймер
             */
            _event = new EventInfo("Last chance", "Let's gather money to revive the company");
            var votingInfo = new MoneyVotingInfo(Common.BankruptcyGatherTarget - Context.Company.Balance);

            _votingState = new MoneyVotingState(votingInfo);
            UIManager.Instance.ShowMoneyVotingPopup(_event, _votingState);
            SoundManager.Instance.Play(SoundBank.Instance.Bankruptcy);
        }
        public void Setup(EventInfo eventInfo, MoneyVotingState state)
        {
            _state     = state;
            _eventInfo = eventInfo;
            BasePopup.Setup(eventInfo.Title, eventInfo.Description);

            if (Timer != null)
            {
                Timer.Timer = state.Timer;
            }

            FundRaiser.Setup(state.Info.TargetAmount, state.CurrentAmount);
        }
Beispiel #4
0
        public override void StateStarted()
        {
            /*
             * 1. Выбираем рандомное доступное событие
             *  если оно есть
             *      открываем popup с событием
             *      ставим таймер на просмотр / голосование
             */

            _event = Context.GetRandomAvailableEvent();
            if (_event != null)
            {
                if (_event.Voting != null)
                {
                    // Если это голосование на деньги
                    if (_event.Voting is MoneyVotingInfo moneyVotingInfo)
                    {
                        _moneyVotingState = new MoneyVotingState(moneyVotingInfo);
                        _activeVoting     = _moneyVotingState;
                        UIManager.Instance.ShowMoneyVotingPopup(_event, _moneyVotingState);
                    }

                    // Если это голосование с выбором ответа
                    if (_event.Voting is OptionsVotingInfo optionsVotingInfo)
                    {
                        _optionsVotingState = new OptionsVotingState(optionsVotingInfo);
                        _activeVoting       = _optionsVotingState;
                        UIManager.Instance.ShowOptionsVotingPopup(_event, _optionsVotingState);
                    }
                }
                else
                {
                    _activeVoting = new NotificationVotingState(Common.InformationPopupDisplayTime);
                    UIManager.Instance.ShowNotificationPopup(_event);
                }

                SoundManager.Instance.Play(SoundBank.Instance.NewEvent);
            }
        }