HeroDetailPanel.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. using Core.Language;
  2. using Excel2Json;
  3. using Fort23.UTool;
  4. using GameLogic.Hero;
  5. using UnityEngine.UI;
  6. namespace Fort23.Mono
  7. {
  8. [UIBinding(prefab = "HeroDetailPanel" )]
  9. public partial class HeroDetailPanel : UIPanel
  10. {
  11. private void Init()
  12. {
  13. // InitHeroDetailPanel();
  14. }
  15. protected override void AddEvent()
  16. {
  17. }
  18. protected override void DelEvent()
  19. {
  20. }
  21. public override void AddButtonEvent()
  22. {
  23. btnBack.onClick.AddListener(OnClickClose);
  24. }
  25. private void OnClickClose()
  26. {
  27. UIManager.Instance.HideUIUIPanel(this);
  28. }
  29. public void InitHeroDetailPanel(HeroInfo heroInfo)
  30. {
  31. iconZhiYe.icon_name = heroInfo.iconZhiYe;
  32. heroName.text = LanguageManager.Instance.Text(heroInfo.modelConfig.name);
  33. HeroUITools.SetStarShow(stars, heroInfo.star.Value);
  34. switch (heroInfo.modelConfig.rarity)
  35. {
  36. case 1:
  37. heroRarity.text = LanguageManager.Instance.Text(32);
  38. break;
  39. case 2:
  40. heroRarity.text = LanguageManager.Instance.Text(31);
  41. break;
  42. case 3:
  43. heroRarity.text = LanguageManager.Instance.Text(30);
  44. break;
  45. default:
  46. LogTool.Error("找不到hero的稀有度:" + heroInfo.modelConfig.ID);
  47. break;
  48. }
  49. txtHP.text = heroInfo.hp.Value.ToString();
  50. txtATK.text = heroInfo.attack.Value.ToString();
  51. txtDEF.text = heroInfo.defense.Value.ToString();
  52. txtSHANBI.text = heroInfo.shanbi.Value.ToString();
  53. txtLv.text = heroInfo.level.Value.ToString();
  54. txtExpGain.text = heroInfo.expGain.Value.ToString();
  55. }
  56. }
  57. }