update
This commit is contained in:
11
apps/client/assets/Scripts/Utils/index.ts
Normal file
11
apps/client/assets/Scripts/Utils/index.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { SpriteFrame } from "cc"
|
||||
|
||||
const INDEX_REG = /\((\d+)\)/
|
||||
|
||||
const getNumberWithinString = (str: string) => parseInt(str.match(INDEX_REG)?.[1] || '0')
|
||||
|
||||
export const sortSpriteFrame = (spriteFrame: Array<SpriteFrame>) =>
|
||||
spriteFrame.sort((a, b) => getNumberWithinString(a.name) - getNumberWithinString(b.name))
|
||||
|
||||
export const rad2Angle = (rad: number) => rad / Math.PI * 180
|
||||
|
9
apps/client/assets/Scripts/Utils/index.ts.meta
Normal file
9
apps/client/assets/Scripts/Utils/index.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "2e280f2e-52a3-465a-acf5-fb412ef51d6b",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
Reference in New Issue
Block a user