Commit 1244f7f9 authored by yu's avatar yu

完成

parent 9f5f5457
import { asyncDelay, onHomeworkFinish } from "../script/util";
import { MyCocosSceneComponent } from "../script/MyCocosSceneComponent";
const { ccclass, property } = cc._decorator;
@ccclass
export default class SceneComponent extends MyCocosSceneComponent {
addPreloadImage() {
// TODO 根据自己的配置预加载图片资源
this._imageResList.push({ url: this.data.pic_url });
this._imageResList.push({ url: this.data.pic_url_2 });
}
addPreloadAudio() {
// TODO 根据自己的配置预加载音频资源
this._audioResList.push({ url: this.data.audio_url });
}
addPreloadAnima() {
}
onLoadEnd() {
// TODO 加载完成后的逻辑写在这里, 下面的代码仅供参考
this.initData();
this.initView();
this.initListener();
}
_cantouch = null;
initData() {
// 所有全局变量 默认都是null
this._cantouch = true;
}
initView() {
this.initBg();
this.initPic();
this.initBtn();
this.initIcon();
}
initBg() {
const bgNode = cc.find('Canvas/bg');
bgNode.scale = this._mapScaleMax;
}
pic1 = null;
pic2 = null;
initPic() {
const canvas = cc.find('Canvas');
const maxW = canvas.width * 0.7;
this.getSprNodeByUrl(this.data.pic_url, (sprNode) => {
const picNode1 = sprNode;
picNode1.scale = maxW / picNode1.width;
picNode1.baseX = picNode1.x;
canvas.addChild(picNode1);
this.pic1 = picNode1;
const labelNode = new cc.Node();
labelNode.color = cc.Color.YELLOW;
const label = labelNode.addComponent(cc.Label);
label.string = this.data.text;
label.fontSize = 60;
label.lineHeight = 60;
label.font = cc.find('Canvas/res/font/BRLNSDB').getComponent('cc.Label').font;
picNode1.addChild(labelNode);
});
this.getSprNodeByUrl(this.data.pic_url_2, (sprNode) => {
const picNode2 = sprNode;
picNode2.scale = maxW / picNode2.width;
canvas.addChild(picNode2);
picNode2.x = canvas.width;
picNode2.baseX = picNode2.x;
this.pic2 = picNode2;
const labelNode = new cc.Node();
const label = labelNode.addComponent(cc.RichText);
const size = 60
label.font = cc.find('Canvas/res/font/BRLNSDB').getComponent(cc.Label).font;
label.string = `<outline color=#751e00 width=4><size=${size}><color=#ffffff>${this.data.text}</color></size></outline>`
label.lineHeight = size;
picNode2.addChild(labelNode);
});
}
initIcon() {
const iconNode = this.getSprNode('icon');
iconNode.zIndex = 5;
iconNode.anchorX = 1;
iconNode.anchorY = 1;
iconNode.parent = cc.find('Canvas');
iconNode.x = iconNode.parent.width / 2 - 10;
iconNode.y = iconNode.parent.height / 2 - 10;
iconNode.on(cc.Node.EventType.TOUCH_START, () => {
this.playAudioByUrl(this.data.audio_url);
})
}
curPage = null;
initBtn() {
this.curPage = 0;
const bottomPart = cc.find('Canvas/bottomPart');
bottomPart.zIndex = 5; // 提高层级
bottomPart.x = bottomPart.parent.width / 2;
bottomPart.y = -bottomPart.parent.height / 2;
const leftBtnNode = bottomPart.getChildByName('btn_left');
//节点中添加了button组件 则可以添加click事件监听
leftBtnNode.on('click', () => {
if (!this._cantouch) {
return;
}
if (this.curPage == 0) {
return;
}
this.curPage = 0
this.leftMove();
this.playLocalAudio('btn');
})
const rightBtnNode = bottomPart.getChildByName('btn_right');
//节点中添加了button组件 则可以添加click事件监听
rightBtnNode.on('click', () => {
if (!this._cantouch) {
return;
}
if (this.curPage == 1) {
return;
}
this.curPage = 1
this.rightMove();
// 游戏结束时需要调用这个方法通知系统作业完成
onHomeworkFinish();
this.playLocalAudio('btn');
})
}
leftMove() {
this._cantouch = false;
const len = this.pic1.parent.width;
cc.tween(this.pic1)
.to(1, { x: this.pic1.baseX }, { easing: 'cubicInOut' })
.start();
cc.tween(this.pic2)
.to(1, { x: this.pic2.baseX }, { easing: 'cubicInOut' })
.call(() => {
this._cantouch = true;
})
.start();
}
rightMove() {
this._cantouch = false;
const len = this.pic1.parent.width;
cc.tween(this.pic1)
.to(1, { x: this.pic1.baseX - len }, { easing: 'cubicInOut' })
.start();
cc.tween(this.pic2)
.to(1, { x: this.pic2.baseX - len }, { easing: 'cubicInOut' })
.call(() => {
this._cantouch = true;
})
.start();
}
// update (dt) {},
initListener() {
}
playLocalAudio(audioName) {
const audio = cc.find(`Canvas/res/audio/${audioName}`).getComponent(cc.AudioSource);
return new Promise((resolve, reject) => {
const id = cc.audioEngine.playEffect(audio.clip, false);
cc.audioEngine.setFinishCallback(id, () => {
resolve(id);
});
})
}
}
export const defaultData = {
"pic_url": "http://staging-teach.cdn.ireadabc.com/ed94332a503c31e0908bd4c6923a2665.png",
"pic_url_2": "http://staging-teach.cdn.ireadabc.com/5fb60317ade0195d35ad8034d5370a7f.png",
"text": "This is a test label.",
"audio_url": "http://staging-teach.cdn.ireadabc.com/f47f1d7b5c160fe1c59500d180346240.mp3"
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "18d07592-51a9-421e-8972-0f67b68d29e1",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 144,
"height": 144,
"platformSettings": {},
"subMetas": {
"icon": {
"ver": "1.0.4",
"uuid": "6fbc30a8-3c49-44ae-8ba4-7f56f385b78a",
"rawTextureUuid": "18d07592-51a9-421e-8972-0f67b68d29e1",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": -0.5,
"trimX": 3,
"trimY": 2,
"width": 138,
"height": 141,
"rawWidth": 144,
"rawHeight": 144,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "c35bb2f6-f24a-4850-ae44-643f2fdc7541",
"uuid": "35d89f9a-5c78-44c1-a71c-57ee2c1c2be3",
"isBundle": false,
"bundleName": "",
"priority": 1,
......
{
"ver": "1.1.2",
"uuid": "cb9fa4ea-66ca-45af-ad31-e445c7b0ef32",
"uuid": "8f92f3bd-f52a-468d-a051-f815071d6e88",
"isBundle": false,
"bundleName": "",
"priority": 1,
......
{
"ver": "2.0.1",
"uuid": "f0680ae0-c079-45ef-abd7-9e63d90b982b",
"uuid": "428a5c91-897a-4fa2-bc11-913af202e8fc",
"downloadMode": 0,
"duration": 0.130612,
"subMetas": {}
......
{
"ver": "2.0.1",
"uuid": "140b26af-6541-4432-af27-5c48759bc768",
"downloadMode": 0,
"duration": 0.835918,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "2385c284-2aee-424e-a993-6bd55ded0dc6",
"downloadMode": 0,
"duration": 2.1956,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "50d2af3a-22ce-4807-b807-c029f546be6d",
"downloadMode": 0,
"duration": 0.2642,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "b1d1c162-a3d7-4551-be1c-f6074582fb8a",
"downloadMode": 0,
"duration": 1.959184,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "6ac29d4d-a6d4-4a80-81d6-289dbb2ed6b6",
"downloadMode": 0,
"duration": 0.365714,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "902ce3e2-e421-4bdf-88f7-5568666acc18",
"downloadMode": 0,
"duration": 0.972,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "4fc3a7c0-bea7-4706-ae69-7a992db6d90c",
"downloadMode": 0,
"duration": 0.864,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "3c5f95f5-6190-4866-8f75-726d22f1eac5",
"downloadMode": 0,
"duration": 1.368,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "bea4ad9f-b23d-4d42-868c-4335ec9a7ca9",
"downloadMode": 0,
"duration": 1.584,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "1e7e5bea-4489-412b-a1d1-fd081aaa044c",
"downloadMode": 0,
"duration": 1.56,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "7956d136-597e-46a4-8d60-e67b4173870f",
"downloadMode": 0,
"duration": 1.752,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "0853721c-3f55-4eb2-873d-e3081cfadd4b",
"uuid": "75d85b31-d56b-4b61-b988-c58d10c019cb",
"isBundle": false,
"bundleName": "",
"priority": 1,
......
{
"ver": "1.1.2",
"uuid": "898fe215-88d4-40fb-8627-de0d22ca08fa",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
{
"ver": "1.0.1",
"uuid": "ff098a61-1807-402b-a826-0ce4be2105c0",
"subMetas": {}
}
\ No newline at end of file
{"name":"mao","imagePath":"mao_tex.png","SubTexture":[{"name":"猫01/影子","x":1,"height":66,"y":343,"width":337},{"name":"猫01/尾巴","x":1,"height":109,"y":188,"width":175},{"name":"猫01/右腿","x":178,"height":117,"y":188,"width":104},{"name":"猫01/左腿","x":1,"height":115,"y":569,"width":64},{"name":"猫01/右手","x":427,"height":122,"y":590,"width":69},{"name":"猫01/左手","x":301,"height":74,"y":590,"width":124},{"name":"猫01伸/左手伸直","x":299,"height":169,"y":1,"width":168},{"name":"猫01伸/右手伸直","x":299,"height":169,"y":172,"width":168},{"name":"猫01/身体","x":340,"height":180,"y":343,"width":122},{"name":"猫01/领带","x":1,"height":156,"y":411,"width":120},{"name":"猫01/右耳","x":155,"height":76,"y":602,"width":90},{"name":"猫01/左耳","x":67,"height":85,"y":602,"width":86},{"name":"猫01/组_1","x":1,"height":185,"y":1,"width":296},{"name":"猫01/右眼","x":1,"height":60,"y":686,"width":59},{"name":"猫01/右眉毛","x":67,"height":5,"y":595,"width":33},{"name":"猫01/左眼","x":247,"height":60,"y":666,"width":59},{"name":"猫01/左眉毛","x":247,"height":12,"y":602,"width":31},{"name":"猫01/眼镜","x":301,"height":63,"y":525,"width":170},{"name":"猫01/胡子","x":123,"height":85,"y":515,"width":176},{"name":"猫01/鼻子","x":67,"height":24,"y":569,"width":28},{"name":"猫01/嘴","x":1,"height":30,"y":299,"width":65},{"name":"猫01/帽子","x":123,"height":102,"y":411,"width":158}],"height":1024,"width":512}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "cb568bc3-2e4a-4fbd-9310-900e6656ad91",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "51078f46-aced-4110-98be-3ef166e94a39",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 512,
"height": 1024,
"platformSettings": {},
"subMetas": {
"mao_tex": {
"ver": "1.0.4",
"uuid": "639e2e3e-8656-475f-9007-391b6090943a",
"rawTextureUuid": "51078f46-aced-4110-98be-3ef166e94a39",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -7.5,
"offsetY": 138.5,
"trimX": 1,
"trimY": 1,
"width": 495,
"height": 745,
"rawWidth": 512,
"rawHeight": 1024,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "d604fdf1-0fae-494e-9f60-972289112fc2",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{"frameRate":24,"name":"水","version":"5.5","compatibleVersion":"5.5","armature":[{"type":"Armature","frameRate":24,"name":"Armature","aabb":{"x":-290.5,"y":-114.25,"width":581,"height":228.5},"bone":[{"name":"root"},{"length":26,"name":"图层15","parent":"root","transform":{"x":13.85,"y":-111.675,"skX":95.7161,"skY":95.7161}},{"length":51.5,"name":"图层22","parent":"图层15","transform":{"x":71.2338,"y":-9.74325,"skX":-5.7161,"skY":-5.7161}}],"slot":[{"name":"图层15","parent":"图层15"},{"displayIndex":2,"name":"图层22","parent":"图层22"}],"skin":[{"slot":[{"name":"图层22","display":[{"name":"水/图层22","transform":{"x":45.58,"y":15.2,"skX":-90,"skY":-90}},{"name":"水/图层16(2)","transform":{"x":40.58,"y":6.2,"skX":-90,"skY":-90}},{"name":"水/图层21","transform":{"x":44.58,"y":-0.55,"skX":-90,"skY":-90}}]},{"name":"图层15","display":[{"name":"水/图层15","transform":{"x":112.5,"y":2.66,"skX":-95.72,"skY":-95.72}}]}]}],"animation":[{"duration":24,"playTimes":0,"name":"normal","slot":[{"name":"图层22","displayFrame":[{"duration":4,"value":1},{"duration":4,"value":2},{"duration":4},{"duration":4,"value":1},{"duration":4,"value":2},{"duration":4},{"duration":0,"value":1}]}]}],"defaultActions":[{"gotoAndPlay":"normal"}]}]}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "72f14c5c-4188-4479-9f96-a8f8341e9e13",
"subMetas": {}
}
\ No newline at end of file
{"width":1024,"imagePath":"水_tex.png","height":512,"name":"水","SubTexture":[{"width":581,"y":1,"height":229,"name":"水/图层15","x":1},{"width":425,"y":232,"height":227,"name":"水/图层16(2)","x":468},{"width":465,"y":232,"height":217,"name":"水/图层22","x":1},{"width":418,"y":1,"height":219,"name":"水/图层21","x":584}]}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "55eb410f-3ec9-4871-9715-fdeb1f83a21c",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "c247dd14-cd1e-4539-a1b1-1676851b4ba6",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1024,
"height": 512,
"platformSettings": {},
"subMetas": {
"水_tex": {
"ver": "1.0.4",
"uuid": "80ca8e65-197a-48ad-a10d-aae6eb8fd1c8",
"rawTextureUuid": "c247dd14-cd1e-4539-a1b1-1676851b4ba6",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -10.5,
"offsetY": 26,
"trimX": 1,
"trimY": 1,
"width": 1001,
"height": 458,
"rawWidth": 1024,
"rawHeight": 512,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "fa5e9260-2e13-4fb7-a084-b829f94ad1b0",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{"frameRate":24,"name":"水花","version":"5.5","compatibleVersion":"5.5","armature":[{"type":"Armature","frameRate":24,"name":"Armature","aabb":{"x":-363,"y":-30.75,"width":706.5,"height":73.5},"bone":[{"name":"root"},{"length":36.5,"name":"图层19","parent":"root","transform":{"x":1.7,"y":32.425,"skX":-90,"skY":-90}}],"slot":[{"displayIndex":2,"name":"图层19","parent":"图层19"}],"skin":[{"slot":[{"name":"图层19","display":[{"name":"水花/图层19","transform":{"x":32.42,"y":-11.7,"skX":90,"skY":90}},{"name":"水花/图层14","transform":{"x":31.43,"y":3.3,"skX":90,"skY":90}},{"name":"水花/图层20","transform":{"x":26.43,"y":-11.45,"skX":90,"skY":90}}]}]}],"animation":[{"duration":72,"playTimes":0,"name":"normal","slot":[{"name":"图层19","displayFrame":[{"duration":6,"value":1},{"duration":6},{"duration":6,"value":2},{"duration":6,"value":1},{"duration":6},{"duration":6,"value":2},{"duration":6,"value":1},{"duration":6},{"duration":6,"value":2},{"duration":6,"value":1},{"duration":6},{"duration":6,"value":2},{"duration":0,"value":1}]}]}],"defaultActions":[{"gotoAndPlay":"normal"}]}]}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "59528cd1-f0b6-430b-b513-da03bae3684d",
"subMetas": {}
}
\ No newline at end of file
{"width":1024,"imagePath":"水花_tex.png","height":256,"name":"水花","SubTexture":[{"width":727,"y":1,"height":86,"name":"水花/图层19","x":1},{"width":737,"y":89,"height":84,"name":"水花/图层14","x":1},{"width":707,"y":175,"height":74,"name":"水花/图层20","x":1}]}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "a7dcbcd7-d1ff-45bf-b5a7-c0d1748a0c49",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "a40b9c09-cf2e-40ec-a6d7-4610b35ecde2",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1024,
"height": 256,
"platformSettings": {},
"subMetas": {
"水花_tex": {
"ver": "1.0.4",
"uuid": "1b1abaae-4711-4bfc-be15-860831b55a42",
"rawTextureUuid": "a40b9c09-cf2e-40ec-a6d7-4610b35ecde2",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -142.5,
"offsetY": 3,
"trimX": 1,
"trimY": 1,
"width": 737,
"height": 248,
"rawWidth": 1024,
"rawHeight": 256,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "fc69c259-f517-43df-9fdc-b5afc45c4f50",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{"frameRate":24,"name":"云","version":"5.5","compatibleVersion":"5.5","armature":[{"type":"Armature","frameRate":24,"name":"Armature","aabb":{"x":-323,"y":-166.5,"width":676.5,"height":71},"bone":[{"name":"root"},{"length":9.5,"name":"图层_3","parent":"root","transform":{"x":308.725,"y":-110.6,"skX":-8.1301,"skY":-8.1301}},{"length":8,"name":"图层_2","parent":"root","transform":{"x":132.325,"y":-147.725,"skX":4.7636,"skY":4.7636}},{"length":9.5,"name":"图层27(2)","parent":"root","transform":{"x":-74.9,"y":-111.3,"skX":-4.0856,"skY":-4.0856}},{"length":14,"name":"图层_1","parent":"root","transform":{"x":-290.525,"y":-123.9,"skX":-5.7106,"skY":-5.7106}}],"slot":[{"name":"图层27(2)","parent":"图层27(2)"},{"name":"图层_3","parent":"图层_3"},{"name":"图层_2","parent":"图层_2"},{"name":"图层_1","parent":"图层_1"}],"skin":[{"slot":[{"name":"图层_1","display":[{"name":"云/图层_1","transform":{"x":5.28,"y":-4.85,"skX":5.71,"skY":5.71}}]},{"name":"图层_3","display":[{"name":"云/图层_3","transform":{"x":3.72,"y":-2.9,"skX":8.13,"skY":8.13}}]},{"name":"图层27(2)","display":[{"name":"云/图层27(2)","transform":{"x":2.35,"y":-2.79,"skX":4.09,"skY":4.09}}]},{"name":"图层_2","display":[{"name":"云/图层_2","transform":{"x":2.91,"y":-0.27,"skX":-4.76,"skY":-4.76}}]}]}],"animation":[{"duration":48,"playTimes":0,"name":"normal","bone":[{"name":"图层_3","translateFrame":[{"duration":24,"tweenEasing":0},{"duration":24,"tweenEasing":0,"x":-5.6},{"duration":0}]},{"name":"图层_2","translateFrame":[{"duration":24,"tweenEasing":0},{"duration":24,"tweenEasing":0,"x":4.2},{"duration":0}]},{"name":"图层27(2)","translateFrame":[{"duration":24,"tweenEasing":0},{"duration":24,"tweenEasing":0,"x":-5.6},{"duration":0}]},{"name":"图层_1","translateFrame":[{"duration":24,"tweenEasing":0},{"duration":24,"tweenEasing":0,"x":7.7},{"duration":0}]}]}],"defaultActions":[{"gotoAndPlay":"normal"}],"canvas":{"width":780,"height":360}}]}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "8d603bbb-397b-4c5c-8c2a-1fabbded25f0",
"subMetas": {}
}
\ No newline at end of file
{"width":128,"imagePath":"云_tex.png","height":256,"name":"云","SubTexture":[{"width":75,"y":41,"height":38,"name":"云/图层27(2)","x":1},{"width":83,"y":121,"height":34,"name":"云/图层_3","x":1},{"width":75,"y":81,"height":38,"name":"云/图层_2","x":1},{"width":75,"y":1,"height":38,"name":"云/图层_1","x":1}]}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "b04d4a09-f79e-48c3-b988-6944bb427263",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "f17dc593-b63c-4276-ac1a-6a08aca3a25e",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 128,
"height": 256,
"platformSettings": {},
"subMetas": {
"云_tex": {
"ver": "1.0.4",
"uuid": "339b11b4-02c0-4310-abb2-97a4ee501f42",
"rawTextureUuid": "f17dc593-b63c-4276-ac1a-6a08aca3a25e",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -21.5,
"offsetY": 50,
"trimX": 1,
"trimY": 1,
"width": 83,
"height": 154,
"rawWidth": 128,
"rawHeight": 256,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "20185448-a1ca-4de2-8b37-7bf6cdfccbae",
"uuid": "cf5a9d5f-6e6e-472a-ab09-a49ac1f574c9",
"isBundle": false,
"bundleName": "",
"priority": 1,
......
{
"ver": "1.1.0",
"uuid": "c551970e-b095-45f3-9f1d-25cde8b8deb1",
"uuid": "9caaf685-281c-42bb-8cfd-e454981b36fa",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "d3bce17c-e0a8-4230-a190-eb5f7bb7fc89",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "e098d881-7ec1-47ab-8794-37b8db5b189e",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "3076c781-5de6-4ac3-9fb0-8187f17509ee",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "4b5ea4e9-94bb-4cd2-bcef-43acf02106ca",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "57c0f38d-95d7-4fc9-b4b2-80899ea0bef1",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
export as namespace Play;
declare class EventEmitter<T> {
on<K extends keyof T>(event: K, listener: (payload: T[K]) => any): this;
on(evt: string, listener: Function): this;
once<K extends keyof T>(event: K, listener: (payload: T[K]) => any): this;
once(evt: string, listener: Function): this;
off<K extends keyof T>(evt: K | string, listener?: Function): this;
emit<K extends keyof T>(evt: K | string, ...args: any[]): boolean;
}
export enum Event {
/** 断开连接 */
DISCONNECTED = 'disconnected',
/** 加入到大厅 */
LOBBY_JOINED = 'lobbyJoined',
/** 大厅房间列表变化 */
LOBBY_ROOM_LIST_UPDATED = 'lobbyRoomListUpdate',
/** 有新玩家加入房间 */
PLAYER_ROOM_JOINED = 'newPlayerJoinedRoom',
/** 有玩家离开房间 */
PLAYER_ROOM_LEFT = 'playerLeftRoom',
/** 玩家活跃属性变化 */
PLAYER_ACTIVITY_CHANGED = 'playerActivityChanged',
/** 主机变更 */
MASTER_SWITCHED = 'masterSwitched',
/** 离开房间 */
ROOM_LEFT = 'roomLeft',
/** 被踢出房间 */
ROOM_KICKED = 'roomKicked',
/** 房间系统属性变化 */
ROOM_SYSTEM_PROPERTIES_CHANGED = 'roomSystemPropertiesChanged',
/** 房间自定义属性变化 */
ROOM_CUSTOM_PROPERTIES_CHANGED = 'roomCustomPropertiesChanged',
/** 玩家自定义属性变化 */
PLAYER_CUSTOM_PROPERTIES_CHANGED = 'playerCustomPropertiesChanged',
/** 自定义事件 */
CUSTOM_EVENT = 'customEvent',
/** 错误事件 */
ERROR = 'error',
}
export enum ReceiverGroup {
/** 其他人(除了自己之外的所有人) */
Others,
/** 所有人(包括自己) */
All,
/** 主机客户端 */
MasterClient,
}
interface CustomProperties {
[key: string]: any;
}
interface CustomEventData {
[key: string]: any;
}
interface ErrorEvent {
code: number;
detail: string;
}
declare interface PlayEvent {
connected: void;
connectFailed: ErrorEvent;
disconnected: void;
lobbyJoined: void;
lobbyLeft: void;
lobbyRoomListUpdate: void;
roomCreated: void;
roomCreateFailed: ErrorEvent;
roomJoined: void;
roomJoinFailed: ErrorEvent;
newPlayerJoinedRoom: {
newPlayer: Player;
};
playerLeftRoom: {
leftPlayer: Player;
};
playerActivityChanged: {
player: Player;
};
masterSwitched: {
newMaster: Player;
};
roomLeft: void;
roomKicked: {
code: number;
msg: string;
};
roomCustomPropertiesChanged: {
changedProps: CustomProperties;
};
roomSystemPropertiesChanged: {
changedProps: CustomProperties;
};
playerCustomPropertiesChanged: {
player: Player;
changedProps: CustomProperties;
};
customEvent: {
eventId: number;
eventData: CustomEventData;
senderId: number;
};
error: ErrorEvent;
}
export class LobbyRoom {
readonly roomName: string;
readonly maxPlayerCount: number;
readonly expectedUserIds: string[];
readonly emptyRoomTtl: number;
readonly playerTtl: number;
readonly playerCount: number;
readonly customRoomPropertiesForLobby: CustomProperties;
}
export class Player {
readonly userId: string;
readonly actorId: number;
readonly isLocal: boolean;
readonly isMaster: boolean;
readonly isActive: boolean;
setCustomProperties(
properties: CustomProperties,
opts?: {
expectedValues?: CustomProperties;
}
): Promise<void>;
readonly customProperties: CustomProperties;
}
export class Room {
readonly name: string;
readonly open: boolean;
readonly visible: boolean;
readonly maxPlayerCount: number;
readonly master: Player;
readonly masterId: number;
readonly expectedUserIds: string[];
readonly playerList: Player[];
getPlayer(actorId: number): Player;
setCustomProperties(
properties: CustomProperties,
opts?: {
expectedValues?: CustomProperties;
}
): Promise<void>;
readonly customProperties: CustomProperties;
setOpen(open: boolean): Promise<void>;
setVisible(visible: boolean): Promise<void>;
setRoomMaxPlayerCount(count: number): Promise<void>;
setRoomExpectedUserIds(expectedUserIds: string[]): Promise<void>;
clearRoomExpectedUserIds(): Promise<void>;
addRoomExpectedUserIds(expectedUserIds: string[]): Promise<void>;
removeRoomExpectedUserIds(expectedUserIds: string[]): Promise<void>;
setMaster(newMasterId: number): Promise<void>;
sendEvent(
eventId: number,
eventData?: CustomEventData,
options?: {
receiverGroup?: ReceiverGroup;
targetActorIds?: number[];
}
): Promise<void>;
kickPlayer(
actorId: number,
opts?: {
code?: number;
msg?: string;
}
): Promise<void>;
leave(): Promise<void>;
}
export class Client extends EventEmitter<PlayEvent> {
readonly room: Room;
readonly player: Player;
readonly lobbyRoomList: LobbyRoom[];
userId: string;
constructor(opts: {
appId: string;
appKey: string;
userId: string;
ssl?: boolean;
feature?: string;
gameVersion?: string;
playServer?: string;
});
connect(): Promise<Client>;
reconnect(): Promise<Client>;
reconnectAndRejoin(): Promise<Room>;
close(): Promise<void>;
joinLobby(): Promise<void>;
leaveLobby(): Promise<void>;
createRoom(opts?: {
roomName?: string;
roomOptions?: Object;
expectedUserIds?: string[];
}): Promise<Room>;
joinRoom(
roomName: string,
opts?: {
expectedUserIds?: string[];
}
): Promise<Room>;
rejoinRoom(roomName: string): Promise<Room>;
joinOrCreateRoom(
roomName: string,
opts?: {
roomOptions?: Object;
expectedUserIds: string[];
}
): Promise<Room>;
joinRandomRoom(opts?: {
matchProperties?: Object;
expectedUserIds?: string[];
}): Promise<Room>;
matchRandom(
piggybackPeerId: string,
opts?: { matchProperties?: Object; expectedUserIds?: string[] }
): Promise<LobbyRoom>;
setRoomOpen(open: boolean): Promise<void>;
setRoomVisible(visible: boolean): Promise<void>;
setRoomMaxPlayerCount(count: number): Promise<void>;
setRoomExpectedUserIds(expectedUserIds: string[]): Promise<void>;
clearRoomExpectedUserIds(): Promise<void>;
addRoomExpectedUserIds(expectedUserIds: string[]): Promise<void>;
removeRoomExpectedUserIds(expectedUserIds: string[]): Promise<void>;
setMaster(newMasterId: number): Promise<void>;
sendEvent(
eventId: number,
eventData?: CustomEventData,
options?: {
receiverGroup?: ReceiverGroup;
targetActorIds?: number[];
}
): Promise<void>;
leaveRoom(): Promise<void>;
kickPlayer(
actorId: number,
opts?: {
code?: number;
msg?: string;
}
): Promise<void>;
pauseMessageQueue(): void;
resumeMessageQueue(): void;
}
export enum CreateRoomFlag {
FixedMaster = 1,
MasterUpdateRoomProperties = 2,
}
export function setAdapters(newAdapters: { WebSocket: Function }): void;
export enum LogLevel {
Debug = 'Debug',
Warn = 'Warn',
Error = 'Error',
}
export function setLogger(logger: {
Debug: (...args: any[]) => any;
Warn: (...args: any[]) => any;
Error: (...args: any[]) => any;
}): void;
export enum PlayErrorCode {
OPEN_WEBSOCKET_ERROR = 10001,
SEND_MESSAGE_STATE_ERROR = 10002,
}
export function registerType<T>(
type: T,
typeId: number,
serializeMethod: (obj: T) => Uint8Array,
deserializeMethod: (bytes: Uint8Array) => T
): void;
export function serializeObject(obj: Object): Uint8Array;
export function deserializeObject(bytes: Uint8Array): Object;
{
"ver": "2.0.0",
"uuid": "ca514a69-2a63-4fea-a843-2dc5b015bef5",
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
{
"ver": "1.0.8",
"uuid": "27890380-3992-471a-bb1a-27b2efabe844",
"isPlugin": true,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": true,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "c1f757e8-76a4-4b5a-9c07-41caf7be2a5c",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "9769711b-5dec-4b9a-be2a-ef457fe0aabe",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.2.9",
"uuid": "9e527f2a-48d8-42fe-b0cf-2de1d43c8952",
"optimizationPolicy": "SINGLE_INSTANCE",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "ff86810f-5884-4a0d-a530-ec6206ffc34c",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "ff7efdcb-1a49-41e4-a4fd-24d7ecb42813",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "efa5fa09-a4dd-4bfc-ab7e-17c19f85408f",
"uuid": "ac53f937-d392-4755-afac-bb7bb5e7e46f",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 366,
"height": 336,
"width": 2176,
"height": 1600,
"platformSettings": {},
"subMetas": {
"1orange": {
"bg": {
"ver": "1.0.4",
"uuid": "43d1e79d-6de8-4dcb-b8ce-d767df7913aa",
"rawTextureUuid": "efa5fa09-a4dd-4bfc-ab7e-17c19f85408f",
"uuid": "270fd07d-8c20-4021-90a8-10bf47fe5f85",
"rawTextureUuid": "ac53f937-d392-4755-afac-bb7bb5e7e46f",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": -0.5,
"offsetY": 0,
"trimX": 0,
"trimY": 1,
"width": 366,
"height": 335,
"rawWidth": 366,
"rawHeight": 336,
"trimY": 0,
"width": 2176,
"height": 1600,
"rawWidth": 2176,
"rawHeight": 1600,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
......
{
"ver": "1.1.0",
"uuid": "2f73ebf9-49f6-4b6f-985c-b16df41fc2c2",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "d582359e-924e-4ee9-9964-1fc4bb417e71",
"uuid": "7c67e529-29af-47b2-8d27-e26ce8a2c008",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 61,
"height": 67,
"width": 184,
"height": 184,
"platformSettings": {},
"subMetas": {
"btn_right": {
"head_4": {
"ver": "1.0.4",
"uuid": "e5a2dbaa-a677-4a32-90d7-a1b057d7fb59",
"rawTextureUuid": "d582359e-924e-4ee9-9964-1fc4bb417e71",
"uuid": "2ac16b8f-fb2d-4d3f-b3e2-45c4956bee77",
"rawTextureUuid": "7c67e529-29af-47b2-8d27-e26ce8a2c008",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -0.5,
"offsetY": 0.5,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 60,
"height": 66,
"rawWidth": 61,
"rawHeight": 67,
"width": 184,
"height": 184,
"rawWidth": 184,
"rawHeight": 184,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
......
{
"ver": "2.3.5",
"uuid": "ae605318-1385-46fc-9738-0474a1dce9cb",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "point",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1568,
"height": 32,
"platformSettings": {},
"subMetas": {
"progress_bar": {
"ver": "1.0.4",
"uuid": "143d928f-5b50-46be-8bda-f8bbee8438be",
"rawTextureUuid": "ae605318-1385-46fc-9738-0474a1dce9cb",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 1568,
"height": 32,
"rawWidth": 1568,
"rawHeight": 32,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "1fb9bf64-298f-4d67-8add-4cdfae2d822a",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "point",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1578,
"height": 42,
"platformSettings": {},
"subMetas": {
"progress_bg": {
"ver": "1.0.4",
"uuid": "8f8e072a-e7b2-4096-a9fc-d9e73e7c96e5",
"rawTextureUuid": "1fb9bf64-298f-4d67-8add-4cdfae2d822a",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 1578,
"height": 42,
"rawWidth": 1578,
"rawHeight": 42,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "083371e5-3f87-4693-a386-4af8ed35abe4",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 95,
"height": 88,
"platformSettings": {},
"subMetas": {
"progress_dot": {
"ver": "1.0.4",
"uuid": "4c1fa0c3-95fa-4f1d-8f57-40be8134d5b5",
"rawTextureUuid": "083371e5-3f87-4693-a386-4af8ed35abe4",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 95,
"height": 88,
"rawWidth": 95,
"rawHeight": 88,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "8a49a94f-9df2-4db8-bc2e-fcea49f9fe76",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": true,
"genMipmaps": false,
"packable": true,
"width": 280,
"height": 280,
"platformSettings": {},
"subMetas": {
"tx_01": {
"ver": "1.0.4",
"uuid": "339f64aa-da92-4e88-8615-3cfc18fe1928",
"rawTextureUuid": "8a49a94f-9df2-4db8-bc2e-fcea49f9fe76",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 280,
"height": 280,
"rawWidth": 280,
"rawHeight": 280,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "892318b9-ab6b-4faa-9cbc-cc38b4632c4f",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 258,
"height": 258,
"platformSettings": {},
"subMetas": {
"tx_01zw": {
"ver": "1.0.4",
"uuid": "e3bbea27-99c1-4085-bc05-a876bce4be32",
"rawTextureUuid": "892318b9-ab6b-4faa-9cbc-cc38b4632c4f",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 258,
"height": 258,
"rawWidth": 258,
"rawHeight": 258,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment