public void Init(UIMenuListItem _parent, UIMenuList _list) { list = _list; parent = _parent; content = new GameObject("content"); content.transform.parent = gameObject.transform; content.transform.localPosition = Vector3.zero; content.transform.localScale = Vector3.one; GameObject bg = GameObject.Instantiate(list.SlicedSpriteBg.gameObject) as GameObject; bg.transform.parent = gameObject.transform; bg.transform.localPosition = Vector3.zero; bg.transform.localScale = Vector3.one; bg.SetActive(true); spBg = bg.GetComponent <UISlicedSprite>(); mBoxCollider = bg.GetComponent <BoxCollider>(); //spBg. gameObject.SetActive(true); UpdatePosition(); }
private void OnUIMenuDestroyed(UIMenu uiMenu) { if (UIMenuList == null) { return; } UIMenuList.Remove(uiMenu); }
private void OnNewUIInitCompleted(UIMenu uiMenu) { if (UIMenuList == null) { UIMenuList = new List <UIMenu>(); } UIMenuList.Add(uiMenu); OnUIMenuInitCompleted?.Invoke(uiMenu); }
public T GetUIMenu <T>() where T : UIMenu { T target = (T)UIMenuList.FirstOrDefault(val => val is T); if (target == null) { target = FindObjectOfType <T>(); } return(target); }
private UIMenuPanel CreatePanel(UIMenuListItem _parent, UIMenuList _list) { string name = (_parent == null) ? "root" : "panel_" + _parent.Text; GameObject obj = new GameObject(name); obj.transform.parent = _list.ItemsContent.transform; obj.transform.localPosition = Vector3.zero; obj.transform.localScale = Vector3.one; UIMenuPanel panel = obj.AddComponent <UIMenuPanel>(); panel.Init(_parent, _list); panels.Add(panel); if (panel.parent == null) { rootPanel = panel; } return(panel); }
void Awake() { InitializeComponent(); minstance = this; }
public override void OnEnable() { base.OnEnable(); menuList = target as UIMenuList; }