Beispiel #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);
        }
Beispiel #2
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);
        }