ItemInfoWnd.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using System;
  2. using UnityEngine;
  3. public class ItemInfoWnd : MonoBehaviour
  4. {
  5. private void Start()
  6. {
  7. GameObject childObject = UTY.GetChildObject(base.gameObject, "Base", false);
  8. this.m_uiBase = childObject.GetComponent<UISprite>();
  9. GameObject childObject2 = UTY.GetChildObject(childObject, "Title", false);
  10. this.m_uiTitle = childObject2.GetComponent<UILabel>();
  11. GameObject childObject3 = UTY.GetChildObject(childObject, "Info", false);
  12. this.m_uiInfo = childObject3.GetComponent<UILabel>();
  13. GameObject childObject4 = UTY.GetChildObject(childObject, "Icon", false);
  14. this.m_uiIcon = childObject4.GetComponent<UI2DSprite>();
  15. this.m_uiBase.color = new Color(1f, 1f, 1f, 0f);
  16. }
  17. public void Open(Vector3 f_vecPos, Texture2D f_texIcon, string f_strTitle, string f_strInfo, int group_num = 0)
  18. {
  19. Transform transform = this.m_uiBase.gameObject.transform;
  20. transform.position = f_vecPos;
  21. float y = transform.localPosition.y;
  22. transform.localPosition = this.m_vecOffsetPos + new Vector3(-337f, y, 0f);
  23. if (-512f > transform.localPosition.y - 90f)
  24. {
  25. Vector3 vecOffsetPos = this.m_vecOffsetPos;
  26. vecOffsetPos.y *= -1f;
  27. transform.localPosition = vecOffsetPos + new Vector3(-337f, y, 0f);
  28. }
  29. Sprite sprite2D = Sprite.Create(f_texIcon, new Rect(0f, 0f, (float)f_texIcon.width, (float)f_texIcon.height), default(Vector2));
  30. this.m_uiIcon.sprite2D = sprite2D;
  31. this.m_uiTitle.text = f_strTitle;
  32. if (0 < group_num)
  33. {
  34. this.m_uiInfo.text = string.Concat(new object[]
  35. {
  36. "全",
  37. group_num,
  38. "種\n",
  39. f_strInfo
  40. });
  41. }
  42. else
  43. {
  44. this.m_uiInfo.text = f_strInfo;
  45. }
  46. this.m_uiBase.color = new Color(1f, 1f, 1f, 1f);
  47. }
  48. public void Close()
  49. {
  50. this.m_uiIcon.sprite2D = null;
  51. this.m_uiTitle.text = string.Empty;
  52. this.m_uiInfo.text = string.Empty;
  53. this.m_uiBase.color = new Color(1f, 1f, 1f, 0f);
  54. }
  55. private void Update()
  56. {
  57. }
  58. private UISprite m_uiBase;
  59. private UILabel m_uiTitle;
  60. private UILabel m_uiInfo;
  61. private UI2DSprite m_uiIcon;
  62. public Vector3 m_vecOffsetPos;
  63. }