using System; using UnityEngine; public class SubSlotEditItem : MonoBehaviour { public bool frameVisible { get { return this.frameObject.activeSelf; } set { this.frameObject.SetActive(value); } } public SceneEdit.SMenuItem menuItem { get; private set; } public Maid maid { get { return (!(this.sceneEdit != null)) ? null : this.sceneEdit.maid; } } private void Awake() { this.button = base.GetComponentInChildren(true); EventDelegate.Add(this.button.onClick, new EventDelegate.Callback(this.OnClickEvent)); this.frameObject = UTY.GetChildObject(base.gameObject, "Frame", false); this.frameVisible = false; } public bool SetItem(string menuFileName) { if (this.maid.GetSubProp(this.targetMpn, this.sloatNo) != null) { return false; } this.maid.SetSubProp(this.targetMpn, this.sloatNo, menuFileName, 0); return true; } public bool SetItem(SceneEdit.SMenuItem menu) { return this.SetItem(menu.m_strMenuFileName); } public bool UpdateSloatInformation() { NDebug.Assert(this.targetMpn != MPN.null_mpn, "MPNの設定がnullです"); SubProp subProp = this.sceneEdit.maid.GetSubProp(this.targetMpn, this.sloatNo); if (subProp == null || !this.sceneEdit.m_menuRidDic.ContainsKey(subProp.nFileNameRID)) { MaidProp prop = this.sceneEdit.maid.GetProp(this.targetMpn); if (prop != null && this.sceneEdit.m_menuRidDic.ContainsKey(prop.nFileNameRID)) { this.menuItem = this.sceneEdit.m_menuRidDic[prop.nFileNameRID]; if (this.menuItem.m_texIconRef != null) { this.button.normalSprite2D = Sprite.Create(this.menuItem.m_texIconRef, new Rect(0f, 0f, (float)this.menuItem.m_texIconRef.width, (float)this.menuItem.m_texIconRef.height), Vector2.zero); } } this.menuItem = null; this.button.isEnabled = false; return false; } this.menuItem = this.sceneEdit.m_menuRidDic[subProp.nFileNameRID]; if (this.menuItem.m_texIconRef != null) { this.button.normalSprite2D = Sprite.Create(this.menuItem.m_texIconRef, new Rect(0f, 0f, (float)this.menuItem.m_texIconRef.width, (float)this.menuItem.m_texIconRef.height), Vector2.zero); } this.button.isEnabled = true; return true; } private void OnClickEvent() { if (this.onClickEvent != null) { this.onClickEvent(this); } } public SceneEdit sceneEdit; public MPN targetMpn; public int sloatNo; public Action onClickEvent; private UIButton button; private GameObject frameObject; }