Пример #1
0
    void OnButtonClick()
    {
        RectTransform rt = btn.GetComponent <RectTransform>();

        Debug.Log("Clicked");

        PxPre.DropMenu.StackUtil menuStack = new PxPre.DropMenu.StackUtil("Test");
        menuStack.AddAction("yo", () => { });
        menuStack.AddAction("muaha", () => { });
        menuStack.AddSeparator();
        menuStack.PushMenu("Testerosa");
        menuStack.AddAction("One thing", null);
        menuStack.AddAction("nother thing", null);
        menuStack.PopMenu();

        PxPre.DropMenu.Singleton.MenuInst.CreateDropdownMenu(
            this.canvas,
            menuStack.Root,
            rt);
    }
Пример #2
0
    public override void Init(Main m, SceneActor actor, EditValue ev)
    {
        base.Init(m, actor, ev);

        this.OnUpdateValue();

        ValEnum ve = ev.val as ValEnum;

        this.button.onClick.AddListener(
            () =>
        {
            PxPre.DropMenu.StackUtil stk =
                new PxPre.DropMenu.StackUtil("");

            foreach (string sel in ve.selections.GetNames())
            {
                string selCpy = sel;
                stk.AddAction(
                    selCpy,
                    () =>
                {
                    int?n = ve.selections.GetInt(selCpy);
                    if (n.HasValue == true)
                    {
                        ve.i = n.Value;
                        this.OnUpdateValue();
                        this.Mgr.NotifyActorModified(actor, this.EV.name);
                    }
                });
            }

            PxPre.DropMenu.DropMenuSingleton.MenuInst.CreateDropdownMenu(
                CanvasSingleton.Instance,
                stk.Root,
                button.GetComponent <RectTransform>());
        });
    }