rexrainbow / phaser3-rex-notes

Notes of phaser3 engine
MIT License
1.18k stars 259 forks source link

rex-ui #425

Open cy920820 opened 3 months ago

cy920820 commented 3 months ago

Does the component support automatic adaptation to mobile landscape?

rexrainbow commented 3 months ago

No, rexui does not response mobile landscape automatically.

cy920820 commented 3 months ago

No, rexui does not response mobile landscape automatically.

Is there any way to do that?

cy920820 commented 3 months ago

I'm just getting started with this framework, sorry

rexrainbow commented 3 months ago

Might listen 'orientationchange' event, or 'resize' event, under this event, change size of sizer (setMinSize()) and run sizer.layout() again.

cy920820 commented 2 months ago

I have another question, I hope the big shot will not hesitate to teach me

https://codepen.io/rexrainbow/pen/JzBZzy

In this demo, how to place some emoji images and other resources inside the container, similar to how DOM elements contain some sub elements, how to more easily locate them, such as placing these images in the upper right corner of the container @rexrainbow

cy920820 commented 2 months ago

https://codepen.io/rexrainbow/pen/GRYLrje

And I hope to add the text animation from this demo to the textarea component, but I have tried many times but cannot implement it

cy920820 commented 2 months ago

I have completed the animation

rexrainbow commented 2 months ago

https://codepen.io/rexrainbow/pen/GRYLrje

And I hope to add the text animation from this demo to the textarea component, but I have tried many times but cannot implement it

Because that textare element is not designed for playing typing animation.

rexrainbow commented 2 months ago

Here is another text game object class, for typing and scrolling content both. I can add a test code for that purpose when I have time.

cy920820 commented 2 months ago

Here is another text game object class, for typing and scrolling content both. I can add a test code for that purpose when I have time.

Thank you, thank you for your time. I achieved the animation yesterday as well

That is to say, this plugin can help achieve both animation and automatic scrolling?

cy920820 commented 2 months ago

I have another question, I hope the big shot will not hesitate to teach me

https://codepen.io/rexrainbow/pen/JzBZzy

In this demo, how to place some emoji images and other resources inside the container, similar to how DOM elements contain some sub elements, how to more easily locate them, such as placing these images in the upper right corner of the container @rexrainbow

But is there any good solution to this problem? I want a texture to be located based on a container or region, rather than simply assigning coordinates x and y

rexrainbow commented 2 months ago

I have another question, I hope the big shot will not hesitate to teach me https://codepen.io/rexrainbow/pen/JzBZzy In this demo, how to place some emoji images and other resources inside the container, similar to how DOM elements contain some sub elements, how to more easily locate them, such as placing these images in the upper right corner of the container @rexrainbow

But is there any good solution to this problem? I want a texture to be located based on a container or region, rather than simply assigning coordinates x and y

emoji images as part of text game object (i.e. embed inside content, scrolling with text together), or image located at related position of textArea game object (i,e, position of image won't change when scrolling contenrt)?

cy920820 commented 2 months ago

I have another question, I hope the big shot will not hesitate to teach me https://codepen.io/rexrainbow/pen/JzBZzy In this demo, how to place some emoji images and other resources inside the container, similar to how DOM elements contain some sub elements, how to more easily locate them, such as placing these images in the upper right corner of the container @rexrainbow

But is there any good solution to this problem? I want a texture to be located based on a container or region, rather than simply assigning coordinates x and y

emoji images as part of text game object (i.e. embed inside content, scrolling with text together), or image located at related position of textArea game object (i,e, position of image won't change when scrolling contenrt)?

Yes, it's the same as relative positioning in CSS

cy920820 commented 2 months ago

Here is another text game object class, for typing and scrolling content both. I can add a test code for that purpose when I have time.

Thank you, thank you for your time. I achieved the animation yesterday as well

That is to say, this plugin can help achieve both animation and automatic scrolling?

I just achieved real-time scrolling through this method textArea.scrollToBottom();

rexrainbow commented 2 months ago

TextArea, and all other kind of sizer game object, has pin(gameObject) method.

cy920820 commented 2 months ago

TextArea, and all other kind of sizer game object, has pin(gameObject) method.

const icon = scene.add.image(0, 0, 'emotion_0').setDisplaySize(50, 50)
this.textArea.setVisible(false)
this.textArea.pin(icon)

I tried to do this, but found that the icon is still located based on the origin of the entire viewport,But my goal is to make it locate based on textarea

rexrainbow commented 2 months ago

TextArea, and all other kind of sizer game object, has pin(gameObject) method.

const icon = scene.add.image(0, 0, 'emotion_0').setDisplaySize(50, 50)
this.textArea.setVisible(false)
this.textArea.pin(icon)

I tried to do this, but found that the icon is still located based on the origin of the entire viewport,But my goal is to make it locate based on textarea

Pin method won't change current position of game object, it is not the same as built-in container. Please put icon at the right position then pin to textArea.

For example, textArea is at (400,300), and icon is at (300, 300), after pining icon to textArea, position of icon will still at (300, 300).

rexrainbow commented 2 months ago

Or you can use pinLocal(gameObject) if you only has related position

cy920820 commented 2 months ago

Or you can use pinLocal(gameObject) if you only has related position

Because I couldn't find the documentation for this API, I'm sorry

but I still used the container and tied them together

cy920820 commented 2 months ago

Actually, I have always had a question, for example, when a game switches from landscape to portrait, if the UI is two sets, how can the layout of the process be switched to allow users to continue playing the game

rexrainbow commented 2 months ago

Actually, I have always had a question, for example, when a game switches from landscape to portrait, if the UI is two sets, how can the layout of the process be switched to allow users to continue playing the game

There has no easy way to implement two sets of UI ( two kind of layout style ), perhaps hiding some elements for another layout style.

rexrainbow commented 2 months ago

Or you can use pinLocal(gameObject) if you only has related position

Because I couldn't find the documentation for this API, I'm sorry

but I still used the container and tied them together

Do you mean built-in container of phaser3 engine ?

cy920820 commented 2 months ago

Actually, I have always had a question, for example, when a game switches from landscape to portrait, if the UI is two sets, how can the layout of the process be switched to allow users to continue playing the game

There has no easy way to implement two sets of UI ( two kind of layout style ), perhaps hiding some elements for another layout style.

Is there a direct listening event in the framework to trigger layout refresh?

cy920820 commented 2 months ago

Or you can use pinLocal(gameObject) if you only has related position

Because I couldn't find the documentation for this API, I'm sorry but I still used the container and tied them together

Do you mean built-in container of phaser3 engine ?

Yes, it's using a built-in container

rexrainbow commented 2 months ago

Actually, I have always had a question, for example, when a game switches from landscape to portrait, if the UI is two sets, how can the layout of the process be switched to allow users to continue playing the game

There has no easy way to implement two sets of UI ( two kind of layout style ), perhaps hiding some elements for another layout style.

Is there a direct listening event in the framework to trigger layout refresh?

Phaser3 engine provides orientation event.