cocos-enhance-kit/creator-sp.d.ts

989 lines
22 KiB
TypeScript
Raw Permalink Normal View History

2022-06-24 17:04:46 +00:00
declare module cc {
/**
2022-07-11 04:18:01 +00:00
* Cocos Creator Enhance Kit
2022-06-24 17:04:46 +00:00
*/
module sp {
/**
*
*/
const inited: boolean,
/**
*
*/
const version: string,
/**
*
*
* 8
*/
const MAX_MULTITEXTURE_NUM: number;
/**
*
*/
let autoSwitchMaterial: boolean;
/**
*
*/
let allowDynamicAtlas: boolean;
/**
* Label DPI
*/
let enableLabelRetina: boolean;
/**
* Label
*/
let labelRetinaScale: number;
/**
* Char
*/
let charAtlasAutoBatchCount: number;
/**
* Char
*/
let charAtlasAutoResetBeforeSceneLoad: boolean;
/**
* Effect Asset
*/
const multi2dSpriteEffectAsset: cc.EffectAsset;
/**
* property index to name
*/
function propertyIndex2Name(index: number): string;
/**
* property name to index
*/
function propertyName2Index(name: string): number;
/**
* Material
*/
class MultiHandler {
/**
*
*/
material: cc.Material;
/**
* Texture
*
* cc.Texture2D
*/
protected textures: any[];
/**
*
*/
protected hasEmptySlot: boolean;
constructor(material?: cc.Material);
/**
* Material
*
* Material textures
*/
syncTextures(): void;
/**
* cc.Texture2D
*/
setTexture(index: number, texture: cc.Texture2D): void;
/**
*
*
* cc.Texture2D
*/
removeTexture(texture: any): void;
/**
*
*
* cc.Texture2D
*/
hasTexture(texture: any): boolean;
/**
* Index -1
*
* cc.Texture2D
*/
getIndex(texture: any): number;
/**
* index
*
* cc.Texture2D
*/
getTexture(index: number): any;
/**
* Index -1
*/
getEmptyIndex(): number;
/**
* -1 cc.Texture2D
*/
autoSetTexture(texture: cc.Texture2D): number;
}
/**
*
*/
class MultiBatcher {
/**
*
*/
handlers: MultiHandler[];
/**
*
*/
nextHandler: MultiHandler;
/**
*
*/
init(): void;
/**
* cc.Texture2D
*/
requsetMaterial(texture: cc.Texture2D): cc.Material;
/**
* 使
*/
reset(): void;
}
};
namespace RenderComponent {
export enum EnableType {
/**
* !#en Global.
* !#zh 使
* @property {Number} GLOBAL
*/
GLOBAL = 0,
/**
* !#en Enable.
* !#zh
* @property {Number} ENABLE
*/
ENABLE = 1,
/**
* !#en Disable.
* !#zh
* @property {Number} DISABLE
*/
DISABLE = 2,
}
}
interface RenderComponent {
/**
* `updateRenderData` 使 Texture Index
*/
_texIdDirty: boolean;
/**
* 使 Texture Index
*/
_texId: number;
/**
* `_texId`使 Texture Index
*/
_updateMultiTexId(material: cc.MaterialVariant, texture: cc.Texture2D);
}
interface Label {
/**
*
*/
autoSwitchMaterial: cc.RenderComponent.EnableType;
/**
*
*/
allowDynamicAtlas: cc.RenderComponent.EnableType;
/**
* DPI
*/
enableRetina: cc.RenderComponent.EnableType;
/**
*
*/
setVertsDirty(): void;
}
namespace Label {
/**
* CHAR
*/
class LetterAtlas {
/**
*
*/
_atlases: cc.Label.LetterAtlases;
/**
*
*/
_texture: cc.RenderTexture;
/**
*
*/
_id: number;
/**
*
*/
_tmpId: number;
/**
*
*/
frees: cc.BitmapFont.FontLetterDefinition[];
/**
*
*/
waitCleans: cc.BitmapFont.FontLetterDefinition[];
/**
*
*/
reset(): void;
/**
*
*/
destroy(): void;
}
/**
* CHAR
*/
class LetterAtlases {
/**
*
*/
atlases: any[];
/**
* Char
*/
material: cc.Material;
/**
* Fake MaterialVariant
*/
fakeMaterial: { material: cc.Material };
/**
* cc.BitmapFont.FontAtlas
*/
_fontDefDictionary: any;
/**
* 使 CHAR
*/
getLetterDefinitionForChar(char: string, labelInfo: any): any;
/**
*
*/
getLetter(key: string): cc.BitmapFont.FontLetterDefinition;
/**
*
*/
deleteLetter(letter: cc.BitmapFont.FontLetterDefinition): void;
/**
*
*/
reset(): void;
/**
*
*/
destroy(): void;
}
/**
* CHAR
*/
const _shareAtlas: LetterAtlases;
}
namespace BitmapFont {
/**
* Letter
*/
class FontLetterDefinition {
u: number;
v: number;
w: number;
h: number;
offsetX: number;
offsetY: number;
textureID: number;
valid: boolean;
xAdvance: number;
texture: cc.Texture2D;
atlas: cc.Label.LetterAtlas;
ref: number;
_inCleans: boolean;
_hash: string;
_width: number;
_height: number;
}
}
interface Sprite {
/**
*
*/
autoSwitchMaterial: cc.RenderComponent.EnableType;
/**
*
*/
allowDynamicAtlas: cc.RenderComponent.EnableType;
/**
*
*/
setVertsDirty(): void;
}
interface RichText {
/**
* 使
*/
customMaterial: cc.Material;
/**
*
*/
autoSwitchMaterial: cc.RenderComponent.EnableType;
/**
*
*/
allowDynamicAtlas: cc.RenderComponent.EnableType;
/**
* DPI
*/
enableRetina: cc.RenderComponent.EnableType;
/**
*
*/
setVertsDirty(): void;
}
interface MotionStreak {
/**
*
*/
autoSwitchMaterial: cc.RenderComponent.EnableType;
/**
*
*/
_checkSwitchMaterial(): void;
/**
*
*/
setVertsDirty(): void;
}
interface Texture2D {
/**
*
*/
_multiMaterial: cc.Material;
/**
*
*
* @param material
* @param index
*/
linkMaterial(material: cc.Material, index?: number): boolean;
/**
*
*/
unlinkMaterial(): void;
/**
*
*/
getLinkedMaterial(): cc.Material;
/**
*
*/
hasLinkedMaterial(): boolean;
}
interface Material {
/**
* MultiHandler
*/
_multiHandler?: cc.sp.MultiHandler;
/**
* `USE_MULTI_TEXTURE`
*/
updateMultiSupport(): boolean;
/**
* MultiHandler
*/
isMultiSupport(): boolean;
/**
* MultiHandler
*/
setMultiSupport(bool: boolean): void;
/**
* MultiHandler
*/
getMultiHandler(): cc.sp.MultiHandler;
}
namespace DynamicAtlasManager {
/**
*
*/
class Atlas {
/**
*
*/
static ignoreRectSize: number;
/**
* Atlas
*/
static DEFAULT_HASH: string;
/**
*
*/
width: number;
/**
*
*/
height: number;
/**
*
*/
padding: number;
/**
*
*/
border: number;
/**
*
*/
rootRect: Rect;
/**
*
*/
freeRects: Rect[];
/**
* 使
*/
_count: number;
/**
* cc.RenderTexture
*/
_texture: cc.RenderTexture;
/**
* texture update dirty
*/
_dirty: boolean;
constructor(width: number, height: number, padding?: number, border?: number);
/**
* push to free rects
*/
protected pushFreeRect(rect: Rect): void;
/**
* faster remove from free rects
*/
protected removeFreeRect(index: number): void;
/**
* change member from free rects
*/
protected replaceFreeRect(index: number, rect: Rect): void;
/**
* SpriteFrame
*/
insertSpriteFrame(spriteFrame: cc.SpriteFrame): { x: number, y: number, texture: cc.Texture2D };
/**
*
*/
deleteSpriteFrame(texture: cc.Texture2D, frame: cc.SpriteFrame): boolean;
/**
*
*/
deleteInnerRect(rect: Rect): void;
/**
*
*/
deleteInnerTexture(texture: cc.Texture2D): boolean;
/**
* 使
*/
isEmpty(): boolean;
/**
*
*/
reset(): void;
/**
*
*/
destroy(): void;
}
/**
*
*/
class Rect {
/**
*
*/
static reuse(atlas: Atlas, width: number, height: number, x: number, y: number): cc.DynamicAtlasManager.Rect;
/**
*
*/
static recycle(rect: Rect): void;
/**
* Atlas
*/
atlas: Atlas;
/**
*
*/
width: number;
/**
*
*/
height: number;
/**
*
*/
x: number;
/**
*
*/
y: number;
/**
* freeRects
*/
cacheIndex: number;
/**
* cc.Texture2D UUID
*/
uuid: string;
/**
* 使
*/
spriteFrames: cc.SpriteFrame[] = [];
/**
*
*/
parentRect: Rect | undefined;
/**
*
*/
subRectA: Rect | undefined;
/**
*
*/
subRectB: Rect | undefined;
/**
*
*/
subRectC: Rect | undefined;
/**
*
*/
used: number;
/**
*
*/
readonly sizes: number;
constructor(atlas: Atlas, width: number, height: number, x: number, y: number);
}
}
interface DynamicAtlasManager {
/**
* !#en Is enable autoMultiBatch.
* !#zh
* @property autoMultiBatch
* @type {Boolean}
*/
autoMultiBatch: boolean;
/**
* !#en Is enable autoResetBeforeSceneLoad.
* !#zh
* @property autoResetBeforeSceneLoad
* @type {Boolean}
*/
autoResetBeforeSceneLoad: boolean;
/**
*
*/
atlases: cc.DynamicAtlasManager.Atlas[];
/**
* <`texture._uuid`, Rect>
*/
rects: Record<string, cc.DynamicAtlasManager.Rect>;
/**
* !#en Delete a sprite frame from the dynamic atlas.
* !#zh 使使
* @method deleteSpriteFrame
* @param {SpriteFrame} spriteFrame
*/
deleteSpriteFrame(spriteFrame: cc.SpriteFrame): void;
/**
* !#en Delete a texture from the dynamic atlas.
* !#zh 使
* @method deleteTexture
* @param {Texture2D} texture
*/
deleteTexture(texture: cc.Texture2D): void;
}
}
declare namespace cc.AssetManager {
interface CacheManager {
/**
!#en
Get temporary path with origin url, this method only works on mini-game platforms
Use 'getTempAsync' if multithreading is enabled.
!#zh
url
线使 `getTempAsync`.
@param originUrl originUrl
*/
getTemp(originUrl: string): string;
/**
!#en
Get temporary path with origin url, this method only works on mini-game platforms
!#zh
url
@param originUrl originUrl
@param callback
*/
getTempAsync(originUrl: string, callback: (path: string) => void): void;
}
}
2022-06-24 17:04:46 +00:00
declare module sp {
2022-07-05 03:08:23 +00:00
/**
* Spine Attachment Region
*/
class RegionData {
2022-06-24 17:04:46 +00:00
/**
2022-07-05 03:08:23 +00:00
* `x` `y` `width` `height` `texture` uv
2022-06-24 17:04:46 +00:00
*/
2022-07-05 03:08:23 +00:00
static updateUV(region: RegionData | spine.TextureAtlasRegion): void;
2022-06-24 17:04:46 +00:00
2022-07-05 03:08:23 +00:00
x: number;
y: number;
degrees: number;
texture2D: cc.Texture2D;
texture: any;
u: number;
v: number;
u2: number;
v2: number;
width: number;
height: number;
rotate: boolean;
offsetX: number;
offsetY: number;
originalWidth: number;
originalHeight: number;
2022-06-24 17:04:46 +00:00
2022-07-05 03:08:23 +00:00
constructor(attachmentOrSpriteFrame?: spine.Attachment | cc.SpriteFrame);
2022-06-24 17:04:46 +00:00
/**
2022-07-05 03:08:23 +00:00
* 使 SpriteFrame RegionData
2022-06-24 17:04:46 +00:00
*/
2022-07-05 03:08:23 +00:00
initWithSpriteFrame(spriteFrame: cc.SpriteFrame): void;
2022-06-24 17:04:46 +00:00
/**
2022-07-05 03:08:23 +00:00
* 使 Attachment RegionData
*/
initWithAttachment(attachment: spine.Attachment): void;
/**
* `x` `y` `width` `height` `texture` uv
*/
updateUV(): void;
/**
* 使 PackedFrame RegionData
*/
updateWithPackedFrame(packedFrame: any): void;
/**
* 使 Texture2D RegionData
*/
updateWithTexture2D(texture2d: cc.Texture2D): void;
/**
* SpriteFrame
2022-06-24 17:04:46 +00:00
*
* SpriteFrame region 270 0
*
2022-07-05 03:08:23 +00:00
* @param strict `null` `false`
*/
toSpriteFrame(strict?: boolean): cc.SpriteFrame;
/**
* Attachment
*
* @param strict
* @param resetDynamicAtlas 使
*/
assignToAttachment(attachment: spine.Attachment, strict?: boolean, resetDynamicAtlas?: boolean): void;
}
interface SkeletonData {
/**
* SkeletonData
*
*
2022-06-24 17:04:46 +00:00
*/
2022-07-05 03:08:23 +00:00
clone(): SkeletonData;
2022-06-24 17:04:46 +00:00
}
interface Skeleton {
/**
*
*/
autoSwitchMaterial: cc.RenderComponent.EnableType;
/**
*
*/
allowDynamicAtlas: cc.RenderComponent.EnableType;
/**
2022-07-05 03:08:23 +00:00
* slot attachment attachment region Skeleton Skeleton Data
2022-06-24 17:04:46 +00:00
*/
2022-07-05 03:08:23 +00:00
getRegionData(slotName: string, attachmentName: string): sp.RegionData | null;
2022-06-24 17:04:46 +00:00
/**
2022-07-05 03:08:23 +00:00
* slot attachment attachment region Skeleton Skeleton Data
2022-06-24 17:04:46 +00:00
*/
2022-07-05 03:08:23 +00:00
setRegionData(slotName: string, attachmentName: string, region: sp.RegionData): boolean;
2022-06-24 17:04:46 +00:00
/**
*
*/
setVertsDirty(): void;
}
}
/**
* 访 Worker
*/
declare const worker: any;
declare module ipcMain {
/**
* Worker 访
*/
export function registerHandler(name: string, handler: object): Promise<void>;
}
/**
* Worker 线
*/
declare var CC_WORKER_ASSET_PIPELINE: boolean;
/**
* Worker
*/
declare var CC_WORKER_AUDIO_SYSTEM: boolean;
/**
* Worker
*/
declare var CC_WORKER_AUDIO_SYSTEM_SYNC_INTERVAL: number;
/**
* Worker
*/
declare var CC_CUSTOM_WORKER: boolean;
/**
* Worker
*/
declare var CC_WORKER_DEBUG: boolean;
/**
* Worker 使 API
*/
declare var CC_WORKER_FS_SYNC: boolean;
/**
* Worker
*/
declare var CC_WORKER_SUB_PACKAGE: boolean;
/**
* Worker
*/
declare var CC_USE_WORKER: boolean;