Commit dd087543 authored by chenli's avatar chenli

蛋糕功能部分,增加

parent f32eae1d
{
"ver": "2.0.1",
"uuid": "11b780d3-4491-4f17-ab3d-a58660c33d54",
"downloadMode": 0,
"duration": 0.2642,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "d81ea52c-6b20-4a64-9d55-ed33de516387",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "98c45dc8-c06c-4823-a47e-b284276aa115",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
......@@ -115,14 +115,8 @@ export class MyCocosSceneComponent extends cc.Component {
}
onLoadEnd() {
}
}
......
......@@ -2,5 +2,11 @@ export const defaultData = {
"pic_url": "http://staging-teach.cdn.ireadabc.com/ed94332a503c31e0908bd4c6923a2665.png",
"pic_url_2": "http://staging-teach.cdn.ireadabc.com/5fb60317ade0195d35ad8034d5370a7f.png",
"text": "This is a test label.",
"audio_url": "http://staging-teach.cdn.ireadabc.com/f47f1d7b5c160fe1c59500d180346240.mp3"
"audio_url": "http://staging-teach.cdn.ireadabc.com/f47f1d7b5c160fe1c59500d180346240.mp3",
"title_text" : "Find the missing piece of the cake",
"timu_arr": ["the","that","where","is","okok"],
"timu_right_arr":["h","a","e","i","k"],
"timu_wrong_arr":["m","m","m","m","m"],
}
\ 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
const {ccclass, property} = cc._decorator;
@ccclass
export default class timuPrefab extends cc.Component {
@property(cc.Label)
lab_bottom: cc.Label = null;
// @property(cc.Node)
// root: cc.Node = null;
// @property
// text: string = 'hello';
// LIFE-CYCLE CALLBACKS:
// onLoad () {}
private cakeNodes:Array<cc.Node> = [];
private str:string;
private right:string;
private wrong:string;
//第几个位置
private index:number = 0;
@property(cc.Node)
private cake_right_1:cc.Node;
@property(cc.Node)
private cake_right_2:cc.Node;
start () {
}
// update (dt) {}
public initUI(){
for(var i = 0;i < 5;i++){
let id = i + 1;
this.cakeNodes.push(this.node.getChildByName("cake" + id));
}
}
setString(str:string,right:string,wrong:string){
this.str = str;
this.right = right;
this.wrong = wrong;
this.lab_bottom.string = str;
let newStr:string = "";
for(var i = 0;i < str.length;i++){
if(str[i] == this.right){
this.index = i;
}
else{
newStr = newStr + str[i];
}
}
for(var i = 0;i < this.cakeNodes.length;i++){
if(newStr[i] != null && newStr[i] != undefined){
this.cakeNodes[i].active = true;
this.cakeNodes[i].getChildByName("lab_text").getComponent(cc.Label).string = newStr[i];
}
else{
this.cakeNodes[i].active = false;
}
}
this.cake_right_1.getChildByName("lab_text").getComponent(cc.Label).string = this.right;
this.cake_right_2.getChildByName("lab_text").getComponent(cc.Label).string = this.wrong;
if(Math.random() * 100 < 50){
this.cake_right_1.y = 120;
this.cake_right_2.y = -81;
}
else{
this.cake_right_1.y = -81;
this.cake_right_2.y = 120;
}
this.cake_right_1.on('click', () => {
this.log("right");
})
this.cake_right_2.on('click', () => {
this.log("wrong");
})
}
moveLeft(){
this.node.x = cc.winSize.width/2 + 310/2;
cc.tween(this.node)
.to(1, { x: 0 }, { easing: 'cubicInOut' })
.call(() => {
})
.start();
}
moveRight(){
cc.tween(this.node)
.to(1, { x: cc.winSize.width/2 + 310/2 }, { easing: 'cubicInOut' })
.call(() => {
this.node.destroy();
})
.start();
}
log (str) {
const node = cc.find('middleLayer');
if(node){
node.getComponent('middleLayer').log(str);
}else{
cc.log(str);
}
}
}
{
"ver": "1.0.8",
"uuid": "d6fa384f-3473-4b4c-b398-ad41f65a860e",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "0a4513eb-908c-4d65-a564-8d9b26035f49",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "74da1635-61c1-485e-a16a-db16c4ad8c66",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1280,
"height": 720,
"platformSettings": {},
"subMetas": {
"bg": {
"ver": "1.0.4",
"uuid": "422910aa-afbc-45d5-9829-a5084d13cdcb",
"rawTextureUuid": "74da1635-61c1-485e-a16a-db16c4ad8c66",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 1280,
"height": 720,
"rawWidth": 1280,
"rawHeight": 720,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "e5a99510-f0e1-4bc7-b915-76c02325c8e1",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1280,
"height": 35,
"platformSettings": {},
"subMetas": {
"bottom1": {
"ver": "1.0.4",
"uuid": "8985e2e7-77d2-40e9-91d1-1f7fc3225c90",
"rawTextureUuid": "e5a99510-f0e1-4bc7-b915-76c02325c8e1",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 1280,
"height": 35,
"rawWidth": 1280,
"rawHeight": 35,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "4df818c3-788e-46ed-a338-8a811704c719",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 400,
"height": 99,
"platformSettings": {},
"subMetas": {
"bottom2": {
"ver": "1.0.4",
"uuid": "6cab2089-0938-4747-ad5a-e0ae30496f50",
"rawTextureUuid": "4df818c3-788e-46ed-a338-8a811704c719",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 400,
"height": 99,
"rawWidth": 400,
"rawHeight": 99,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "baeac049-f743-432a-86ae-cafc74708196",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 310,
"height": 175,
"platformSettings": {},
"subMetas": {
"cake1": {
"ver": "1.0.4",
"uuid": "1ea6330c-9d93-4732-88ab-3e5c6cfcaee0",
"rawTextureUuid": "baeac049-f743-432a-86ae-cafc74708196",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 1,
"trimY": 2,
"width": 308,
"height": 171,
"rawWidth": 310,
"rawHeight": 175,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "604016ec-83c0-43a3-8855-f61c69e724a7",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 332,
"height": 196,
"platformSettings": {},
"subMetas": {
"cake1_k": {
"ver": "1.0.4",
"uuid": "e7448a90-f9dd-484c-8ba9-fe32c21d062c",
"rawTextureUuid": "604016ec-83c0-43a3-8855-f61c69e724a7",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 332,
"height": 196,
"rawWidth": 332,
"rawHeight": 196,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "bea686bd-a469-4746-bc7e-077f0be85d16",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 305,
"height": 175,
"platformSettings": {},
"subMetas": {
"cake2": {
"ver": "1.0.4",
"uuid": "e9eb8fab-f25a-4b24-a925-0bd33f480165",
"rawTextureUuid": "bea686bd-a469-4746-bc7e-077f0be85d16",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 2,
"trimY": 0,
"width": 301,
"height": 175,
"rawWidth": 305,
"rawHeight": 175,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "fd83bdb5-90fd-4472-a005-8c3ec508bd4d",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 325,
"height": 199,
"platformSettings": {},
"subMetas": {
"cake2_k": {
"ver": "1.0.4",
"uuid": "81191b41-1b2c-403e-8928-8c3985123bc5",
"rawTextureUuid": "fd83bdb5-90fd-4472-a005-8c3ec508bd4d",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 325,
"height": 199,
"rawWidth": 325,
"rawHeight": 199,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "5cfeb8ce-fd15-4aa3-bf30-d85b328651b1",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 305,
"height": 175,
"platformSettings": {},
"subMetas": {
"cake3": {
"ver": "1.0.4",
"uuid": "4ca5ee2d-6c1a-4ca9-9296-2755ccc9f20c",
"rawTextureUuid": "5cfeb8ce-fd15-4aa3-bf30-d85b328651b1",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -0.5,
"offsetY": 0.5,
"trimX": 1,
"trimY": 0,
"width": 302,
"height": 174,
"rawWidth": 305,
"rawHeight": 175,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"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.
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