using System; using UnityEngine; namespace SceneNPCEdit { public class NPCEditPlate : MonoBehaviour { public string lastName { get { return this.labelLastName.text; } set { this.labelLastName.text = value; } } public string firstName { get { return this.labelFirstName.text; } set { this.labelFirstName.text = value; } } public Texture2D thumbnail { get { return this.GetThumTex(); } set { this.SetThumTex(value); } } public Sprite thumbnailSprite { get { return this.thumSprite.sprite2D; } } private void Awake() { UnityEngine.Object.Destroy(UTY.GetChildObject(base.gameObject, "Button", false).GetComponent()); UIWFTabButton component = UTY.GetChildObject(base.gameObject, "Button", false).GetComponent(); if (component != null) { component.enabled = true; EventDelegate.Add(component.onSelect, new EventDelegate.Callback(this.OnSelectPlate)); } UTY.GetChildObject(base.gameObject, "LeftPlate/FrameBaseData/FixText2", false).SetActive(false); UTY.GetChildObject(base.gameObject, "LeftPlate/FrameBaseData/TextTypeName", false).SetActive(false); this.labelLastName = UTY.GetChildObject(base.gameObject, "LeftPlate/FrameBaseData/TextLastName", false).GetComponent(); this.labelFirstName = UTY.GetChildObject(base.gameObject, "LeftPlate/FrameBaseData/TextFirstName", false).GetComponent(); this.thumSprite = UTY.GetChildObject(base.gameObject, "LeftPlate/FrameThumbnail/Thum", false).GetComponent(); } private void SetThumTex(Texture2D tex) { if (tex != null) { if (this.thumSprite.sprite2D == null || this.thumSprite.sprite2D.texture != tex) { Sprite sprite2D = Sprite.Create(tex, new Rect(0f, 0f, (float)tex.width, (float)tex.height), default(Vector2)); this.thumSprite.sprite2D = sprite2D; this.thumSprite.SetDimensions(61, 88); } } else { this.thumSprite.sprite2D = null; } } private Texture2D GetThumTex() { return (!(this.thumSprite.sprite2D != null)) ? null : this.thumSprite.sprite2D.texture; } private void OnSelectPlate() { if (!UIWFSelectButton.current.isSelected) { return; } if (this.onSelectEvent != null) { this.onSelectEvent(this); } } public Action onSelectEvent; private UILabel labelLastName; private UILabel labelFirstName; private UI2DSprite thumSprite; } }