Commit 42be91ea authored by 张世斌's avatar 张世斌

1.网络参数配置

parent 8c60f94f
This diff is collapsed.
This diff is collapsed.
{
"ver": "1.2.9",
"uuid": "477c1d15-15ba-4964-bcab-10beec13cb42",
"asyncLoadAssets": false,
"autoReleaseAssets": false,
"subMetas": {}
}
\ No newline at end of file
......@@ -114,9 +114,6 @@ export default class AssetMgr extends Manager {
})
}
public releaseAsset(asset: cc.Asset, _?)
public releaseAsset(abName: string, resName: string)
public releaseAsset(a1: any, a2: any) {
......
......@@ -207,6 +207,7 @@ export default class SoundMgr extends Manager{
//播放URL的音效
public async playEffectByUrl(resName: string, delay: number = 0, volume: number = 1, isLoop: boolean = false) {
this.stopAllMusic();
let audio = await this.loadResEffectByUrl(resName)
if (audio) {
let id = cc.audioEngine.play(audio, isLoop, volume)
......@@ -220,6 +221,7 @@ export default class SoundMgr extends Manager{
//播放场景中的音效
public playResEffect(resName:string,delay:number=0,volume:number=1,isLoop:boolean=false){
this.stopAllMusic();
let audio=this.loadResEffectClone(resName)
if(audio){
let id=cc.audioEngine.play(audio,isLoop,volume)
......
......@@ -191,5 +191,19 @@ export default class UIUtil {
return sprite
}
//提取网络图片
public static async getSpriteByUrl(key:{url:string}):Promise<cc.SpriteFrame>{
return new Promise((resolve, reject) => {
cc.loader.load(key, (err, img) => {
if (err) {
cc.error("loadBundleByUrl error", key.url, err)
reject(err)
}
else {
const spriteFrame = new cc.SpriteFrame(img)
resolve(spriteFrame);
}
})
});
}
}
\ No newline at end of file
......@@ -16,6 +16,8 @@ export default class MenuController extends Controller{
private colorCur:string //当前选择的色彩
private answers:string[]
private camera:cc.Camera
private isCanTap:boolean=true;
constructor(){
super();
......@@ -33,7 +35,7 @@ export default class MenuController extends Controller{
await this.model.init();
this.view=await this.getView(ViewConst.MenuView,MenuView) as MenuView;
await this.view.updateData();
await this.view.updateData(this.model);
this.view.open();
let gameData=this.model.getItem(this.stageIdx);
......@@ -44,7 +46,7 @@ export default class MenuController extends Controller{
this.answers=new Array();
cc.log(words);
cc.log(answers);
let colorBlocks=this.view.colorItems;
let colorBlocks=this.view.colorItems1;
for(let i=0;i<colorBlocks.length;i++){
cc.log(colorBlocks[i].name);
let word=colorBlocks[i].getComponentInChildren(cc.Label);
......@@ -52,6 +54,10 @@ export default class MenuController extends Controller{
colorBlocks[i].color=cc.Color.WHITE;
// colorBlocks[i].getComponent(cc.Sprite).trim=true;
colorBlocks[i].on(cc.Node.EventType.TOUCH_START,()=>{
// if(!this.isCanTap){
// return;
// }
// this.isCanTap=false;
if(GameUtil.isEmptyObj(this.colorCur))
{
return;
......@@ -70,7 +76,7 @@ export default class MenuController extends Controller{
color.fromHEX(this.colorCur);
colorBlocks[i].color=color;
// cc.Color.fromHEX(colorBlocks[i].color,+"#"+this.colorCur);
this.onRight(itemAudio);
this.onRight();
let flag=0;
for(let i=0;i<this.answers.length;i++){
......@@ -78,7 +84,7 @@ export default class MenuController extends Controller{
flag++;
}
}
(flag>=answers.length)&&this.finish(colorBlocks);
(flag>=answers.length)&&this.finish();
}
});
colorBlocks[i]._hitTest=this._hitTest.bind(this);
......@@ -127,13 +133,18 @@ export default class MenuController extends Controller{
this.playDragonBoneAnimation(this.catAni,"normal",-1);
}
private finish(colorBlocks){
AppFacade.getMgr(SoundMgr).playResEffect(this.model.getFinishAudio());
this.playDragonBoneAnimation(this.catAni,"finish",1);
this.view.resultPaint.active=true;
this.view.paint.active=false;
private finish(){
AppFacade.getMgr(SoundMgr).playEffectByUrl(this.model.getFinishAudio());
this.playDragonBoneAnimation(this.catAni,"finish",1,()=>{
this.playDragonBoneAnimation(this.catAni,"normal",-1);
});
// this.view.resultPaint.active=true;
// this.view.paint.active=false;
let resultPaint=this.view.resultPaint.children[0];
// let resultPaint=this.view.resultPaint.children[0];
this.view.showPaint2();
let colorBlocks=this.view.colorItems1;
let colorBlocks2=this.view.colorItems2;
// let colorBlocks=this.view.colorItems;
for(let i=0;i<colorBlocks.length;i++){
// cc.log(colorBlocks[i].color);
......@@ -141,7 +152,7 @@ export default class MenuController extends Controller{
// word.string=words[i];
// colorBlocks[i].color=cc.Color.WHITE;
let item=resultPaint.children[i];
let item=colorBlocks2[i]
if(colorBlocks[i].color){
item.color=colorBlocks[i].color;
}
......@@ -166,19 +177,24 @@ export default class MenuController extends Controller{
}
private async onRight(){
AppFacade.getMgr(SoundMgr).playEffectByUrl(this.model.getFinishWaitAudio());
this.playDragonBoneAnimation(this.catAni,"right",1);
AppFacade.getMgr(SoundMgr).playResEffect(ResConst.snd.right);
this.playDragonBoneAnimation(this.catAni,"right",1,()=>{
this.playDragonBoneAnimation(this.catAni,"normal",-1);
});
cc.log("Right")
}
private onWrong(){
AppFacade.getMgr(SoundMgr).playResEffect(this.model.getFinishWaitAudio());
this.playDragonBoneAnimation(this.catAni,"wrong",1);
AppFacade.getMgr(SoundMgr).playResEffect(ResConst.snd.wrong);
this.playDragonBoneAnimation(this.catAni,"wrong",1,()=>{
this.playDragonBoneAnimation(this.catAni,"normal",-1);
});
cc.log("Wrong")
}
private onClickRole(){
AppFacade.getMgr(SoundMgr).playResEffect(ResConst.snd.click);
// AppFacade.getMgr(SoundMgr).playResEffect(ResConst.snd.click);
AppFacade.getMgr(SoundMgr).playEffectByUrl(this.model.getStartAudio());
}
......
......@@ -3,6 +3,7 @@ import { defaultData } from "../defaultData";
export default class MenuModel extends Model{
public stageIdx=0;
private data;
public async init() {
let getData = this.getData.bind(this);
......@@ -37,6 +38,11 @@ export default class MenuModel extends Model{
func(this.getDefaultData());
}
public getFont(){
let node=cc.find("res/font/MMTextBook-Bold");
let label=node.getComponent(cc.Label);
return label.font;
}
public getConfigs(){
return this.data;
}
......
import UIFullView from "../Core/BaseView/UIFullView";
import { ViewConst } from "../Core/ConstDefine/ViewConst";
import UIButton from "../Core/UI/UIButton";
import GameUtil from "../Core/Util/GameUtil";
import UIUtil from "../Core/Util/UIUtil";
import MenuModel from "./MenuModel";
export default class MenuView extends UIFullView{
public paint:cc.Node; //游戏画板
public resultPaint:cc.Node; //结束画板
private paint:cc.Node; //游戏画板
private resultPaint:cc.Node; //结束画板
public paint1:cc.Node; //游戏色块父节点
public paint2:cc.Node; //结束面板色块父节点
// public palette:cc.Node; //调色板
public choiceColor:cc.Node; //色彩选择框
public roleAnimation:dragonBones.ArmatureDisplay;//动画角色猫龙骨骼
public btnSubmit:UIButton //提交按钮*取消
public btnColors:UIButton[] //色彩按钮
public colorItems:cc.Node[]; //要涂的色块对象。每个色块为一个节点。对节点进行改色
public colorItems1:cc.Node[]; //要涂的色块对象。每个色块为一个节点。对节点进行改色
public colorItems2:cc.Node[]; //结束面板色块对象。每个色块为一个节点。对节点进行改色
public btnRole:UIButton
public getTypeName(): string {
......@@ -20,15 +26,20 @@ export default class MenuView extends UIFullView{
}
protected async getChilds(){
this.paint=this.getChildNode("main_area/paint");
let colorArea=this.getChildNode("main_area/paint/alligator");
this.colorItems=new Array();
for(let i=0;i<colorArea.childrenCount;i++){
let item=colorArea.children[i];
this.colorItems[i]=item;
}
this.paint=this.getChildNode("main_area/paint");
this.paint1=this.getChildNode("main_area/paint/alligator");
this.paint1.destroyAllChildren();
// this.colorItems=new Array();
// for(let i=0;i<colorArea.childrenCount;i++){
// let item=colorArea.children[i];
// this.colorItems[i]=item;
// }
this.resultPaint=this.getChildNode("paint2");
this.paint2=this.getChildNode("paint2/alligator");
this.paint2.destroyAllChildren();
let palette=this.getChildNode("color_area");
this.choiceColor=this.getChildNode("color_area/icon_choose");
this.roleAnimation=this.getChildComp("bottom_area/coolcat",dragonBones.ArmatureDisplay);
......@@ -47,7 +58,65 @@ export default class MenuView extends UIFullView{
}
}
protected async onUpdateData(){
public showPaint2(){
this.paint.active=false;
this.resultPaint.active=true;
}
protected async onUpdateData(model:MenuModel){
let images:{img:string}[]=model.getImages();
let bg1=this.getChildComp("main_area/paint/alligator",cc.Sprite);
let bg2=this.getChildComp("paint2/alligator",cc.Sprite);
bg1.spriteFrame=await UIUtil.getSpriteByUrl(model.getBG());
bg2.spriteFrame=await UIUtil.getSpriteByUrl(model.getBG());
//要涂的色块
this.colorItems1 = new Array();
let colorArea1=this.paint1;
this.colorItems2 = new Array();
let colorArea2=this.paint2;
let gameData=model.getItem(model.stageIdx);
let words=gameData.words.split("");
let pos=gameData.pos;
for (let i = 0; i < images.length; i++) {
let spriteFrame = await UIUtil.getSpriteByUrl({url:images[i].img})
let item1=GameUtil.createNode("img"+1,colorArea1);
item1.group="camera";
let sprite1:cc.Sprite=this.addCCComp(item1,cc.Sprite);
sprite1.spriteFrame=spriteFrame;
let wordNode1=GameUtil.createNode("word",item1);
wordNode1.x= pos[i][0];
wordNode1.y=pos[i][1];
wordNode1.color=cc.Color.BLACK;
let label1:cc.Label=this.addCCComp(wordNode1,cc.Label);
label1.string=words[i];
label1.font=model.getFont();
label1.fontSize=80;
label1.lineHeight=80;
this.colorItems1[i] = sprite1.node;
let item2=GameUtil.createNode("img"+1,colorArea2);
item2.group="camera"
let sprite2:cc.Sprite=this.addCCComp(item2,cc.Sprite);
sprite2.spriteFrame=spriteFrame;
let wordNode2=GameUtil.createNode("word",item2);
wordNode2.anchorX=0;
wordNode2.x=pos[i][0];
wordNode2.y=pos[i][1];
wordNode2.color=cc.Color.BLACK;
let label2:cc.Label=this.addCCComp(wordNode2,cc.Label);
label2.string=words[i];
label2.font=model.getFont();
label2.fontSize=80;
label2.lineHeight=80;
this.colorItems2[i] = sprite2.node;
}
}
protected onOpen(){
......
......@@ -2,9 +2,16 @@ export const defaultData =
{
"items": [
{
"words": "aAcBaCbA",
"answers": "0147",
"audio_url": "http://staging-teach.cdn.ireadabc.com/18bf8207ddea222c9b82c68f2549dadc.mp3"
"words": "FdFFf",
"answers": "0234",
"audio_url": "http://staging-teach.cdn.ireadabc.com/18bf8207ddea222c9b82c68f2549dadc.mp3",
"pos":[
[-425.989,-6.456],
[-37.043,195.708],
[151.487,-129.498],
[570.348,200],
[617.5,43.247]
]
},
{
"words": "aAcBaCbA",
......@@ -12,19 +19,30 @@ export const defaultData =
"audio_url": "http://staging-teach.cdn.ireadabc.com/18bf8207ddea222c9b82c68f2549dadc.mp3"
},
],
"startAudio": "http://staging-teach.cdn.ireadabc.com/17edcaecd09a72a64a77480673cdc232.mp3",
"waitAudio": "http://staging-teach.cdn.ireadabc.com/fd8a2b8eeb4abbe7683d30e728ece184.mp3",
"finishAudio": "http://staging-teach.cdn.ireadabc.com/17edcaecd09a72a64a77480673cdc232.mp3",
"finishWaitAudio": "http://staging-teach.cdn.ireadabc.com/c0926db86deeb3edc9642cb14a516b36.mp3",
"bg": "http://staging-teach.cdn.ireadabc.com/5a6b2c02be73b864c7aa5d83099c6263.png",
"images": [
{
"img": "http://staging-teach.cdn.ireadabc.com/9fb2c19d37ee3f71352c85fb3fe08768.png"
},
{
"img": "http://staging-teach.cdn.ireadabc.com/c281cbfa449b15f6d2a444f1162bf421.png"
}
]
"startAudio": "http://staging-teach.cdn.ireadabc.com/18bf8207ddea222c9b82c68f2549dadc.mp3",
"waitAudio": "http://staging-teach.cdn.ireadabc.com/46cba1330608d848239ec6a68bb4707e.mp3",
"finishAudio": "http://staging-teach.cdn.ireadabc.com/b3260e3d6972cc59b345f573aaab4290.mp3",
"finishWaitAudio": "http://staging-teach.cdn.ireadabc.com/b3260e3d6972cc59b345f573aaab4290.mp3",
"rightAudio": "http://staging-teach.cdn.ireadabc.com/e3921a16a8313df274d8bc4e3f2bedd8.mp3",
"wrongAudio": "http://staging-teach.cdn.ireadabc.com/fca98e3ed3f1269c07de6aac67f9d2c2.mp3",
"bg": "http://staging-teach.cdn.ireadabc.com/90bd03bdc2437b51055ed0423bac9b4a.png",
"images": [
{
"img": "http://staging-teach.cdn.ireadabc.com/4cc0099a522ba36f0916b6aeb5c85a84.png"
},
{
"img": "http://staging-teach.cdn.ireadabc.com/5ef1b6241fbdb251848ec9ae3bc3773a.png"
},
{
"img": "http://staging-teach.cdn.ireadabc.com/b8369480bf8db275d94c889d6155ab52.png"
},
{
"img": "http://staging-teach.cdn.ireadabc.com/3caca3cd7fff035545689e1b0d5cc724.png"
},
{
"img": "http://staging-teach.cdn.ireadabc.com/e6b058fa93f6d635afab2c3b853d3ac1.png"
}
]
}
// {
// "items": [
......
{
"ver": "1.1.2",
"uuid": "708cca69-e488-459b-b87e-4f63e03d27d4",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "0848006a-b3a2-4be0-82b7-7ebd757e12e4",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1407,
"height": 731,
"platformSettings": {},
"subMetas": {
"Ff": {
"ver": "1.0.4",
"uuid": "01f99d17-df74-416f-8e7b-963d729fa77c",
"rawTextureUuid": "0848006a-b3a2-4be0-82b7-7ebd757e12e4",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -1,
"offsetY": 17,
"trimX": 50,
"trimY": 31,
"width": 1305,
"height": 635,
"rawWidth": 1407,
"rawHeight": 731,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "85474ca0-6d94-4fa2-aae7-ab0b019a8773",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1407,
"height": 731,
"platformSettings": {},
"subMetas": {
"Ff1": {
"ver": "1.0.4",
"uuid": "9fcb715d-4988-46c5-89b6-9d9becd6996c",
"rawTextureUuid": "85474ca0-6d94-4fa2-aae7-ab0b019a8773",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -459,
"offsetY": 43,
"trimX": 58,
"trimY": 181,
"width": 373,
"height": 283,
"rawWidth": 1407,
"rawHeight": 731,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "6e659dbc-3f8f-4624-bd14-e2b059c6e4cf",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1407,
"height": 731,
"platformSettings": {},
"subMetas": {
"Ff2": {
"ver": "1.0.4",
"uuid": "1d7622b3-7a2f-4798-bf2c-6f57b9b1c416",
"rawTextureUuid": "6e659dbc-3f8f-4624-bd14-e2b059c6e4cf",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -13,
"offsetY": 192,
"trimX": 376,
"trimY": 40,
"width": 629,
"height": 267,
"rawWidth": 1407,
"rawHeight": 731,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "447a83ff-1af3-4c2b-a6c1-1f6cdbe96369",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1407,
"height": 731,
"platformSettings": {},
"subMetas": {
"Ff3": {
"ver": "1.0.4",
"uuid": "d1901a0c-7f87-452b-b20c-0f9b2d7d6b8d",
"rawTextureUuid": "447a83ff-1af3-4c2b-a6c1-1f6cdbe96369",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 175,
"offsetY": -101.5,
"trimX": 752,
"trimY": 365,
"width": 253,
"height": 204,
"rawWidth": 1407,
"rawHeight": 731,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "0e42b3da-a83f-4050-bd25-a79d7bd68d4e",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1407,
"height": 731,
"platformSettings": {},
"subMetas": {
"Ff4": {
"ver": "1.0.4",
"uuid": "20b6e9bb-97e8-41f1-917a-16fd9224bcb5",
"rawTextureUuid": "0e42b3da-a83f-4050-bd25-a79d7bd68d4e",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 567,
"offsetY": 217.5,
"trimX": 1208,
"trimY": 86,
"width": 125,
"height": 124,
"rawWidth": 1407,
"rawHeight": 731,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "c511c8db-f4f7-43aa-b03e-660f10e817b2",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1407,
"height": 731,
"platformSettings": {},
"subMetas": {
"Ff5": {
"ver": "1.0.4",
"uuid": "67c5a188-253f-4d98-aa26-df3d814b9bfe",
"rawTextureUuid": "c511c8db-f4f7-43aa-b03e-660f10e817b2",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 617,
"offsetY": 59.5,
"trimX": 1292,
"trimY": 278,
"width": 57,
"height": 56,
"rawWidth": 1407,
"rawHeight": 731,
"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