Esempio n. 1
0
    private void PlayPopup()
    {
        if (_pm == null)
        {
            _pm = new PopupMenu();
            _pm.AddItem("Item 1", __clickMenu);
            _pm.AddItem("Item 2", __clickMenu);
            _pm.AddItem("Item 3", __clickMenu);
            _pm.AddItem("Item 4", __clickMenu);
        }

        if (_popupCom == null)
        {
            _popupCom = UIPackage.CreateObject("Basics", "Component12").asCom;
            _popupCom.Center();
        }
        GComponent obj = _demoObjects["Popup"];
        obj.GetChild("n0").onClick.Add((EventContext context) =>
        {
            _pm.Show((GObject)context.sender, true);
        });

        obj.GetChild("n1").onClick.Add(() =>
        {
            GRoot.inst.ShowPopup(_popupCom);
        });

        obj.onRightClick.Add(() =>
        {
            _pm.Show();
        });
    }