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