Commit 8e2c8cf7 authored by Vũ Gia Vương's avatar Vũ Gia Vương

add slot

parent 44938c22
This diff is collapsed.
...@@ -59,7 +59,7 @@ export default class FragmentJarController extends cc.Component { ...@@ -59,7 +59,7 @@ export default class FragmentJarController extends cc.Component {
} }
private checkTouch(point: cc.Vec2) { private checkTouch(point: cc.Vec2) {
if (this.isDropped) { if (this.isDropped || this.isBottom) {
return; return;
} }
const pos = point.clone().subtract(cc.v2(this.node.position.x, this.node.position.y)); const pos = point.clone().subtract(cc.v2(this.node.position.x, this.node.position.y));
...@@ -91,10 +91,10 @@ export default class FragmentJarController extends cc.Component { ...@@ -91,10 +91,10 @@ export default class FragmentJarController extends cc.Component {
return; return;
} }
if (this.isBottom) { // if (this.isBottom) {
eventTarget.emit(DROP_ALL_FRAGMENT) // eventTarget.emit(DROP_ALL_FRAGMENT)
return; // return;
} // }
this.dropFragment(); this.dropFragment();
} }
......
import { eventTarget, SHOW_ACTION_SCREEN, SHOW_SELECT_POPUP, SHOW_START_SCREEN } from "../Events"; import { eventTarget, SHOW_ACTION_SCREEN, SHOW_START_SCREEN } from "../Events";
import { Global } from "../Global"; import { Global } from "../Global";
const { ccclass, property } = cc._decorator; const { ccclass, property } = cc._decorator;
...@@ -8,30 +8,13 @@ export default class StartScreen extends cc.Component { ...@@ -8,30 +8,13 @@ export default class StartScreen extends cc.Component {
@property(cc.Node) @property(cc.Node)
private selectBtnNode: cc.Node = null; private selectBtnNode: cc.Node = null;
@property(cc.Node)
private contentNode: cc.Node = null;
@property(cc.Node)
private checkedNode: cc.Node = null;
protected onLoad(): void { protected onLoad(): void {
this.selectBtnNode.on('click', this.onSelectBtnClick, this); this.selectBtnNode.on('click', this.onSelectBtnClick, this);
this.contentNode.children.forEach((item: cc.Node, index: number) => {
item.on(cc.Node.EventType.TOUCH_START, () => this.onItemNodeClick(item, index), this);
});
eventTarget.on(SHOW_START_SCREEN, () => this.node.active = true, this); eventTarget.on(SHOW_START_SCREEN, () => this.node.active = true, this);
eventTarget.on(SHOW_ACTION_SCREEN, () => this.node.active = false, this); eventTarget.on(SHOW_ACTION_SCREEN, () => this.node.active = false, this);
} }
private onItemNodeClick(item: cc.Node, index: number) {
this.checkedNode.active = true;
this.checkedNode.setPosition(item.getPosition());
Global.tool = index;
}
private onSelectBtnClick() { private onSelectBtnClick() {
Global.tool = 3; Global.tool = 3;
eventTarget.emit(SHOW_ACTION_SCREEN); eventTarget.emit(SHOW_ACTION_SCREEN);
......
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