-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
25b4a01
commit 07c3333
Showing
16 changed files
with
160 additions
and
296 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,9 @@ | ||
var DragEnd = function (pointer) { | ||
var dragData = this.miniboardInput.drag; | ||
// Not dragging | ||
if (dragData.state === 0) { | ||
var DragEnd = function () { | ||
if (!this.dragPointer) { | ||
return; | ||
} | ||
|
||
if (pointer === undefined) { | ||
pointer = this.miniboardInput.pointer; | ||
} | ||
var dragPosition = dragData.position; | ||
var dragX = pointer.x - dragPosition.x; | ||
var dragY = pointer.y - dragPosition.y; | ||
dragData.state = 0; | ||
this.emit('dragend', pointer, dragX, dragY); | ||
this.scene.input.setDragState(this.dragPointer, 5); | ||
return this; | ||
} | ||
|
||
export default DragEnd; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const RectangleContains = Phaser.Geom.Rectangle.Contains; | ||
|
||
var HitAreaCallback = function (shape, x, y, gameObject) { | ||
if (!RectangleContains(shape, x, y)) { | ||
return false; | ||
} | ||
|
||
return gameObject.isInTouching(); | ||
} | ||
|
||
export default HitAreaCallback; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import PointerTest from '../../../utils/input/PointerTest.js'; | ||
|
||
var IsInTouching = function (pointer) { | ||
if (!this.visible) { | ||
return false; | ||
} | ||
|
||
return PointerTest(this, pointer, MainTest); | ||
} | ||
|
||
var MainTest = function (miniboard, x, y) { | ||
miniboard.worldXYToChess(x, y, globChessArray); | ||
var isHit = (globChessArray.length > 0); | ||
globChessArray.length = 0; | ||
return isHit; | ||
} | ||
|
||
var globChessArray = []; | ||
|
||
export default IsInTouching; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
var RegisterDragEvents = function () { | ||
this.dragPointer = null; | ||
|
||
this | ||
.on('dragstart', function (pointer, dragX, dragY) { | ||
this.dragPointer = pointer; | ||
}, this) | ||
.on('dragend', function (pointer, dragX, dragY, dropped) { | ||
this.dragPointer = null; | ||
}, this); | ||
} | ||
|
||
export default RegisterDragEvents; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
var RegisterPointerEvents = function () { | ||
this | ||
.on('pointerdown', function (pointer, localX, localY, event) { | ||
FireTileEvent.call(this, pointer, 'gameobjectdown', 'miniboard.pointerdown'); | ||
}, this) | ||
.on('pointerup', function (pointer, localX, localY, event) { | ||
FireTileEvent.call(this, pointer, 'gameobjectup', 'miniboard.pointerup'); | ||
}, this) | ||
.on('pointermove', function (pointer, localX, localY, event) { | ||
FireTileEvent.call(this, pointer, 'gameobjectmove', 'miniboard.pointermove'); | ||
}, this) | ||
} | ||
|
||
var FireTileEvent = function (pointer, miniboardEvent, tileEvent) { | ||
var gameObjects = this.worldXYToChess(pointer.worldX, pointer.worldY, globChessArray); | ||
var gameObject; | ||
for (var i = 0, cnt = gameObjects.length; i < cnt; i++) { | ||
gameObject = gameObjects[i]; | ||
if (gameObject.emit) { | ||
gameObject.emit(tileEvent, pointer); | ||
} | ||
this.emit(miniboardEvent, pointer, gameObject); | ||
} | ||
globChessArray.length = 0; | ||
} | ||
|
||
var globChessArray = []; | ||
|
||
export default RegisterPointerEvents; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.