コード例 #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();
    }
コード例 #2
0
ファイル: UIMenuManager.cs プロジェクト: mrvcmrvc/UMVC
        private void OnUIMenuDestroyed(UIMenu uiMenu)
        {
            if (UIMenuList == null)
            {
                return;
            }

            UIMenuList.Remove(uiMenu);
        }
コード例 #3
0
ファイル: UIMenuManager.cs プロジェクト: mrvcmrvc/UMVC
        private void OnNewUIInitCompleted(UIMenu uiMenu)
        {
            if (UIMenuList == null)
            {
                UIMenuList = new List <UIMenu>();
            }

            UIMenuList.Add(uiMenu);

            OnUIMenuInitCompleted?.Invoke(uiMenu);
        }
コード例 #4
0
ファイル: UIMenuManager.cs プロジェクト: mrvcmrvc/UMVC
        public T GetUIMenu <T>()
            where T : UIMenu
        {
            T target = (T)UIMenuList.FirstOrDefault(val => val is T);

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

            return(target);
        }
コード例 #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);
    }
コード例 #6
0
 void Awake()
 {
     InitializeComponent();
     minstance = this;
 }
コード例 #7
0
 public override void OnEnable()
 {
     base.OnEnable();
     menuList = target as UIMenuList;
 }