Compare commits

...

15 Commits

Author SHA1 Message Date
hyde zhou 7c75834010 bump version to 4.0.0-alpha.17 (#135) 2026-05-11 23:18:35 +08:00
hyde zhou 8fd985af75 bump version to 4.0.0-alpha.16 (#134) 2026-05-07 15:35:41 +08:00
qiuguohua cc97bc8af4 V4.0.0 fix get window info cache (#123) 2026-05-07 15:16:18 +08:00
tangkai 92124590fe update (#131) 2026-04-29 16:10:42 +08:00
tangkai 822ac6026c update assets.js (#129) 2026-04-29 13:04:48 +08:00
hyde zhou 4a6f83bd6d Revert "refactor platforms (#126)" (#128) 2026-04-28 23:12:10 +08:00
tangkai 04f063eb2b add key value to assets.js (#127) 2026-04-28 23:09:53 +08:00
hyde zhou 910865bd8b refactor platforms (#126) 2026-04-28 18:53:46 +08:00
hyde zhou e384f54ed2 bump version to 4.0.0-alpha.15 (#125) 2026-04-28 16:46:44 +08:00
hyde zhou 5964835c83 bump version to 4.0.0-alpha.14 (#122) 2026-04-22 15:36:07 +08:00
tangkai f4ae16247c overrideClips_experimental error handle (#121) 2026-04-22 15:30:17 +08:00
qiuguohua 4b4a3ca13f Fix the issue where getWindowInfo does not have a cache, which causes lag. (#120) 2026-04-22 15:29:46 +08:00
hyde zhou f1c5d21be6 bump version to 4.0.0-alpha.13 (#119) 2026-04-15 14:09:42 +08:00
bofeng-song da75e89f4a export interface for CLI (#118) 2026-04-15 10:07:46 +08:00
hyde zhou aba27a715d bump version to 4.0.0-alpha.12 (#116) 2026-04-08 16:41:15 +08:00
7 changed files with 40 additions and 17 deletions
@@ -160,7 +160,8 @@ class ClipMotionEval implements MotionEval {
public overrideClips (context: AnimationGraphBindingContext): void {
const { _originalClip: originalClip } = this;
const overriding = context.clipOverrides?.get(originalClip);
const clipOverrides: any = context.clipOverrides;
const overriding: AnimationClip | null = clipOverrides && clipOverrides.get ? clipOverrides.get(originalClip) : null;
if (overriding) {
this._setClip(overriding, context);
}
+14 -12
View File
@@ -33,16 +33,16 @@ const MAGIC = 0x4E4F4343;
const CHUNK_ALIGN_AS = 8;
export class CCON {
constructor (document: unknown, chunks: Uint8Array[]) {
constructor(document: unknown, chunks: Uint8Array[]) {
this._document = document;
this._chunks = chunks;
}
get document (): unknown {
get document(): unknown {
return this._document;
}
get chunks (): Uint8Array[] {
get chunks(): Uint8Array[] {
return this._chunks;
}
@@ -50,7 +50,7 @@ export class CCON {
private declare _chunks: Uint8Array[];
}
export function encodeCCONBinary (ccon: CCON): Uint8Array {
export function encodeCCONBinary(ccon: CCON): Uint8Array {
const { document, chunks } = ccon;
const jsonBytes = new Uint8Array(notepackEncode(document));
@@ -75,7 +75,7 @@ export function encodeCCONBinary (ccon: CCON): Uint8Array {
headerView.setUint32(8, ccobBuilder.byteLength, true);
return ccobBuilder.get();
function uint32Bytes (value: number): ArrayBufferView {
function uint32Bytes(value: number): ArrayBufferView {
const bytes = new ArrayBuffer(4);
const view = new DataView(bytes);
view.setUint32(0, value, true);
@@ -83,7 +83,7 @@ export function encodeCCONBinary (ccon: CCON): Uint8Array {
}
}
export function decodeCCONBinary (bytes: Uint8Array): CCON {
export function decodeCCONBinary(bytes: Uint8Array): CCON {
if (bytes.length < 16) {
throw new InvalidCCONError(getError(13102));
}
@@ -159,7 +159,7 @@ interface BufferConstructor {
from(buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): Buffer;
}
function decodeJson (data: Uint8Array): string {
function decodeJson(data: Uint8Array): string {
if (typeof TextDecoder !== 'undefined') {
return new TextDecoder().decode(data);
} else if ('Buffer' in globalThis) {
@@ -177,13 +177,13 @@ export class BufferBuilder {
private _viewOrPaddings: (ArrayBufferView | number)[] = [];
private _length = 0;
constructor () {}
constructor() { }
get byteLength (): number {
get byteLength(): number {
return this._length;
}
public alignAs (align: number): number {
public alignAs(align: number): number {
if (align !== 0) {
const remainder = this._length % align;
if (remainder !== 0) {
@@ -196,14 +196,14 @@ export class BufferBuilder {
return 0;
}
public append (view: ArrayBufferView): number {
public append(view: ArrayBufferView): number {
const result = this._length;
this._viewOrPaddings.push(view);
this._length += view.byteLength;
return result;
}
public get (): Uint8Array {
public get(): Uint8Array {
const result = new Uint8Array(this._length);
let counter = 0;
this._viewOrPaddings.forEach((viewOrPadding) => {
@@ -219,4 +219,6 @@ export class BufferBuilder {
}
cclegacy.internal.decodeCCONBinary = decodeCCONBinary;
cclegacy.internal.encodeCCONBinary = encodeCCONBinary;
cclegacy.internal.CCON = CCON;
cclegacy.internal.BufferBuilder = BufferBuilder;
+5
View File
@@ -38,6 +38,11 @@ module.exports = {
newCubeMap: 'CubeMap',
newRenderTexture: 'Render Texture',
newScene: 'Scene',
newScene:{
'2d': '2D Scene',
'3d': '3D Scene',
quality: 'High Quality Scene',
},
newPrefab: 'Node Prefab',
newMaterial: 'Material',
newPhysicsMaterial: 'Physics Material',
+5
View File
@@ -37,6 +37,11 @@ module.exports = {
newTypeScript: '脚本 (TypeScript)',
newCubeMap: '立方体贴图',
newScene: '场景',
newScene:{
'2d': '2D 场景',
'3d': '3D 场景',
quality: '高质量场景',
},
newPrefab: '预制 (Prefab)',
newRenderTexture: '渲染纹理 (Render Texture)',
newMaterial: '材质',
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "cocos-creator",
"version": "4.0.0-alpha.11",
"version": "4.0.0-alpha.17",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "cocos-creator",
"version": "4.0.0-alpha.11",
"version": "4.0.0-alpha.17",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "cocos-creator",
"version": "4.0.0-alpha.11",
"version": "4.0.0-alpha.17",
"description": "Cocos Creator is a cross-platform 2D & 3D game engine written in C++ and TypeScript, licensed under MIT.",
"homepage": "http://www.cocos.com",
"license": "MIT",
+11 -1
View File
@@ -24,7 +24,7 @@
*/
import { ALIPAY, BYTEDANCE, HUAWEI, OPPO, RUNTIME_BASED, SUD, SUDV2, VIVO, MIGU, HONOR, WECHAT, XIAOMI, DEBUG, TEST, TAOBAO, TAOBAO_MINIGAME, WECHAT_MINI_PROGRAM } from 'internal:constants';
import { minigame, SystemInfo as MinigameSystemInfo } from 'pal/minigame';
import { minigame, SystemInfo as MinigameSystemInfo, WindowInfo } from 'pal/minigame';
import { IFeatureMap } from 'pal/system-info';
import { EventTarget } from '../../../cocos/core/event';
import { checkPalIntegrity, withImpl } from '../../integrity-check';
@@ -100,7 +100,10 @@ if (BYTEDANCE) {
}
const originalGetSystemInfoSync = minigame.getSystemInfoSync;
// Some platforms may not have this interface(getWindowInfo).
const originalGetWindowInfo = minigame.getWindowInfo;
let _cachedSystemInfo: MinigameSystemInfo = originalGetSystemInfoSync.call(minigame);
let _cachedWindowInfo: WindowInfo | undefined = originalGetWindowInfo?.call(minigame);
function testAndUpdateSystemInfoCache (testAmount: number, testInterval: number): void {
let successfullyTestTimes = 0;
@@ -127,12 +130,19 @@ if (WECHAT && versionCompare(minigame.getAppBaseInfo().SDKVersion, '2.25.3') < 0
minigame.onWindowResize?.(() => {
// update cached system info
_cachedSystemInfo = originalGetSystemInfoSync.call(minigame);
_cachedWindowInfo = originalGetWindowInfo?.call(minigame);
});
minigame.getSystemInfoSync = function (): MinigameSystemInfo {
return _cachedSystemInfo;
};
if (originalGetWindowInfo !== undefined) {
minigame.getWindowInfo = function (): WindowInfo {
return _cachedWindowInfo!;
};
}
class SystemInfo extends EventTarget {
public declare readonly networkType: NetworkType;
public declare readonly isNative: boolean;