Commit a0fd46f2 authored by Lwd's avatar Lwd

aaaa

parent 8acdd228
This diff is collapsed.
......@@ -14,6 +14,7 @@ cc.Class({
default: [],
type: cc.Widget,
},
canvasView: {
default: null,
type: cc.Canvas,
......@@ -34,6 +35,7 @@ cc.Class({
var w = (canvaSize.width) / 720;
var h = (canvaSize.height) / 1280;
this.MaxSize = w / h > 1 ? w / h : h / w;
this.setUIMax(this.MaxSize);
this.settopUI(this.MaxSize);
var scene = cc.director.getScene();
......@@ -45,7 +47,6 @@ cc.Class({
}
}, 0);
this.MaxSize = 1;
// if (window.addEventListener) {
// window.addEventListener('resize', scaleEventCallBack, false)
// } else if (window.attachEvent) {
......@@ -73,6 +74,7 @@ cc.Class({
var w = (canvaSize.width) / 750;
var h = (canvaSize.height) / 1334;
this.MaxSize = w / h > 1 ? w / h : h / w;
g.data_mgr.MaxSize = this.MaxSize;
this.setUIMax(this.MaxSize);
this.settopUI(this.MaxSize);
......@@ -83,6 +85,7 @@ cc.Class({
}
},
// //屏幕缩放事件
// scaleEventCallBack: function () {
// //setTimeout(function () {
......
......@@ -84,7 +84,6 @@ var game = cc.Class({
console.log("游戏开始:" + g.data_mgr);
//播放一个上面的音乐
this.setAudioInfo(1);
this.PlayAudio();
},
//获得随机播放的音乐并播放
......@@ -95,6 +94,7 @@ var game = cc.Class({
//设置播放信息
g.data_mgr.playId = num;
g.data_mgr.playType = type;
this.PlayAudio();
},
//重新播放音乐
......@@ -121,6 +121,8 @@ var game = cc.Class({
g.data_mgr.addPreloadAudio();
g.data_mgr.addPreloadAnima();
g.result.inst.End = true;
//初始化界面
this.UpdataUi();
......@@ -130,8 +132,6 @@ var game = cc.Class({
//游戏开始
g.game.inst.gameStart();
//清除线
this.clearLine();
},
......
/**
* result
*/
const Color_texts = ['#BE1AC1', '#24C11A', '#1A1DC1', '#9F5307'];
const Color_texts = ['#BE1AC1', '#2E6EEE', '#1A1DC1', '#770060'];
var result = cc.Class({
extends: cc.Component,
......@@ -86,7 +86,37 @@ var result = cc.Class({
// 初始化文本
initRichText(text) {
this.lb_tips.string = text;
//this.lb_tips.string = text;
// text = 'I am flying';
this.layoutText.removeAllChildren();
if (!text) {
return;
}
text = text.replace(/ /g, " |");
let arr = text.split('|');
if (arr.length <= 0) {
return;
}
this.layoutText.active = true;
this.lb_tips.string = arr[0];
this.lb_tips._forceUpdateRenderData(true)
for (let i = 0; i < arr.length; i++) {
if (arr[i + 1] == ' ') {
continue;
}
let node = cc.instantiate(this.lb_tips.node);
let label = node.getComponent(cc.Label);
label.string = arr[i];
node.parent = this.layoutText;
label._forceUpdateRenderData(true);
}
this.layoutText.getComponent(cc.Layout).updateLayout();
let width = this.layoutText.width;
if (width > 1000) {
let scale = 1000 / width;
this.layoutText.scale = scale;
}
},
//设置图片
......@@ -113,7 +143,9 @@ var result = cc.Class({
},
playAudio() {
cc.assetManager.loadRemote(this.itemInfo.group_audio_url, null, (err, clip) => {
// this.itemInfo.group_audio_url
var test = "http://staging-teach.cdn.ireadabc.com/495324991838775e49e3ca6593d432c9.mp3"
cc.assetManager.loadRemote(test, null, (err, clip) => {
this.audioID = cc.audioEngine.play(clip, false, 1);
this.audioDuration = cc.audioEngine.getDuration(this.audioID);
this.textDuration = this.audioDuration / this.layoutText.childrenCount;
......@@ -125,7 +157,7 @@ var result = cc.Class({
cc.audioEngine.stop(this.audioID);
this.unschedule(this.chengeTextColor);
this.isPlaying = false;
this.stopSpine();
// this.stopSpine();
},
chengeTextColor() {
......@@ -139,17 +171,27 @@ var result = cc.Class({
},
clearTextColor() {
for (let i = 0; i < this.layoutText.children.length; i++) {
this.layoutText.children[i].color = new cc.Color().fromHEX(Color_texts[3]);
this.layoutText.children[i].color = new cc.Color().fromHEX(Color_texts[1]);
}
},
onBtnText() {
this.clearTextColor();
this.stopAudio();
this.playAudio();
},
//点击关闭
onBtnClose: function () {
this.node.active = false;
//如果播放列表少于1则显示
if (this.End == false) {
return;
}
if (g.data_mgr.temPlayAudio.length < 1) {
//显示结算撒花
g.game.inst.showResult();
this.End = false;
} else {
//重新随机一组数据
g.game.inst.setAudioInfo(1);
......
{
"ver": "2.3.5",
"uuid": "b1526667-de09-4475-a793-de7e9b63c68d",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 852,
"height": 516,
"platformSettings": {},
"subMetas": {
"frame_dragon": {
"ver": "1.0.4",
"uuid": "8c658fc0-c1e4-4993-bce4-b5cce324b69b",
"rawTextureUuid": "b1526667-de09-4475-a793-de7e9b63c68d",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 852,
"height": 516,
"rawWidth": 852,
"rawHeight": 516,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
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