/// <summary> /// Gets called when the trade button is touched /// First there is a check to see if the player can move /// Then the points will be deducted if it is not the first trade /// </summary> private void TradeLetterBtnTouch() { int timesTraded; if (GameInstance.instance.IsMultiplayer) { if (PhotonNetwork.LocalPlayer.CustomProperties["TimesTraded"] != null) { timesTraded = (int)PhotonNetwork.LocalPlayer.CustomProperties["TimesTraded"]; } else { timesTraded = 0; } } else { timesTraded = Player.TimesTraded; } switch (timesTraded) { case 0: TradeLetters(timesTraded); TradeBtn.GetComponentInChildren <Text>().text = I2.Loc.LocalizationManager.GetTranslation("10_points"); break; case 1: if (Player.EarnedPoints < 10) { Player.InfoText = I2.Loc.LocalizationManager.GetTranslation("trade_10_points"); } else { TradeLetters(timesTraded); TradeBtn.GetComponentInChildren <Text>().text = I2.Loc.LocalizationManager.GetTranslation("20_points"); Player.EarnedPoints -= 10; } break; case 2: if (Player.EarnedPoints < 20) { Player.InfoText = I2.Loc.LocalizationManager.GetTranslation("trade_20_points"); } else { var subtractColor = new Color(0, 0, 0, 0.5f); TradeLetters(timesTraded); Button trade = TradeBtn.GetComponent <Button>(); trade.image.color -= subtractColor; TradeBtn.GetComponentInChildren <Text>().color -= subtractColor; TradeBtn.GetComponentInChildren <Image>().color -= subtractColor; Player.EarnedPoints -= 20; } break; default: Player.InfoText = I2.Loc.LocalizationManager.GetTranslation("trade_used_all"); break; } }