Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qiaqia_qx
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
邱旭
qiaqia_qx
Commits
02e2d983
Commit
02e2d983
authored
Jun 01, 2020
by
haiyoucuv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
d840db21
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
102 additions
and
257 deletions
+102
-257
workspace.xml
.idea/workspace.xml
+38
-14
config.js
mock/config.js
+4
-1
rule.json
mock/miniTb/rule.json
+5
-0
Main.ts
src/Main.ts
+10
-1
TaoBaoNet.ts
src/TaoBaoNet.ts
+15
-11
RulePanel.ts
src/panels/RulePanel.ts
+4
-4
UnlockPanel.ts
src/panels/UnlockPanel.ts
+0
-109
GameLayer.ts
src/parts/Game/GameLayer.ts
+3
-2
Land.ts
src/parts/Game/Land.ts
+22
-5
GameEle.ts
src/parts/GameEle.ts
+0
-39
MoveAni.ts
src/parts/MoveAni.ts
+0
-70
UILayer.ts
src/parts/UI/UILayer.ts
+1
-1
No files found.
.idea/workspace.xml
View file @
02e2d983
...
...
@@ -2,11 +2,18 @@
<project
version=
"4"
>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"31be0130-d27d-4740-b668-956a8050e1bf"
name=
"Default Changelist"
comment=
""
>
<change
afterPath=
"$PROJECT_DIR$/mock/miniTb/rule.json"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/mock/config.js"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/mock/config.js"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/Main.ts"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/Main.ts"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/TaoBaoNet.ts"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/TaoBaoNet.ts"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/panels/RulePanel.ts"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/panels/RulePanel.ts"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/panels/UnlockPanel.ts"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/parts/Game/GameLayer.ts"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/parts/Game/GameLayer.ts"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/parts/Game/Land.ts"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/parts/Game/Land.ts"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/parts/Game/Option.ts"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/parts/Game/Option.ts"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/scenes/GameScene.ts"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/scenes/GameScene.ts"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/parts/GameEle.ts"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/parts/MoveAni.ts"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/parts/UI/UILayer.ts"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/parts/UI/UILayer.ts"
afterDir=
"false"
/>
</list>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
...
...
@@ -17,6 +24,7 @@
<option
name=
"RECENT_TEMPLATES"
>
<list>
<option
value=
"TypeScript File"
/>
<option
value=
"JsonFile"
/>
</list>
</option>
</component>
...
...
@@ -77,9 +85,9 @@
</configuration>
<recent_temporary>
<list>
<item
itemvalue=
"npm.dev"
/>
<item
itemvalue=
"npm.handleRes"
/>
<item
itemvalue=
"npm.flushRes"
/>
<item
itemvalue=
"npm.dev"
/>
</list>
</recent_temporary>
</component>
...
...
@@ -95,30 +103,46 @@
<updated>
1590749938444
</updated>
<workItem
from=
"1590749939792"
duration=
"84000"
/>
<workItem
from=
"1590976087296"
duration=
"15316000"
/>
<workItem
from=
"1590996860067"
duration=
"7029000"
/>
<workItem
from=
"1590996860067"
duration=
"12763000"
/>
</task>
<task
id=
"LOCAL-00001"
summary=
"1"
>
<created>
1591003912929
</created>
<option
name=
"number"
value=
"00001"
/>
<option
name=
"presentableId"
value=
"LOCAL-00001"
/>
<option
name=
"project"
value=
"LOCAL"
/>
<updated>
1591003912929
</updated>
</task>
<option
name=
"localTasksCounter"
value=
"2"
/>
<servers
/>
</component>
<component
name=
"TypeScriptGeneratedFilesManager"
>
<option
name=
"version"
value=
"2"
/>
</component>
<component
name=
"VcsManagerConfiguration"
>
<MESSAGE
value=
"1"
/>
<option
name=
"LAST_COMMIT_MESSAGE"
value=
"1"
/>
</component>
<component
name=
"WindowStateProjectService"
>
<state
width=
"255"
height=
"907"
key=
"GridCell.Tab.0.bottom"
timestamp=
"1591000059062"
>
<state
x=
"466"
y=
"108"
key=
"CommitChangelistDialog2"
timestamp=
"1591003912498"
>
<screen
x=
"35"
y=
"23"
width=
"1645"
height=
"1027"
/>
</state>
<state
x=
"466"
y=
"108"
key=
"CommitChangelistDialog2/35.23.1645.1027/1680.-199.1920.1177@35.23.1645.1027"
timestamp=
"1591003912498"
/>
<state
width=
"255"
height=
"543"
key=
"GridCell.Tab.0.bottom"
timestamp=
"1591005691603"
>
<screen
x=
"35"
y=
"23"
width=
"1645"
height=
"1027"
/>
</state>
<state
width=
"255"
height=
"
907"
key=
"GridCell.Tab.0.bottom/35.23.1645.1027/1680.-199.1920.1177@35.23.1645.1027"
timestamp=
"1591000059062
"
/>
<state
width=
"255"
height=
"
907"
key=
"GridCell.Tab.0.center"
timestamp=
"1591000059061
"
>
<state
width=
"255"
height=
"
543"
key=
"GridCell.Tab.0.bottom/35.23.1645.1027/1680.-199.1920.1177@35.23.1645.1027"
timestamp=
"1591005691603
"
/>
<state
width=
"255"
height=
"
543"
key=
"GridCell.Tab.0.center"
timestamp=
"1591005691600
"
>
<screen
x=
"35"
y=
"23"
width=
"1645"
height=
"1027"
/>
</state>
<state
width=
"255"
height=
"
907"
key=
"GridCell.Tab.0.center/35.23.1645.1027/1680.-199.1920.1177@35.23.1645.1027"
timestamp=
"1591000059061
"
/>
<state
width=
"255"
height=
"
907"
key=
"GridCell.Tab.0.left"
timestamp=
"1591000059061
"
>
<state
width=
"255"
height=
"
543"
key=
"GridCell.Tab.0.center/35.23.1645.1027/1680.-199.1920.1177@35.23.1645.1027"
timestamp=
"1591005691600
"
/>
<state
width=
"255"
height=
"
543"
key=
"GridCell.Tab.0.left"
timestamp=
"1591005691596
"
>
<screen
x=
"35"
y=
"23"
width=
"1645"
height=
"1027"
/>
</state>
<state
width=
"255"
height=
"
907"
key=
"GridCell.Tab.0.left/35.23.1645.1027/1680.-199.1920.1177@35.23.1645.1027"
timestamp=
"1591000059061
"
/>
<state
width=
"255"
height=
"
907"
key=
"GridCell.Tab.0.right"
timestamp=
"1591000059062
"
>
<state
width=
"255"
height=
"
543"
key=
"GridCell.Tab.0.left/35.23.1645.1027/1680.-199.1920.1177@35.23.1645.1027"
timestamp=
"1591005691596
"
/>
<state
width=
"255"
height=
"
543"
key=
"GridCell.Tab.0.right"
timestamp=
"1591005691603
"
>
<screen
x=
"35"
y=
"23"
width=
"1645"
height=
"1027"
/>
</state>
<state
width=
"255"
height=
"
907"
key=
"GridCell.Tab.0.right/35.23.1645.1027/1680.-199.1920.1177@35.23.1645.1027"
timestamp=
"1591000059062
"
/>
<state
width=
"255"
height=
"
543"
key=
"GridCell.Tab.0.right/35.23.1645.1027/1680.-199.1920.1177@35.23.1645.1027"
timestamp=
"1591005691603
"
/>
<state
x=
"614"
y=
"245"
key=
"RollbackChangesDialog"
timestamp=
"1590993046653"
>
<screen
x=
"35"
y=
"23"
width=
"1645"
height=
"1027"
/>
</state>
...
...
@@ -127,9 +151,9 @@
<screen
x=
"35"
y=
"23"
width=
"1645"
height=
"1027"
/>
</state>
<state
x=
"586"
y=
"314"
key=
"refactoring.ChangeSignatureDialog/35.23.1645.1027/1680.-199.1920.1177@35.23.1645.1027"
timestamp=
"1590980819551"
/>
<state
x=
"522"
y=
"250"
width=
"670"
height=
"676"
key=
"search.everywhere.popup"
timestamp=
"15910
01551518
"
>
<state
x=
"522"
y=
"250"
width=
"670"
height=
"676"
key=
"search.everywhere.popup"
timestamp=
"15910
14302210
"
>
<screen
x=
"35"
y=
"23"
width=
"1645"
height=
"1027"
/>
</state>
<state
x=
"522"
y=
"250"
width=
"670"
height=
"676"
key=
"search.everywhere.popup/35.23.1645.1027/1680.-199.1920.1177@35.23.1645.1027"
timestamp=
"15910
01551518
"
/>
<state
x=
"522"
y=
"250"
width=
"670"
height=
"676"
key=
"search.everywhere.popup/35.23.1645.1027/1680.-199.1920.1177@35.23.1645.1027"
timestamp=
"15910
14302210
"
/>
</component>
</project>
\ No newline at end of file
mock/config.js
View file @
02e2d983
...
...
@@ -2,6 +2,9 @@ const path = require('path');
const
config
=
{
'/ngame/new/datapash'
:
{
data
:
'./json/datapash.json'
},
'rule'
:
{
data
:
'./miniTb/rule.json'
}
}
...
...
mock/miniTb/rule.json
0 → 100644
View file @
02e2d983
{
"success"
:
true
,
"code"
:
"1111"
,
"data"
:
"1.哈哈哈哈哈
\n
2.哈哈哈哈哈
\n
3.哈哈哈哈哈
\n
4.哈哈哈哈哈
\n
5.哈哈哈哈哈
\n
6.哈哈哈哈哈
\n
7.哈哈哈哈哈
\n
8.哈哈哈哈哈
\n
9.哈哈哈哈哈
\n
10.哈哈哈哈哈
\n
11.哈哈哈哈哈
\n
12.哈哈哈哈哈
\n
13.哈哈哈哈哈
\n
14.哈哈哈哈哈
\n
15.哈哈哈哈哈
\n
16.哈哈哈哈哈
\n
17.哈哈哈哈哈
\n
18.哈哈哈哈哈
\n
19.哈哈哈哈哈
\n
20.哈哈哈哈哈
\n
21.哈哈哈哈哈
\n
"
}
src/Main.ts
View file @
02e2d983
import
{
Tool
}
from
"./Tools"
;
import
{
layers
,
destroyLayers
}
from
"../module/views/layers"
;
...
...
@@ -20,6 +19,7 @@ export class Main {
stage
:
FYGE
.
Stage
;
private
requestID
;
private
_pause
:
boolean
;
constructor
(
canvas
:
HTMLCanvasElement
)
{
var
sysInfo
;
//@ts-ignore 存在my就初始化
...
...
@@ -49,6 +49,7 @@ export class Main {
var
self
=
this
;
// console.log(FYGE)
loop
();
function
loop
()
{
if
(
!
self
.
_pause
)
{
// stats.begin();
...
...
@@ -74,6 +75,11 @@ export class Main {
//隐藏加载中
// if (document.getElementById("__loading__")) document.getElementById("__loading__").style.display = "none";
//打开开始场景
// 请求规则
sendTbNet
(
TbNetName
.
rule
,
{},
()
=>
{
});
changeScene
(
GameScene
);
//测试
// sendTbNet(TbNetName.aaa, {}, (s, res) => {
...
...
@@ -96,6 +102,7 @@ export class Main {
run
()
{
this
.
_pause
=
false
}
//在小程序隐藏时调用onHide
pause
()
{
this
.
_pause
=
true
...
...
@@ -115,6 +122,7 @@ export class Main {
GDispatcher
.
addEventListener
(
name
,
fun
,
thisObj
)
}
}
/**
* 派发全局事件,用于小程序的交互调用
* @param name
...
...
@@ -123,6 +131,7 @@ export class Main {
dispatchGlobalEvent
(
name
:
string
,
data
?:
any
)
{
GDispatcher
.
dispatchEvent
(
name
,
data
)
}
/**
* 移除全局事件,用于小程序交互调用
* @param name
...
...
src/TaoBaoNet.ts
View file @
02e2d983
import
{
showToast
,
wait
,
clearWait
}
from
"../module/ctrls"
;
//接口枚举,包括需要调用淘宝的api,用是否含有兑吧区分,或者单独区分
export
enum
TbNetName
{
aaa
=
"aaa
"
,
rule
=
"rule
"
,
/**
* 查询积分
...
...
@@ -42,11 +41,13 @@ export enum TbNetName {
useTools
=
"useTools"
,
}
//返回数据类型,到时再调整
interface
dataIn
{
netName
:
TbNetName
data
:
any
}
//返回数据类型
interface
dataOut
{
success
:
boolean
,
...
...
@@ -54,6 +55,7 @@ interface dataOut {
code
?:
string
,
message
?:
string
}
//记录数据
let
dataRecord
:
{
[
name
:
string
]:
any
...
...
@@ -82,13 +84,14 @@ export function sendTbNet(netName: TbNetName, parameter: any, callback: Function
//清除超时
clearWait
(
waitObj
)
//记录数据
dataRecord
[
name
]
=
data
;
dataRecord
[
n
etN
ame
]
=
data
;
//统一错误信息提示
if
(
!
hideMsg
&&
!
data
.
success
)
showToast
(
data
.
message
||
"网络异常"
)
//回调
callback
(
data
.
success
,
data
);
},
()
=>
{
})
return
},
()
=>
{
});
return
;
}
//@ts-ignore
if
(
!
fc
)
fc
=
getApp
().
cloud
.
function
;
...
...
@@ -118,6 +121,7 @@ export function getTbData(netName: TbNetName): dataOut {
export
function
destroyNetData
()
{
dataRecord
=
{}
}
//webview里调用无效,用postMessage去调
// export const navigateToOutside = (url) => {
// my.call("navigateToOutside", {
...
...
src/panels/RulePanel.ts
View file @
02e2d983
import
{
Panel
}
from
"../../module/views/Panel"
;
import
{
Tool
}
from
"../Tools"
;
import
{
getTbData
,
sendTbNet
,
TbNetName
}
from
"../TaoBaoNet"
;
import
Sprite
=
FYGE
.
Sprite
;
import
ScrollPage
=
FYGE
.
ScrollPage
;
import
TextField
=
FYGE
.
TextField
;
...
...
@@ -25,11 +26,10 @@ export class RulePanel extends Panel {
this
.
ruleLabel
.
size
=
28
;
this
.
ruleLabel
.
fillColor
=
'#c28b4c'
;
this
.
ruleLabel
.
text
=
"<p>哈哈哈哈哈哈</p>哈<p>djkahsdahsjjfda</p><p>规则</p><p>规则</p><p>规则</p>"
+
"<p>规则</p><p>规则</p><p>规则</p><p>规则</p><p>规则</p>"
+
"<p>规则</p><p>规则</p><p>规则</p><p>规则</p><p>规则</p>"
;
// 设置规则内容
this
.
ruleLabel
.
text
=
getTbData
(
TbNetName
.
rule
).
data
;
// 滚动容器
this
.
scroll
=
this
.
addChild
(
new
ScrollPage
(
430
,
360
,
this
.
ruleLabel
.
textHeight
));
this
.
scroll
.
position
.
set
(
170
,
675
);
this
.
scroll
.
view
.
addChild
(
this
.
ruleLabel
);
...
...
src/panels/UnlockPanel.ts
deleted
100644 → 0
View file @
d840db21
import
{
Tool
}
from
"../Tools"
;
import
{
Panel
}
from
"../../module/views/Panel"
;
import
{
RES
}
from
"../../module/RES"
;
import
{
Light
}
from
"../parts/Light"
;
const
foodData
:
{
[
key
:
number
]:
{
name
:
string
,
des
:
string
}
}
=
{
8
:
{
name
:
"爆浆麻薯150g*2袋"
,
des
:
""
},
16
:
{
name
:
"面筋卷120g*2袋"
,
des
:
""
},
32
:
{
name
:
"岩焗乳酪吐司500g"
,
des
:
""
},
64
:
{
name
:
"鱼豆腐170g"
,
des
:
""
},
128
:
{
name
:
"猪肉脯200g"
,
des
:
"解锁后可在首页领取奖励哦~"
},
256
:
{
name
:
"卤藕168g*2袋"
,
des
:
"解锁后可在首页领取奖励哦~"
},
512
:
{
name
:
"手撕面包1050g"
,
des
:
"解锁后可在首页领取奖励哦~"
},
1024
:
{
name
:
"枣夹核桃700g"
,
des
:
"解锁后可在首页领取奖励哦~"
},
2048
:
{
name
:
"甜辣鸭脖190g"
,
des
:
"解锁后可在首页领取奖励哦~"
},
}
/**
* 解锁弹框
*/
export
class
UnlockPanel
extends
Panel
{
get
groupNames
()
{
return
[
"unlockPanel"
]
}
closeBtn
:
FYGE
.
Button
;
data
:
{
grade
:
number
,
closeFun
:
Function
}
initUi
()
{
//加光
this
.
addChild
(
new
Light
()).
position
.
set
(
375
,
735
);
//背景
this
.
addChild
(
Tool
.
getSprite
(
"unlockPanelBg.png"
));
//关闭按钮
this
.
closeBtn
=
new
FYGE
.
Button
(
RES
.
getRes
(
"comCloseBtn.png"
));
this
.
closeBtn
.
position
.
set
(
614
,
460
);
this
.
addChild
(
this
.
closeBtn
);
//继续游戏
this
.
addChild
(
new
FYGE
.
Button
(
RES
.
getRes
(
"zailaiyiju.png"
)))
.
once
(
FYGE
.
MouseEvent
.
CLICK
,
this
.
onClick_closeBtn
,
this
)
.
position
.
set
((
750
-
233
)
/
2
,
938
)
//标题文案
// this.addChild(new Title(this.data.grade))
//奖品图片 246;
this
.
addChild
(
new
FYGE
.
Sprite
(
RES
.
getRes
(
"unlock"
+
this
.
data
.
grade
+
".png"
)))
.
position
.
set
((
750
-
449
)
/
2
-
20
,
580
+
20
)
//名字
// this.addChild(Tool.addText(
// foodData[this.data.grade].name,
// 28,
// "#ffffff",
// undefined,
// 560,
// (750 - 560) / 2,
// 890
// ))
//描述
// this.addChild(Tool.addText(
// foodData[this.data.grade].des,
// 22,
// "#dac5fc",
// undefined,
// 560,
// (750 - 560) / 2,
// 931
// ))
}
start
(
data
)
{
super
.
start
();
}
initEvents
()
{
this
.
closeBtn
.
addEventListener
(
FYGE
.
MouseEvent
.
CLICK
,
this
.
onClick_closeBtn
,
this
)
}
onClick_closeBtn
()
{
this
.
data
.
closeFun
()
this
.
hidePanel
();
}
removeEvents
()
{
this
.
closeBtn
.
removeEventListener
(
FYGE
.
MouseEvent
.
CLICK
,
this
.
onClick_closeBtn
,
this
)
}
}
class
Title
extends
FYGE
.
Container
{
grade
:
number
constructor
(
grade
:
number
)
{
super
();
var
msg
=
new
FYGE
.
Sprite
(
RES
.
getRes
(
"unlockMsg.png"
))
this
.
addChild
(
msg
);
var
textures
=
{}
for
(
var
i
=
0
;
i
<
10
;
i
++
)
textures
[
i
]
=
RES
.
getRes
(
"n"
+
i
+
".png"
);
var
num
=
new
FYGE
.
BitmapText
(
textures
);
num
.
textAlign
=
FYGE
.
TEXT_ALIGN
.
LEFT
;
num
.
text
=
grade
+
""
;
this
.
addChild
(
num
);
var
w
=
msg
.
width
+
num
.
width
;
msg
.
position
.
set
((
750
-
w
)
/
2
,
548
);
num
.
position
.
set
(
msg
.
x
+
msg
.
width
,
548
+
4
)
}
}
\ No newline at end of file
src/parts/Game/GameLayer.ts
View file @
02e2d983
...
...
@@ -29,8 +29,6 @@ export default class GameLayer extends Container {
private
constructor
()
{
super
();
new
FrameAni
([]);
this
.
initLand
();
// 种植列表
...
...
@@ -46,6 +44,9 @@ export default class GameLayer extends Container {
}
/**
* 初始化土地
*/
private
initLand
()
{
const
pos
=
[
[
99
,
730
],
...
...
src/parts/Game/Land.ts
View file @
02e2d983
...
...
@@ -15,19 +15,28 @@ export enum LAND_STATE {
export
class
Land
extends
Container
{
/**
* 当前激活的土地
* @static
* @type {Land}
*/
public
static
activeLand
:
Land
=
null
;
/////////////
// private //
/////////////
// 田_初始.png 田_种植.png 田_选择.png
// 三个田的选择状态对应的 texture
private
land_default_texture
=
RES
.
getRes
(
'田_初始.png'
);
private
land_choose_texture
=
RES
.
getRes
(
'田_选择.png'
);
private
land_plant_texture
=
RES
.
getRes
(
'田_种植.png'
);
private
landSprite
=
new
Sprite
();
private
landSprite
=
new
Sprite
();
// 土地的精灵
private
state
:
LAND_STATE
;
private
state
:
LAND_STATE
;
// 状态机
private
option
:
Option
;
private
option
:
Option
=
null
;
// 当前显示的 Option
// id
private
_id
:
number
;
...
...
@@ -39,12 +48,15 @@ export class Land extends Container {
return
this
.
_id
;
}
/**
* @constructor
*/
constructor
()
{
super
();
this
.
addChild
(
this
.
landSprite
);
//
改写点击
方法
//
重写点击的
方法
this
.
landSprite
.
hitTestPoint
=
function
(
point
,
isMouseEvent
=
false
)
{
// |Ax*Th/2|+|Ay*Tw/2|=Th*Tw/4 时点是在菱形上的。>时在菱形区域外,<时在菱形内的。
if
(
!
this
.
visible
)
return
null
;
...
...
@@ -59,16 +71,21 @@ export class Land extends Container {
return
judge
?
this
:
null
;
}.
bind
(
this
.
landSprite
);
// 加个监听
this
.
addEventListener
(
MouseEvent
.
CLICK
,
()
=>
{
console
.
log
(
`点到了土地:
${
this
.
id
}
`
);
GameLayer
.
ins
.
plantList
.
show
(
this
.
id
);
// 显示种植列表
this
.
activate
();
// 变成选中状态
});
// 修改默认的状态机
this
.
changeState
(
LAND_STATE
.
DEFAULT
);
}
/**
* 状态机
* @param state
*/
public
changeState
(
state
)
{
if
(
state
===
this
.
state
)
return
;
...
...
src/parts/GameEle.ts
deleted
100644 → 0
View file @
d840db21
import
{
RES
}
from
"../../module/RES"
;
import
{
Tool
}
from
"../Tools"
;
export
class
GameEle
extends
FYGE
.
Sprite
{
private
_type
:
number
get
type
()
{
return
this
.
_type
}
set
type
(
value
:
number
)
{
this
.
_type
=
value
;
this
.
texture
=
RES
.
getRes
(
"ele"
+
value
+
".png"
)
}
private
_tempType
:
number
=
null
;
get
tempType
()
{
return
this
.
_tempType
;
}
set
tempType
(
value
)
{
this
.
_tempType
=
value
;
}
index
:
number
;
get
row
()
{
return
Tool
.
indexToRc
(
this
.
index
)[
0
]
}
get
col
()
{
return
Tool
.
indexToRc
(
this
.
index
)[
1
]
}
constructor
(
type
:
number
)
{
super
();
this
.
type
=
type
;
this
.
anchorTexture
.
set
(
0.5
,
0.5
);
}
reset
(
type
)
{
this
.
type
=
type
;
this
.
scale
.
set
(
1
,
1
)
}
}
\ No newline at end of file
src/parts/MoveAni.ts
deleted
100644 → 0
View file @
d840db21
import
{
GameEle
}
from
"./GameEle"
;
import
{
Tool
}
from
"../Tools"
;
import
{
RES
}
from
"../../module/RES"
;
import
{
GPool
}
from
"../../module/tools/GPool"
;
export
interface
MoveAniInt
{
startEle1
:
GameEle
,
startEle2
?:
GameEle
,
endIndex
:
number
,
}
/**
* 偷懒先用fun的试下,不然就动画独立
* @param callback 回调里计数完成用
* @param startEle1
* @param endIndex
* @param startEle2
*/
export
function
moveAni
(
callback
:
()
=>
void
,
startEle1
:
GameEle
,
endIndex
:
number
,
startEle2
?:
GameEle
,
)
{
var
endType
:
number
=
startEle1
.
type
*
2
;
var
endP
=
Tool
.
getPositionByIndex
(
endIndex
);
//移动动画
FYGE
.
Tween
.
get
(
startEle1
)
.
to
({
x
:
endP
[
0
],
y
:
endP
[
1
]
},
200
)
.
call
(()
=>
{
callback
();
if
(
!
startEle2
)
return
;
//添加动画
// startEle1.parent.addChild(playDisAni(endType, startEle1.x, startEle1.y))
//第一个缩小
FYGE
.
Tween
.
get
(
startEle1
)
.
to
({
scaleX
:
0.1
,
scaleY
:
0.1
},
100
)
.
call
(()
=>
{
startEle1
.
type
=
endType
;
startEle1
.
tempType
=
null
;
})
.
to
({
scaleX
:
1
,
scaleY
:
1
},
100
,
FYGE
.
Ease
.
backOut
)
// .call(() => { callback() })
})
if
(
startEle2
)
{
FYGE
.
Tween
.
get
(
startEle2
)
.
to
({
x
:
endP
[
0
],
y
:
endP
[
1
]
},
200
)
.
call
(()
=>
{
//移除第二个
startEle2
.
parent
.
removeChild
(
startEle2
);
GPool
.
recover
(
"gameEle"
,
startEle2
)
})
}
}
// const disAniName = "disAniName"
// function playDisAni(type: number, x, y) {
// let mv: FYGE.MovieClip = GPool.takeOut(disAniName + type)
// if (!mv) {
// mv = new FYGE.MovieClip(RES.getRes("create" + type + ".svga"))
// }
// mv.position.set(x - 125, y - 125);
// mv.startAniRange(1, mv.totalFrames, 1, () => {
// if (mv.parent) {
// mv.parent.removeChild(mv);
// GPool.recover(disAniName + type, mv);
// }
// })
// return mv
// }
src/parts/UI/UILayer.ts
View file @
02e2d983
...
...
@@ -57,7 +57,7 @@ export class UILayer extends Container {
console
.
log
(
'点击了商店'
);
break
;
case
this
.
ruleBtn
:
//
console.log('点击了规则');
console
.
log
(
'点击了规则'
);
PanelCtrl
.
instance
.
show
(
RulePanel
);
break
;
case
this
.
adBtn
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment