Esempio n. 1
0
    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();
    }
Esempio n. 2
0
        private void OnUIMenuDestroyed(UIMenu uiMenu)
        {
            if (UIMenuList == null)
            {
                return;
            }

            UIMenuList.Remove(uiMenu);
        }
Esempio n. 3
0
        private void OnNewUIInitCompleted(UIMenu uiMenu)
        {
            if (UIMenuList == null)
            {
                UIMenuList = new List <UIMenu>();
            }

            UIMenuList.Add(uiMenu);

            OnUIMenuInitCompleted?.Invoke(uiMenu);
        }
Esempio n. 4
0
        public T GetUIMenu <T>()
            where T : UIMenu
        {
            T target = (T)UIMenuList.FirstOrDefault(val => val is T);

            if (target == null)
            {
                target = FindObjectOfType <T>();
            }

            return(target);
        }
Esempio n. 5
0
    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);
    }
Esempio n. 6
0
 void Awake()
 {
     InitializeComponent();
     minstance = this;
 }
Esempio n. 7
0
 public override void OnEnable()
 {
     base.OnEnable();
     menuList = target as UIMenuList;
 }