After setting setContentScaleFactor for cocos Director UI created by FairyGUI is disturbed.

My project is designed in such a way that i have 3 set of graphics HDR, HD and SD and depending on the screensize i set Director's setContentScaleFactor to 1, 0.5 and 0.25 respectively. Now i have integrated Fairygui into project and created a popup using HDR resources. It works fine if setContentScaleFactor is set to 1 but it doesn't work well if for other values. 9 slice images, bitmap fonts all looses their size and shape.
I have tried similar behaviour in your sample project and same outcome was there. Can you help me how can i solve this issue so i can run with setContentScaleFactor 0.5 and 0.25? Thanks
已邀请:

谷主

赞同来自:

We dont use Director's setContentScaleFactor, or say it's not supported. We have the mechanism to support resources for different resolution.  For more information please visit https://en.fairygui.com/docs/guide/editor/image.html#HD-resource-selection

shaniamjad

赞同来自:

Thank you for your response, Problem is that my project is very big and i cannot change setContentScaleFactor from my code and yet i want to use fairygui for my future UI's i create. So is there any hack OR code change you can advice so Director's setContentScaleFactor doesn't cause any impact on fairygui component? OR you can say that it just simply ignores Director's setContentScaleFactor?. Any help in this regards would be helpful for me to start using fairygui for my future UI's / projects.

谷主

赞同来自:

I see. I'll take a moment to look at this.

shaniamjad

赞同来自:

Thank you, I will be waiting for your suggestion. 

shaniamjad

赞同来自:

Any updates on this? I have also been trying this https://en.fairygui.com/docs/guide/editor/image.html#HD-resource-selection and i am not able to run it for ContentScaleFactor 2. It crashes on below line of function "PackageItem::getHighResolution()" because highResolution is of size 0.
std::string itemId = (*highResolution)[GRoot::contentScaleLevel - 1];
I have placed graphics in the editor fine please see screenshot attached. 
I am unable to find any example in samples for this. Any ideas about this what am i doing wrong here? Thanks

谷主

赞同来自:

Check it later

shaniamjad

赞同来自:

Any updates guys? I need it urgent so i can integrate it into my project. Please let me know if you guys are looking into this? Thanks

谷主

赞同来自:

Will back to you tomorrow.

谷主

赞同来自:

"It crashes on below line of function "PackageItem::getHighResolution()" because highResolution is of size 0.
std::string itemId = (*highResolution)[GRoot::contentScaleLevel - 1];"
 
This bug is fixed.

shaniamjad

赞同来自:

I will check it Thank you. Is there anyway i can use it with Less then 1 ContentScaleFactor? Basically my design resolution if of large device resolution and for medium and small resolution i set contentScaleFactor to 0.5 and 0.25 respectively which messes up with the graphics on medium and small resolution devices. So any help in this regards would be great as well.

谷主

赞同来自:

This is a feature request. I'll think about it.

shaniamjad

赞同来自:

Ok, Thank you.

要回复问题请先登录注册