完善 docs

This commit is contained in:
SmallMain
2022-06-17 18:44:55 +08:00
parent 142e19d075
commit d081c60b05
3 changed files with 61 additions and 38 deletions

View File

@@ -9,7 +9,7 @@
"packageName": "org.cocos2d.helloworld", "packageName": "org.cocos2d.helloworld",
"startScene": "cab4af66-dc74-41b5-8826-79b3a30ba99a", "startScene": "cab4af66-dc74-41b5-8826-79b3a30ba99a",
"title": "Cocos-Service-Pack-Demo", "title": "Cocos-Service-Pack-Demo",
"webOrientation": "auto", "webOrientation": "landscape",
"inlineSpriteFrames": true, "inlineSpriteFrames": true,
"inlineSpriteFrames_native": true, "inlineSpriteFrames_native": true,
"mainCompressionType": "merge_all_json", "mainCompressionType": "merge_all_json",

View File

@@ -47,7 +47,7 @@ Vue.component("cc-richtext", {
:multi-values="multi" :multi-values="multi"
></ui-prop> ></ui-prop>
<ui-prop v-prop="target.customMaterial"></ui-prop> <ui-prop v-show="!_isCharCacheMode()" v-prop="target.customMaterial"></ui-prop>
<ui-prop v-prop="target.autoSwitchMaterial"></ui-prop> <ui-prop v-prop="target.autoSwitchMaterial"></ui-prop>
<ui-prop v-prop="target.allowDynamicAtlas"></ui-prop> <ui-prop v-prop="target.allowDynamicAtlas"></ui-prop>
<ui-prop v-prop="target.enableRetina"></ui-prop> <ui-prop v-prop="target.enableRetina"></ui-prop>
@@ -65,6 +65,9 @@ Vue.component("cc-richtext", {
T: Editor.T, T: Editor.T,
_isSystemFont() { _isSystemFont() {
return this.target.useSystemFont.value return this.target.useSystemFont.value
} },
_isCharCacheMode() {
return 2 === this.target.cacheMode.value
},
} }
}); });

90
src/creator-sp.d.ts vendored
View File

@@ -144,6 +144,12 @@ declare module cc {
*/ */
getEmptyIndex(): number; getEmptyIndex(): number;
/**
* 自动设置纹理到空插槽,返回插槽下标,失败返回 -1提供 cc.Texture2D
*/
autoSetTexture(texture: cc.Texture2D): number;
} }
/** /**
@@ -175,14 +181,9 @@ declare module cc {
/** /**
* 使 cc.Texture2D 关联指定材质 * 重置多纹理材质数组,再次使用请先初始化
*/ */
linkMaterial(texture: cc.Texture2D, handler: MultiHandler, index: number): void; reset(): void;
/**
* 取消关联 cc.Texture2D 上已关联的材质
*/
unlinkMaterial(texture: cc.Texture2D): void;
} }
@@ -249,6 +250,11 @@ declare module cc {
*/ */
enableRetina: cc.RenderComponent.EnableType; enableRetina: cc.RenderComponent.EnableType;
/**
* 置渲染数据刷新脏标记
*/
setVertsDirty(): void;
} }
namespace Label { namespace Label {
@@ -399,6 +405,11 @@ declare module cc {
*/ */
allowDynamicAtlas: cc.RenderComponent.EnableType; allowDynamicAtlas: cc.RenderComponent.EnableType;
/**
* 置渲染数据刷新脏标记
*/
setVertsDirty(): void;
} }
interface RichText { interface RichText {
@@ -423,6 +434,11 @@ declare module cc {
*/ */
enableRetina: cc.RenderComponent.EnableType; enableRetina: cc.RenderComponent.EnableType;
/**
* 置渲染数据刷新脏标记
*/
setVertsDirty(): void;
} }
interface MotionStreak { interface MotionStreak {
@@ -437,34 +453,10 @@ declare module cc {
*/ */
_checkSwitchMaterial(): void; _checkSwitchMaterial(): void;
}
/** /**
* 富文本扩展组件 * 置渲染数据刷新脏标记
*
* 因为引擎未提供其 inspector 文件,无法修改组件的 inspector所以扩展属性通过相应的扩展组件提供
*/ */
class RichTextSP extends cc.Component { setVertsDirty(): void;
/**
* 自定义内部使用的材质
*/
customMaterial: cc.Material;
/**
* 是否自动切换至贴图关联的材质
*/
autoSwitchMaterial: cc.RenderComponent.EnableType;
/**
* 参与动态合图
*/
allowDynamicAtlas: cc.RenderComponent.EnableType;
/**
* 是否启用渲染时进行缩放以适配高 DPI 屏幕
*/
enableRetina: cc.RenderComponent.EnableType;
} }
@@ -475,6 +467,29 @@ declare module cc {
*/ */
_multiMaterial: cc.Material; _multiMaterial: cc.Material;
/**
* 关联指定材质,返回是否成功
*
* @param material 材质
* @param index 材质纹理插槽下标,默认自动寻找第一个空插槽
*/
linkMaterial(material: cc.Material, index?: number): boolean;
/**
* 取消已关联的材质
*/
unlinkMaterial(): void;
/**
* 获取已关联的材质
*/
getLinkedMaterial(): cc.Material;
/**
* 是否已关联材质
*/
hasLinkedMaterial(): boolean;
} }
interface Material { interface Material {
@@ -556,7 +571,7 @@ declare module cc {
/** /**
* 已使用数量 * 已使用数量
*/ */
_count; _count: number;
/** /**
* cc.RenderTexture * cc.RenderTexture
@@ -681,7 +696,7 @@ declare module cc {
/** /**
* cc.Texture2D UUID * cc.Texture2D UUID
*/ */
uuid: cc.Texture2D; uuid: string;
/** /**
* 使用该贴图的精灵帧数组 * 使用该贴图的精灵帧数组
@@ -829,6 +844,11 @@ declare module sp {
*/ */
setRegion(slotName: string, attachmentName: string, region: spine.TextureRegion): boolean; setRegion(slotName: string, attachmentName: string, region: spine.TextureRegion): boolean;
/**
* 置渲染数据刷新脏标记
*/
setVertsDirty(): void;
} }
} }