Commit 3215a93b authored by 李维's avatar 李维

修改涂色按钮位置

parent 4fdc86f4
......@@ -22,6 +22,9 @@
},
{
"__id__": 4
},
{
"__id__": 8
}
],
"_active": true,
......@@ -153,105 +156,25 @@
},
{
"__type__": "cc.Node",
"_name": "ToolBox",
"_name": "btnStartPaint",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 5
},
{
"__id__": 9
},
{
"__id__": 13
},
{
"__id__": 22
}
],
"_active": true,
"_components": [
{
"__id__": 97
},
{
"__id__": 98
}
],
"_prefab": {
"__id__": 99
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 316,
"height": 64
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
92,
288,
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": "Close",
"_objFlags": 0,
"_parent": {
"__id__": 4
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 6
"__id__": 5
},
{
"__id__": 7
"__id__": 6
}
],
"_prefab": {
"__id__": 8
"__id__": 7
},
"_opacity": 255,
"_opacity": 230,
"_color": {
"__type__": "cc.Color",
"r": 255,
......@@ -273,7 +196,7 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
127.5,
0,
0,
0,
0,
......@@ -303,7 +226,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 5
"__id__": 4
},
"_enabled": true,
"_materials": [
......@@ -314,10 +237,10 @@
"_srcBlendFactor": 1,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "6ea705f8-2da6-4402-a0f6-8700207af371"
"__uuid__": "e24fd2d0-5c35-4575-a145-32f8f20d223e"
},
"_type": 0,
"_sizeMode": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
......@@ -335,7 +258,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 5
"__id__": 4
},
"_enabled": true,
"_normalMaterial": null,
......@@ -406,15 +329,92 @@
"asset": {
"__uuid__": "6042751a-2c97-4cba-8feb-d1917e67a74b"
},
"fileId": "1fBHxQ/KZCkaHB1u9quXH+",
"fileId": "39zk93KatFQokUV5izdi5h",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "Painter",
"_name": "ToolBox",
"_objFlags": 0,
"_parent": {
"__id__": 4
"__id__": 1
},
"_children": [
{
"__id__": 9
},
{
"__id__": 13
},
{
"__id__": 22
}
],
"_active": true,
"_components": [
{
"__id__": 97
},
{
"__id__": 98
}
],
"_prefab": {
"__id__": 99
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 316,
"height": 64
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
92,
288,
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": "Close",
"_objFlags": 0,
"_parent": {
"__id__": 8
},
"_children": [],
"_active": true,
......@@ -451,7 +451,7 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
46.5,
127.5,
0,
0,
0,
......@@ -492,7 +492,7 @@
"_srcBlendFactor": 1,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "e24fd2d0-5c35-4575-a145-32f8f20d223e"
"__uuid__": "6ea705f8-2da6-4402-a0f6-8700207af371"
},
"_type": 0,
"_sizeMode": 0,
......@@ -584,7 +584,7 @@
"asset": {
"__uuid__": "6042751a-2c97-4cba-8feb-d1917e67a74b"
},
"fileId": "c6oEyk4n5ImJVyz2n7CH4c",
"fileId": "1fBHxQ/KZCkaHB1u9quXH+",
"sync": false
},
{
......@@ -592,7 +592,7 @@
"_name": "Eraser",
"_objFlags": 0,
"_parent": {
"__id__": 4
"__id__": 8
},
"_children": [
{
......@@ -633,7 +633,7 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-34.5,
46.5,
0,
0,
0,
......@@ -956,7 +956,7 @@
"_name": "Palette",
"_objFlags": 0,
"_parent": {
"__id__": 4
"__id__": 8
},
"_children": [
{
......@@ -1003,7 +1003,7 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-115.5,
-34.5,
0,
0,
0,
......@@ -4050,7 +4050,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 4
"__id__": 8
},
"_enabled": true,
"alignMode": 1,
......@@ -4079,7 +4079,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 4
"__id__": 8
},
"_enabled": true,
"_layoutSize": {
......
......@@ -74,6 +74,7 @@ export default class DrawingBoard extends cc.Component {
start () {
this.initData();
this.initButtons();
this.initEventListener();
this.initDrawBoardCenter();
}
......@@ -140,7 +141,7 @@ export default class DrawingBoard extends cc.Component {
bgPalette.active = false;
})
const painterBtn = cc.find("ToolBox/Painter", this.node)
const painterBtn = cc.find("btnStartPaint", this.node)
painterBtn.on("click", ()=>{
eraserBtn.active = true; // 显示橡皮按钮
painterBtn.active = false; // 隐藏画笔按钮
......@@ -216,6 +217,19 @@ export default class DrawingBoard extends cc.Component {
paletteBtn.active = false;
}
initEventListener() {
const toolBox = cc.find("ToolBox", this.node)
const painterBtn = cc.find("btnStartPaint", this.node)
this.node.on("enable", ()=>{
toolBox.active = true;
painterBtn.active = true;
})
this.node.on("disable", ()=>{
toolBox.active = false;
painterBtn.active = false;
})
}
initDrawBoardCenter() {
this.pathPointContainer = cc.find("PathPointContainer", this.node)
this.node.on(cc.Node.EventType.TOUCH_START, (e) => {
......
This diff is collapsed.
......@@ -48,7 +48,7 @@ const layer_3 = 15 // 布局层3
const layer_4 = 20 // 常规热区布局层 [热区]
const layer_5 = 25 // 布局层 [连线终点]
const layer_6 = 30
const layer_10 = 50
@ccclass
export default class SceneComponent extends MyCocosSceneComponent {
@property({type: cc.Node, displayName: "键盘"})
......@@ -3119,22 +3119,39 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 画图计数,用于同时打开多个画图板控制页面滚动的
drawingCount = 0;
// 存储所有涂色热区
allDrawingBoards = [];
// 画图题
setDrawingArea(contentData, hotZoneItemData, debugMode=false) {
const rect = this.newRectNode(hotZoneItemData, layer_4, debugMode);
const drawingBoard = cc.instantiate(this.drawingBoardTemplate);
const uid = getUUID();
drawingBoard.uid = uid;
this.allDrawingBoards.push(drawingBoard);
drawingBoard.width = rect.width;
drawingBoard.height = rect.height;
drawingBoard.y = rect.height / 2;
drawingBoard.x = drawingBoard.width / 2;
drawingBoard.active = true;
drawingBoard.on("onPaintingStart", ()=>{
rect.zIndex = layer_10;
this.allDrawingBoards.forEach(borad => {
if(borad.uid != uid) {
borad.emit("disable");
}
})
this.drawingCount ++;
if(this.drawingCount == 1) {
this.disableScroll()
}
})
drawingBoard.on("onPaintingEnd", ()=>{
rect.zIndex = layer_4;
this.allDrawingBoards.forEach(borad => {
if(borad.uid != uid) {
borad.emit("enable");
}
})
this.drawingCount --;
if(this.drawingCount == 0) {
this.enableScroll();
......@@ -3146,18 +3163,33 @@ export default class SceneComponent extends MyCocosSceneComponent {
setDrawingAreaWithCheck(contentData, hotZoneItemData, debugMode=false) {
const rect = this.newRectNode(hotZoneItemData, layer_4, debugMode);
const drawingBoard = cc.instantiate(this.drawingBoardTemplate);
const uid = getUUID();
drawingBoard.uid = uid;
this.allDrawingBoards.push(drawingBoard);
drawingBoard.width = rect.width;
drawingBoard.height = rect.height;
drawingBoard.y = rect.height / 2;
drawingBoard.x = drawingBoard.width / 2;
drawingBoard.active = true;
drawingBoard.on("onPaintingStart", ()=>{
rect.zIndex = layer_10;
this.allDrawingBoards.forEach(borad => {
if(borad.uid != uid) {
borad.emit("disable");
}
})
this.drawingCount ++;
if(this.drawingCount == 1) {
this.disableScroll()
}
})
drawingBoard.on("onPaintingEnd", ()=>{
rect.zIndex = layer_4;
this.allDrawingBoards.forEach(borad => {
if(borad.uid != uid) {
borad.emit("enable");
}
})
this.drawingCount --;
if(this.drawingCount == 0) {
this.enableScroll();
......@@ -3734,6 +3766,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.currentVideoPlay = null;
this.videoDuration = null;
this.drawingCount = 0;
this.allDrawingBoards = [];
this.allTipVideos = [];
this.startTimestamp = new Date().getTime();
......
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