uGUIMaidPlate.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. using System;
  2. using MaidStatus;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. public class uGUIMaidPlate : MonoBehaviour
  6. {
  7. public Maid maid
  8. {
  9. get
  10. {
  11. return this.m_maid;
  12. }
  13. }
  14. private void Awake()
  15. {
  16. this.m_status.main = UTY.GetChildObject(base.gameObject, "Plate", false);
  17. this.m_status.leaderPlate = UTY.GetChildObject(base.gameObject, "Status/Leader", false).GetComponent<Image>();
  18. this.m_status.icon = UTY.GetChildObject(base.gameObject, "Figure/Icon", false).GetComponent<Image>();
  19. this.m_status.firstName = UTY.GetChildObject(base.gameObject, "Status/Name/FirstName", false).GetComponent<Text>();
  20. this.m_status.lastName = UTY.GetChildObject(base.gameObject, "Status/Name/LastName", false).GetComponent<Text>();
  21. this.m_status.contractType = UTY.GetChildObject(base.gameObject, "Status/ContractType/Value", false).GetComponent<Text>();
  22. this.SetMaidData(GameMain.Instance.CharacterMgr.GetMaid(0));
  23. }
  24. public void SetMaidData(Maid maid)
  25. {
  26. this.m_maid = maid;
  27. if (this.m_maid == null)
  28. {
  29. return;
  30. }
  31. MaidStatus.Status status = this.m_maid.status;
  32. this.m_status.leaderPlate.gameObject.SetActive(status.leader);
  33. NamePair charaName = status.charaName;
  34. this.m_status.lastName.text = charaName.name1;
  35. this.m_status.firstName.text = charaName.name2;
  36. if (status.heroineType != HeroineType.Sub)
  37. {
  38. this.m_status.contractType.text = EnumConvert.GetString(status.contract);
  39. }
  40. else
  41. {
  42. this.m_status.contractType.text = status.subCharaStatus.contractText;
  43. }
  44. Texture2D thumIcon = this.m_maid.GetThumIcon();
  45. if (thumIcon != null)
  46. {
  47. Sprite sprite = Sprite.Create(thumIcon, new Rect(0f, 0f, (float)thumIcon.width, (float)thumIcon.height), default(Vector2));
  48. this.m_status.icon.sprite = sprite;
  49. }
  50. else
  51. {
  52. this.m_status.icon.sprite = null;
  53. }
  54. }
  55. private Maid m_maid;
  56. private uGUIMaidPlate.Status m_status;
  57. private struct Status
  58. {
  59. public GameObject main;
  60. public Text firstName;
  61. public Text lastName;
  62. public Text contractType;
  63. public Image leaderPlate;
  64. public Image icon;
  65. }
  66. }