Exemplo n.º 1
0
    /// <summary>
    /// Not finished, dont use it
    /// </summary>
    /// <param name="reform"></param>
    internal Procent getYesVotes2(AbstractReformValue reform, ref Procent procentPopulationSayedYes)
    {
        uint    totalPopulation       = this.getMenPopulation();
        uint    votingPopulation      = 0;
        uint    populationSayedYes    = 0;
        uint    votersSayedYes        = 0;
        Procent procentVotersSayedYes = new Procent(0f);
        Dictionary <PopType, uint> divisionPopulationResult = new Dictionary <PopType, uint>();
        Dictionary <PopType, uint> divisionVotersResult     = Game.player.getYesVotesByType(reform, ref divisionPopulationResult);

        foreach (KeyValuePair <PopType, uint> next in divisionVotersResult)
        {
            votersSayedYes += next.Value;
        }

        if (totalPopulation != 0)
        {
            procentPopulationSayedYes.set((float)populationSayedYes / totalPopulation);
        }
        else
        {
            procentPopulationSayedYes.set(0);
        }

        if (votingPopulation == 0)
        {
            procentVotersSayedYes.set(0);
        }
        else
        {
            procentVotersSayedYes.set((float)votersSayedYes / votingPopulation);
        }
        return(procentVotersSayedYes);
    }
Exemplo n.º 2
0
    internal Dictionary <PopType, uint> getYesVotesByType(AbstractReformValue reform, ref Dictionary <PopType, uint> divisionPopulationResult)
    {  // division by pop types
        Dictionary <PopType, uint> divisionVotersResult = new Dictionary <PopType, uint>();

        foreach (PopType type in PopType.allPopTypes)
        {
            divisionVotersResult.Add(type, 0);
            divisionPopulationResult.Add(type, 0);
            foreach (Province pro in Game.player.ownedProvinces)
            {
                var popList = pro.FindAllPopUnits(type);
                foreach (PopUnit pop in popList)
                {
                    if (pop.getSayingYes(reform))
                    {
                        divisionPopulationResult[type] += pop.population;
                        if (pop.canVote())
                        {
                            divisionVotersResult[type] += pop.population;
                        }
                    }
                }
            }
        }
        return(divisionVotersResult);
    }
Exemplo n.º 3
0
        //private Movement(PopUnit firstPop, Country place) : base(place)
        //{
        //    members.Add(firstPop);
        //    Country.movements.Add(this);
        //}

        private Movement(AbstractReform reform, AbstractReformValue goal, PopUnit firstPop, Country place) : base(place)// : this(firstPop, place)
        {
            members.Add(firstPop);
            Country.movements.Add(this);
            targetReform      = reform;
            targetReformValue = goal;
            Flag = Nashet.Flag.Rebels;
        }
Exemplo n.º 4
0
        internal float find(AbstractReformValue reformValue)
        {
            var foundModifier = list.Find(x => reformValue.allowed.contains(x)) as Modifier;

            if (foundModifier == null)
            {
                return(0f);
            }
            else
            {
                return(foundModifier.getValue());
            }
        }
Exemplo n.º 5
0
    internal Procent getYesVotes(AbstractReformValue reform, ref Procent procentPopulationSayedYes)
    {
        // calc how much of population wants selected reform
        uint    totalPopulation       = this.getMenPopulation();
        uint    votingPopulation      = 0;
        uint    populationSayedYes    = 0;
        uint    votersSayedYes        = 0;
        Procent procentVotersSayedYes = new Procent(0);

        //Procent procentPopulationSayedYes = new Procent(0f);
        foreach (Province pro in ownedProvinces)
        {
            foreach (PopUnit pop in pro.allPopUnits)
            {
                if (pop.canVote())
                {
                    if (pop.getSayingYes(reform))
                    {
                        votersSayedYes     += pop.population;
                        populationSayedYes += pop.population;
                    }
                    votingPopulation += pop.population;
                }
                else
                {
                    if (pop.getSayingYes(reform))
                    {
                        populationSayedYes += pop.population;
                    }
                }
            }
        }
        if (totalPopulation != 0)
        {
            procentPopulationSayedYes.set((float)populationSayedYes / totalPopulation);
        }
        else
        {
            procentPopulationSayedYes.set(0);
        }

        if (votingPopulation == 0)
        {
            procentVotersSayedYes.set(0);
        }
        else
        {
            procentVotersSayedYes.set((float)votersSayedYes / votingPopulation);
        }
        return(procentVotersSayedYes);
    }
Exemplo n.º 6
0
    //slider.onValueChanged.AddListener(ListenerMethod);

    public void onChoiceValueChanged()
    {
        ////if current reform does not contain reform value
        //bool contain = false;
        //foreach (AbstractReformValue reformValue in selectedReform)
        //{
        //    if (reformValue == selectedReformValue) contain = true;
        //}
        //if (!contain)
        {
            //selectedReformValue = selectedReform.getValue(assotiateTable[choise.value]);
            selectedReformValue = assotiateTable[choise.value];
            refresh(false);
        }
    }
Exemplo n.º 7
0
        //slider.onValueChanged.AddListener(ListenerMethod);

        public void onChoiceValueChanged()
        {
            selectedReformValue = assotiateTable[dropDown.value];
            refresh(false);
        }
Exemplo n.º 8
0
 private Movement(AbstractReform reform, AbstractReformValue goal, PopUnit firstPop, Country place) : this(firstPop, place)
 {
     this.targetReform      = reform;
     this.targetReformValue = goal;
 }
Exemplo n.º 9
0
 internal override void setValue(AbstractReformValue selectedReform)
 {
     status = (ReformValue)selectedReform;
 }
Exemplo n.º 10
0
 internal abstract void setValue(AbstractReformValue selectedReformValue);