Commit b321010c authored by Tt's avatar Tt

mrbr02整体修改

parent 7c0a3ba6
{
"ver": "1.1.2",
"uuid": "b027ddf6-6657-4490-9416-0c8b01ecad96",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "329181ef-e920-4e0d-8f97-8ef4149b7743",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 278,
"height": 275,
"platformSettings": {},
"subMetas": {
"icon_bigstar": {
"ver": "1.0.4",
"uuid": "1f039de2-0395-4240-a2d6-77c5918ad985",
"rawTextureUuid": "329181ef-e920-4e0d-8f97-8ef4149b7743",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 278,
"height": 275,
"rawWidth": 278,
"rawHeight": 275,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "230a73ce-15c3-43cb-8ebf-9df5248d4991",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 62,
"height": 69,
"platformSettings": {},
"subMetas": {
"star": {
"ver": "1.0.4",
"uuid": "19c56e55-a25a-4590-8c3b-d56f0254b442",
"rawTextureUuid": "230a73ce-15c3-43cb-8ebf-9df5248d4991",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 62,
"height": 69,
"rawWidth": 62,
"rawHeight": 69,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "29239e52-a730-4c67-9782-10ea26230b45",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 62,
"height": 69,
"platformSettings": {},
"subMetas": {
"star_bg": {
"ver": "1.0.4",
"uuid": "639a6d2e-30bb-42c0-9c54-9f827295e90d",
"rawTextureUuid": "29239e52-a730-4c67-9782-10ea26230b45",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 1.5,
"trimX": 0,
"trimY": 0,
"width": 62,
"height": 66,
"rawWidth": 62,
"rawHeight": 69,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "e50816e7-a843-4920-8269-53555103beac",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 282,
"height": 118,
"platformSettings": {},
"subMetas": {
"Img_bt_right": {
"ver": "1.0.4",
"uuid": "6049e9b1-b6da-4323-8d37-33a677eccd56",
"rawTextureUuid": "e50816e7-a843-4920-8269-53555103beac",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 282,
"height": 118,
"rawWidth": 282,
"rawHeight": 118,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "0c8d6a87-d127-478d-8bf0-656b9a4b95a9",
"downloadMode": 0,
"duration": 1.776327,
"subMetas": {}
}
\ No newline at end of file
// Learn TypeScript:
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
import pg from "../scene/pg";
const { ccclass, property } = cc._decorator;
@ccclass
export default class NewClass extends cc.Component {
@property(cc.Node)
item: cc.Node = null;
// LIFE-CYCLE CALLBACKS:
private mouseList = [];
private mouseNum = 0;
onLoad() {
pg.event.on("mouse_add", () => {
this.reviceMouse();
})
let max = 3;
for (let i = 0; i < max; i++) {
this.addMouse();
}
}
reviceMouse() {
this.mouseNum++;
this.updateMouse();
}
start() {
}
addMouse() {
let item = cc.instantiate(this.item);
item.active = true;
item.getChildByName("light").active = false;
this.node.addChild(item);
this.mouseList.push(item)
}
updateMouse() {
for (let i = 0; i < this.mouseList.length; i++) {
let item = this.mouseList[i];
item.getChildByName("light").active = i < this.mouseNum;
}
}
// update (dt) {}
}
{
"ver": "1.1.2",
"uuid": "828d76bc-8d6c-456d-a0df-6af33caf2179",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
[
{
"__type__": "cc.Prefab",
"_name": "",
"_objFlags": 0,
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"asyncLoadAssets": false,
"readonly": false
},
{
"__type__": "cc.Node",
"_name": "layout_mouse",
"_objFlags": 0,
"_parent": null,
"_children": [
{
"__id__": 2
}
],
"_active": true,
"_components": [
{
"__id__": 13
}
],
"_prefab": {
"__id__": 14
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 1,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "img",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 3
},
{
"__id__": 6
},
{
"__id__": 9
}
],
"_active": false,
"_components": [],
"_prefab": {
"__id__": 12
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "star_bg",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 4
}
],
"_prefab": {
"__id__": 5
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 59,
"height": 42
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 3
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "54beeaf0-8640-4d6d-bdb2-40be6c49f378"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "564dd930-80a8-4d89-bf96-f0f5be1e92cb"
},
"fileId": "1a6bNni9hAzZuAOicd4es+",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "star",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 7
}
],
"_prefab": {
"__id__": 8
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 59,
"height": 42
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 6
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "047bdd7d-6c4f-47dc-944a-12cf7a461f93"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "564dd930-80a8-4d89-bf96-f0f5be1e92cb"
},
"fileId": "0dcJdIc9BNfbQiPTRx9GVW",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "icon_bigstar",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 10
}
],
"_prefab": {
"__id__": 11
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 59,
"height": 42
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 9
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "047bdd7d-6c4f-47dc-944a-12cf7a461f93"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "564dd930-80a8-4d89-bf96-f0f5be1e92cb"
},
"fileId": "e8QBmuw8VOBYptnR5JD386",
"sync": false
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "564dd930-80a8-4d89-bf96-f0f5be1e92cb"
},
"fileId": "9eIg5jomZOV5E+Yzh+2uPU",
"sync": false
},
{
"__type__": "aa1f1smbntECpwesqp/Tg0F",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "564dd930-80a8-4d89-bf96-f0f5be1e92cb"
},
"fileId": "",
"sync": false
}
]
\ No newline at end of file
{
"ver": "1.2.9",
"uuid": "564dd930-80a8-4d89-bf96-f0f5be1e92cb",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}
\ No newline at end of file
// Learn TypeScript:
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
import Game from "../../scene/Game";
import pg from "../../scene/pg";
const { ccclass, property } = cc._decorator;
@ccclass
export default class NewClass extends cc.Component {
// LIFE-CYCLE CALLBACKS:
onLoad() {
pg.event.on("mouse_add", () => {
this.showBigStar();
})
pg.event.on("mouse_num", (max: number) => {
this.initStar();
})
}
init(max) {
}
reviceMouse() {
}
start() {
}
//-----------------------STAR-----------------------------
bigStarArr: cc.Node[];
canvas: cc.Node;
curGroupIndex: number
@property(cc.Vec2)
position: cc.Vec2;
@property(cc.AudioClip)
bigStarClip: cc.AudioClip;
@property(cc.AudioClip)
starCountClip: cc.AudioClip;
//搭配res中的star_bg star等使用
initStar() {
this.curGroupIndex = 0;
this.canvas = cc.find('Canvas');
const gArr = Game.getIns().lists;
if (gArr.length <= 1) {
return;
}
this.cleanStar();
this.bigStarArr = [];
let baseX = this.position.x;
let baseY = this.position.y;
let disW = 80;// * this._mapScaleMin
// let disH = 80 * this._mapScaleMin;
let disScale = 1;
if (gArr.length > 5) {
// disH = (400 / gArr.length) * this._mapScaleMin;
disScale = 5 / gArr.length;
}
for (let i = 0; i < gArr.length; i++) {
const starBg = this.getSprNode('star_bg');
this.canvas.addChild(starBg, 10);
// starBg.x = baseX;
// starBg.y = baseY - i * disH;
starBg.x = baseX - i * disW;
starBg.y = baseY
starBg.scale = disScale;
const starTop = this.getSprNode('star');
starBg.addChild(starTop);
starTop.active = false;
starBg.star = starTop;
const starBig = this.getSprNode('icon_bigstar');
starTop.addChild(starBig);
starBig.angle = -90;
starBg.starBig = starBig;
this.bigStarArr.push(starBg);
}
console.log("bigStarArr: ", this.bigStarArr);
}
cleanStar() {
if (this.bigStarArr && this.bigStarArr.length > 0) {
for (let i = 0; i < this.bigStarArr.length; i++) {
this.bigStarArr[i].removeFromParent();
}
}
}
showBigStar() {
if (!this.bigStarArr || this.bigStarArr.length <= 0) {
// this.checkGameEnd();
return;
}
const bigStarBg = this.bigStarArr[this.curGroupIndex++];
const starBig = bigStarBg.starBig;
starBig.scale = 1;
const star = bigStarBg.star;
star.active = true;
star.scaleX = 0.7 / bigStarBg.scale;
star.scaleY = 1 / bigStarBg.scale;
star.angle = 90;
const canvas = cc.find('Canvas');
const startPos = this.exchangeNodePos(star.parent, canvas);
const middlePos = this.exchangeNodePos(star.parent, canvas);
star.x = startPos.x;
star.y = startPos.y - starBig.height;
console.log('middlePos = ' + JSON.stringify(middlePos));
const time = 1;
cc.tween(star)
.to(0.3, { y: middlePos.y + 80 }, { easing: 'quadOut' })
.to(0.1, { y: middlePos.y + 40, scaleX: 1.2 / bigStarBg.scale, scaleY: 0.8 / bigStarBg.scale }, { easing: 'quadOut' })
.to(0.1, { y: middlePos.y, scaleX: 1 / bigStarBg.scale, scaleY: 1 / bigStarBg.scale }, { easing: 'quadOut' })
.delay(0.1)
.to(0.8, { angle: -720, scale: 1 })
.start();
cc.tween(star)
.delay(0.6)
.to(0.8, { x: 0 }, { easing: 'quadIn' })
.start();
cc.tween(star)
.delay(0.6)
.to(0.8, { y: 0 }, { easing: 'quadOut' })
.start();
cc.tween(starBig)
.delay(0.6)
.to(0.8, { scale: 0 }, { easing: 'quadOut' })
.call(() => {
pg.event.emit("mouse_num_game_end")
this.playAudio(this.starCountClip);
})
.start();
this.playAudio(this.bigStarClip);
}
//-----------------------STAR-----------------------------
getSprNode(resName) {
const sf = pg.view.find(this, `img/${resName}`).getComponent(cc.Sprite).spriteFrame;
const node = new cc.Node();
node.addComponent(cc.Sprite).spriteFrame = sf;
return node;
}
exchangeNodePos(baseNode, targetNode) {
return baseNode.convertToNodeSpaceAR(targetNode._parent.convertToWorldSpaceAR(cc.v2(targetNode.x, targetNode.y)));
}
playAudio(audioClip, cb = null) {
if (audioClip) {
const audioId = cc.audioEngine.playEffect(audioClip, false);
if (cb) {
cc.audioEngine.setFinishCallback(audioId, () => {
cb();
});
}
}
}
// update (dt) {}
}
......@@ -22,16 +22,22 @@
},
{
"__id__": 5
},
{
"__id__": 8
},
{
"__id__": 12
}
],
"_active": true,
"_components": [
{
"__id__": 8
"__id__": 20
}
],
"_prefab": {
"__id__": 9
"__id__": 21
},
"_opacity": 255,
"_color": {
......@@ -62,8 +68,8 @@
0,
0,
1,
0.11,
0.11,
0.2,
0.2,
1
]
},
......@@ -82,7 +88,7 @@
},
{
"__type__": "cc.Node",
"_name": "ske",
"_name": "shadow",
"_objFlags": 0,
"_parent": {
"__id__": 1
......@@ -105,6 +111,113 @@
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 282,
"height": 118
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
5272.015,
-3197.113,
0,
0,
0,
0,
1,
5,
5,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "6049e9b1-b6da-4323-8d37-33a677eccd56"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "57753175-db68-4aab-a973-8abce1f1664a"
},
"fileId": "ecpREk57VFhaAUZMWKAQ4x",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "ske",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 6
}
],
"_prefab": {
"__id__": 7
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1559,
......@@ -119,8 +232,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
4825.941,
-2215.831,
5454.443,
-2366.485,
0,
0,
0,
......@@ -149,7 +262,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
"__id__": 5
},
"_enabled": true,
"_materials": [
......@@ -177,7 +290,7 @@
"__uuid__": "04a8dfaa-9baf-4407-af0a-2d3a9e89dbd8"
},
"_N$_defaultArmatureIndex": 0,
"_N$_animationIndex": 1,
"_N$_animationIndex": 0,
"_N$_defaultCacheMode": 0,
"_N$timeScale": 1,
"_N$debugBones": false,
......@@ -198,7 +311,7 @@
{
"__type__": "cc.Node",
"_name": "block",
"_objFlags": 0,
"_objFlags": 512,
"_parent": {
"__id__": 1
},
......@@ -206,13 +319,16 @@
"_active": true,
"_components": [
{
"__id__": 6
"__id__": 9
},
{
"__id__": 10
}
],
"_prefab": {
"__id__": 7
"__id__": 11
},
"_opacity": 255,
"_opacity": 100,
"_color": {
"__type__": "cc.Color",
"r": 255,
......@@ -264,11 +380,43 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 5
"__id__": 8
},
"_enabled": true,
"_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 8
},
"_enabled": false,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "a23235d1-15db-4b95-8439-a2e005bfff91"
},
"_type": 0,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
......@@ -280,6 +428,272 @@
"fileId": "efp877hUFLz4dHY4gxxXKw",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "audio",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 13
},
{
"__id__": 16
}
],
"_active": true,
"_components": [],
"_prefab": {
"__id__": 19
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "enter",
"_objFlags": 0,
"_parent": {
"__id__": 12
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 14
}
],
"_prefab": {
"__id__": 15
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 13
},
"_enabled": true,
"_clip": {
"__uuid__": "bce3261e-7314-4067-9337-459533b97896"
},
"_volume": 1,
"_mute": false,
"_loop": false,
"_firstlyEnabled": true,
"playOnLoad": false,
"preload": false,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "57753175-db68-4aab-a973-8abce1f1664a"
},
"fileId": "6dXSctH45Kj5MbzEKNyUGl",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "leave",
"_objFlags": 0,
"_parent": {
"__id__": 12
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 17
}
],
"_prefab": {
"__id__": 18
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 16
},
"_enabled": true,
"_clip": {
"__uuid__": "3fa7aab4-b81d-40e6-9691-73935a1d92da"
},
"_volume": 1,
"_mute": false,
"_loop": false,
"_firstlyEnabled": true,
"playOnLoad": false,
"preload": false,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "57753175-db68-4aab-a973-8abce1f1664a"
},
"fileId": "3dER2Qz/ZEyI6vLH55eksI",
"sync": false
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "57753175-db68-4aab-a973-8abce1f1664a"
},
"fileId": "04Mh2bmZRDIaNa8D8xWN8l",
"sync": false
},
{
"__type__": "219b1yegNJPW4jalMImtj4z",
"_name": "",
......@@ -290,15 +704,15 @@
"_enabled": true,
"startPosition": {
"__type__": "cc.Vec2",
"x": 14000,
"y": -2215
"x": 0,
"y": 0
},
"targetPosition": {
"__type__": "cc.Vec2",
"x": 4825.941,
"y": -2215
"x": 0,
"y": 0
},
"moveInTime": 2,
"moveInTime": 1,
"_id": ""
},
{
......
......@@ -21,45 +21,109 @@ export default class MouseStart extends cc.Component {
private ske: cc.Node;
private block: cc.Node;
private shadow: cc.Node;
onLoad() {
//修改ske的信息
this.ske = this.node.getChildByName("ske");
this.block = this.node.getChildByName("block");
this.shadow = this.node.getChildByName("shadow");
this.ske.x = this.startPosition.x;
this.ske.y = this.startPosition.y;
pg.event.on("mouse_start_play", (data) => {
this.play(data).then(() => {
pg.event.emit("mouse_start_play_success");
})
})
}
play(audioUrl?: string) {
this.moveInTime = Game.getIns().aniEnter.time || 5;
play({ voice, time }: any) {
this.node.active = true;
this.block.active = true;
this.ske.active = true;
this.ske.x = this.startPosition.x;
this.ske.y = this.startPosition.y;
this.moveInTime = time || 5;
return new Promise((resolve, reject) => {
let isPlaying = true;
this.ske.x = this.startPosition.x;
this.ske.y = this.startPosition.y;
this.ske.active = true;
this.node.active = true;
this.block.active = true;
let load = false;
pg.load.loadDB(this.ske, { ske: Game.getIns().aniEnter.skeJsonData.url, tex: Game.getIns().aniEnter.texJsonData.url, png: Game.getIns().aniEnter.texPngData.url }).then((animationName) => {
cc.tween(this.ske).to(1.3, { x: this.targetPosition.x, y: this.targetPosition.y }).call(() => {
audioUrl = audioUrl ? audioUrl : Game.getIns().aniEnter.audioUrl;
if (audioUrl) {
pg.audio.playAudioByUrl(audioUrl).then(() => {
isPlaying = false;
resolve('');
})
}
if (load) return;
load = true;
cc.Tween.stopAllByTarget(this.ske);
this.playLocalAudio('enter').then(() => {
this.playAudioByUrl(voice)
})
cc.tween(this.ske).to(0.5, { x: this.targetPosition.x, y: this.targetPosition.y }).delay(0.9).call(() => {
let db = this.ske.getComponent(dragonBones.ArmatureDisplay);
db.playAnimation('normal', 1111111);
db.addEventListener("loopComplete", () => {
if (!isPlaying) {
this.block.active = false;
resolve('');
}
})
db.playAnimation('normal', 0);
}).delay(this.moveInTime).call(() => {
this.ske.active = false;
this.node.active = false;
this.block.active = false;
this.playLocalAudio('leave')
cc.tween(this.ske).by(0.1, { y: 200 }).by(1, { y: -10000 }).call(() => {
this.ske.active = false;
this.node.active = false;
this.block.active = false;
resolve('');
}).start();
}).start();
})
});
// this.moveInTime = Game.getIns().aniEnter.time || 5;
// return new Promise((resolve, reject) => {
// let isPlaying = true;
// this.ske.x = this.startPosition.x;
// this.ske.y = this.startPosition.y;
// this.ske.active = true;
// this.node.active = true;
// this.block.active = true;
// pg.load.loadDB(this.ske, { ske: Game.getIns().aniEnter.skeJsonData.url, tex: Game.getIns().aniEnter.texJsonData.url, png: Game.getIns().aniEnter.texPngData.url }).then((animationName) => {
// cc.tween(this.ske).to(1.3, { x: this.targetPosition.x, y: this.targetPosition.y }).call(() => {
// audioUrl = audioUrl ? audioUrl : Game.getIns().aniEnter.audioUrl;
// if (audioUrl) {
// pg.audio.playAudioByUrl(audioUrl).then(() => {
// isPlaying = false;
// resolve('');
// })
// }
// let db = this.ske.getComponent(dragonBones.ArmatureDisplay);
// db.playAnimation('normal', 1111111);
// db.addEventListener("loopComplete", () => {
// if (!isPlaying) {
// this.block.active = false;
// resolve('');
// }
// })
// }).delay(this.moveInTime).call(() => {
// this.ske.active = false;
// this.node.active = false;
// this.block.active = false;
// }).start();
// })
// });
}
playAudioByUrl(audio_url, cb = null) {
if (audio_url) {
cc.assetManager.loadRemote(audio_url, (err, audioClip: any) => {
const audioId = cc.audioEngine.play(audioClip, false, 0.8);
if (cb) {
cc.audioEngine.setFinishCallback(audioId, () => {
cb();
});
}
});
} else {
cb && cb();
}
}
playLocalAudio(audioName) {
const audio = this.node.getChildByName("audio").getChildByName(audioName).getComponent(cc.AudioSource);
return new Promise((resolve, reject) => {
const id = cc.audioEngine.playEffect(audio.clip, false);
cc.audioEngine.setFinishCallback(id, () => {
resolve(id);
});
})
}
}
......@@ -20,9 +20,13 @@ export class Item {
public audio;
public image;
public optionList;
public voice;
public time;
constructor(data, page) {
this.audio = data.audio;
this.image = data.image;
this.voice = data.voice;
this.time = data.time;
let id = 0;
this.optionList = data.optionList.map(o => {
......@@ -46,7 +50,7 @@ export default class Game {
return Game.ins;
}
private data: any;
private lists: Array<Item>
public lists: Array<Item>
constructor() {
//
this.start = false;
......
This diff is collapsed.
import { asyncDelay, onHomeworkFinish } from "../script/util";
import { asyncDelay, exchangeNodePos, getSprNode, onHomeworkFinish, playAudio } from "../script/util";
import { MyCocosSceneComponent } from "../script/MyCocosSceneComponent";
import Game, { Item, Option } from "./Game";
import pg from "./pg";
......@@ -51,7 +51,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
Game.getIns().init(this.data);
}
initView() {
pg.view.find(this, "mouse_start").getComponent("mstart").play();
pg.event.emit("mouse_start_play", { voice: Game.getIns().aniEnter.audioUrl, time: Game.getIns().aniEnter.time });
}
initEvent() {
pg.view.touchOn(pg.view.find(this, 'bg/bg_card/btn_check'), this.onTouchCheck, this);
......@@ -61,10 +61,15 @@ export default class SceneComponent extends MyCocosSceneComponent {
pg.event.on("gameOver", () => { this.gameOver() })
}
private currentCards: cc.Node[];
//开始游戏
startGame() {
Game.getIns().reset();
pg.event.emit("mouse_num", Game.getIns().getTotalPageNum());
this.nextPage();
}
nextPage() {
......@@ -211,6 +216,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
})
if (!itemBg || this.currentCards[itemBg.data.count]) {
//回退
this.playLocalAudio("error");
target.setPosition(this.getPostionById(data.count))
for (let i = 0; i < this.currentCards.length; i++) {
let cd = this.currentCards[i];
......@@ -226,6 +232,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
target.setPosition(pos);
this.currentCards[itemBg.data.count] = target;
this.playLocalAudio("right");
let ani_flower = cc.instantiate(this.ani_flower);
ani_flower.active = true;
target.addChild(ani_flower);
......@@ -251,6 +258,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
if (this.onTouchCheckCantouch) return;
let isSuccess = Game.getIns().checkSuccess(this.currentCards.map(cd => cd.data));
if (!isSuccess) {
this.playLocalAudio("error");
this.currentCards.forEach(card => {
cc.tween(card).to(0.3, { x: this.getPostionById(card.data.count).x, y: this.getPostionById(card.data.count).y }).start();
})
......@@ -259,30 +267,22 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
this.onTouchCheckCantouch = true;
pg.event.emit("mouse_add");
this.updateCardResult().then(this.updateLollipop.bind(this)).then(() => {
Game.getIns().addPage();
if (Game.getIns().isOver) {
pg.event.emit("gameOver")
} else {
pg.event.emit("nextPage")
}
this.onTouchCheckCantouch = false;
})
setTimeout(() => {
this.updateCardResult();
this.updateLollipop().then(() => {
Game.getIns().addPage();
if (Game.getIns().isOver) {
pg.event.emit("gameOver")
} else {
pg.event.emit("nextPage")
}
this.onTouchCheckCantouch = false;
})
}, 500);
}
updateCardResult() {
return new Promise((res, rej) => {
let page = Game.getIns().getCurrentPage();
//显示小老鼠
if (page.audio) {
pg.view.find(this, "mouse_start").getComponent("mstart").play(page.audio).then(() => {
res(true);
});
} else {
setTimeout(() => {
res(true);
}, 1000);
}
if (!!page.image) {
this.layout_card.active = false;
this.layout_card_result.active = true;
......@@ -290,6 +290,13 @@ export default class SceneComponent extends MyCocosSceneComponent {
let img = pg.view.find(this.layout_card_result, "img");
pg.view.setNetImg(img, page.image, { w: 340, h: 150 })
}
//显示小老鼠
if (page.voice) {
pg.event.on("mouse_start_play_success", () => { res(true); })
pg.event.emit("mouse_start_play", { voice: page.voice, time: page.time });//
} else {
setTimeout(() => { res(true); }, 1000);
}
})
}
updateLollipop() {
......@@ -328,7 +335,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
let sprite = progressbar_red.getComponent(cc.Sprite);
sprite.fillRange = 1;
let i2 = setInterval(() => {
sprite.fillRange -= 0.005;
sprite.fillRange -= 0.009;
}, 30)
setTimeout(() => {
......
export const defaultData = {
"aniEnter": {
"skeJsonData": {}, "texJsonData": {}, "texPngData": {}, "audioUrl": "http://staging-teach.cdn.ireadabc.com/7fe846cbce9c853eb000e567eee5e4f6.mp3", "time": "2"
},
"item": {
"questionList": [
{
"audio": "http://staging-teach.cdn.ireadabc.com/116fb7accb5428361836fbc46287f769.mp3",
"image": "http://staging-teach.cdn.ireadabc.com/a5b6943a004bc48b07220f832853bd46.png",
"optionList": [
{
"type": "picText",
"text": "as",
"image": "http://staging-teach.cdn.ireadabc.com/418486dc95e98b7d3f88f652c4716bbc.png",
"optionAudio": "http://staging-teach.cdn.ireadabc.com/116fb7accb5428361836fbc46287f769.mp3"
}, {
"type": "picText",
"text": "bs",
"image": "http://staging-teach.cdn.ireadabc.com/476305ab6763e6821b34f66f1b6a59ed.png",
"optionAudio": "http://staging-teach.cdn.ireadabc.com/f7fb9f71ab7d460ac2f78c85efba7610.mp3"
},
]
},
{
"audio": "", "image": "", "optionList": [{ "type": "text", "text": "a", "image": "", "optionAudio": "http://staging-teach.cdn.ireadabc.com/116fb7accb5428361836fbc46287f769.mp3" }, { "type": "text", "text": "b", "image": "", "optionAudio": "http://staging-teach.cdn.ireadabc.com/526624b47ba5e46f698add9e152a4b4e.mp3" }, { "type": "text", "text": "", "image": "", "optionAudio": "http://staging-teach.cdn.ireadabc.com/fe2520ea0b12ad8c482595f6dddf8019.mp3" }]
}
]
}
}
\ No newline at end of file
export const defaultData = { "aniEnter": { "skeJsonData": {}, "texJsonData": {}, "texPngData": {}, "audioUrl": "http://staging-teach.cdn.ireadabc.com/fe2520ea0b12ad8c482595f6dddf8019.mp3", "time": "2" }, "item": { "questionList": [{ "audio": "", "image": "", "optionList": [{ "type": "text", "text": "a", "image": "", "optionAudio": "http://staging-teach.cdn.ireadabc.com/116fb7accb5428361836fbc46287f769.mp3" }, { "type": "text", "text": "b", "image": "", "optionAudio": "http://staging-teach.cdn.ireadabc.com/526624b47ba5e46f698add9e152a4b4e.mp3" }, { "type": "text", "text": "", "image": "", "optionAudio": "http://staging-teach.cdn.ireadabc.com/fe2520ea0b12ad8c482595f6dddf8019.mp3" }], "voice": "http://staging-teach.cdn.ireadabc.com/7fe846cbce9c853eb000e567eee5e4f6.mp3", "time": "2" }, { "audio": "", "image": "http://staging-teach.cdn.ireadabc.com/a5b6943a004bc48b07220f832853bd46.png", "optionList": [{ "type": "picText", "text": "as", "image": "http://staging-teach.cdn.ireadabc.com/418486dc95e98b7d3f88f652c4716bbc.png", "optionAudio": "http://staging-teach.cdn.ireadabc.com/116fb7accb5428361836fbc46287f769.mp3" }, { "type": "picText", "text": "bs", "image": "http://staging-teach.cdn.ireadabc.com/476305ab6763e6821b34f66f1b6a59ed.png", "optionAudio": "http://staging-teach.cdn.ireadabc.com/f7fb9f71ab7d460ac2f78c85efba7610.mp3" }, { "type": "picText", "text": "cd", "image": "http://staging-teach.cdn.ireadabc.com/cda87159d3d022b6469b186e325c2bb6.png", "optionAudio": "" }, { "type": "picText", "text": "dd", "image": "http://staging-teach.cdn.ireadabc.com/bb4244d166b6d077617ff089f7fd46c4.png", "optionAudio": "" }, { "type": "picText", "text": "ed", "image": "http://staging-teach.cdn.ireadabc.com/be64edcdfed05f4a61690207570f39d7.png", "optionAudio": "http://staging-teach.cdn.ireadabc.com/9df3f14bc88bcffc49b6717c40428ed8.mp3" }], "voice": "http://staging-teach.cdn.ireadabc.com/9df3f14bc88bcffc49b6717c40428ed8.mp3", "time": "5" }] } }
\ No newline at end of file
......@@ -3571,6 +3571,8 @@ declare namespace cc {
!#zh 获取节点正前方(z 轴)面对的方向,返回值为世界坐标系下的归一化向量 */
forward: Vec3;
data: any;
star: Node;
starBig: Node;
/**
@param name name
......@@ -43,6 +43,15 @@
<div *ngFor="let question of item.questionList; let i = index" class="card-item clearfix"
style="padding: 0.5vw; width: 100%; ">
<div class="card-item-content border">
<div>
<div style="height: 30px; font-size: 18px;">动画提示音频:</div>
<app-audio-recorder [audioUrl]="question.voice" (audioUploaded)="onVioceUploadSuccess($event, i)">
</app-audio-recorder>
</div>
<div>
动画停留时间:
<input type="text" nz-input [(ngModel)]="question.time" (ngModelChange)="this.onTxtChangeAniEnter($event, i)">
</div>
<div>
<span style="height: 30px; font-size: 18px;">完整单词:</span>
<span style="height: 30px; font-size: 18px;">{{getQuestionText(question)}}</span>
......
......@@ -35,7 +35,9 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
"type": 0,
"text": "",
"image": "",
"optionAudio": ""
"optionAudio": "",
"time": '',
'voice': '',
}]
}
);
......@@ -58,7 +60,9 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
"type": 0,
"text": "",
"image": "",
"optionAudio": ""
"optionAudio": "",
"time": '',
'voice': '',
});
this.save();
}
......@@ -85,7 +89,9 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
"type": 0,
"text": "",
"image": "",
"optionAudio": ""
"optionAudio": "",
"time": '',
'voice': '',
}]
}]
};
......@@ -119,6 +125,10 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
init() {
}
onVioceUploadSuccess(e, questionIdx) {
this.item.questionList[questionIdx].voice = e.url;
this.save();
}
onAudioUploadSuccess(e, questionIdx) {
this.item.questionList[questionIdx].audio = e.url;
......
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