Commit ebe5c962 authored by unknown's avatar unknown

虚线取消已经好了

parent ea31e67e
...@@ -371,7 +371,7 @@ ...@@ -371,7 +371,7 @@
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 1200, "width": 1200,
"height": 263 "height": 413
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -406,7 +406,7 @@ ...@@ -406,7 +406,7 @@
"b": 255, "b": 255,
"a": 255 "a": 255
}, },
"_string": "玩法说明\n从绿色的点出发,使数字周围出现对应数量线段后回到起点则成功。\n注意:从绿色和黄色的点开始画出的线段为不透明线段,计入有效路径。从白色的点开始画出的线段为半透明线段,不计入有效路径。\n出现红色线段表示数字周围的有效线段过多。", "_string": "玩法说明\n从绿色的点出发,使数字周围出现对应数量线段后回到起点则成功。\n注意:从绿色和黄色的点开始画出的线段为不透明线段,计入有效路径。从白色的点开始画出的线段为半透明线段,不计入有效路径。\n出现红色线段表示数字周围的有效线段过多。\n如何取消线段?\n半透明线段通过双击可直接取消;其它线段通过回到之前的点来取消。",
"_horizontalAlign": 0, "_horizontalAlign": 0,
"_verticalAlign": 1, "_verticalAlign": 1,
"_actualFontSize": 40, "_actualFontSize": 40,
......
...@@ -23,10 +23,13 @@ ...@@ -23,10 +23,13 @@
}, },
{ {
"__id__": 4 "__id__": 4
},
{
"__id__": 6
} }
], ],
"_prefab": { "_prefab": {
"__id__": 6 "__id__": 8
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
...@@ -128,6 +131,23 @@ ...@@ -128,6 +131,23 @@
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "20UGQn4U9GUoln0NJQTkbG" "fileId": "20UGQn4U9GUoln0NJQTkbG"
}, },
{
"__type__": "3c5abLv5y5FurklK5dC2tZg",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 7
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "0fbhLKgCBHwJIyfWemktms"
},
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
"root": { "root": {
......
...@@ -10,6 +10,7 @@ import { ChallengeFailView } from '../../commonView/script/ChallengeFailView'; ...@@ -10,6 +10,7 @@ import { ChallengeFailView } from '../../commonView/script/ChallengeFailView';
import { ChallengeSuccView } from '../../commonView/script/ChallengeSuccView'; import { ChallengeSuccView } from '../../commonView/script/ChallengeSuccView';
import { LatticeBlockadeIfo, LB_LV_1, LB_LV_2 } from './LatticeBlockadeCfg'; import { LatticeBlockadeIfo, LB_LV_1, LB_LV_2 } from './LatticeBlockadeCfg';
import { LatticeBlockadeItem } from './LatticeBlockadeItem'; import { LatticeBlockadeItem } from './LatticeBlockadeItem';
import { LatticeBlockadeLine } from './LatticeBlockadeLine';
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
export interface ItemPosIfo { export interface ItemPosIfo {
...@@ -28,12 +29,12 @@ export interface GridIfo { ...@@ -28,12 +29,12 @@ export interface GridIfo {
count: number count: number
} }
enum LINE_TYPE { export enum LINE_TYPE {
FULL = 10, FULL = 10,
DOTTED = 20, DOTTED = 20,
} }
interface LineIfo { export interface LineIfo {
type: LINE_TYPE, type: LINE_TYPE,
s_item: ItemPosIfo, s_item: ItemPosIfo,
e_item: ItemPosIfo, e_item: ItemPosIfo,
...@@ -132,6 +133,8 @@ export class LatticeBlockadeCtr extends Component { ...@@ -132,6 +133,8 @@ export class LatticeBlockadeCtr extends Component {
this.posArrNode.on(Node.EventType.TOUCH_START, this.onTouchStart, this); this.posArrNode.on(Node.EventType.TOUCH_START, this.onTouchStart, this);
this.posArrNode.on(Node.EventType.TOUCH_MOVE, this.onTouchMove, this); this.posArrNode.on(Node.EventType.TOUCH_MOVE, this.onTouchMove, this);
this.posArrNode.on(Node.EventType.TOUCH_END, this.onTouchEnd, this); this.posArrNode.on(Node.EventType.TOUCH_END, this.onTouchEnd, this);
//@ts-ignore
this.posArrNode._eventProcessor.touchListener.setSwallowTouches(false);
director.on("begin_countdown_end", () => { director.on("begin_countdown_end", () => {
//引导 //引导
if (!this.isShowGameDescViewOnce) { if (!this.isShowGameDescViewOnce) {
...@@ -143,12 +146,19 @@ export class LatticeBlockadeCtr extends Component { ...@@ -143,12 +146,19 @@ export class LatticeBlockadeCtr extends Component {
} }
}, this); }, this);
director.on("game_desc_close", this.onCloseGameDescView, this); director.on("game_desc_close", this.onCloseGameDescView, this);
director.on("line_click", this.onLineClick, this);
this.gameStart(); this.gameStart();
} }
onLineClick(ifo: LineIfo) {
ifo.targSpr.node.destroy();
this.lineArr.splice(this.lineArr.indexOf(ifo), 1);
}
onDestroy() { onDestroy() {
director.off("begin_countdown_end"); director.off("begin_countdown_end");
director.off("game_desc_close", this.onCloseGameDescView, this); director.off("game_desc_close", this.onCloseGameDescView, this);
director.off("line_click", this.onLineClick, this);
} }
onTouchStart(event: EventTouch) { onTouchStart(event: EventTouch) {
...@@ -528,12 +538,14 @@ export class LatticeBlockadeCtr extends Component { ...@@ -528,12 +538,14 @@ export class LatticeBlockadeCtr extends Component {
this.lineArrNode.addChild(spr.node); this.lineArrNode.addChild(spr.node);
spr.node.setPosition(s_posIfo.pos) spr.node.setPosition(s_posIfo.pos)
spr.node.angle = angle; spr.node.angle = angle;
return { let ifo: LineIfo = {
type: LINE_TYPE.FULL, type: LINE_TYPE.FULL,
s_item: s_posIfo, s_item: s_posIfo,
e_item: e_posIfo, e_item: e_posIfo,
targSpr: spr, targSpr: spr,
} }
spr.node.getComponent(LatticeBlockadeLine)!.ifo = ifo;
return ifo;
} }
update(deltaTime: number) { update(deltaTime: number) {
......
import { _decorator, Component, Node, director } from 'cc';
import { LineIfo, LINE_TYPE } from './LatticeBlockadeCtr';
const { ccclass, property } = _decorator;
@ccclass('LatticeBlockadeLine')
export class LatticeBlockadeLine extends Component {
public ifo: LineIfo = null!;
private lastClickTime = 0;
start() {
// [3]
this.node.on(Node.EventType.TOUCH_END, () => {
if (this.ifo.type == LINE_TYPE.DOTTED) {
let curTime = new Date().getTime();
if (curTime - this.lastClickTime < 700) {
director.emit("line_click", this.ifo);
}
else {
this.lastClickTime = curTime;
}
}
});
}
// update (deltaTime: number) {
// // [4]
// }
}
/**
* [1] Class member could be defined like this.
* [2] Use `property` decorator if your want the member to be serializable.
* [3] Your initialization goes here.
* [4] Your update function goes here.
*
* Learn more about scripting: https://docs.cocos.com/creator/3.0/manual/en/scripting/
* Learn more about CCClass: https://docs.cocos.com/creator/3.0/manual/en/scripting/ccclass.html
* Learn more about life-cycle callbacks: https://docs.cocos.com/creator/3.0/manual/en/scripting/life-cycle-callbacks.html
*/
{
"ver": "4.0.22",
"importer": "typescript",
"imported": true,
"uuid": "3c5ab2ef-e72e-45ba-b925-2b9742dad660",
"files": [],
"subMetas": {},
"userData": {}
}
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