Commit eeb207d3 authored by wildfirecode's avatar wildfirecode

1

parent 8522633d
No preview for this file type
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -22,6 +22,16 @@ ...@@ -22,6 +22,16 @@
"type": "number", "type": "number",
"default": 827 "default": 827
}, },
"OFFSET_X": {
"alias": "OFFSET_X",
"type": "number",
"default": 0
},
"OFFSET_Y": {
"alias": "OFFSET_Y",
"type": "number",
"default": 0
},
"GAP": { "GAP": {
"alias": "图片间隙", "alias": "图片间隙",
"type": "number", "type": "number",
......
...@@ -7,6 +7,8 @@ import qietu from "./qietu"; ...@@ -7,6 +7,8 @@ import qietu from "./qietu";
import { getIndexFromRC, getRandomArray, getTextureByName } from "./utils"; import { getIndexFromRC, getRandomArray, getTextureByName } from "./utils";
import ObjectPool = engine.ObjectPool; import ObjectPool = engine.ObjectPool;
let OFFSET_X;
let OFFSET_Y;
let MAX_COL; let MAX_COL;
let MAX_ROW; let MAX_ROW;
let W; let W;
...@@ -144,6 +146,8 @@ export default class GameView extends engine.Container { ...@@ -144,6 +146,8 @@ export default class GameView extends engine.Container {
MAX_COL = props.MAX_COL; MAX_COL = props.MAX_COL;
MAX_ROW = props.MAX_ROW; MAX_ROW = props.MAX_ROW;
GAME_TIME = props.GAME_TIME; GAME_TIME = props.GAME_TIME;
OFFSET_X = props.OFFSET_X;
OFFSET_Y = props.OFFSET_Y;
W = props.W; W = props.W;
H = props.H; H = props.H;
GAP = props.GAP; GAP = props.GAP;
...@@ -157,9 +161,9 @@ export default class GameView extends engine.Container { ...@@ -157,9 +161,9 @@ export default class GameView extends engine.Container {
const parent = new engine.Sprite(); const parent = new engine.Sprite();
this.picturesWrapper = parent; this.picturesWrapper = parent;
this.addChild(parent); this.addChild(parent);
const OFFSET = (750 - props.W) / 2
this.picturesWrapper.x = OFFSET; // this.picturesWrapper.x = OFFSET_X;
this.picturesWrapper.y = (this.stage.height - props.H) / 2; // this.picturesWrapper.y = OFFSET_Y;
// 添加按钮 // 添加按钮
// const btn = new engine.Rect(); // const btn = new engine.Rect();
...@@ -310,8 +314,9 @@ export default class GameView extends engine.Container { ...@@ -310,8 +314,9 @@ export default class GameView extends engine.Container {
onMove(e: engine.MouseEvent) { onMove(e: engine.MouseEvent) {
// 当前图片的位置 // 当前图片的位置
this.dragPic.x = e.stageX - this.localPicX; this.dragPic.x = e.stageX - this.localPicX - OFFSET_X;
this.dragPic.y = e.stageY - this.localPicY; this.dragPic.y = e.stageY - this.localPicY - (1624 - this.stage.height) / 2 - (1624-OFFSET_Y)/2;
console.log('fuck on move',OFFSET_Y)
// console.log(this.dragPic.x, this.dragPic.y) // console.log(this.dragPic.x, this.dragPic.y)
// 当前图片的中心位置 // 当前图片的中心位置
......
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