BuyUtil.cs 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using UnityEngine;
  2. using System.Collections;
  3. public class BuyUtil
  4. {
  5. public enum Currency
  6. {
  7. Diamond = 0,
  8. Coin = 1,
  9. Money = 2,
  10. }
  11. private static System.Array currencyArr = System.Enum.GetValues(typeof(Currency));
  12. public static Currency GetCurrencyByCode(int code)
  13. {
  14. return (Currency)currencyArr.GetValue(code);
  15. }
  16. public enum ItemType
  17. {
  18. None = 0,
  19. VIP = 1,
  20. Coin = 2,
  21. Diam = 3,
  22. Halo = 4,
  23. Skin = 5,
  24. }
  25. public enum ItemState
  26. {
  27. Sell,
  28. Bought,
  29. Equiped,
  30. }
  31. public static void Bought(string name)
  32. {
  33. ShopData data = ShopManager.GetInstance().GetDataByCode(name);
  34. if(data.sort == ItemType.Coin.GetHashCode())
  35. {
  36. AlertPanel.Show (null, string.Format(Language.GetStr("BuyCoinPanel", "coinBought"), data.value));
  37. }
  38. else if(data.sort == ItemType.Diam.GetHashCode())
  39. {
  40. AlertPanel.Show (null, string.Format(Language.GetStr("BuyCoinPanel", "diamondBought"), data.value));
  41. }
  42. else if(data.sort == ItemType.VIP.GetHashCode())
  43. {
  44. AlertPanel.Show (null, Language.GetStr("BuyCoinPanel", "vipBought"));
  45. }
  46. }
  47. }