Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed taobao-minigame use bitmapfont sometimes error #17023

Merged
merged 6 commits into from
Jun 12, 2024
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cocos2d/core/renderer/assembler-2d.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ export default class Assembler2D extends Assembler {
indiceOffset = offsetInfo.indiceOffset,
vertexId = offsetInfo.vertexOffset;
for (let i = 0, l = iData.length; i < l; i++) {
//Because taobao-minigame does not allow out-of-bounds access to Uint16Array, otherwise it will report an error and cause the game to be unresponsive
if (cc.sys.platform === cc.sys.TAOBAO_MINIGAME && indiceOffset >= ibuf.length) break;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • why do it in for loop, can determine how much data to copy before for loop
  • this PR means that on tabao platform, some data will not be copied into ibuf, can it work correctly on tabao platform?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, after project testing, this PR will not cause any abnormalities in the game, and it has solved the problem of the game not responding. I will try to handle this issue in a more performant way.

ibuf[indiceOffset++] = vertexId + iData[i];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may exceed iData too. So i think should use the min value of them, for example

const indicesToFill = min(this.indicesCount, iData.length);

}
}
Expand Down