private void button1_Click(object sender, EventArgs e) { if (UserProfile.InfoBag.PayDiamond(itemprice * count)) { UserProfile.InfoBag.AddItem(itemid, count); Close(); ParentPanel.SetBlacken(false); } else { MainTipManager.AddTip(HSErrors.GetDescript(ErrorConfig.Indexer.BagNotEnoughDimond), "Red"); } }
private void pictureBoxBuy_Click(object sender, EventArgs e) { if (UserProfile.InfoBag.GetBlankCount() <= 0) { parent.AddFlowCenter(HSErrors.GetDescript(ErrorConfig.Indexer.BagIsFull), "Red"); return; } var gameShopConfig = ConfigData.GetGameShopConfig(productId); var eid = HItemBook.GetItemId(gameShopConfig.Item); var itmConfig = ConfigData.GetHItemConfig(eid); var goldPrice = GameResourceBook.OutGoldSellItem(itmConfig.Rare, itmConfig.ValueFactor) * 2; bool buyFin = false; if (gameShopConfig.UseDiamond) { var diamondPrice = (int)Math.Max(1, goldPrice / GameConstants.DiamondToGold); if (UserProfile.InfoBag.PayDiamond(diamondPrice)) { UserProfile.InfoBag.AddItem(eid, 1); buyFin = true; } else { parent.AddFlowCenter(HSErrors.GetDescript(ErrorConfig.Indexer.BagNotEnoughDimond), "Red"); } } else { if (UserProfile.InfoBag.HasResource(GameResourceType.Gold, goldPrice)) { UserProfile.InfoBag.SubResource(GameResourceType.Gold, goldPrice); UserProfile.InfoBag.AddItem(eid, 1); buyFin = true; } else { parent.AddFlowCenter(HSErrors.GetDescript(ErrorConfig.Indexer.BagNotEnoughResource), "Red"); } } if (buyFin) { parent.AddFlowCenter("+1", "Lime", HItemBook.GetHItemImage(eid)); } //PopBuyProduct.Show(eid, (int)Math.Max(1, itemPrice / GameConstants.DiamondToGold)); }