RarityIconController.cs 1.2 KB

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