Comments (2)
你说的是这个吗
`/**
- @en
- Decode base64-compressed uuid.
- @zh
- 解码用 base64 压缩过的 uuid。
- @param base64 @en Base-64 compressed uuid. @zh 用 base-64 压缩过的 uuid。
- @returns @en Original uuid. @zh 未压缩过的 uuid。
- @example
-
- const uuid = 'fcmR3XADNLgJ1ByKhqcC5Z';
- const originalUuid = decodeUuid(uuid); // fc991dd7-0033-4b80-9d41-c8a86a702e59
-
*/
export default function decodeUuid (base64: string): string {
const strs = base64.split(separator);
const uuid = strs[0];
if (uuid.length !== 22) {
return base64;
}
UuidTemplate[0] = base64[0];
UuidTemplate[1] = base64[1];
for (let i = 2, j = 2; i < 22; i += 2) {
const lhs = BASE64_VALUES[base64.charCodeAt(i)];
const rhs = BASE64_VALUES[base64.charCodeAt(i + 1)];
UuidTemplate[Indices[j++]] = HexChars[lhs >> 2];
UuidTemplate[Indices[j++]] = HexChars[((lhs & 3) << 2) | rhs >> 4];
UuidTemplate[Indices[j++]] = HexChars[rhs & 0xF];
}
return base64.replace(uuid, UuidTemplate.join(''));
}
if (TEST) {
legacyCC._Test.decodeUuid = decodeUuid;
}`
from cocos-engine.
你说的是这个吗 `/**
- @en
- Decode base64-compressed uuid.
- @zh
- 解码用 base64 压缩过的 uuid。
- @param base64 @en Base-64 compressed uuid. @zh 用 base-64 压缩过的 uuid。
- @returns @en Original uuid. @zh 未压缩过的 uuid。
- @example
- const uuid = 'fcmR3XADNLgJ1ByKhqcC5Z';
- const originalUuid = decodeUuid(uuid); // fc991dd7-0033-4b80-9d41-c8a86a702e59
*/ export default function decodeUuid (base64: string): string { const strs = base64.split(separator); const uuid = strs[0]; if (uuid.length !== 22) { return base64; } UuidTemplate[0] = base64[0]; UuidTemplate[1] = base64[1]; for (let i = 2, j = 2; i < 22; i += 2) { const lhs = BASE64_VALUES[base64.charCodeAt(i)]; const rhs = BASE64_VALUES[base64.charCodeAt(i + 1)]; UuidTemplate[Indices[j++]] = HexChars[lhs >> 2]; UuidTemplate[Indices[j++]] = HexChars[((lhs & 3) << 2) | rhs >> 4]; UuidTemplate[Indices[j++]] = HexChars[rhs & 0xF]; } return base64.replace(uuid, UuidTemplate.join('')); }
if (TEST) { legacyCC._Test.decodeUuid = decodeUuid; }`
是这个, 但是这个是 decode , 我还想要 encode .
其实 uuid的压缩 解压 算法和 cocos 2.x 的是一样的. 我如果要用 可以自己从 cocos 2.x 里copy出来.
但是我还是希望引擎直接提供 . 因为万一哪天 3.x 改了算法呢. 还是引擎提供保险些.
(可以不开放出来, 但是最好能让开发者找到源码, 知道具体怎么处理的)
from cocos-engine.
Related Issues (20)
- 3.8.3 Pass.overridePipelineStates() mobile crash
- Tiled文件对象层属性读取错误 HOT 2
- compile script only function support in 3.x(3.x支持只构建脚本)
- Show loading progress for multiple resources
- [spine相关] 动画倒放时, "在指定区间内播放"的功能失效
- [EDITOR相关] 2D模式下 难以定位到 缩放 移动 调整大小 等工具的控制点. HOT 3
- typescript non-empty assertion operator is invalid HOT 4
- GameActivity onPauseNative ANR
- [spine相关] 通过 setCompleteListener 添加的事件, 有时候不会被触发
- tsconfig useDefineForClassFields does not work HOT 1
- when windows update to windows11, the creator can not open project HOT 1
- Box selection doesn't work in 2d scene
- s HOT 2
- when a picture be set to sprite-frame, then use texture and sprite-frame resources will occur errors
- Splash Setting occur 403 forbidden, while update it from others
- Setting import-map.json to Import Map,after clear the path of it, it still occur error in the packing HOT 2
- [EDITOR相关] 试图选择 复杂属性中的text框内的文本时, 变成拖拽这个属性了
- collide Events needs rigidbody in Cocos 3.8x but dont need in Cocos 3.7.4
- AssetsManagerEx.cpp AssetsManagerEx::prepareUpdate, cost a lot of times HOT 1
- 【Android】在Cocos所在的Activity的被其他的Activity覆盖或者不可见的时候出现JNI ERROR
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cocos-engine.