public void onDestroyClick() { //if (shownFactory.whyCantDestroyFactory() == null) { factory.destroyImmediately(); MainCamera.refreshAllActive(); } }
private void changeReformValue() { if (!(ReferenceEquals(selectedReformType, null)) && selectedReformValue != null && selectedReformType != selectedReformValue) { selectedReformType.SetValue(selectedReformValue); MainCamera.refreshAllActive(); } }
void changeReformValue() { if (selectedReform != null && selectedReformValue != null && selectedReformValue != selectedReform.getValue()) { selectedReform.setValue(selectedReformValue); MainCamera.refreshAllActive(); } }
//public void findNoonesEterprises() //{ // foreach (var item in Province.allProvinces) // { // foreach (var fact in item.allFactories) // { // if (fact.getOwner() == null) // new Message("", "Null owner in " + item + " " + fact, "Got it"); // else // if (fact.getOwner() is PopUnit) // { // var owner = fact.getOwner() as PopUnit; // if (!owner.isAlive()) // new Message("", "Dead pop owner in " + item + " " + fact, "Got it"); ; // } // else // if (fact.getOwner() is Country) // { // var c = fact.getOwner() as Country; // if (!c.isAlive()) // new Message("", "Dead country owner in " + item + " " + fact, "Got it"); ; // } // } // } //} public void onTakeLoan() { Money loan = Game.Player.Bank.HowBigCreditCanGive(Game.Player).Copy(); if (loanLimit.value != 1f) { loan.Multiply((decimal)loanLimit.value); } Game.Player.Bank.GiveCredit(Game.Player, loan); MainCamera.refreshAllActive(); }
public void onUpgradeClick() { //if (shownFactory.getConditionsForFactoryUpgradeFast(Game.player)) { factory.upgrade(Game.Player); MainCamera.refreshAllActive(); if (Game.Player != factory.Country) { factory.Country.Diplomacy.ChangeRelation(Game.Player, Options.RelationImpactOnGovernmentInvestment.get()); } } }
public void onGrantIndependenceClick() { Country whomGrant = Game.selectedProvince.getRandomCore(x => x != Game.Player && !x.isAlive()); if (whomGrant == null) { whomGrant = Game.selectedProvince.getRandomCore(x => x != Game.Player); } whomGrant.onGrantedProvince(Game.selectedProvince); MainCamera.refreshAllActive(); }
public void onPutInDeposit() { if (loanLimit.value == 1f)//.Copy() { Game.Player.Bank.ReceiveMoney(Game.Player, Game.Player.Cash); } else { Game.Player.Bank.ReceiveMoney(Game.Player, Game.Player.Cash.Copy().Multiply((decimal)depositLimit.value)); } MainCamera.refreshAllActive(); }
public void onPutInDeposit() { if (loanLimit.value == 1f) { Game.Player.getBank().takeMoney(Game.Player, Game.Player.cash.Copy());// Copye some how related to bug with self paying } else { Game.Player.getBank().takeMoney(Game.Player, Game.Player.cash.Copy().multiply(depositLimit.value)); } MainCamera.refreshAllActive(); }
public void onPutInDeposit() { if (loanLimit.value == 1f) { Game.Player.getBank().takeMoney(Game.Player, new Value(Game.Player.cash)); } else { Game.Player.getBank().takeMoney(Game.Player, Game.Player.cash.multiplyOutside(depositLimit.value)); } MainCamera.refreshAllActive(); }
//public void findNoonesEterprises() //{ // foreach (var item in Province.allProvinces) // { // foreach (var fact in item.allFactories) // { // if (fact.getOwner() == null) // new Message("", "Null owner in " + item + " " + fact, "Got it"); // else // if (fact.getOwner() is PopUnit) // { // var owner = fact.getOwner() as PopUnit; // if (!owner.isAlive()) // new Message("", "Dead pop owner in " + item + " " + fact, "Got it"); ; // } // else // if (fact.getOwner() is Country) // { // var c = fact.getOwner() as Country; // if (!c.isAlive()) // new Message("", "Dead country owner in " + item + " " + fact, "Got it"); ; // } // } // } //} public void onTakeLoan() { Value loan = Game.Player.getBank().howMuchCanGive(Game.Player); if (loanLimit.value != 1f) { loan.multiply(loanLimit.value); } if (Game.Player.getBank().canGiveMoney(Game.Player, loan)) { Game.Player.getBank().giveMoney(Game.Player, loan); } MainCamera.refreshAllActive(); }
public static void GivePlayerControlOf(Country country) { //if (country != Country.NullCountry) { surrended = false; Player = country; MainCamera.politicsPanel.selectReform(null); MainCamera.inventionsPanel.selectInvention(null); // not necessary since it will change automatically on province selection MainCamera.buildPanel.selectFactoryType(null); MainCamera.refreshAllActive(); } }
public void onBuildClick() { bool buildSomething = false; Factory factory; if (Economy.isMarket.checkIfTrue(Game.Player)) { MoneyView cost = selectedFactoryType.GetBuildCost(); if (Game.Player.CanPay(cost)) { factory = Game.selectedProvince.BuildFactory(Game.Player, selectedFactoryType, cost); Game.Player.PayWithoutRecord(factory, cost); buildSomething = true; MainCamera.factoryPanel.show(factory); if (Game.Player != factory.Country) { factory.Country.changeRelation(Game.Player, Options.RelationImpactOnGovernmentInvestment.get()); } } } else // non market { //todo remove grain connection var resourceToBuild = selectedFactoryType.GetBuildNeeds(); Storage needFood = resourceToBuild.GetFirstSubstituteStorage(Product.Grain); if (Game.Player.countryStorageSet.has(needFood)) { factory = Game.selectedProvince.BuildFactory(Game.Player, selectedFactoryType, World.market.getCost(resourceToBuild)); Game.Player.countryStorageSet.Subtract(needFood); buildSomething = true; MainCamera.factoryPanel.show(factory); if (Game.Player != factory.Country) { factory.Country.changeRelation(Game.Player, Options.RelationImpactOnGovernmentInvestment.get()); } } } if (buildSomething) { selectedFactoryType = null; MainCamera.refreshAllActive(); } }
public void onBuildClick() { bool buildSomething = false; if (Economy.isMarket.checkIftrue(Game.Player)) //if (Game.player.economy.status == Economy.StateCapitalism) //have money /resource { //Value cost = Game.market.getCost(resourceToBuild); //cost.add(Options.factoryMoneyReservePerLevel); Value cost = selectedFactoryType.getInvestmentsCost(); if (Game.Player.canPay(cost)) { var factory = new Factory(Game.selectedProvince, Game.Player, selectedFactoryType); Game.Player.payWithoutRecord(factory, cost); buildSomething = true; MainCamera.factoryPanel.show(factory); } } else // non market { //todo remove grain connection var resourceToBuild = selectedFactoryType.getBuildNeeds(); Storage needFood = resourceToBuild.getFirstStorage(Product.Grain); if (Game.Player.countryStorageSet.has(needFood)) { Factory fact = new Factory(Game.selectedProvince, Game.Player, selectedFactoryType); //wallet.pay(fact.wallet, new Value(100f)); Game.Player.countryStorageSet.subtract(needFood); buildSomething = true; MainCamera.factoryPanel.show(fact); } } if (buildSomething == true) { // voteButton.interactable = false; MainCamera.refreshAllActive(); selectedFactoryType = null; //table.Refresh(); Refresh(); } }
public void onNationalizeClick() { Game.Player.Nationilize(factory); MainCamera.refreshAllActive(); }
public void OnBuyClick() { factory.ownership.BuyStandardShare(Game.Player); MainCamera.refreshAllActive(); }
public void onNationalizeClick() { shownFactory.setOwner(Game.Player); MainCamera.refreshAllActive(); }