[Phaser 3] rexUI plugins

Hi, I’m using RexPlugins.UI.Menu
how can I get the moment that the easeIn duration oncomplete

Not support now, add it to TODO.

Update:

Menu : Add ‘popup.complete’ event (Demo)

menu.on('popup.complete', function(menu) {
    // ....
}, scope)
  • menu : Root-menu, or sub-menu

@ling0502 Please download the latest rexUI minify file.

1 Like

Super high efficiency, Thanks !

Hi, I’m using RexPlugins.UI.Menu

orientation : 1 (top to bottom) , 0 ('left-to-right')

is it possible from bottom to top / right to left ?

Can you inverse the children data for this case? Or your requirement is scale-up menu from bottom to top?

scale-up menu from bottom to top

It is possible to scale-up from bottom to top for root menu, but it might be strange to scale-up fro sub-menu.

like this , or I can just use root-menu
image

In my case, the button is below the menu,when I click it
I want the menu scale-up from bottom to top

Will try to add this feature later, add to TODO

Update

Menu

  • Add easeIn.orientation , easeOut.orientation parameter

@ling0502

Here is a demo.
Change the line 92,93 to

var exapndOrientation = 'x';
var easeOrientation = 'y';

will layout menu horizontally, with pop-up vertically.

Sorry for my poor English,
maybe I didn’t explain the requirements completely,
but it’s still a cool function

I found my requirement in your document,
when inputPointer.y < bounds.centerY ,the menu will expand from bottom to top,
can I set this expandOrientation with my situation

1611278075871

Update

Menu: add ‘subMenuSide’ parameter, to overwrite default behavior of putting sub menu.

@ling0502

See this demo, uncomment line 99, the submenu will always put at right side.

If you only has one level menu, you can try buttons, grid buttons, or fixed width buttons

1 Like

Got it ! Thanks a lot

Rex, sorry if this sounds too simple or stupid - but is there someway I can rotate a label?
Something equivalent of text.setAngle(90)?

Set angle after layout()

label
    .layout()
    .setAngle(45);

Do they support topOnly function?

when I click the buttonA on BoardA , the BoardB is displayed,
then I click the buttonB on BoardB , buttonA and buttonB are triggered at the same time
I want just trigger buttonB (the top one)

ps.
BoardA & BoardB is extand RexPlugins.UI.Dialog
buttonB is above buttonA

Yes, all game objects are placed on display list of scene, and have depth properties.

Could you provide a simplest test case if this issue has not been resolved?

sorry I make a small mistake ,now the quesiton is

When I click the overlap of button A and button B
the printText show the bottom one not the top one

Did i do something wrong

I modify from here

create() {
    this.print = this.add.text(0, 0, '');
    this.print2 = this.add.text(150, 0, '');
  
    var BoardA = this.rexUI.add.dialog({
        x: 250,
        y: 300,

        background: this.rexUI.add.roundRectangle(0, 0, 100, 100, 20, 0x1565c0),


        content: this.add.text(0, 0, 'Board A ', { fontSize: '24px' }),

        actions: [
             createLabel(this, 'button A')
        ],

        space: {
            content: 30,
            action: 15,

            left: 20,
            right: 20,
            top: 30,
            bottom: 20,
        },

        align: {
            content: 'center',
            actions: 'center', // 'center'|'left'|'right'
        },

        expand: {
            actions: true, // Content is a pure text object
        }
    })       
        .layout()
    
    BoardA
        .on('button.click', function (button, groupName, index) {
            this.print.text += index + ': ' + button.text + '\n';
        }, this)
    }
}

var createLabel = function (scene, text) {
    return scene.rexUI.add.label({
        background: scene.rexUI.add.roundRectangle(0, 0, 0, 0, 20, 0x5e92f3),
        text: scene.add.text(0, 0, text, { fontSize: '24px' }),
        align: 'center',
        space: {
            left: 10,
            right: 10,
            top: 10,
            bottom: 10
        }
    })

    .setInteractive().on('pointerup', function() {
            showTipsBoard(scene)
     })
}

var showTipsBoard = function (scene) {
  var BoardB = scene.rexUI.add.dialog({
        x: 250,
        y: 290,
        background: scene.rexUI.add.roundRectangle(0, 0, 100, 100, 20, 0x78c015),
        content: scene.add.text(0, 0, 'Board B ', {
            fontSize: '24px'
        }),

        actions: [
             createLabel(scene, 'Btn B'),
        ],

        space: {
            left: 10,
            right: 10,
            top: 20,
            bottom: 5,                          
        },

        align: {
            actions: 'center',
        },

        expand: {
            actions: true,
        }
    })       
        .layout()
    
    BoardB
        .on('button.click', function (button, groupName, index) {
            this.print2.text += index + ': ' + button.text + '\n';
        }, scene)
}

Input events in rexUI might have bug with phaser3.52.0. Parent container dose not add to sorting list correctly. You might try to patch this PR manually to solve it.