Commit 30955449 authored by Tt's avatar Tt

finished

parent 3b680f1f
{
"ver": "2.0.1",
"uuid": "f0680ae0-c079-45ef-abd7-9e63d90b982b",
"uuid": "d7ee13c8-7c6f-4ed4-bf81-c85ae91edfa9",
"downloadMode": 0,
"duration": 0.130612,
"duration": 7.74,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "fc2be55f-3d94-44e0-9ebf-09e0eaa47873",
"downloadMode": 0,
"duration": 10.944,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "4d2df5f4-a774-4e06-a410-4e38195952ad",
"downloadMode": 0,
"duration": 0.365714,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "0d2dd7a8-9bc2-4cd5-a432-a13f8fb43033",
"downloadMode": 0,
"duration": 1.044898,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "a544c1e7-32f5-4754-95a2-823398db0dcc",
"downloadMode": 0,
"duration": 0.287347,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "293ae196-a9b5-4da0-a0b6-597baa25f7b1",
"downloadMode": 0,
"duration": 0.365714,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "b733b7d3-4082-4320-9fe0-2ce28088b687",
"downloadMode": 0,
"duration": 0.966531,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "e87d3f15-54b2-4a37-9793-9923fa34fda9",
"downloadMode": 0,
"duration": 0.626939,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "d9be9283-652e-44da-98d6-680406e71a03",
"downloadMode": 0,
"duration": 0.168,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "7bf9c308-8dd5-411d-8770-ddc8341386d0",
"downloadMode": 0,
"duration": 0.39185,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "ac17bb63-beac-4d42-bc52-1d53b848082f",
"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": "42cb15db-315a-4d11-9814-0fe5f8808a72",
"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": "b2242a6f-c54f-4b2d-8151-89a713576e41",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "c8f02f6a-80f7-4712-8a8c-26db0a90ab03",
"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": "837a88a0-d171-4421-8e58-63a525eabc62",
"rawTextureUuid": "c8f02f6a-80f7-4712-8a8c-26db0a90ab03",
"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": "6fca0a2c-2b67-4da6-8255-260ba2320830",
"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":-57.5,"y":-420,"width":152,"height":97},"bone":[{"name":"root"},{"length":84,"name":"烟花","parent":"root","transform":{"x":-3,"y":-332,"skX":-91.3639,"skY":-91.3639}}],"slot":[{"name":"烟花","parent":"烟花"},{"displayIndex":-1,"name":"1","parent":"root"}],"skin":[{"slot":[{"name":"烟花","display":[{"name":"烟花/烟花","transform":{"x":38.98,"y":22.43,"skX":91.36,"skY":91.36}}]},{"name":"1","display":[{"name":"烟花/1","transform":{"x":-3,"y":-385.5}},{"name":"烟花/2","transform":{"x":-2,"y":-406}},{"name":"烟花/3","transform":{"y":-425.5}},{"name":"烟花/4","transform":{"x":-6,"y":-434}},{"name":"烟花/5","transform":{"x":-7.5,"y":-439.5}},{"name":"烟花/6","transform":{"x":-11,"y":-439.5}},{"name":"烟花/7","transform":{"x":-15.5,"y":-431.5}},{"name":"烟花/8","transform":{"x":-5,"y":-425.5}},{"name":"烟花/9","transform":{"y":-420}}]}]}],"animation":[{"duration":30,"playTimes":0,"name":"normal","bone":[{"name":"烟花","translateFrame":[{"duration":10,"tweenEasing":0,"y":421.44},{"duration":20}]}],"slot":[{"name":"烟花","displayFrame":[{"duration":12},{"duration":18,"value":-1}]},{"name":"1","displayFrame":[{"duration":12,"value":-1},{"duration":2},{"duration":2,"value":1},{"duration":2,"value":2},{"duration":2,"value":3},{"duration":2,"value":4},{"duration":2,"value":5},{"duration":2,"value":6},{"duration":2,"value":7},{"duration":2,"value":8},{"duration":0,"value":-1}]}]}],"defaultActions":[{"gotoAndPlay":"normal"}]}]}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "bce4f069-c7dc-4d7c-bdae-9528d291dc83",
"subMetas": {}
}
\ No newline at end of file
{"width":1024,"imagePath":"烟花_tex.png","height":1024,"name":"烟花","SubTexture":[{"width":152,"y":605,"height":97,"name":"烟花/烟花","x":323},{"width":167,"y":645,"height":65,"name":"烟花/1","x":1},{"width":267,"y":505,"height":98,"name":"烟花/4","x":323},{"width":456,"y":264,"height":239,"name":"烟花/7","x":528},{"width":193,"y":505,"height":54,"name":"烟花/2","x":592},{"width":493,"y":1,"height":261,"name":"烟花/8","x":528},{"width":409,"y":275,"height":211,"name":"烟花/6","x":1},{"width":320,"y":488,"height":155,"name":"烟花/5","x":1},{"width":525,"y":1,"height":272,"name":"烟花/9","x":1},{"width":203,"y":505,"height":33,"name":"烟花/3","x":787}]}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "6edbd32c-4733-466b-a910-5cf85b3eaef8",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "c138e5ff-6afa-4eef-8c24-7308cc6e2f7b",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1024,
"height": 1024,
"platformSettings": {},
"subMetas": {
"烟花_tex": {
"ver": "1.0.4",
"uuid": "91a38a51-4650-4bb3-89db-b1827ed75bf2",
"rawTextureUuid": "c138e5ff-6afa-4eef-8c24-7308cc6e2f7b",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -1,
"offsetY": 156.5,
"trimX": 1,
"trimY": 1,
"width": 1020,
"height": 709,
"rawWidth": 1024,
"rawHeight": 1024,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "9f991a7e-ecea-4eaf-9885-a86a224536db",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"ver": "1.0.8",
"uuid": "771c13cf-dd4a-4c25-9dca-413a319550cf",
"isPlugin": true,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "37dec809-5c30-48d6-a760-640872b102e3",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "3ea68530-b11e-4763-9b54-2613d28bab9c",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
cc.Class({
extends: cc.Component,
properties: {
},
ctor() {
this._timeoutIds = [];
this._intervalIds = [];
this._maxRate = 0;
},
// 生命周期 onLoad
onLoad() {
this.initSize();
},
_designSize: null, // 设计分辨率
_frameSize: null, // 屏幕分辨率
_mapScaleMin: null, // 场景中常用缩放(取大值)
_mapScaleMax: null, // 场景中常用缩放(取小值)
_cocosScale: null, // 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: null,
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: null,
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) => {
const audioId = cc.audioEngine.play(audioClip, false, 0.8);
this.currentPlayedAudioId = audioId;
if (cb) {
cc.audioEngine.setFinishCallback(audioId, cb);
}
});
},
_timeoutIds: null,
_intervalIds: null,
// 生命周期
onDestroy() {
this._timeoutIds.forEach(id => {
clearTimeout(id);
});
this._intervalIds.forEach(id => {
clearInterval(id);
});
},
});
{
"ver": "1.0.8",
"uuid": "f8b451ff-857c-4ca8-9870-866bc5154a29",
"uuid": "4958153e-41d4-4e14-ab85-924b2e2ef7d8",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
......
{
"ver": "1.2.9",
"uuid": "4839576b-7c74-49ab-aa3e-8eeec631d7c0",
"optimizationPolicy": "SINGLE_INSTANCE",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "b0630a70-c307-47a2-8793-4f2b7043c9bc",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "c551970e-b095-45f3-9f1d-25cde8b8deb1",
"uuid": "b2c8b99b-9591-4c2d-8fe0-34536a5d109d",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "efa5fa09-a4dd-4bfc-ab7e-17c19f85408f",
"uuid": "47ac2804-dd13-4e67-a551-f2af947a17a4",
"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": "2163211c-9302-4166-893a-be24e4eda962",
"rawTextureUuid": "47ac2804-dd13-4e67-a551-f2af947a17a4",
"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": "bdac295a-5671-4f2e-a096-d1f0cbe4355b",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "d582359e-924e-4ee9-9964-1fc4bb417e71",
"uuid": "206857ca-d877-4bb2-892b-9b2b6cd6e934",
"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": "846e4d5a-f87b-4a56-87ee-f007c80c9818",
"rawTextureUuid": "206857ca-d877-4bb2-892b-9b2b6cd6e934",
"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": "30eca875-dbb3-4505-b41f-3f502fa4f3e7",
"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": "6359268b-7d99-407e-a7e4-2d29eaf0bc67",
"rawTextureUuid": "30eca875-dbb3-4505-b41f-3f502fa4f3e7",
"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": "2614ae74-82b8-4165-b007-67734e1fab8e",
"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": "18994b29-1d03-4165-a3ec-a470e996e99a",
"rawTextureUuid": "2614ae74-82b8-4165-b007-67734e1fab8e",
"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": "2c93c432-230b-45d4-816a-4701687c9f0d",
"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": "0c20d442-93df-4a35-aced-0c2b30f738dc",
"rawTextureUuid": "2c93c432-230b-45d4-816a-4701687c9f0d",
"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": "3377045c-74ca-4627-8df4-0c602930a041",
"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": "d1e76bbe-19cd-4b0f-b1e4-1dab0f15db1b",
"rawTextureUuid": "3377045c-74ca-4627-8df4-0c602930a041",
"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": "407949db-a810-44d7-ada9-9956e0feb5dd",
"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": "89d07b3a-2999-49eb-9a7f-31addfa26717",
"rawTextureUuid": "407949db-a810-44d7-ada9-9956e0feb5dd",
"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": "c66a5e80-6f62-4db4-8b0e-dd54c24577da",
"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": "18e7b494-5f08-424a-bcc9-7c802668be83",
"rawTextureUuid": "c66a5e80-6f62-4db4-8b0e-dd54c24577da",
"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
{
"ver": "1.1.2",
"uuid": "2cafa4b9-7926-4978-9a3c-0a94a63e6def",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
cc.Class({
extends: cc.Component,
properties: {
},
start () {
const BtnExit = cc.find('BtnFrame/BtnExit', this.node);
BtnExit.on('click', ()=>{
const middleLayer = cc.find('middleLayer');
cc.game.removePersistRootNode(middleLayer);
cc.director.getScene().destroy();
cc.audioEngine.stopAll();
if (window.courseware) {
window.courseware.freeAllOcMethod();
}
cc.director.loadScene("debug_shell", null, null, (err, scene) => {
});
});
const BtnPlayAgain = cc.find('BtnFrame/BtnPlayAgain', this.node);
BtnPlayAgain.on('click', ()=>{
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) => {
});
});
},
});
{
"ver": "1.0.8",
"uuid": "408a67f8-65fa-4cf1-8cf2-83e20e1a0fd5",
"uuid": "b0f566a5-d2a1-4389-9c1c-92e315e3f71a",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
......
{
"ver": "1.2.9",
"uuid": "1e11f1b1-8bd1-448d-92da-17f062444db3",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "75afd7d5-1552-4361-bbb6-acd728a170a9",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "9a79969a-0506-48d4-bc98-3c05d109b027",
"uuid": "484a02bb-20eb-4a48-b440-c9b9c08bed96",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 61,
"height": 67,
"width": 158,
"height": 60,
"platformSettings": {},
"subMetas": {
"btn_left": {
"BtnExit": {
"ver": "1.0.4",
"uuid": "ce19457d-e8f3-4c38-ae3e-d4b99208ddb5",
"rawTextureUuid": "9a79969a-0506-48d4-bc98-3c05d109b027",
"uuid": "5ad5a040-45af-4787-b6ad-ef6d25814c6c",
"rawTextureUuid": "484a02bb-20eb-4a48-b440-c9b9c08bed96",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
......@@ -22,10 +22,10 @@
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 61,
"height": 67,
"rawWidth": 61,
"rawHeight": 67,
"width": 158,
"height": 60,
"rawWidth": 158,
"rawHeight": 60,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
......
{
"ver": "2.3.5",
"uuid": "cb354f78-665c-443e-9893-e06d09b42cd4",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 684,
"height": 244,
"platformSettings": {},
"subMetas": {
"BtnFrame": {
"ver": "1.0.4",
"uuid": "4560a114-94c8-4372-ade2-c489c6e74bb7",
"rawTextureUuid": "cb354f78-665c-443e-9893-e06d09b42cd4",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 684,
"height": 244,
"rawWidth": 684,
"rawHeight": 244,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "90340e1e-6634-40aa-936d-a81f5968ffc0",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 158,
"height": 60,
"platformSettings": {},
"subMetas": {
"BtnPlayAgain": {
"ver": "1.0.4",
"uuid": "f5f86bc8-874a-4fd8-9dc9-e89b2f7420e6",
"rawTextureUuid": "90340e1e-6634-40aa-936d-a81f5968ffc0",
"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
export class NetworkHelper {
_eventListeners: any = {};
ctor() {}
on(eventName, func) {
this._eventListeners[eventName] = func;
}
async init(roomType: string, maxPlayers: number) {
this.initRoom();
try {
return await this.joinRoom(roomType, maxPlayers);
} catch (e) {
await this.initListener();
this.initRoom();
return await this.joinRoom(roomType, maxPlayers);
}
}
async startGame() {
await this.startFrameSync();
await this.closeRoom();
}
async stopGame() {
await this.stopFrameSync();
await this.leaveRoom();
}
getRoomInfo() {
return this.room.roomInfo;
}
initListener() {
if (MGOBE.Player.id !== undefined) {
return;
}
return new Promise((resolve, reject) => {
const gameId = "obg-i4ql53h1"; //替换为控制台上的 游戏 ID
const secretKey = "060d81c7abaf24c8ce2afc5a725c152062676d35"; //替换为控制台上的 游戏 Key
const serverUrl = "i4ql53h1.wxlagame.com"; //替换为控制台上的 域名
const gameInfo = {
gameId: gameId,
openId: "openid_test" + Math.random(), //自定义的用户唯一ID
secretKey: secretKey,
};
const config = {
url: serverUrl,
reconnectMaxTimes: 5,
reconnectInterval: 1000,
resendInterval: 1000,
resendTimeout: 10000,
cacertNativeUrl: "",
};
MGOBE.DebuggerLog.enable = false;
// 如果是原生平台,则加载 Cert 证书,否则会提示 WSS 错误
if (cc.sys.isNative) {
let cacertFile;
const cacertNode = cc.find("cacertNode");
if (cacertNode) {
cacertFile = cacertNode.getComponent("cacert").cacertFile;
}
if (!cacertFile) {
this.log("没有cacertFile!!!");
}
config.cacertNativeUrl =
cc.loader.md5Pipe && cc.ENGINE_VERSION < "2.4.0"
? cc.loader.md5Pipe.transformURL(cacertFile.nativeUrl)
: cacertFile.nativeUrl;
}
MGOBE.Listener.init(gameInfo, config, (event) => {
this.log(JSON.stringify(event));
if (event.code !== 0) {
this.log("初始化失败: " + event.code);
reject();
return;
}
this.log("初始化成功");
resolve(null);
});
});
}
room: MGOBE.Room;
initRoom() {
this.room = new MGOBE.Room();
MGOBE.Listener.add(this.room);
this.room.onJoinRoom = this.onJoinRoom.bind(this);
this.room.onLeaveRoom = this.onLeaveRoom.bind(this);
this.room.onRecvFromClient = this.onRecvFromClient.bind(this);
this.room.onRecvFrame = this.onRecvFrame.bind(this);
this.room.onChangePlayerNetworkState =
this.onChangePlayerNetworkState.bind(this);
this.room.onStartFrameSync = this.onStartFrameSync.bind(this);
this.room.onStopFrameSync = this.onStopFrameSync.bind(this);
this.room.onRecvFromGameSvr = this.onRecvFromGameSvr.bind(this);
this.log("this.room = " + JSON.stringify(this.room.roomInfo));
}
joinRoom(roomType: string, maxPlayers: number, customData: string = "") {
return new Promise((resolve, reject) => {
const playerName = "Tom" + Math.random();
const playerInfo = {
name: playerName,
customPlayerStatus: 0,
customProfile: customData,
};
const matchRoomPara = {
playerInfo,
maxPlayers: maxPlayers,
roomType: roomType,
};
this.room.matchRoom(matchRoomPara, (event) => {
this.log(JSON.stringify(event));
if (event.code === 0) {
cc.log("匹配成功: " + event.data.roomInfo.id);
const player = event.data.roomInfo.playerList.find(
(player) => player.name == playerName
);
if (this.checkRoomOwnerOffLine()) {
if (this._eventListeners["playerOffLine"]) {
this._eventListeners["playerOffLine"](event);
}
cc.log("房主掉线了");
resolve(null);
return;
}
resolve(player.id);
} else {
cc.log("匹配失败");
reject(event);
}
});
});
}
leaveRoom() {
return new Promise((resolve, reject) => {
this.room.leaveRoom({}, (event) => {
this.log(JSON.stringify(event));
if (event.code === 0) {
this.log("退房成功" + this.room.roomInfo.id);
// this.room.initRoom();
resolve(null);
} else {
this.log("退房失败");
}
});
});
}
closeRoom() {
return new Promise((resolve, reject) => {
this.room.changeRoom({ isForbidJoin: true }, (event) => {
console.log("关门");
this.log(JSON.stringify(event));
resolve(null);
});
});
}
sendMessage() {
const sendToClientPara = {
recvType: MGOBE.ENUM.RecvType.ROOM_ALL,
recvPlayerList: [],
msg: "hello" + Math.random(),
};
this.room.sendToClient(sendToClientPara, (event) => console.log(event));
}
startFrameSync() {
return new Promise((resolve, reject) => {
this.room.startFrameSync({}, (event) => {
this.log(JSON.stringify(event));
if (event.code === 0) {
cc.log("开始帧同步成功,请到控制台查看具体帧同步信息");
resolve(null);
} else {
reject();
}
});
});
}
stopFrameSync() {
return new Promise((resolve, reject) => {
if (!this.room) {
resolve(null);
return;
}
this.room.stopFrameSync({}, (event) => {
this.log(JSON.stringify(event));
if (event.code === 0) {
this.log("停止帧同步成功");
resolve(null);
} else {
this.log("停止帧同步失败");
reject(event.code);
}
});
});
}
sendToServer() {
const sendToGameServerPara = {
data: {
cmd: 1,
},
};
this.room.sendToGameSvr(sendToGameServerPara, (event) =>
console.log(event)
);
}
sendFrame(data: any) {
this.room.sendFrame({ data }, (err) => {
if (err.code != 0) {
console.log("err", err);
}
});
}
onJoinRoom(event) {
if (this._eventListeners["playerJoin"]) {
this._eventListeners["playerJoin"](event);
}
console.log("新玩家加入", event.data.joinPlayerId);
}
onLeaveRoom(event) {
if (this._eventListeners["playerLeave"]) {
this._eventListeners["playerLeave"](event);
}
console.log("玩家退出", event.data.leavePlayerId);
}
onRecvFromClient() {}
checkRoomOwnerOffLine() {
const owner = this.room.roomInfo.playerList.find(
(player) => player.id == this.room.roomInfo.owner
);
return (
owner.commonNetworkState == MGOBE.types.NetworkState.COMMON_OFFLINE ||
owner.relayNetworkState == MGOBE.types.NetworkState.RELAY_OFFLINE
);
}
onChangePlayerNetworkState(event) {
console.log("玩家网络变化: " + JSON.stringify(event));
if (this.checkRoomOwnerOffLine()) {
if (this._eventListeners["playerOffLine"]) {
this._eventListeners["playerOffLine"](event);
}
cc.log("房主掉线了");
}
}
onRecvFrame(event) {
if (this._eventListeners["frameEvent"]) {
this._eventListeners["frameEvent"](event);
}
}
onStartFrameSync(event) {
if (this._eventListeners["gameStart"]) {
this._eventListeners["gameStart"](event);
}
}
onStopFrameSync(event) {}
onRecvFromGameSvr() {}
async onDestroy() {
try {
this.log("onDestroy1");
MGOBE.Listener.clear();
await this.stopGame();
this.log("onDestroy2");
} catch (e) {
this.log(JSON.stringify(e));
}
}
log(str) {
const node = cc.find("middleLayer");
if (node) {
node.getComponent("middleLayer").log(str);
} else {
cc.log(str);
}
}
}
{
"ver": "1.0.8",
"uuid": "e3a72981-f907-450f-a211-00c58009747a",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
{
"ver": "1.2.9",
"uuid": "0737ce42-24f0-45c6-8e1a-8bdab4f74ba3",
"uuid": "8a87399a-564e-43d5-86c1-e974e7ef4221",
"asyncLoadAssets": false,
"autoReleaseAssets": true,
"autoReleaseAssets": false,
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
{
"ver": "1.0.8",
"uuid": "badc4c0a-bc4e-4125-a4ac-81c4ade0526d",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
import { RandomInt } from "../script/util";
cc.Class({
extends: cc.Component,
properties: {
},
ctor() {
this._resultList = [];
this._maxPlayerNumber = 5;
},
setFinishAudioList(finishAudioList) {
this._finishAudioList = finishAudioList;
},
start() {
this.updateLabel('等待其他小伙伴中');
},
addPlayerResult(headUrl, isSelf, name, duration, uuid) {
if (this._resultList.find(player => player.uuid == uuid)) {
return;
}
this._resultList.push({ headUrl, isSelf, name, duration, uuid });
if (isSelf) {
this.showJiangTai();
}
this.updatePlayer();
if (isSelf) {
const idx = this._resultList.findIndex(result => result.isSelf == true);
if (idx != -1) {
this.playAudioByUrl(this._finishAudioList[idx]);
}
}
},
showLight() {
const fire = cc.find('jiangtaiNode/fire', this.node);
cc.tween(fire)
.set({ opacity: 200 })
.to(1, { opacity: 255, scale: 1.0 }, { easing: 'quadOut' })
.to(1, { opacity: 200, scale: 0.8 }, { easing: 'quadIn' })
.union()
.repeatForever()
.start();
const light = cc.find('jiangtaiNode/light', this.node);
cc.tween(light)
.by(4, { angle: 360 })
.repeatForever()
.start();
},
showJiangTai() {
const label = cc.find('label', this.node);
label.active = false;
const jiangtaiNode = cc.find('jiangtaiNode', this.node);
jiangtaiNode.active = true;
jiangtaiNode.zIndex = 1;
const catFrame = cc.find('catFrame', this.node);
catFrame.zIndex = 1;
this.showLight();
this.showStar();
this.updatePlayer();
},
showStar() {
for (let i = 0; i < 100; i++) {
const star = cc.instantiate(cc.find('star', this.node));
star.active = true;
star.parent = this.node;
const basePos = {
x: RandomInt(this.node.width / 2, -this.node.width / 2),
y: RandomInt(this.node.height / 2, -500)
};
cc.tween(star)
.to(0.5, { x: basePos.x, y: basePos.y }, { easing: 'quintIn' })
.start();
const rate = Math.random();
cc.tween(star)
.set({ scale: rate, opacity: parseInt(255 * rate) })
.to((1 - rate), { scale: 1, opacity: 255 })
.to(1, { scale: 0, opacity: 0 })
.delay(Math.random() * 3)
.to(rate, { scale: rate, opacity: parseInt(255 * rate) })
.union()
.repeatForever()
.start();
}
},
updatePlayer() {
this._resultList.sort((a, b) => {
return a.duration - b.duration;
});
this._resultList.forEach((player, idx) => {
const headNode = cc.find(`jiangtaiNode/head_${idx}`, this.node);
const headImg = cc.find(`mask/headImg`, headNode);
const name = cc.find(`name`, headNode);
const arrow = cc.find(`arrow`, headNode);
if (player.isSelf) {
arrow.active = true;
} else {
arrow.active = false;
}
name.getComponent(cc.Label).string = player.name;
this.loadSpriteByUrl(headImg, player.headUrl, () => {
const scale = Math.max(
headImg.parent.width / headImg.width,
headImg.parent.height / headImg.height
);
headImg.scale = scale;
if (!headNode.active) {
headNode.active = true;
cc.tween(headNode)
.set({ scale: 0 })
.to(0.2, { scale: 1 }, { easing: 'backOut' })
.start();
}
});
});
},
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();
},
loadSpriteByUrl(node, url, cb) {
cc.loader.load({
url: url.toLowerCase()
}, (err, img) => {
if (!node) {
cb && cb();
}
const spriteFrame = new cc.SpriteFrame(img)
const spr = node.getComponent(cc.Sprite);
spr.spriteFrame = spriteFrame;
if (cb) {
cb();
}
});
},
playAudioByUrl(audio_url, cb = null) {
if (!audio_url) {
if (cb) {
cb();
}
return;
}
const url = audio_url
.toLowerCase();
cc.assetManager.loadRemote(url, (err, audioClip) => {
const audioId = cc.audioEngine.play(audioClip, false, 0.8);
if (cb) {
cc.audioEngine.setFinishCallback(audioId, cb);
}
});
},
});
{
"ver": "1.0.8",
"uuid": "a4bc6cba-f662-42e6-91cd-36632f88ac11",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
{
"ver": "1.0.8",
"uuid": "c14083ff-05eb-40ee-8eae-2cadede6f0c5",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"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.
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