Ejemplo n.º 1
0
        public override void StateStarted()
        {
            /*
             *  при условии что контракта активного нет
             *
             *  выбрать рандомный контракт
             *  открыть popup с названием описанием и reward?
             *
             *  делаем его активным
             */

            var selectedContracts = ContractGenerator.ReturnContracts(Context, Db);
            var contractOptions   = new List <OptionsVotingInfo.Option>();

            foreach (var contract in selectedContracts)
            {
                var option = new OptionsVotingInfo.Option
                {
                    Name      = contract.Name,
                    Action    = new SetContract(contract),
                    IsEnabled = contract.Level <= Context.Company.Level
                };
                contractOptions.Add(option);
            }

            var optionsVotingInfo = new OptionsVotingInfo(true, contractOptions, Common.DefaultVotingDuration);

            _activeVoting = new OptionsVotingState(optionsVotingInfo);

            UIManager.Instance.ShowOptionsVotingPopup(new EventInfo("Choose contract", "Every next contract is more complicated than the previous one! But the harder the contract, the more money you will make..."), _activeVoting);
            SoundManager.Instance.Play(SoundBank.Instance.ContractStarted);
        }
Ejemplo n.º 2
0
        public DistrVotingState(OptionsVotingInfo info)
        {
            Info     = info;
            Timer    = new TimerState(info.Duration);
            IsActive = true;

            foreach (var option in info.Options)
            {
                Options.Add(option.Name, option);
                Results.Add(option.Name, 50);
            }
#if DEBUGGER
            Debugger.Default.Display("Skip Voting", Timer.Skip);
#endif
        }
Ejemplo n.º 3
0
        public override void StateStarted()
        {
            // Выводим окошко с OptionsVoting за название (выбираем рандомные 4), ставим таймер
            _event = new EventInfo(
                "Choose new name for company!",
                "Looks like the previous company wasn't as successful as we wanted it to be. But the new mysterious investor wants to try it all again! Even better, he wants to keep the previous board.");

            var randomNames   = RandomUtils.NRandom(_names, 4);
            var votingOptions = randomNames.Select(name => new OptionsVotingInfo.Option {
                Name = name
            });
            var votingInfo = new OptionsVotingInfo(allowMultipleVotes: true, votingOptions, Common.DefaultVotingDuration);

            _votingState = new OptionsVotingState(votingInfo);
            UIManager.Instance.ShowOptionsVotingPopup(_event, _votingState);
            SoundManager.Instance.Play(SoundBank.Instance.NewCompany);
        }
Ejemplo n.º 4
0
        public override void StateStarted()
        {
            /*
             * 1. открываем UI голосовалки распределения доходов (и начинаем принимать голоса)
             *      в UI пишем reward или в чат?
             *  начинаем таймер голосования
             *
             * 2. выполняем SuccessAction
             * 3. Context.Company.ActiveContract.Earnings = GetRewardAction()?
             */
            if (!Context.Company.HasContract)
            {
                return;
            }

            var activeContract = Context.Company.ActiveContract;

            activeContract.Info.SuccessAction?.Call(Context);

            var options = new OptionsVotingInfo.Option[]
            {
                new OptionsVotingInfo.Option {
                    Name = CompanyOption
                },
                new OptionsVotingInfo.Option {
                    Name = InvestorsOption
                },
            };
            var votingInfo = new OptionsVotingInfo(true, options, Common.DefaultVotingDuration);

            _votingState = new DistrVotingState(votingInfo);
            _event       = new EventInfo(
                "Split the money!",
                $"You got an <b>$ {Context.Company.ActiveContract.Info.Reward:N0}</b> for finishing your last contract. Divide the money between the workers and the company - part of the earned money will go to the company's account, and part will be credited to your personal balance.");

            _reward = Context.Company.ActiveContract.Info.Reward;
            Context.Company.ActiveContract = null;
            UIManager.Instance.ShowDualOptionsVotingPopup(_event, _votingState);
            SoundManager.Instance.Play(SoundBank.Instance.ContractFinished);
        }