private void AddSkinOption(UM_iProduct product, int offset) { var newSkin = Instantiate(m_SkinButtonTemplate.gameObject, Vector3.one, Quaternion.identity, m_SkinButtonTemplate.transform.parent); newSkin.transform.localScale = Vector3.one; newSkin.transform.localPosition = new Vector3(10, -offset, 0); newSkin.SetActive(true); var isLocked = Main.GameData.IsSkinLocked(product.Id); var newSkinButton = newSkin.GetComponent <SkinButton>(); newSkinButton.SetUp(product.Icon, product.Title, isLocked); newSkinButton.onClick.AddListener(() => { if (isLocked) { Main.PaymentService.AddPayment(product.Id); } else { Main.Game.ActiveModel.SetSkin(product.Id); } }); m_SkinButtons.Add(newSkinButton); }
private void StartPayment(UM_ProductType productType) { UM_iProduct validProduct = null; foreach (var product in UM_InAppService.Client.Products) { if (product.Type == productType && product.IsActive) { validProduct = product; break; } } if (validProduct != null) { UM_InAppService.Client.AddPayment(validProduct.Id); } else { var message = string.Format("You don't have any {0} products set.", productType); UM_DialogsUtility.ShowMessage("Not Found", message); } }