Commit 7ac9aa67 authored by Tt's avatar Tt

初始化

parent 3d36cbfc
{
"ver": "1.1.2",
"uuid": "3f43f526-9b13-4e15-bc3d-9dcf21d0b981",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "36abc766-60c3-40c3-965f-8232c750d9db",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"__type__": "cc.AnimationClip",
"_name": "collision",
"_objFlags": 0,
"_native": "",
"_duration": 0.16666666666666666,
"sample": 60,
"speed": 0.3,
"wrapMode": 1,
"curveData": {
"paths": {
"path-5": {
"props": {
"scale": [
{
"frame": 0,
"value": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
}
},
{
"frame": 0.16666666666666666,
"value": {
"__type__": "cc.Vec2",
"x": 3,
"y": 3
}
}
],
"active": [
{
"frame": 0,
"value": true
},
{
"frame": 0.16666666666666666,
"value": false
}
],
"opacity": [
{
"frame": 0,
"value": 255
},
{
"frame": 0.16666666666666666,
"value": 0
}
]
}
}
}
},
"events": []
}
\ No newline at end of file
{
"ver": "2.1.0",
"uuid": "a5c6cff3-0959-4f10-b41b-91eb895a42d2",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "d3b94adb-1774-4139-903f-4a9de780fc15",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "7e9aad34-5fac-4c8e-af1c-fafa45bfb2b8",
"downloadMode": 0,
"duration": 0.130612,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "0e9766cd-15c5-4e58-8a02-69074537676f",
"downloadMode": 0,
"duration": 1.854694,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "fc079afd-b223-42f4-a015-4c4693896b68",
"downloadMode": 0,
"duration": 4.04898,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "e2c5914f-ce64-4595-a7a1-62901880f3f1",
"downloadMode": 0,
"duration": 0.940417,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "8fbd176d-e0c8-45fb-bd90-aab4b112eae6",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "a2064f38-4656-43e0-a4c6-dd45856f6ecc",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "bbb7f5b8-6788-4f09-bb15-e32ab0dbbdcc",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "c8735c01-b123-44ce-be09-078222f3b98f",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "0fab6378-4a5f-4b6d-a672-8ff2a25159ea",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "ac86e335-44ed-48e5-bd97-5f4ab7fa28d4",
"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": "ItemLetter",
"_objFlags": 0,
"_parent": null,
"_children": [],
"_active": true,
"_components": [
{
"__id__": 2
}
],
"_prefab": {
"__id__": 3
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 101,
"b": 127,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 25.59,
"height": 63
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
1.4210854715202004e-14,
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.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_useOriginalSize": true,
"_string": "a",
"_N$string": "a",
"_fontSize": 50,
"_lineHeight": 50,
"_enableWrapText": true,
"_N$file": {
"__uuid__": "c8735c01-b123-44ce-be09-078222f3b98f"
},
"_isSystemFontUsed": false,
"_spacingX": 0,
"_batchAsBitmap": false,
"_styleFlags": 0,
"_underlineHeight": 0,
"_N$horizontalAlign": 0,
"_N$verticalAlign": 0,
"_N$fontFamily": "Arial",
"_N$overflow": 0,
"_N$cacheMode": 0,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "b6tUp6h3FGqIzgruhfeGOW",
"sync": false
}
]
\ No newline at end of file
{
"ver": "1.2.9",
"uuid": "bd542fa6-8b7f-4b6a-9ab4-e98f7ddfe311",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
{
"ver": "1.2.9",
"uuid": "d7b06c6a-31a1-4cd8-9d8b-a6d42be9b5fa",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"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": "ItemSlot",
"_objFlags": 0,
"_parent": null,
"_children": [
{
"__id__": 2
}
],
"_active": true,
"_components": [
{
"__id__": 5
}
],
"_prefab": {
"__id__": 6
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 214,
"height": 275
},
"_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": 2,
"groupIndex": 2,
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "bg_di2",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 3
}
],
"_prefab": {
"__id__": 4
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 224,
"height": 273
},
"_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": 2,
"groupIndex": 2,
"_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__": "76e95207-abc9-4ae7-92e3-62ccbd231e98"
},
"_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__": "4bd0a815-c853-4953-9646-5142394886f0"
},
"fileId": "4cQzpDxmxCfrsXcoXqBf/0",
"sync": false
},
{
"__type__": "cc.CircleCollider",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"tag": 0,
"_offset": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_radius": 47,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "4bd0a815-c853-4953-9646-5142394886f0"
},
"fileId": "23OrwiGHlFpq/19juKx2OK",
"sync": false
}
]
\ No newline at end of file
{
"ver": "1.2.9",
"uuid": "4bd0a815-c853-4953-9646-5142394886f0",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
{
"ver": "1.2.9",
"uuid": "08943eff-5fc8-47e9-bf14-8f95396918a9",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "822a497c-4e18-461e-9cf9-2c967fc9f809",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
{
"ver": "1.2.9",
"uuid": "57ea7c61-9b8b-498a-b024-c98ee9124beb",
"asyncLoadAssets": false,
"autoReleaseAssets": true,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "1727edb7-5ab0-4d47-be21-60c7dd7aaca5",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
cc.Class({
extends: cc.Component,
onLoad() {
this.nodeDict = {};
this.linkWidget(this.node);
},
// 遍历节点树,获取重要节点
// 节点名字以$开头的节点为重要节点,放进nodeDict中,可以直接拿到,不用拖拽绑定
// $btn为按钮类型,放进nodeDict,并且绑定按钮点击事件
// $ui为ui节点,放进nodeDict,并且上面绑定了BaseUI脚本,所以不继续遍历该节点的子节点
// $btnUI为按钮类型ui节点,放进nodeDict,并且上面绑定了BaseUI脚本,所以不继续遍历该节点的子节点,并且绑定按钮点击事件
linkWidget(node) {
let children = node.children;
for (let i = 0; i < children.length; i++) {
let nodeName = children[i].name;
if (nodeName.substring(0, 1) !== "$") {
this.linkWidget(children[i]);
continue;
}
let realName = nodeName.substring(1);
if (this.nodeDict[realName]) {
cc.error("节点名字重复!" + realName);
this.linkWidget(children[i]);
continue;
}
let isUI = false;
this.nodeDict[realName] = children[i];
if (nodeName.substring(1, 6) === "btnUI") {
children[i].on('click', this.buttonListener, this);
isUI = true;
} else if (nodeName.substring(1, 4) === "btn") {
children[i].on('click', this.buttonListener, this);
isUI = false;
} else if (nodeName.substring(1, 3) === "ui") {
isUI = true;
}
children[i].name = realName;
this.nodeDict[realName] = children[i];
if (!isUI) {
this.linkWidget(children[i]);
}
}
},
getNodeByName(name) {
return this.nodeDict[name];
},
buttonListener(button) { }
});
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "7af27a40-c9d2-4101-b894-8dff982f3985",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
export const DefaultData = {
"questionAudio": "http://staging-teach.cdn.ireadabc.com/0a78ca4f93c66c026d1e5319baffae6e.mp3",
"questionText": "123123",
"questionList": [
{
"audio": "http://staging-teach.cdn.ireadabc.com/0a78ca4f93c66c026d1e5319baffae6e.mp3",
"optionList": [
{
"text": "a",
"optionAudio": "http://staging-teach.cdn.ireadabc.com/0a78ca4f93c66c026d1e5319baffae6e.mp3"
},
{
"text": "pp",
"optionAudio": "http://staging-teach.cdn.ireadabc.com/d4a2488ca37b24c40012132d95484459.mp3"
},
{
"text": "l",
"optionAudio": "http://staging-teach.cdn.ireadabc.com/d4a2488ca37b24c40012132d95484459.mp3"
},
{
"text": "e",
"optionAudio": "http://staging-teach.cdn.ireadabc.com/d4a2488ca37b24c40012132d95484459.mp3"
},
{
"text": "e",
"optionAudio": "http://staging-teach.cdn.ireadabc.com/d4a2488ca37b24c40012132d95484459.mp3"
}
],
"image": "http://staging-teach.cdn.ireadabc.com/4260e4b2c49eebf248b71542fb285c35.png"
}
]
}
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "6fa9c94a-d3df-4f14-bf6b-b6aa701eb398",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
/**
* 事件模块
* onfire.js
*
*/
interface Listener {
cb: Function;
once: boolean;
target: object;
}
interface EventsType {
[eventName: string]: Listener[];
}
class EventMgr {
// 所有事件的监听器
es: EventsType = {};
on(eventName: string, cb: Function, target: object) {
if (!this.es[eventName]) {
this.es[eventName] = [];
}
this.es[eventName].push({
cb,
once: false,
target,
});
}
once(eventName: string, cb: Function, target: object) {
if (!this.es[eventName]) {
this.es[eventName] = [];
}
this.es[eventName].push({
cb,
once: true,
target,
});
}
emit(eventName: string, params?: any) {
const listeners = this.es[eventName] || [];
let l = listeners.length;
for (let i = 0; i < l; i++) {
const { cb, once, target } = listeners[i];
let args = [eventName, params];
cb.apply(target, args);
if (once) {
listeners.splice(i, 1);
i--;
l--;
}
}
}
off(eventName?: string, cb?: Function, target?: object) {
// clean all
if (eventName === undefined) {
this.es = {};
} else {
if (cb === undefined) {
// clean the eventName's listeners
delete this.es[eventName];
} else if (cb === null) {
if (!target) {
return;
}
const listeners = this.es[eventName] || [];
// clean the event and listener
let l = listeners.length;
for (let i = 0; i < l; i++) {
if (listeners[i].target === target) {
listeners.splice(i, 1);
i--;
l--;
}
}
} else {
const listeners = this.es[eventName] || [];
// clean the event and listener
let l = listeners.length;
for (let i = 0; i < l; i++) {
if (listeners[i].cb === cb && listeners[i].target === target) {
listeners.splice(i, 1);
i--;
l--;
}
}
}
}
}
}
export default new EventMgr();
\ No newline at end of file
{
"ver": "1.0.8",
"uuid": "f25d28c5-2fa1-4bfc-ab0c-9f8e3e8ff631",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
cc.Class({
extends: cc.Component,
properties: {
labWord: cc.Label,
nodRed: cc.Node,
sprPart: cc.Sprite,
},
onLoad() {
this.node.on('touchstart', this.onTouchStart, this);
this.node.on('touchmove', this.onTouchMove, this);
this.node.on('touchend', this.onTouchEnd, this);
this.node.on('touchcancel', this.onTouchEnd, this);
},
onDestroy() {
this.node.off('touchstart', this.onTouchStart, this);
this.node.off('touchmove', this.onTouchMove, this);
this.node.off('touchend', this.onTouchEnd, this);
this.node.off('touchcancel', this.onTouchEnd, this);
},
init(index, data, partCount, imgUrl, slotArr, scene) {
this.slotIndex = -1;
this.partIndex = -1;
this.scene = scene;
this.index = index;
this.data = data;
this.partCount = partCount;
this.imgUrl = imgUrl;
this.slotArr = slotArr;
this.labWord.string = data.text;
this.initSprite();
this.scheduleOnce(() => {
this.startPos = this.node.position;
})
},
initSprite() {
let url = this.imgUrl;
cc.assetManager.loadRemote(url, null, (err, texture) => {
if (err) {
console.log(err)
return;
}
let rect = cc.rect(0, 0, texture.width, texture.height);
let newRectWidth = rect.width / this.partCount;
let newRectHeight = rect.height;
let newRectX = this.index * newRectWidth;
let newRectY = 0;
let newRect = cc.rect(newRectX, newRectY, newRectWidth, newRectHeight);
this.sprPart.spriteFrame = new cc.SpriteFrame(texture, newRect);
if (this.sprPart.node.width > 152 || this.sprPart.node.height > 216) {
// 缩放背景图
if (this.sprPart.node.width / this.sprPart.node.height > 152 / 216) {
this.sprPart.node.scale = 152 / this.sprPart.node.width;
} else {
this.sprPart.node.scale = 216 / this.sprPart.node.height;
}
}
});
},
onTouchStart() {
this.node.zIndex = 2;
this.nodRed.active = true;
this.playAudio();
},
onTouchMove(event) {
let delta = event.getDelta();
let pos = this.node.position.add(delta);
this.node.position = pos;
},
onTouchEnd() {
this.node.zIndex = 1;
if (!this.otherNode) {
this.moveToTargetPos();
this.nodRed.active = false;
return;
}
this.otherPart = this.slotArr[this.otherNode.slotIndex];
if (this.otherPart) {
if (this.slotIndex !== -1) {
let temp = this.slotIndex;
this.slotIndex = this.otherNode.slotIndex;
this.slotArr[this.slotIndex] = this;
this.otherPart.slotIndex = temp;
this.slotArr[this.otherPart.slotIndex] = this.otherPart;
} else {
this.slotIndex = this.otherNode.slotIndex;
this.slotArr[this.slotIndex] = this;
this.otherPart.partIndex = this.partIndex;
this.slotArr[this.otherPart.slotIndex] = null;
this.otherPart.slotIndex = -1;
this.partIndex = -1;
}
} else {
if(this.slotIndex !== -1){
this.slotArr[this.slotIndex] = null;
}
this.slotIndex = this.otherNode.slotIndex;
}
this.slotArr[this.slotIndex] = this;
this.moveToTargetPos();
if (this.otherPart) {
this.otherPart.moveToTargetPos();
this.otherPart = null;
}
this.scene.checkDone();
this.nodRed.active = false;
},
playAudio() {
GameData.audioCount++;
let url = this.data.optionAudio;
cc.assetManager.loadRemote(url, null, (err, clip) => {
if (err) {
console.log(err)
return;
}
if (this.audioId) {
cc.audioEngine.stop(this.audioId);
this.audioId = null;
}
this.audioId = cc.audioEngine.play(clip, false, 1);
cc.audioEngine.setFinishCallback(id, () => {
GameData.audioCount--;
this.audioId = null;
})
});
},
toStartPos() {
this.slotIndex = -1;
cc.tween(this.node)
.to(0.1, { position: this.startPos })
.start()
},
moveToTargetPos() {
let pos;
if (this.slotIndex !== -1) {
pos = this.scene.arrSlotPos[this.slotIndex];
} else if (this.partIndex !== -1) {
pos = this.scene.arrPartPos[this.partIndex];
} else {
pos = this.startPos;
}
cc.tween(this.node)
.to(0.1, { position: pos })
.start()
},
onCollisionEnter: function (other, self) {
this.otherNode = other.node;
},
onCollisionExit: function (other, self) {
this.otherNode = null;
},
// update (dt) {},
});
{
"ver": "1.0.8",
"uuid": "362f7ae3-f394-4ed6-81c5-52d1c3c1c369",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
cc.Class({
extends: cc.Component,
properties: {
nodDoneBg:cc.Node,
},
// LIFE-CYCLE CALLBACKS:
onLoad () {
this.nodDoneBg.on('touchstart',this.onTouchStart,this)
},
onTouchStart () {
this.playAudio();
},
playAudio(){
let url = GameData.scene.data.questionList[GameData.questionIndex].audio;
cc.assetManager.loadRemote(url, null, (err, clip) => {
if (err) {
console.log(err)
return;
}
if (this.audioId) {
cc.audioEngine.stop(this.audioId);
this.audioId = null;
}
this.audioId = cc.audioEngine.play(clip, false, 1);
cc.audioEngine.setFinishCallback(id, () => {
this.audioId = null;
})
});
},
// update (dt) {},
});
{
"ver": "1.0.8",
"uuid": "60f0ba18-2997-44b3-a27a-947f5c3e5616",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
const { showFireworks } = require("./utils");
cc.Class({
extends: cc.Component,
properties: {
audOver: cc.AudioClip,
},
// LIFE-CYCLE CALLBACKS:
onLoad() {
this.node.getChildByName('bg_verygood').zIndex = 99;
},
start() {
showFireworks(
this.node,
this.node.getChildByName('RibbonNodeBase').children,
cc.v2(0, -400), cc.v2(0, 1000), 200, 200
);
showFireworks(
this.node,
this.node.getChildByName('RibbonNodeBase').children,
cc.v2(-600, -400), cc.v2(200, 1000), 200, 200
);
showFireworks(
this.node,
this.node.getChildByName('RibbonNodeBase').children,
cc.v2(600, -400), cc.v2(-200, 1000), 200, 200
);
this.playAudioOver();
},
playAudioOver() {
GameData.audioCount++;
let id = cc.audioEngine.play(this.audOver, false, 0.7);
cc.audioEngine.setFinishCallback(id, () => {
GameData.audioCount--;
})
},
// update (dt) {},
});
{
"ver": "1.0.8",
"uuid": "538f4f45-dcad-4ae8-804d-aabcdfae9cee",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
const FitType = {
Scale: 0,//等比缩放,一般用于背景图
FullScreen: 1,//铺满全屏,拉伸
FitMode: 2,//更改canvas适配策略,只能挂在canvas上
FullHeight: 3,
FullWidth: 4,
};
const designSize = cc.size(1280, 720);
cc.Class({
extends: cc.Component,
properties: {
FitType: {
type: cc.Enum(FitType),
default: 0
},
},
onLoad: function () {
cc.view.on('canvas-resize', this.refreshFit, this)
this.refreshFit();
},
onDestroy(){
cc.view.off('canvas-resize', this.refreshFit, this)
},
refreshFit() {
if (this.FitType == FitType.Scale) {
let winSize = cc.view.getVisibleSize();
console.log(winSize)
console.log(this.node.width,this.node.height)
if(this.node.width >= winSize.width && this.node.height >= winSize.height ){
return;
}
let scale1 = winSize.width / this.node.width;
let scale2 = winSize.height / this.node.height;
if (scale1 > scale2) {
this.node.scale = scale1;
} else {
this.node.scale = scale2;
}
} else if (this.FitType == FitType.FullScreen) {
let visiblesize = cc.view.getVisibleSize();
this.node.width = visiblesize.width;
this.node.height = visiblesize.height;
} else if (this.FitType == FitType.FullHeight) {
let visiblesize = cc.view.getVisibleSize();
let scale = visiblesize.width / this.node.width;
this.node.width = scale * this.node.width;
this.node.height = scale * this.node.height;
} else if (this.FitType == FitType.FullWidth) {
let visiblesize = cc.view.getVisibleSize();
let scale = visiblesize.height / this.node.height;
this.node.width = scale * this.node.width;
this.node.height = scale * this.node.height;
} else {
let wsize = cc.view.getFrameSize();
let scaleW = wsize.width / designSize.width;
let scaleH = wsize.height / designSize.height;
let pCanvas = this.node.getComponent(cc.Canvas);
if (pCanvas) {
if (scaleW > scaleH) { //更宽了要fitHeight, 否则height就留黑边了;
pCanvas.fitHeight = true;
pCanvas.fitWidth = false;
} else { //更高;
pCanvas.fitHeight = false;
pCanvas.fitWidth = true;
}
} else {
console.error("fitmode模式只能用在canvas节点上");
}
}
},
});
{
"ver": "1.0.8",
"uuid": "e22e1d5e-d025-463d-a8df-85de258d791e",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
{
"ver": "1.0.8",
"uuid": "f4ede462-f8d7-4069-ba80-915611c058ca",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
{
"ver": "1.0.8",
"uuid": "34fd68c3-ee66-4456-9cb3-15b8cc3478b7",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
{
"ver": "1.0.8",
"uuid": "f1d674f7-4bf6-49d3-9627-955201425216",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
{
"ver": "1.0.8",
"uuid": "d545f402-231b-417e-99e6-3269412a5a2c",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
{
"__type__": "cc.SpriteAtlas"
}
\ 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.
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