RarityIconController.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using FairyGUI;
  2. namespace GFGGame
  3. {
  4. public class RarityIconController
  5. {
  6. public static void UpdateRarityIcon(GLoader rarityUI, int id, bool isSmall, bool isSuit = false)
  7. {
  8. string prefix = null;
  9. if(isSmall)
  10. {
  11. prefix = "zx_bq_shuxing_";
  12. }
  13. else
  14. {
  15. prefix = "hz_bq_shuxing_";
  16. }
  17. int rarity = 0;
  18. if (isSuit)
  19. {
  20. SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(id);
  21. rarity = suitCfg.rarity;
  22. }
  23. else
  24. {
  25. ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(id);
  26. if(itemCfg.itemType == ConstItemType.DRESS_UP || itemCfg.itemType == ConstItemType.CARD)
  27. rarity = itemCfg.rarity;
  28. }
  29. if(rarity > 0)
  30. {
  31. rarityUI.url = "ui://CommonGame/" + prefix + rarity;
  32. rarityUI.visible = true;
  33. }
  34. else
  35. {
  36. rarityUI.visible = false;
  37. }
  38. }
  39. }
  40. }