/// <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); }
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); }
//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; }
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()); } }
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); }
//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); } }
//slider.onValueChanged.AddListener(ListenerMethod); public void onChoiceValueChanged() { selectedReformValue = assotiateTable[dropDown.value]; refresh(false); }
private Movement(AbstractReform reform, AbstractReformValue goal, PopUnit firstPop, Country place) : this(firstPop, place) { this.targetReform = reform; this.targetReformValue = goal; }
internal override void setValue(AbstractReformValue selectedReform) { status = (ReformValue)selectedReform; }
internal abstract void setValue(AbstractReformValue selectedReformValue);