public void UpgradeLevel_CMD(int level, int index, bool hasOwner) { TileController_Country tile = controller.manager.board.tileControllers.Find(n => n.index == index) as TileController_Country; tile.level = level; tile.SetupBuilding(hasOwner); }
internal static int GetMortgagePrice(TileController_Buyable btile) { float percentage = 0.75f; TileBuyable b = btile.tile as TileBuyable; if (btile.GetType() == typeof(TileController_Country)) { TileController_Country country = btile as TileController_Country; return((int)(GetContructionPrice(b.price, country.level) * percentage)); } else { return((int)(wonderPrice * percentage)); } }
private void ChooseProperty_ChangeValueByTime(TileController tile) { if (tile) { if (tileLucky.percentage != 0) { TileController_Country countryTile = (TileController_Country)tile; countryTile.roundsWithMultiplier = 3; countryTile.SetupMultiplier(tileLucky.percentage, countryTile.Owner); } } board.ResetBoard(); clicked = true; }
private void ChooseProperty_BackToBank(TileController tile) { if (tile) { if (tile.GetType() == typeof(TileController_Country)) { TileController_Country countryTile = (TileController_Country)tile; countryTile.SetupMultiplier(100, countryTile.Owner); countryTile.Owner = null; countryTile.UpgradeLevel(0, playerController, false); countryTile.roundsWithMultiplier = 0; } else { TileController_Wonders countryTile = (TileController_Wonders)tile; countryTile.Owner = null; playerController.photonView.RPC("playerController.walletController.ResetWonder_CMD", Photon.Pun.RpcTarget.All); } } board.ResetBoard(); clicked = true; }
public IEnumerator SetupRentTile(TileController_Country tile, PlayerController player) { if (!player.botController) { this.gameObject.SetActive(true); } clicked = false; var tileBuyable = tile.tile as TileBuyable_Country; int rentPrice = (int)MathDt.GetRentPrice(tileBuyable.price, tile.level) * (tile.Multiplier / 100); Transform payRent = rentPanel.transform.GetChild(0).Find("Pay"); payRent.GetComponentInChildren <TextMeshProUGUI>().text = "Pagar aluguel de $" + MathDt.ConfigureMoney(rentPrice); var backgroundHeader = this.transform.Find("BackgroundHeader"); backgroundHeader.GetComponent <Image>().color = tile.Owner.mainColor; backgroundHeader.GetChild(0).GetComponent <TextMeshProUGUI>().text = tile.tile.nameTile; Button rentButton = payRent.GetComponentInChildren <Button>(); rentButton.onClick.RemoveAllListeners(); rentButton.onClick.AddListener(() => { clicked = true; player.walletController.TransferMoney(rentPrice, rentPrice, tile.Owner); player.LogMessagePlayer($"{player.name} pagou {rentPrice} para {tile.Owner.name} em: {tile.tile.nameTile}", true); this.gameObject.SetActive(false); }); int hostilePrice = (int)MathDt.GetHostileTakeoverPrice((int)MathDt.GetContructionPrice(tileBuyable.price, tile.level)); Transform payHostile = hostileTakeoverPanel.transform.GetChild(0).Find("Buy"); payHostile.GetComponentInChildren <TextMeshProUGUI>().text = "Compra hostil por $" + MathDt.ConfigureMoney(hostilePrice); Button hostileButton = payHostile.GetComponentInChildren <Button>(); hostileButton.onClick.RemoveAllListeners(); hostileButton.onClick.AddListener(() => { clicked = true; int creditValue = (int)MathDt.GetContructionPrice(tileBuyable.price, tile.level); player.walletController.TransferMoney(hostilePrice, creditValue, tile.Owner); tile.Owner.properties.Remove(tile.Owner.properties.Find(n => n.index == tile.index)); tile.BuyTile(player, $"{player.name} realizou uma aquisição hostil em: {tileBuyable.nameTile}. Sendo {creditValue} para {tile.Owner.name} e {creditValue} em impostos.", true); this.gameObject.SetActive(false); }); if (player.walletController.currentMoney <= hostilePrice) { hostileButton.interactable = false; } else { hostileButton.interactable = true; } //BOT if (player.botController) { yield return(player.botController.ExecuteAction(() => { clicked = true; player.walletController.TransferMoney(rentPrice, rentPrice, tile.Owner); player.LogMessagePlayer($"{player.name} pagou {rentPrice} para {tile.Owner.name} em: {tile.tile.nameTile}", true); }, null, () => { clicked = true; int creditValue = (int)MathDt.GetContructionPrice(tileBuyable.price, tile.level); player.walletController.TransferMoney(hostilePrice, creditValue, tile.Owner); tile.Owner.properties.Remove(tile.Owner.properties.Find(n => n.index == tile.index)); tile.BuyTile(player, $"{player.name} realizou uma aquisição hostil em: {tileBuyable.nameTile}. Sendo {creditValue} para {tile.Owner.name} e {creditValue} em impostos.", true); })); } yield return(new WaitUntil(() => clicked == true)); }
public IEnumerator SetupUpgradeTile(TileController_Country tile, PlayerController player) { var tileBuyable = tile.tile as TileBuyable_Country; int startValue = tile.level; var backgroundHeader = this.transform.Find("BackgroundHeader"); backgroundHeader.GetChild(0).GetComponent <TextMeshProUGUI>().text = tile.tile.nameTile; if (player.botController) { //BOT yield return(player.botController.ExecuteAction(() => { int level = startValue + 1; if (level < 4) { int fullPrice = (int)MathDt.GetContructionPrice(tileBuyable.price, level, tile.level); player.walletController.DebitValue(fullPrice); tile.BuyTile(player, $"{BabelDt.TileLevelName(level)} em: {tile.tile.nameTile}", false); player.firstBuy = true; tile.UpgradeLevel(level, player); } clicked = true; }, null, () => { int randLevel = Random.Range(0, 100); int level = 3; if (randLevel < 30) { level = startValue + 1; } else if (randLevel < 70) { level = startValue + 2; } if (level > 3) { level = 3; } int fullPrice = (int)MathDt.GetContructionPrice(tileBuyable.price, level, tile.level); clicked = true; player.walletController.DebitValue(fullPrice); tile.BuyTile(player, $"{BabelDt.TileLevelName(level)} em: {tile.tile.nameTile}", false); player.firstBuy = true; tile.UpgradeLevel(level, player); })); } else if (tile.level < 3) { this.gameObject.SetActive(true); clicked = false; if (tile.level < 3 && tile.Owner != null && tile.level > 0) { startValue++; } foreach (var aux in buyablePanel) { aux.SetActive(false); } for (int i = startValue; i < 4; i++) { buyablePanel[i].SetActive(true); var content = buyablePanel[i].transform.GetChild(0); int fullPrice = (int)MathDt.GetContructionPrice(tileBuyable.price, i, tile.level); Transform title = content.transform.Find("Title"); Transform icon = content.transform.Find("Icon"); Transform rentRate = content.transform.Find("Rent Rate"); Transform buy = content.transform.Find("Buy"); title.GetComponent <TextMeshProUGUI>().text = constructionName[i]; icon.GetComponent <Image>().sprite = iconHouse[i]; rentRate.GetComponent <TextMeshProUGUI>().text = "Rent rate: <b>$" + MathDt.ConfigureMoney((int)MathDt.GetRentPrice(tileBuyable.price, i)) + "</b>"; buy.GetComponentInChildren <TextMeshProUGUI>().text = "COMPRAR POR\n<size=32>$" + MathDt.ConfigureMoney(fullPrice) + "</size>"; Button buyButton = buy.GetComponentInChildren <Button>(); int level = i; buyButton.onClick.RemoveAllListeners(); buyButton.onClick.AddListener(() => { clicked = true; player.walletController.DebitValue(fullPrice); tile.BuyTile(player, $"{BabelDt.TileLevelName(level)} em: {tile.tile.nameTile}", false);//Message casa player.firstBuy = true; tile.UpgradeLevel(level, player); this.gameObject.SetActive(false); }); if (player.walletController.currentMoney <= fullPrice) { buyButton.interactable = false; } else { buyButton.interactable = true; } } } else { clicked = true; } yield return(new WaitUntil(() => clicked == true)); }