Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
db-game-template
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
崔立强
db-game-template
Commits
b6518e6f
Commit
b6518e6f
authored
Dec 10, 2019
by
haiyoucuv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
e2c7db6e
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
176 additions
and
78 deletions
+176
-78
workspace.xml
.idea/workspace.xml
+13
-5
IndexUISkin.exml
egret/resource/skins/IndexUISkin.exml
+2
-2
Main.ts
egret/src/Main.ts
+0
-1
SellPanel.ts
egret/src/Panels/SellPanel.ts
+1
-1
TaskPanel.ts
egret/src/Panels/TaskPanel.ts
+16
-8
WareHousePanel.ts
egret/src/Panels/WareHousePanel.ts
+21
-16
IndexUI.ts
egret/src/Scenes/IndexScene/IndexUI.ts
+66
-20
Crop.ts
egret/src/Scenes/IndexScene/Objs/Crop.ts
+20
-14
ProgressNum.ts
egret/src/components/ProgressNum.ts
+13
-5
getLandInfo.json
mock/joyousManor/getLandInfo.json
+5
-5
queryPrizeInfo.json
mock/projectX/queryPrizeInfo.json
+19
-1
No files found.
.idea/workspace.xml
View file @
b6518e6f
...
...
@@ -3,8 +3,16 @@
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"9464afa6-0efb-46c2-9cfd-05475acd81df"
name=
"Default Changelist"
comment=
""
>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/egret/resource/skins/SelledPanelSkin.exml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/egret/resource/skins/SelledPanelSkin.exml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/egret/src/Panels/SelledPanel.ts"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/egret/src/Panels/SelledPanel.ts"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/egret/resource/skins/IndexUISkin.exml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/egret/resource/skins/IndexUISkin.exml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/egret/src/Main.ts"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/egret/src/Main.ts"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/egret/src/Panels/SellPanel.ts"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/egret/src/Panels/SellPanel.ts"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/egret/src/Panels/TaskPanel.ts"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/egret/src/Panels/TaskPanel.ts"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/egret/src/Panels/WareHousePanel.ts"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/egret/src/Panels/WareHousePanel.ts"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/egret/src/Scenes/IndexScene/IndexUI.ts"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/egret/src/Scenes/IndexScene/IndexUI.ts"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/egret/src/Scenes/IndexScene/Objs/Crop.ts"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/egret/src/Scenes/IndexScene/Objs/Crop.ts"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/egret/src/components/ProgressNum.ts"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/egret/src/components/ProgressNum.ts"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/mock/joyousManor/getLandInfo.json"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/mock/joyousManor/getLandInfo.json"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/mock/projectX/queryPrizeInfo.json"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/mock/projectX/queryPrizeInfo.json"
afterDir=
"false"
/>
</list>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
...
...
@@ -80,7 +88,7 @@
<workItem
from=
"1575511989902"
duration=
"370000"
/>
<workItem
from=
"1575512375307"
duration=
"22831000"
/>
<workItem
from=
"1575602130550"
duration=
"39482000"
/>
<workItem
from=
"1575855730362"
duration=
"
36584
000"
/>
<workItem
from=
"1575855730362"
duration=
"
41160
000"
/>
</task>
<servers
/>
</component>
...
...
@@ -108,9 +116,9 @@
<screen
x=
"36"
y=
"23"
width=
"1644"
height=
"1027"
/>
</state>
<state
x=
"659"
y=
"460"
key=
"com.intellij.openapi.vcs.update.UpdateOrStatusOptionsDialogupdate-v2/36.23.1644.1027/1680.-229.1920.1177@36.23.1644.1027"
timestamp=
"1575620245218"
/>
<state
x=
"523"
y=
"250"
width=
"670"
height=
"676"
key=
"search.everywhere.popup"
timestamp=
"157594
2163065
"
>
<state
x=
"523"
y=
"250"
width=
"670"
height=
"676"
key=
"search.everywhere.popup"
timestamp=
"157594
7398722
"
>
<screen
x=
"36"
y=
"23"
width=
"1644"
height=
"1027"
/>
</state>
<state
x=
"523"
y=
"250"
width=
"670"
height=
"676"
key=
"search.everywhere.popup/36.23.1644.1027/1680.-229.1920.1177@36.23.1644.1027"
timestamp=
"157594
2163065
"
/>
<state
x=
"523"
y=
"250"
width=
"670"
height=
"676"
key=
"search.everywhere.popup/36.23.1644.1027/1680.-229.1920.1177@36.23.1644.1027"
timestamp=
"157594
7398722
"
/>
</component>
</project>
\ No newline at end of file
egret/resource/skins/IndexUISkin.exml
View file @
b6518e6f
...
...
@@ -26,7 +26,7 @@
<e:Label
id=
"userGold"
text=
"欢趣豆:23"
x=
"78"
y=
"41"
size=
"20"
/>
<e:Image
id=
"medal"
source=
"勋章_png"
x=
"44"
y=
"49"
visible=
"false"
/>
</e:Group>
<e:Button
id=
"warehouseBtn"
label=
""
x=
"339"
verticalCenter=
"484
.5"
>
<e:Button
id=
"warehouseBtn"
label=
""
verticalCenter=
"484.5"
horizontalCenter=
"17.5"
anchorOffsetX=
"53.5"
anchorOffsetY=
"60
.5"
>
<e:skinName>
<e:Skin
states=
"up,down,disabled"
>
<e:Image
width=
"100%"
height=
"100%"
source=
"仓库_png"
source.down=
"仓库_png"
source.disabled=
"仓库_png"
/>
...
...
@@ -34,7 +34,7 @@
</e:Skin>
</e:skinName>
</e:Button>
<e:Button
id=
"taskBtn"
label=
""
x=
"121.5"
verticalCenter=
"484
.5"
>
<e:Button
id=
"taskBtn"
label=
""
verticalCenter=
"484.5"
horizontalCenter=
"-199
.5"
>
<e:skinName>
<e:Skin
states=
"up,down,disabled"
>
<e:Image
width=
"100%"
height=
"100%"
source=
"任务_png"
source.down=
"任务_png"
source.disabled=
"任务_png"
/>
...
...
egret/src/Main.ts
View file @
b6518e6f
...
...
@@ -16,7 +16,6 @@ import { Panels, Scenes, Tops } from "./types/Scenes";
import
Bar
from
"./components/Bar"
;
let
MainStage
:
egret
.
Stage
=
null
;
console
.
log
(
MainStage
);
export
{
MainStage
};
class
Main
extends
eui
.
UILayer
{
...
...
egret/src/Panels/SellPanel.ts
View file @
b6518e6f
...
...
@@ -74,7 +74,7 @@ export default class SellPanel extends Panel {
this
.
numBar
.
x
=
this
.
width
/
2
-
this
.
numBar
.
width
/
2
;
this
.
numBar
.
y
=
400
;
this
.
sellBtn
.
enabled
=
false
;
this
.
updateSellValue
()
;
}
/**
...
...
egret/src/Panels/TaskPanel.ts
View file @
b6518e6f
...
...
@@ -3,6 +3,7 @@ import { getSkinPath } from "../utils";
import
TopLayerCtrl
from
"../ctrls/topLayerCtrl"
;
import
{
ModuleTypes
}
from
"../types/sceneTypes"
;
import
{
NetManager
}
from
"../../libs/tw/manager/NetManager"
;
import
{
IndexDispatcher
}
from
"../Scenes/IndexScene/IndexScene"
;
export
default
class
TaskPanel
extends
Panel
{
public
list
:
eui
.
List
;
...
...
@@ -37,11 +38,11 @@ export default class TaskPanel extends Panel {
private
getTaskInfo
()
{
/// TODO 调用接口根据返回数据设置添加显示列表
NetManager
.
ins
.
getTaskInfo
((
success
,
res
)
=>
{
if
(
!
success
){
NetManager
.
ins
.
getTaskInfo
((
success
,
res
)
=>
{
if
(
!
success
)
{
return
;
}
console
.
log
(
res
);
console
.
log
(
res
);
});
this
.
list
.
useVirtualLayout
=
false
;
this
.
list
.
itemRenderer
=
TaskItem
;
...
...
@@ -92,11 +93,18 @@ class TaskItem extends eui.ItemRenderer {
/// TODO 根据需要设置btn监听事件
this
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
()
=>
{
TopLayerCtrl
.
instance
.
show
(
ModuleTypes
.
TASK_TOAST
,
{
title
:
"签到成功"
,
water
:
10
,
food
:
30
,
});
NetManager
.
ins
.
doTask
((
success
,
res
)
=>
{
if
(
!
success
)
{
return
;
}
TopLayerCtrl
.
instance
.
show
(
ModuleTypes
.
TASK_TOAST
,
{
title
:
"签到成功"
,
water
:
10
,
food
:
30
,
});
IndexDispatcher
.
dispatchEvent
(
'getPropInfo'
);
},
''
);
/// TODO !!!!! taskId !!!!!
},
this
);
}
}
egret/src/Panels/WareHousePanel.ts
View file @
b6518e6f
...
...
@@ -23,20 +23,20 @@ export let spData = {
export
default
class
WareHousePanel
extends
Panel
{
public
closeBtn
:
eui
.
Image
;
public
record_btn
:
eui
.
Image
;
public
noneImg
:
eui
.
Image
;
public
cropGroup
:
eui
.
Group
;
public
egg_group
:
eui
.
Group
;
public
egg_bg
:
eui
.
Image
;
public
egg_sell_btn
:
eui
.
Image
;
public
egg_label
:
eui
.
Label
;
public
egg_ex_btn
:
eui
.
Image
;
public
wheat_group
:
eui
.
Group
;
public
wheat_bg
:
eui
.
Image
;
public
wheat_sell_btn
:
eui
.
Image
;
public
wheat_label
:
eui
.
Label
;
public
wheat_ex_btn
:
eui
.
Image
;
public
closeBtn
:
eui
.
Image
;
public
record_btn
:
eui
.
Image
;
public
noneImg
:
eui
.
Image
;
public
cropGroup
:
eui
.
Group
;
public
egg_group
:
eui
.
Group
;
public
egg_bg
:
eui
.
Image
;
public
egg_sell_btn
:
eui
.
Image
;
public
egg_label
:
eui
.
Label
;
public
egg_ex_btn
:
eui
.
Image
;
public
wheat_group
:
eui
.
Group
;
public
wheat_bg
:
eui
.
Image
;
public
wheat_sell_btn
:
eui
.
Image
;
public
wheat_label
:
eui
.
Label
;
public
wheat_ex_btn
:
eui
.
Image
;
public
get
skinKey
()
{
return
'WareHouse'
...
...
@@ -89,10 +89,15 @@ export default class WareHousePanel extends Panel {
if
(
!
success
)
{
return
;
}
const
data
=
res
.
data
;
console
.
log
(
data
);
let
data
=
res
.
data
;
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
if
(
data
[
i
].
id
.
indexOf
(
'food'
)
!==
-
1
)
{
data
.
splice
(
i
,
1
);
}
}
for
(
let
v
of
data
)
{
this
[
`
${
spData
[
v
.
id
].
name
}
_label`
].
text
=
`数量:
${
v
.
stock
}
`
;
console
.
log
(
spData
[
v
.
id
].
name
);
this
[
`
${
spData
[
v
.
id
].
name
}
_sell_btn`
].
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
()
=>
{
TopLayerCtrl
.
instance
.
show
(
ModuleTypes
.
SELL_PANEL
,
{
key
:
v
.
id
,
total
:
v
.
stock
},
.
4
);
});
...
...
egret/src/Scenes/IndexScene/IndexUI.ts
View file @
b6518e6f
...
...
@@ -3,25 +3,34 @@ import { GDispatchHideOption } from "./Objs/OptionPanel";
import
PanelCtrl
from
"../../ctrls/panelCtrl"
;
import
{
ModuleTypes
}
from
"../../types/sceneTypes"
;
import
{
showToast
}
from
"../../comm/UtilsConst"
;
import
{
IndexDispatcher
}
from
"./IndexScene"
;
import
{
NetManager
}
from
"../../../libs/tw/manager/NetManager"
;
import
TopLayerCtrl
from
"../../ctrls/topLayerCtrl"
;
import
{
spData
}
from
"../../Panels/WareHousePanel"
;
let
propData
=
{
sp_food_1
:
{
name
:
'food'
,},
sp_food_2
:
{
name
:
'water'
,},
};
export
default
class
IndexUI
extends
ComponentBase
{
public
uiLayer
:
eui
.
Group
;
public
btnGroup
:
eui
.
Group
;
public
taskBtn
:
eui
.
Button
;
public
warehouseBtn
:
eui
.
Button
;
public
propPanel
:
eui
.
Group
;
public
speedGroup
:
eui
.
Group
;
public
speedNum
:
eui
.
Label
;
public
foodGroup
:
eui
.
Group
;
public
foodNum
:
eui
.
Label
;
public
waterGroup
:
eui
.
Group
;
public
waterNum
:
eui
.
Label
;
public
avatarPanel
:
eui
.
Group
;
public
avatarImg
:
eui
.
Image
;
public
avatarMask
:
eui
.
Image
;
public
userName
:
eui
.
Label
;
public
userGold
:
eui
.
Label
;
public
medal
:
eui
.
Image
;
public
uiLayer
:
eui
.
Group
;
public
btnGroup
:
eui
.
Group
;
public
taskBtn
:
eui
.
Button
;
public
warehouseBtn
:
eui
.
Button
;
public
propPanel
:
eui
.
Group
;
public
speedGroup
:
eui
.
Group
;
public
speedNum
:
eui
.
Label
;
public
foodGroup
:
eui
.
Group
;
public
foodNum
:
eui
.
Label
;
public
waterGroup
:
eui
.
Group
;
public
waterNum
:
eui
.
Label
;
public
avatarPanel
:
eui
.
Group
;
public
avatarImg
:
eui
.
Image
;
public
avatarMask
:
eui
.
Image
;
public
userName
:
eui
.
Label
;
public
userGold
:
eui
.
Label
;
public
medal
:
eui
.
Image
;
constructor
()
{
...
...
@@ -80,12 +89,49 @@ export default class IndexUI extends ComponentBase {
private
initUI
():
void
{
this
.
uiLayer
.
height
=
750
/
window
.
innerWidth
*
window
.
innerHeight
;
this
.
touchEnabled
=
true
;
/// TODO 根据数据初始化道具Panel
this
.
foodNum
.
text
=
"×"
+
30
;
this
.
waterNum
.
text
=
"×"
+
30
;
this
.
getPropInfo
();
/// TODO 根据数据初始化头像Panel
//
this
.
warehouseBtn
.
anchorOffsetX
=
this
.
warehouseBtn
.
width
/
2
;
this
.
warehouseBtn
.
anchorOffsetY
=
this
.
warehouseBtn
.
height
/
2
;
IndexDispatcher
.
addEvent
(
'warehouseEffect'
,
this
.
warehouseEffect
,
this
);
IndexDispatcher
.
addEvent
(
'getPropInfo'
,
this
.
getPropInfo
,
this
);
}
private
warehouseEffect
()
{
// 0s(100%,100%)-0.1s(120%,80%)-0.2s(100%,100%)
egret
.
Tween
.
removeTweens
(
this
.
warehouseBtn
);
egret
.
Tween
.
get
(
this
.
warehouseBtn
).
to
({
scaleX
:
1.2
,
scaleY
:
0.8
},
100
,
egret
.
Ease
.
quadInOut
).
call
(()
=>
{
egret
.
Tween
.
get
(
this
.
warehouseBtn
).
to
({
scaleX
:
1
,
scaleY
:
1
},
100
,
egret
.
Ease
.
quadInOut
);
});
}
private
getPropInfo
()
{
NetManager
.
ins
.
queryPrizeInfo
((
success
,
res
)
=>
{
if
(
!
success
)
{
return
;
}
let
data
=
res
.
data
;
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
if
(
data
[
i
].
id
.
indexOf
(
'food'
)
===
-
1
)
{
data
.
splice
(
i
,
1
);
}
}
data
.
forEach
(
v
=>
{
this
[
`
${
propData
[
v
.
id
].
name
}
Num`
].
text
=
`×
${
v
.
stock
}
`
;
})
},
''
);
}
destroy
()
{
super
.
destroy
();
IndexDispatcher
.
removeEvent
(
'warehouseEffect'
,
this
.
warehouseEffect
,
this
);
IndexDispatcher
.
removeEvent
(
'getPropInfo'
,
this
.
getPropInfo
,
this
);
}
get
skinKey
()
{
...
...
egret/src/Scenes/IndexScene/Objs/Crop.ts
View file @
b6518e6f
...
...
@@ -166,29 +166,35 @@ export default class Crop extends eui.Component {
this
.
cropMv
&&
this
.
removeChild
(
this
.
cropMv
)
&&
(
this
.
cropMv
=
null
);
let
catherImg
=
new
eui
.
Image
(
`
${
petData
[
this
.
petId
][
'catherImg'
]}
_png`
);
let
dy
=
IndexIns
().
indexUI
.
height
-
IndexIns
().
group
.
height
;
catherImg
.
x
=
IndexIns
().
landMgr
.
lands
[
this
.
index
-
1
].
x
+
this
.
x
+
100
;
catherImg
.
y
=
IndexIns
().
landMgr
.
lands
[
this
.
index
-
1
].
y
+
this
.
y
-
dy
/
2
+
20
;
catherImg
.
x
=
IndexIns
().
landMgr
.
lands
[
this
.
index
-
1
].
x
+
this
.
x
+
100
+
57
/
2
;
catherImg
.
y
=
IndexIns
().
landMgr
.
lands
[
this
.
index
-
1
].
y
+
this
.
y
-
dy
/
2
+
40
+
63
/
2
;
catherImg
.
anchorOffsetX
=
57
/
2
;
catherImg
.
anchorOffsetY
=
63
/
2
;
catherImg
.
scaleX
=
0
;
catherImg
.
scaleY
=
0
;
IndexIns
().
indexUI
.
addChild
(
catherImg
);
// 移动
egret
.
Tween
.
get
(
catherImg
).
to
({
y
:
catherImg
.
y
-
10
},
170
).
call
(()
=>
{
egret
.
Tween
.
get
(
catherImg
).
to
({
y
:
catherImg
.
y
+
10
},
160
,
egret
.
Ease
.
quadInOut
).
wait
(
500
).
call
(()
=>
{
let
_x
=
IndexIns
().
indexUI
.
warehouseBtn
.
x
+
25
+
57
/
2
;
let
_y
=
IndexIns
().
indexUI
.
warehouseBtn
.
y
+
35
+
63
/
2
;
egret
.
Tween
.
get
(
catherImg
).
to
({
x
:
_x
,
y
:
_y
},
680
);
});
});
// 缩放
egret
.
Tween
.
get
(
catherImg
).
to
({
scaleX
:
1
,
scaleY
:
1
},
170
).
wait
(
500
).
call
(()
=>
{
egret
.
Tween
.
get
(
catherImg
).
to
({
scaleX
:
0.8
,
scaleY
:
1.2
},
500
).
call
(()
=>
{
egret
.
Tween
.
get
(
catherImg
).
to
({
x
:
0.8
,
y
:
0.8
},
330
);
});
});
egret
.
Tween
.
get
(
catherImg
).
to
({
y
:
catherImg
.
y
-
10
},
170
).
call
(()
=>
{
egret
.
Tween
.
get
(
catherImg
).
to
({
y
:
catherImg
.
y
+
10
},
160
).
wait
(
500
).
call
(()
=>
{
let
_x
=
IndexIns
().
indexUI
.
warehouseBtn
.
x
+
25
;
let
_y
=
IndexIns
().
indexUI
.
warehouseBtn
.
y
+
35
;
egret
.
Tween
.
get
(
catherImg
).
to
({
x
:
_x
,
y
:
_y
},
680
);
});
});
// 透明度
egret
.
Tween
.
get
(
catherImg
).
wait
(
1470
).
to
({
alpha
:
0
},
30
).
call
(()
=>
{
egret
.
Tween
.
removeTweens
(
catherImg
);
IndexIns
().
indexUI
.
removeChild
(
catherImg
);
SetGameLayerUpdate
(
true
);
IndexDispatcher
.
dispatchEvent
(
'updateIndex'
);
IndexDispatcher
.
dispatchEvent
(
'warehouseEffect'
);
});
this
.
changePetId
(
CROP_TYPE
.
NONE
);
...
...
@@ -208,7 +214,7 @@ export default class Crop extends eui.Component {
this
.
optionMv
&&
this
.
removeChild
(
this
.
optionMv
)
&&
(
this
.
optionMv
=
null
);
loadSvga
(
getSvga
(
petData
[
this
.
petId
][
'option'
])).
then
(
(
mv
:
egret
.
MovieClip
)
=>
{
mv
.
x
=
-
10
;
mv
.
x
=
((
this
.
petId
==
CROP_TYPE
.
CHICKEN
)
||
(
this
.
petId
==
CROP_TYPE
.
CATTLE
))
?
-
30
:
10
;
mv
.
y
=
((
this
.
petId
==
CROP_TYPE
.
CHICKEN
)
||
(
this
.
petId
==
CROP_TYPE
.
CATTLE
))
?
-
30
:
-
120
;
this
.
addChild
(
mv
);
mv
.
addEventListener
(
egret
.
Event
.
COMPLETE
,
()
=>
{
...
...
@@ -261,16 +267,16 @@ export default class Crop extends eui.Component {
loadSvga
(
getSvga
(
`
${
petData
[
this
.
petId
].
key
}${
this
.
state
}
_birth`
)).
then
(
(
_mv
:
egret
.
MovieClip
)
=>
{
this
.
addChild
(
_mv
);
_mv
.
x
=
-
6
0
;
_mv
.
y
=
((
this
.
petId
==
CROP_TYPE
.
CHICKEN
)
||
(
this
.
petId
==
CROP_TYPE
.
CATTLE
))
?
-
16
5
:
-
140
;
_mv
.
x
=
-
6
5
;
_mv
.
y
=
((
this
.
petId
==
CROP_TYPE
.
CHICKEN
)
||
(
this
.
petId
==
CROP_TYPE
.
CATTLE
))
?
-
16
2
:
-
140
;
_mv
.
addEventListener
(
egret
.
Event
.
COMPLETE
,
()
=>
{
_mv
.
stop
();
let
name
=
`
${
petData
[
this
.
petId
].
key
}${
this
.
state
}
`
;
loadSvga
(
getSvga
(
name
)).
then
(
(
mv
:
egret
.
MovieClip
)
=>
{
this
.
cropMv
=
mv
;
this
.
cropMv
.
x
=
-
6
0
;
this
.
cropMv
.
y
=
((
this
.
petId
==
CROP_TYPE
.
CHICKEN
)
||
(
this
.
petId
==
CROP_TYPE
.
CATTLE
))
?
-
16
5
:
-
140
;
this
.
cropMv
.
x
=
-
6
5
;
this
.
cropMv
.
y
=
((
this
.
petId
==
CROP_TYPE
.
CHICKEN
)
||
(
this
.
petId
==
CROP_TYPE
.
CATTLE
))
?
-
16
2
:
-
140
;
this
.
removeChild
(
_mv
);
this
.
addChild
(
mv
);
this
.
cropMv
.
pixelHitTest
=
true
;
...
...
egret/src/components/ProgressNum.ts
View file @
b6518e6f
...
...
@@ -12,7 +12,7 @@ export class ProgressNum extends eui.Component {
private
data
=
null
;
private
total
=
0
;
// 总个数
private
number
=
0
;
// 当前个数
private
number
=
1
;
// 当前个数
public
get
value
()
{
return
this
.
number
;
}
...
...
@@ -24,7 +24,8 @@ export class ProgressNum extends eui.Component {
this
.
total
=
this
.
data
.
total
;
this
.
numLabel
.
text
=
`
${
this
.
number
}
`
;
// this.numLabel.text = `${this.number}`;
this
.
setHandX
(
0
);
this
.
initEvents
();
this
.
hand
.
anchorOffsetX
=
this
.
hand
.
width
/
2
;
...
...
@@ -38,7 +39,7 @@ export class ProgressNum extends eui.Component {
}
private
setHandX
(
x
)
{
let
aWidth
=
this
.
bar
.
width
/
this
.
total
;
let
aWidth
=
this
.
bar
.
width
/
(
this
.
total
-
1
)
;
let
dx
=
x
%
aWidth
;
// 取余数
x
=
(
~~
(
x
/
aWidth
)
+
(
dx
>=
(
aWidth
/
2
)
?
1
:
0
))
*
aWidth
;
// 过半吸附
this
.
hand
.
x
=
x
;
...
...
@@ -48,12 +49,19 @@ export class ProgressNum extends eui.Component {
this
.
hand
.
x
=
this
.
bar
.
width
;
}
this
.
number
=
~~
(
this
.
hand
.
x
/
this
.
bar
.
width
*
this
.
total
);
this
.
numLabel
.
text
=
`
${
this
.
number
}
`
;
this
.
number
=
~~
(
this
.
hand
.
x
/
this
.
bar
.
width
*
(
this
.
total
-
1
)
+
1
);
this
.
setNumber
();
IndexDispatcher
.
dispatchEvent
(
'updateSellValue'
);
}
private
setNumber
(){
if
(
this
.
total
==
0
){
this
.
number
=
0
;
}
this
.
numLabel
.
text
=
`
${
this
.
number
}
`
;
}
private
groupTouchBegin
(
e
:
egret
.
TouchEvent
)
{
this
.
canMove
=
this
.
touchGroup
.
hitTestPoint
(
e
.
stageX
,
e
.
stageY
);
if
(
this
.
canMove
)
{
...
...
mock/joyousManor/getLandInfo.json
View file @
b6518e6f
...
...
@@ -7,17 +7,17 @@
"id"
:
1
,
"petId"
:
2
,
"level"
:
1
,
"canFeed"
:
fals
e
,
"canFeed"
:
tru
e
,
"feedLeftSeconds"
:
3
,
"canGather"
:
false
},
{
"id"
:
2
,
"petId"
:
0
,
"level"
:
4
,
"canFeed"
:
fals
e
,
"petId"
:
1
,
"level"
:
1
,
"canFeed"
:
tru
e
,
"feedLeftSeconds"
:
4
,
"canGather"
:
tru
e
"canGather"
:
fals
e
},
{
"id"
:
3
,
...
...
mock/projectX/queryPrizeInfo.json
View file @
b6518e6f
...
...
@@ -9,13 +9,31 @@
"stock"
:
100
,
"type"
:
2
},
{
"degree"
:
"10"
,
"icon"
:
"//yun.dui88.com/projectxh5/credits-250-250.png"
,
"id"
:
"sp_food_2"
,
"name"
:
"加10积分"
,
"refType"
:
"increase-credits"
,
"stock"
:
666
,
"type"
:
2
},
{
"degree"
:
"10"
,
"icon"
:
"//yun.dui88.com/projectxh5/credits-250-250.png"
,
"id"
:
"sp_2"
,
"name"
:
"加10积分"
,
"refType"
:
"increase-credits"
,
"stock"
:
3
,
"stock"
:
0
,
"type"
:
2
},
{
"degree"
:
"10"
,
"icon"
:
"//yun.dui88.com/projectxh5/credits-250-250.png"
,
"id"
:
"sp_food_1"
,
"name"
:
"加10积分"
,
"refType"
:
"increase-credits"
,
"stock"
:
777
,
"type"
:
2
}
],
...
...
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