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)
- 编辑器预览和浏览器预览不显示 HOT 1
- Metal swapchain accessed in non-ui thread
- Custom pipeline preview bug list
- [3.8.2] When the high refresh rate mode is enabled, the game FPS cannot be modified, and the FPS limit will automatically change to 65.
- Button,ProgressBar,EditBox等的子节点Label,Bar, TEXTLABEL,PLACEHOLDER_LABEL在创建时其layer没有跟随父节点
- (Cocos Creator - CI/CD) Endless build build via cmd on build agent teamcity: Stops at this log and loads endlessly - [Package] [email protected] enable HOT 1
- Forcing SafeAreaEdge to be symmetrical in ScreenAdapter
- Build machine hangs trying to download a cocos-service.zip but we don't use services
- 383 Label and Mask component lead to App crash on Xcode. HOT 1
- 希望编辑器能支持拖拽任意扩展名的文本文件 到 cc.TextAsset属性框上.
- 2D渲染时, 某些情况下会莫名其妙的断批
- [2.4.x, native] Memory leak in WebSocket binding
- Releasing the LMB outside the canvas keeps MouseInput._isPressed boolean true
- "HEADERS_RECEIVED"和"LOADING"这两个状态根本不会设置,实际请求过程中只有“OPENED”“DONE”这两个状态有用到。这里后续会完善吗? HOT 1
- 希望能考虑下出差办公的程序员, 不要"断网不可用"
- 希望能考虑下出差办公的程序员, 不要"断网不可用". HOT 6
- IDE的自动图集预览时, 希望能显示一下生成的图集的尺寸 HOT 1
- 网上平台创建动态网格报错
- 希望提供一个通过 spriteFrame 获得 cc.Texture2D 的API HOT 3
- tiled-map 的 doCleanupImageCache() 压根不会被执行.
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.