ItemInfoWnd.cs 2.2 KB

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