Commit 6ee2c7e6 authored by yu's avatar yu

选项布局

parent f1a71cf3
// 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 "./pg";
const { ccclass, property } = cc._decorator;
@ccclass
export default class TipsJigsaw extends cc.Component {
// LIFE-CYCLE CALLBACKS:
private sureCall = null;
private canCall = null;
onLoad() {
pg.view.touchOn(cc.find("continue", this.node), this.onContinue, this);
pg.view.touchOn(cc.find("leave", this.node), this.onLeave, this);
pg.view.touchOn(cc.find("btn_zcdt", this.node), this.onContinue, this);
pg.view.touchOn(cc.find("btn_bl", this.node), this.onLeave, this);
pg.event.on("show_tips", (data) => {
this.sureCall = data.sureCall;
this.canCall = data.canCall;
cc.find("desc", this.node).getComponent(cc.Label).string = data.text;
this.updataBtn(data.type);
this.node.active = true;
this.node.zIndex = 100;
})
}
start() {
}
private updataBtn(type) {
cc.find("btn_zcdt", this.node).active = type == "again";
cc.find("btn_bl", this.node).active = type == "again";
cc.find("leave", this.node).active = type == "leave";
cc.find("continue", this.node).active = type == "leave";
}
private onContinue() {
this.sureCall && this.sureCall();
this.hide();
}
private onLeave() {
this.canCall && this.canCall();
this.hide();
}
private hide() {
this.node.active = false;
this.sureCall = null;
this.canCall = null;
}
// update (dt) {}
}
{
"ver": "1.0.8",
"uuid": "9ce746a4-83d0-4dfb-8808-e3dec4d9ef2b",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
...@@ -3383,7 +3383,7 @@ ...@@ -3383,7 +3383,7 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 426, "width": -20,
"height": 200 "height": 200
}, },
"_anchorPoint": { "_anchorPoint": {
...@@ -3430,7 +3430,7 @@ ...@@ -3430,7 +3430,7 @@
"_enabled": true, "_enabled": true,
"_layoutSize": { "_layoutSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 426, "width": -20,
"height": 200 "height": 200
}, },
"_resize": 1, "_resize": 1,
...@@ -3445,11 +3445,11 @@ ...@@ -3445,11 +3445,11 @@
"_N$paddingRight": 0, "_N$paddingRight": 0,
"_N$paddingTop": 0, "_N$paddingTop": 0,
"_N$paddingBottom": 0, "_N$paddingBottom": 0,
"_N$spacingX": 30, "_N$spacingX": 20,
"_N$spacingY": 0, "_N$spacingY": 0,
"_N$verticalDirection": 1, "_N$verticalDirection": 1,
"_N$horizontalDirection": 0, "_N$horizontalDirection": 0,
"_N$affectedByScale": false, "_N$affectedByScale": true,
"_id": "dculHDD/FJyLWvSjvjsbGg" "_id": "dculHDD/FJyLWvSjvjsbGg"
}, },
{ {
......
import { asyncDelay, exchangeNodePos, getSprNode, onHomeworkFinish, onHomeworkStart, playAudio } from "../script/util"; import { asyncDelay, exchangeNodePos, getSprNode, onHomeworkFinish, onHomeworkStart, playAudio } from "../script/util_op_input";
import { MyCocosSceneComponent } from "../script/MyCocosSceneComponent"; import { MyCocosSceneComponent } from "../script/MyCocosSceneComponent_op_input";
import Game, { Item, Option } from "./Game"; import Game, { Item, Option } from "./Game_op_input";
import pg from "./pg"; import pg from "./pg_op_input";
const { ccclass, property } = cc._decorator; const { ccclass, property } = cc._decorator;
...@@ -208,6 +208,15 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent { ...@@ -208,6 +208,15 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent {
}) })
this.nor_label.opacity = 0; this.nor_label.opacity = 0;
this.nor_label.getComponent(cc.Label).string = wordStr; this.nor_label.getComponent(cc.Label).string = wordStr;
let len = this.word_layout.children.length
if (len > 8) {
let scale = len > 8 && len < 11 ? 0.9 : len <= 12 ? 0.8 : 0.75;
let spx = len > 8 && len < 11 ? 20 : len <= 12 ? 10 : 0;
this.word_layout.getComponent(cc.Layout).spacingX = spx;
this.word_layout.children.forEach((ch) => {
ch.scale = scale;
})
}
} }
private setTouchPos(e) { private setTouchPos(e) {
let location = e.getLocation(); let location = e.getLocation();
......
import { defaultData } from "../script/defaultData"; import { defaultData } from "../script/defaultData_op_input";
export class MyCocosSceneComponent extends cc.Component { export class MyCocosSceneComponent extends cc.Component {
......
...@@ -202,3 +202,4 @@ export const defaultData = { ...@@ -202,3 +202,4 @@ export const defaultData = {
"waitAudioName": "", "waitAudioName": "",
"twoVectoringAudio": "http://staging-teach.cdn.ireadabc.com/449e65975d358514cc3494f9f67bc012_l.mp3" "twoVectoringAudio": "http://staging-teach.cdn.ireadabc.com/449e65975d358514cc3494f9f67bc012_l.mp3"
} }
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"height": 720, "height": 720,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"bg_color": { "bg_color_op_input": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "fcc3e161-74b6-4abe-956c-2ef793e0c7d8", "uuid": "fcc3e161-74b6-4abe-956c-2ef793e0c7d8",
"rawTextureUuid": "98bd8059-0830-4f4a-bf64-ea9e69d2ce7a", "rawTextureUuid": "98bd8059-0830-4f4a-bf64-ea9e69d2ce7a",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"height": 208, "height": 208,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"bg_good-job2": { "bg_good-job2_op_input": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "3f4908f4-73c0-44ba-a05e-45808841bfc6", "uuid": "3f4908f4-73c0-44ba-a05e-45808841bfc6",
"rawTextureUuid": "ff8924fb-b75c-4125-aa38-5ca522f6f13e", "rawTextureUuid": "ff8924fb-b75c-4125-aa38-5ca522f6f13e",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"height": 720, "height": 720,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"bg": { "bg_op_input": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "57974699-2eed-49a1-ad53-218384298775", "uuid": "57974699-2eed-49a1-ad53-218384298775",
"rawTextureUuid": "7249f019-68c0-4fde-9f7b-80248ce56fca", "rawTextureUuid": "7249f019-68c0-4fde-9f7b-80248ce56fca",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"height": 116, "height": 116,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"fangkuang": { "fangkuang_op_input": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "5ef02ff5-cfad-464f-8851-2cd44b3ab93d", "uuid": "5ef02ff5-cfad-464f-8851-2cd44b3ab93d",
"rawTextureUuid": "dc429aec-841e-4b52-b0f8-9b0e8276b9e2", "rawTextureUuid": "dc429aec-841e-4b52-b0f8-9b0e8276b9e2",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"height": 102, "height": 102,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"icon_1": { "icon_1_op_input": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "9f60a430-8452-4000-be30-2eb6a0b0a0de", "uuid": "9f60a430-8452-4000-be30-2eb6a0b0a0de",
"rawTextureUuid": "d627d2c5-fda5-412e-bb71-e248128e1caf", "rawTextureUuid": "d627d2c5-fda5-412e-bb71-e248128e1caf",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"height": 32, "height": 32,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"icon_2": { "icon_2_op_input": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "0b1b6372-ceae-4932-aaee-a48b4721e069", "uuid": "0b1b6372-ceae-4932-aaee-a48b4721e069",
"rawTextureUuid": "b29e23cd-af1d-4636-bb5a-e9f8b6bd064c", "rawTextureUuid": "b29e23cd-af1d-4636-bb5a-e9f8b6bd064c",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"height": 188, "height": 188,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"item_bg": { "item_bg_op_input": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "77bbd220-4066-4908-90dd-10ddf8f17996", "uuid": "77bbd220-4066-4908-90dd-10ddf8f17996",
"rawTextureUuid": "2eb500cc-5898-47b3-96db-c7ddb111e6f9", "rawTextureUuid": "2eb500cc-5898-47b3-96db-c7ddb111e6f9",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"height": 52, "height": 52,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"panzi": { "panzi_op_input": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "7bae7286-9e5c-4e1f-90e2-0dac610a76e6", "uuid": "7bae7286-9e5c-4e1f-90e2-0dac610a76e6",
"rawTextureUuid": "bda417d5-6e2f-4b33-96ad-b130f7c4bc29", "rawTextureUuid": "bda417d5-6e2f-4b33-96ad-b130f7c4bc29",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"height": 21, "height": 21,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"tiao_1": { "tiao_1_op_input": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "6c83e2dd-3069-45d5-b1fe-bf4db4d30fc6", "uuid": "6c83e2dd-3069-45d5-b1fe-bf4db4d30fc6",
"rawTextureUuid": "ca2e2059-61d1-4398-ab54-27be56fdb1cb", "rawTextureUuid": "ca2e2059-61d1-4398-ab54-27be56fdb1cb",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"height": 9, "height": 9,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"tiao_2": { "tiao_2_op_input": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "5a598b70-9813-4152-a2ee-a7956004b8a9", "uuid": "5a598b70-9813-4152-a2ee-a7956004b8a9",
"rawTextureUuid": "50c88d00-1dd0-4495-8de9-fa9972c2a385", "rawTextureUuid": "50c88d00-1dd0-4495-8de9-fa9972c2a385",
......
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