RarityIconController.cs 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. rarity = itemCfg.rarity;
  27. }
  28. if(rarity > 0)
  29. {
  30. rarityUI.url = "ui://CommonGame/" + prefix + rarity;
  31. rarityUI.visible = true;
  32. }
  33. else
  34. {
  35. rarityUI.visible = false;
  36. }
  37. }
  38. }
  39. }