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

修改涂色按钮位置

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