SimpleMaidPlate.cs 2.5 KB

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