Ship the WeChat hot-update catalogs and the camp, TideWhale T2, UI atlas, and animation-lab work.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
mergeInto(LibraryManager.library, {
|
||||
AIGame_GetUiSafeInsets: function (pointer) {
|
||||
try {
|
||||
var api = typeof wx !== 'undefined' ? wx :
|
||||
(typeof GameGlobal !== 'undefined' ? GameGlobal.wx : null);
|
||||
if (!api) return 0;
|
||||
var info = null;
|
||||
try { if (api.getWindowInfo) info = api.getWindowInfo(); } catch (ignored) {}
|
||||
if (!info && api.getSystemInfoSync) info = api.getSystemInfoSync();
|
||||
if (!info) return 0;
|
||||
var width = info.windowWidth || info.screenWidth;
|
||||
var height = info.windowHeight || info.screenHeight;
|
||||
if (!(width > 0 && height > 0)) return 0;
|
||||
var safe = info.safeArea;
|
||||
var left = 0, bottom = 0, right = 0, top = 0;
|
||||
if (safe && safe.width > 0 && safe.height > 0) {
|
||||
left = safe.left / width;
|
||||
right = 1 - safe.right / width;
|
||||
bottom = 1 - safe.bottom / height;
|
||||
top = safe.top / height;
|
||||
}
|
||||
// Both APIs use logical pixels with a top-left origin, independent of Unity DPR.
|
||||
var menu = null;
|
||||
try { if (api.getMenuButtonBoundingClientRect) menu = api.getMenuButtonBoundingClientRect(); }
|
||||
catch (ignored) {}
|
||||
if (menu && menu.width > 0 && menu.height > 0 && menu.bottom > 0 && menu.top < height / 2) {
|
||||
top = Math.max(top, (menu.bottom + 8) / height);
|
||||
} else {
|
||||
// Older clients may omit the menu API; reserve one capsule row below the notch.
|
||||
top = Math.max(top, ((safe && safe.top > 0 ? safe.top : info.statusBarHeight || 0) + 40) / height);
|
||||
}
|
||||
var values = [left, bottom, right, top];
|
||||
for (var i = 0; i < 4; i++) HEAPF32[(pointer >> 2) + i] =
|
||||
isFinite(values[i]) ? Math.max(0, Math.min(.35, values[i])) : 0;
|
||||
return 1;
|
||||
} catch (ignored) { return 0; }
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user