SimpleMaidPlate.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. using System;
  2. using MaidStatus;
  3. using UnityEngine;
  4. public class SimpleMaidPlate : MonoBehaviour
  5. {
  6. public void Awake()
  7. {
  8. this.thumbnail_sprite_ = UTY.GetChildObject(base.gameObject, "Plate/FrameThumbnail/Thum", false).GetComponent<UI2DSprite>();
  9. this.last_name_label_ = UTY.GetChildObject(base.gameObject, "Plate/FrameBaseData/TextLastName", false).GetComponent<UILabel>();
  10. this.first_name_label_ = UTY.GetChildObject(base.gameObject, "Plate/FrameBaseData/TextFirstName", false).GetComponent<UILabel>();
  11. this.leader_plate_ = UTY.GetChildObject(base.gameObject, "Plate/FrameBaseData/LeaderPlate", false);
  12. if (UTY.GetChildObject(base.gameObject, "Plate/FrameThumbnail/Engage", true) != null)
  13. {
  14. this.engage_heart_ = UTY.GetChildObject(base.gameObject, "Plate/FrameThumbnail/Engage", false).GetComponent<UILabel>();
  15. }
  16. }
  17. public void SetMaidData(Maid maid)
  18. {
  19. if (maid == null)
  20. {
  21. return;
  22. }
  23. Status status = maid.status;
  24. this.last_name_label_.text = status.lastName;
  25. this.first_name_label_.text = status.firstName;
  26. if (maid.boMAN)
  27. {
  28. this.last_name_label_.text = string.Empty;
  29. if (maid.ActiveSlotNo == 0)
  30. {
  31. this.first_name_label_.text = "主人公";
  32. }
  33. else
  34. {
  35. this.first_name_label_.text = "男" + maid.ActiveSlotNo.ToString();
  36. }
  37. }
  38. if (this.engage_heart_ != null)
  39. {
  40. this.engage_heart_.enabled = false;
  41. }
  42. this.leader_plate_.SetActive(status.leader);
  43. Texture2D thumIcon = maid.GetThumIcon();
  44. if (thumIcon != null)
  45. {
  46. Sprite sprite2D = Sprite.Create(thumIcon, new Rect(0f, 0f, (float)thumIcon.width, (float)thumIcon.height), default(Vector2));
  47. this.thumbnail_sprite_.sprite2D = sprite2D;
  48. }
  49. else
  50. {
  51. this.thumbnail_sprite_.sprite2D = null;
  52. }
  53. }
  54. private UI2DSprite thumbnail_sprite_;
  55. private UILabel last_name_label_;
  56. private UILabel first_name_label_;
  57. private UILabel engage_heart_;
  58. private GameObject leader_plate_;
  59. }