Commit e7bba903 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": "1.1.2", "ver": "1.1.2",
"uuid": "c35bb2f6-f24a-4850-ae44-643f2fdc7541", "uuid": "b7bc1231-2fe7-4a27-a2db-212dedba664a",
"isBundle": false, "isBundle": false,
"bundleName": "", "bundleName": "",
"priority": 1, "priority": 1,
......
{ {
"ver": "1.1.2", "ver": "1.1.2",
"uuid": "cb9fa4ea-66ca-45af-ad31-e445c7b0ef32", "uuid": "c1f254ba-95ec-46ef-a3c4-3316def30c06",
"isBundle": false, "isBundle": false,
"bundleName": "", "bundleName": "",
"priority": 1, "priority": 1,
......
{ {
"ver": "2.0.1", "ver": "2.0.1",
"uuid": "f0680ae0-c079-45ef-abd7-9e63d90b982b", "uuid": "996b6fe2-4d5f-48f1-917d-e9126f6ad63c",
"downloadMode": 0, "downloadMode": 0,
"duration": 0.130612, "duration": 0.130612,
"subMetas": {} "subMetas": {}
......
{
"ver": "2.0.1",
"uuid": "9ed662d4-4acb-4ee3-9f49-bad6d66c0ec1",
"downloadMode": 0,
"duration": 2.1956,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "d8482f16-6cd5-4c56-9be9-552cd74276d8",
"downloadMode": 0,
"duration": 1.959184,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "22f03ca7-fda8-4543-bacd-3d14ed1c772a",
"downloadMode": 0,
"duration": 0.365714,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "737a021b-2448-41ed-b4a0-7119192d40d3",
"downloadMode": 0,
"duration": 0.972,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "7c715589-5bfb-4af9-94f5-2a3eafb1f788",
"downloadMode": 0,
"duration": 0.864,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "aec4d8ab-40eb-42b7-8403-8cf9818789cd",
"downloadMode": 0,
"duration": 1.368,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "6f7ce828-849a-4b42-ada7-6901672e47e9",
"downloadMode": 0,
"duration": 1.584,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "04b3a266-d501-4b30-9f03-03856d8edbc8",
"downloadMode": 0,
"duration": 1.56,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "0c9c4088-6184-4811-a157-888efc69351b",
"downloadMode": 0,
"duration": 1.752,
"subMetas": {}
}
\ No newline at end of file
{ {
"ver": "1.1.2", "ver": "1.1.2",
"uuid": "0853721c-3f55-4eb2-873d-e3081cfadd4b", "uuid": "8f182589-0f8d-432d-82da-0d1056c668bd",
"isBundle": false, "isBundle": false,
"bundleName": "", "bundleName": "",
"priority": 1, "priority": 1,
......
{
"ver": "1.1.2",
"uuid": "efecb7a4-612c-4d7b-8678-f47baddfeb2c",
"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": "f8083adf-9724-441e-8530-d1826a872fa0",
"subMetas": {}
}
\ No newline at end of file
{"width":1024,"imagePath":"草_tex.png","height":128,"name":"草","SubTexture":[{"width":2,"y":100,"height":2,"name":"草/图层1","x":376},{"width":78,"y":64,"height":59,"name":"草/图层20","x":1},{"width":87,"y":64,"height":52,"name":"草/图层12(3)","x":81},{"width":51,"y":64,"height":52,"name":"草/图层23","x":250},{"width":19,"y":64,"height":52,"name":"草/图层22","x":382},{"width":564,"y":1,"height":61,"name":"草/图层21","x":1},{"width":78,"y":64,"height":38,"name":"草/图层12_拷贝","x":170},{"width":15,"y":100,"height":16,"name":"草/图层14","x":342},{"width":15,"y":100,"height":16,"name":"草/图层14(5)","x":325},{"width":15,"y":100,"height":16,"name":"草/图层14(6)","x":359},{"width":55,"y":1,"height":95,"name":"草/图层18","x":567},{"width":77,"y":64,"height":34,"name":"草/图层15","x":303},{"width":27,"y":104,"height":16,"name":"草/图层16_0","x":199},{"width":20,"y":100,"height":14,"name":"草/图层17_0","x":303},{"width":27,"y":104,"height":16,"name":"草/图层16","x":170},{"width":20,"y":104,"height":14,"name":"草/图层17","x":228}]}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "16a784f5-fa19-4da9-b64d-37d0e2ea597a",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "d6076b1d-2e75-48f2-ae34-f41730e0ed70",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1024,
"height": 128,
"platformSettings": {},
"subMetas": {
"草_tex": {
"ver": "1.0.4",
"uuid": "f2202f4f-f4e6-4f0c-93d4-b4b02080e47e",
"rawTextureUuid": "d6076b1d-2e75-48f2-ae34-f41730e0ed70",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -200.5,
"offsetY": 2,
"trimX": 1,
"trimY": 1,
"width": 621,
"height": 122,
"rawWidth": 1024,
"rawHeight": 128,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "67c3e5ef-87ca-4251-8f03-79dcf3804449",
"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":-413.13,"y":-32.68,"width":780,"height":111.5},"bone":[{"name":"root"},{"length":46,"name":"___1","parent":"root","transform":{"x":0.675,"y":76.25,"skX":-88.3821,"skY":-88.3821}},{"length":57.5,"name":"___11","parent":"___1","transform":{"x":47.9926,"y":-0.05505,"skX":1.6469,"skY":1.6469}}],"slot":[{"name":"___1","parent":"___11"}],"skin":[{"slot":[{"name":"___1","display":[{"type":"mesh","name":"前景草/___1","width":780,"height":111,"vertices":[-389.37,-32.52,-390,20.68,-390,79,-275.67,79,-146.17,79,1.65,79,156.12,79,298.7,79,390.05,79,390.05,-32.52,290.85,-32.52,156.12,-32.52,-0.32,-32.52,-156.72,-32.52,-282.25,-32.52],"uvs":[0.0008,-0.00022,0,0.47691,0,1,0.14657,1,0.3126,1,0.50212,1,0.70016,1,0.88295,1,1.00006,1,1.00006,-0.00022,0.87288,-0.00022,0.70016,-0.00022,0.49958,-0.00022,0.29907,-0.00022,0.13814,-0.00022],"triangles":[10,7,9,9,7,8,11,6,10,10,6,7,12,5,11,11,5,6,13,4,12,12,4,5,14,3,13,13,3,4,14,1,3,1,2,3,0,1,14],"weights":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,0.52,1,0.48,1,2,1,2,1,0.010672,2,0.989328,1,2,1,2,2,0.47,1,0.53],"slotPose":[1,0,0,1,0,0],"bonePose":[1,0.028234,-0.999601,0.999601,0.028234,0.675,76.25,2,0.056951,-0.998377,0.998377,0.056951,1.975,28.275],"edges":[0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,14,14,0],"userEdges":[]}]}]}],"animation":[{"duration":96,"playTimes":0,"name":"normal","bone":[{"name":"___11","rotateFrame":[{"duration":24,"tweenEasing":0},{"duration":24,"tweenEasing":0,"rotate":4.16},{"duration":24,"tweenEasing":0},{"duration":24,"tweenEasing":0,"rotate":4.16},{"duration":0}]}]}],"defaultActions":[{"gotoAndPlay":"normal"}],"canvas":{"width":780,"height":360}}]}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "94c18ece-fc81-40ca-873b-4e4f23107b8f",
"subMetas": {}
}
\ No newline at end of file
{"width":1024,"imagePath":"前景草_tex.png","height":128,"name":"前景草","SubTexture":[{"width":780,"y":1,"height":112,"name":"前景草/___1","x":1}]}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "4c14d4d6-d858-46d8-aa80-33e93f005d0b",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "04859e33-b31a-4409-8e9a-4a56748a8bfc",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1024,
"height": 128,
"platformSettings": {},
"subMetas": {
"前景草_tex": {
"ver": "1.0.4",
"uuid": "c1f435d4-6989-4de6-a62b-6638df40a2a9",
"rawTextureUuid": "04859e33-b31a-4409-8e9a-4a56748a8bfc",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -121,
"offsetY": 7,
"trimX": 1,
"trimY": 1,
"width": 780,
"height": 112,
"rawWidth": 1024,
"rawHeight": 128,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "f202c5de-fd3b-4d58-ba53-8838de550a8d",
"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": "80f3099d-b9df-48db-995c-3975f6b7b879",
"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": "3f12102b-b26a-4774-b455-c1a358e04b76",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "217cbcd0-3bcc-4cfe-b5d2-f873370f85c9",
"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": "c9f7d74b-6657-4a94-8c0a-68ce1475dced",
"rawTextureUuid": "217cbcd0-3bcc-4cfe-b5d2-f873370f85c9",
"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", "ver": "1.1.2",
"uuid": "20185448-a1ca-4de2-8b37-7bf6cdfccbae", "uuid": "03879fc8-4b4c-4c04-becb-b50d04f26517",
"isBundle": false, "isBundle": false,
"bundleName": "", "bundleName": "",
"priority": 1, "priority": 1,
......
{ {
"ver": "1.1.0", "ver": "1.1.0",
"uuid": "c551970e-b095-45f3-9f1d-25cde8b8deb1", "uuid": "2748fd4f-7693-4ab9-936c-064ea377df2e",
"subMetas": {} "subMetas": {}
} }
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "acbceb92-f6d8-4cc7-8e77-dbab1d6ad525",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "e0eefaaf-3e56-429a-8330-0eaf526b074b",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "5ba83997-ada8-49db-8127-6c0bca707f84",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "f995d868-89ec-4dda-8225-cadd31d3f555",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "94c4f86c-c039-4ccd-b172-6dd1e7c410b2",
"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": "8cf18276-d586-4e15-81b9-2fee0d057935",
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
{
"ver": "1.0.8",
"uuid": "df3788d5-0184-4ea5-bc88-2c34d8067b13",
"isPlugin": true,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": true,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "4a4e4f1e-1f0a-4e61-aaf6-73698be7aa72",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "e8c9ddfb-481a-4ac3-8d47-f2c1ac172e62",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.2.9",
"uuid": "54a1390a-f2e8-4399-8d23-477f9c88cdbc",
"optimizationPolicy": "SINGLE_INSTANCE",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "0d615143-beef-47e1-905d-4e88d1644981",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "1a07b6bd-0e10-4a02-9a46-8b0ccc83c557",
"subMetas": {}
}
\ No newline at end of file
{ {
"ver": "2.3.5", "ver": "2.3.5",
"uuid": "efa5fa09-a4dd-4bfc-ab7e-17c19f85408f", "uuid": "16d3a8cb-8368-4ad8-a288-7f958538a2bb",
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": false,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 366, "width": 2176,
"height": 336, "height": 1600,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"1orange": { "bg": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "43d1e79d-6de8-4dcb-b8ce-d767df7913aa", "uuid": "ffb7d166-954a-40f4-b406-7ae40925b174",
"rawTextureUuid": "efa5fa09-a4dd-4bfc-ab7e-17c19f85408f", "rawTextureUuid": "16d3a8cb-8368-4ad8-a288-7f958538a2bb",
"trimType": "auto", "trimType": "auto",
"trimThreshold": 1, "trimThreshold": 1,
"rotated": false, "rotated": false,
"offsetX": 0, "offsetX": 0,
"offsetY": -0.5, "offsetY": 0,
"trimX": 0, "trimX": 0,
"trimY": 1, "trimY": 0,
"width": 366, "width": 2176,
"height": 335, "height": 1600,
"rawWidth": 366, "rawWidth": 2176,
"rawHeight": 336, "rawHeight": 1600,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
......
{
"ver": "1.1.0",
"uuid": "f2a53312-f7bc-4f66-b1b5-1fd93dfbad58",
"subMetas": {}
}
\ No newline at end of file
{ {
"ver": "2.3.5", "ver": "2.3.5",
"uuid": "d582359e-924e-4ee9-9964-1fc4bb417e71", "uuid": "9d4f5a94-33b2-41ce-96e6-04936a55f33a",
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": false,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 61, "width": 184,
"height": 67, "height": 184,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"btn_right": { "head_4": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "e5a2dbaa-a677-4a32-90d7-a1b057d7fb59", "uuid": "1aa9cde2-5eb0-40d5-8808-10c6876836e1",
"rawTextureUuid": "d582359e-924e-4ee9-9964-1fc4bb417e71", "rawTextureUuid": "9d4f5a94-33b2-41ce-96e6-04936a55f33a",
"trimType": "auto", "trimType": "auto",
"trimThreshold": 1, "trimThreshold": 1,
"rotated": false, "rotated": false,
"offsetX": -0.5, "offsetX": 0,
"offsetY": 0.5, "offsetY": 0,
"trimX": 0, "trimX": 0,
"trimY": 0, "trimY": 0,
"width": 60, "width": 184,
"height": 66, "height": 184,
"rawWidth": 61, "rawWidth": 184,
"rawHeight": 67, "rawHeight": 184,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
......
{
"ver": "2.3.5",
"uuid": "e61ba1a0-e1b8-4b98-905e-a8f90c0335c7",
"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": "b413e76a-a5f7-40c3-8485-09e9db8411c5",
"rawTextureUuid": "e61ba1a0-e1b8-4b98-905e-a8f90c0335c7",
"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": "e4eaeebb-ab36-436d-8873-bdaf0ef9e410",
"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": "2c405cb0-d094-4395-af56-050e27f99aaf",
"rawTextureUuid": "e4eaeebb-ab36-436d-8873-bdaf0ef9e410",
"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": "6dff7cf9-b0f6-4a50-a752-ab5913796449",
"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": "05b209f5-b47f-4135-870b-5c7f34c0b6c9",
"rawTextureUuid": "6dff7cf9-b0f6-4a50-a752-ab5913796449",
"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": "6c136a34-d430-4dc4-86f5-dd8abd135093",
"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": "b7d60ab5-b73c-4260-99f8-a7a75a7ca0c1",
"rawTextureUuid": "6c136a34-d430-4dc4-86f5-dd8abd135093",
"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": "a53e517a-d663-4fd0-b171-19fa16645212",
"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": "ff1271de-34dd-471c-a48e-80a7a5cc6acf",
"rawTextureUuid": "a53e517a-d663-4fd0-b171-19fa16645212",
"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
{
"ver": "2.3.5",
"uuid": "824302c2-e7eb-4251-86a7-d9fc1533946b",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 388,
"height": 388,
"platformSettings": {},
"subMetas": {
"tx_xuanzhong": {
"ver": "1.0.4",
"uuid": "2d7f0e6b-d5f6-4c53-886c-dca6b2beb70e",
"rawTextureUuid": "824302c2-e7eb-4251-86a7-d9fc1533946b",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 388,
"height": 388,
"rawWidth": 388,
"rawHeight": 388,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
const { ccclass, property } = cc._decorator;
@ccclass
export default class op_72_plus_LoadingLayer extends cc.Component {
private _maxPlayerNum: any;
private _onLoadFinishFunc: any;
ctor() {
}
_timeoutIds;
_maxRate
// 生命周期 onLoad
onLoad() {
this._timeoutIds = [];
this._timeoutIds = [];
this._maxRate = 0;
this.initSize();
}
_designSize; // 设计分辨率
_frameSize; // 屏幕分辨率
_mapScaleMin; // 场景中常用缩放(取大值)
_mapScaleMax; // 场景中常用缩放(取小值)
_cocosScale; // cocos 自缩放 (较少用到)
initSize() {
// 注意cc.winSize只有在适配后(修改fitHeight/fitWidth后)才能获取到正确的值,因此使用cc.getFrameSize()来获取初始的屏幕大小
let screen_size = cc.view.getFrameSize().width / cc.view.getFrameSize().height
let design_size = cc.Canvas.instance.designResolution.width / cc.Canvas.instance.designResolution.height
let f = screen_size >= design_size
cc.Canvas.instance.fitHeight = f
cc.Canvas.instance.fitWidth = !f
const frameSize = cc.view.getFrameSize();
this._frameSize = frameSize;
this._designSize = cc.view.getDesignResolutionSize();
let sx = cc.winSize.width / frameSize.width;
let sy = cc.winSize.height / frameSize.height;
this._cocosScale = Math.min(sx, sy);
sx = frameSize.width / this._designSize.width;
sy = frameSize.height / this._designSize.height;
this._mapScaleMin = Math.min(sx, sy) * this._cocosScale;
this._mapScaleMax = Math.max(sx, sy) * this._cocosScale;
}
// 生命周期 start
async start() {
this.updateLabel('创建房间中');
this.progressTo(0.1, 1);
await this.asyncDelay(1);
this.updateLabel('匹配小伙伴中');
}
async initView() {
this.setMaxPlayerNumber(5);
}
setMaxPlayerNumber(number) {
this._maxPlayerNum = number;
}
_playerList;
addPlayer(name, isSelf, headUrl, uuid) {
if (!this._playerList) {
this._playerList = [];
}
if (this._playerList.find(player => player.uuid == uuid)) {
return;
}
this._playerList.push({ name, isSelf, headUrl, uuid });
console.log('name = ' + name);
const layout = cc.find('layout', this.node);
const headNode = cc.instantiate(cc.find('head', this.node));
headNode.x = 0;
headNode.y = 0;
headNode.active = true;
const frameSelf = cc.find('frame_self', headNode);
if (!isSelf) {
frameSelf.opacity = 0;
}
const nameLabel = cc.find('name', headNode);
nameLabel.getComponent(cc.Label).string = name;
const headImg = cc.find('mask/headImg', headNode);
this.loadSpriteByUrl(headImg, headUrl, () => {
const scale = Math.max(
headImg.parent.width / headImg.width,
headImg.parent.height / headImg.height
);
headImg.scale = scale;
});
layout.addChild(headNode);
const rate = Math.min(1, layout.children.length / this._maxPlayerNum);
if (rate == 1) {
this.updateLabel('同步中');
}
this.progressTo(rate, 3);
}
onLoadFinished(func) {
this._onLoadFinishFunc = func;
}
async asyncDelay(time) {
return new Promise((resolve, reject) => {
try {
this._timeoutIds.push(setTimeout(() => {
resolve("");
}, time * 1000));
} catch (e) {
reject(e);
}
});
}
updateLabel(str) {
const label = cc.find('label', this.node).getComponent(cc.Label);
if (label.tweenAction) {
label.tweenAction.stop();
}
label.tweenAction = cc.tween(label)
.set({ string: `${str}` })
.delay(0.4)
.set({ string: `${str}.` })
.delay(0.4)
.set({ string: `${str}..` })
.delay(0.4)
.set({ string: `${str}...` })
.delay(0.4)
.union()
.repeatForever()
.start();
}
progressTo(rate, time) {
this._maxRate = Math.max(this._maxRate, rate);
const duration = Math.max(time + this.RandomInt(-1, 1), 1);
const progress = cc.find('progressBar', this.node).getComponent(cc.ProgressBar);
if (progress.tweenAction) {
progress.tweenAction.stop();
}
const easingList = [
'linear',
'quadInOut',
'cubicInOut',
];
progress.tweenAction = cc.tween(progress)
.to(duration, { progress: this._maxRate }, { easing: easingList[this.RandomInt(easingList.length)] })
.call(() => {
if (rate == 1) {
if (this._onLoadFinishFunc) {
this._onLoadFinishFunc();
}
this.node.active = false;
}
})
.start();
}
RandomInt(a, b = 0) {
let max = Math.max(a, b);
let min = Math.min(a, b);
return Math.floor(Math.random() * (max - min) + min);
}
// ------------------------------------------------
loadSpriteByUrl(node, url, cb) {
cc.loader.load({ url }, (err, img) => {
if (!node) {
cb && cb();
}
const spriteFrame = new cc.SpriteFrame(img)
const spr = node.getComponent(cc.Sprite);
spr.spriteFrame = spriteFrame;
cb && cb();
});
}
currentPlayedAudioId;
stopCurrentPlayedAudio() {
if (this.currentPlayedAudioId !== null) {
cc.audioEngine.stop(this.currentPlayedAudioId);
this.currentPlayedAudioId = null;
}
}
playEffect(name, cb) {
this.stopCurrentPlayedAudio();
const audioNode = cc.find(`audios/${name}`);
const audioClip = audioNode.getComponent(cc.AudioSource).clip;
const audioId = cc.audioEngine.play(audioClip, false, 0.8);
this.currentPlayedAudioId = audioId;
if (cb) {
cc.audioEngine.setFinishCallback(audioId, cb);
}
}
playAudioByUrl(audio_url, cb = null) {
if (!audio_url) {
if (cb) {
cb();
}
return;
}
this.stopCurrentPlayedAudio();
cc.assetManager.loadRemote(audio_url.toLowerCase(), (err, audioClip: any) => {
const audioId = cc.audioEngine.play(audioClip, false, 0.8);
this.currentPlayedAudioId = audioId;
if (cb) {
cc.audioEngine.setFinishCallback(audioId, cb);
}
});
}
_intervalIds;
// 生命周期
onDestroy() {
this._timeoutIds.forEach(id => {
clearTimeout(id);
});
this._intervalIds.forEach(id => {
clearInterval(id);
});
}
}
{ {
"ver": "1.0.8", "ver": "1.0.8",
"uuid": "408a67f8-65fa-4cf1-8cf2-83e20e1a0fd5", "uuid": "037aa296-8cd3-4205-8fa6-ee0ec1413995",
"isPlugin": false, "isPlugin": false,
"loadPluginInWeb": true, "loadPluginInWeb": true,
"loadPluginInNative": true, "loadPluginInNative": true,
......
{
"ver": "1.1.2",
"uuid": "52a47521-1d0d-4e11-8529-f222dc72f0ee",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.2.9",
"uuid": "c5a985e1-e0fd-4a7f-9e30-13b428f320f5",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}
\ No newline at end of file
cc.Class({
extends: cc.Component,
properties: {
},
start() {
const BtnExit = cc.find('BtnFrame/BtnExit', this.node);
this.buttonOnClick(BtnExit, () => {
const middleLayer = cc.find('middleLayer');
if (middleLayer) {
const middleLayerComponent = middleLayer.getComponent('middleLayer');
if (middleLayerComponent.onClickExitBtn) {
middleLayerComponent.onClickExitBtn();
}
} else {
cc.director.getScene().destroy();
cc.audioEngine.stopAll();
if (window.courseware) {
window.courseware.freeAllOcMethod();
}
var bundle = cc.assetManager.bundles.find((obj) => {
return obj.getSceneInfo('debug_shell');
});
if (bundle) {
cc.director.loadScene("debug_shell", null, null, (err, scene) => { });
} else {
cc.director.loadScene("OXFORDCORE", null, null, (err, scene) => { });
}
}
});
const BtnPlayAgain = cc.find('BtnFrame/BtnPlayAgain', this.node);
this.buttonOnClick(BtnPlayAgain, () => {
const middleLayer = cc.find('middleLayer');
if (middleLayer) {
const middleLayerComponent = middleLayer.getComponent('middleLayer');
if (middleLayerComponent) {
middleLayerComponent.reloadBundle();
}
} else {
const sceneName = cc.director.getScene().name;
cc.director.getScene().destroy();
cc.audioEngine.stopAll();
if (window.courseware) {
window.courseware.freeAllOcMethod();
}
cc.director.loadScene(sceneName, null, null, (err, scene) => { });
}
});
},
buttonOnClick(button, callback, scale = 1.0) {
button.on('click', () => {
if (button['cantClick']) {
return;
}
button['cantClick'] = true;
cc.tween(button)
.to(0.1, { scale: scale * 1.1 })
.to(0.1, { scale: scale })
.call(() => {
button['cantClick'] = false;
callback && callback();
})
.start();
});
}
});
{
"ver": "1.0.8",
"uuid": "dde6ade7-d0f2-4e2e-ad33-bce0d0e9511d",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
{ {
"ver": "1.1.2", "ver": "1.1.2",
"uuid": "8ba21262-178f-4fa5-afc9-2c1dd50ba3ab", "uuid": "fa04a96d-9fb8-4db9-9c07-e9d9f0a3e850",
"isBundle": false, "isBundle": false,
"bundleName": "", "bundleName": "",
"priority": 1, "priority": 1,
......
{
"ver": "2.3.5",
"uuid": "80b4d9d5-0f25-41a8-a2d2-3b9dac88cf39",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 158,
"height": 60,
"platformSettings": {},
"subMetas": {
"BtnExit": {
"ver": "1.0.4",
"uuid": "088cb88b-7783-4489-85d3-e44b19d43e0f",
"rawTextureUuid": "80b4d9d5-0f25-41a8-a2d2-3b9dac88cf39",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 158,
"height": 60,
"rawWidth": 158,
"rawHeight": 60,
"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.
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