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
dcc46ad4
Commit
dcc46ad4
authored
Dec 22, 2020
by
邱旭
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
仓库
parent
7b7652cd
Changes
26
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
396 additions
and
146 deletions
+396
-146
workspace.xml
.idea/workspace.xml
+45
-17
index.html
egret/index.html
+2
-2
warehouse_none_seed.png
...t/resource/assets/warehouse_panel/warehouse_none_seed.png
+0
-0
default.res.json
egret/resource/default.res.json
+6
-5
default.thm.json
egret/resource/default.thm.json
+1
-0
OptionPanelSkin.exml
egret/resource/skins/Objs/OptionPanelSkin.exml
+9
-5
TaskToastSkin.exml
egret/resource/skins/TaskToastSkin.exml
+1
-1
WareHouseSeedItemSkin.exml
egret/resource/skins/WareHouseSeedItemSkin.exml
+7
-0
WareHouseSkin.exml
egret/resource/skins/WareHouseSkin.exml
+6
-3
Main.ts
egret/src/Main.ts
+1
-0
Guide.ts
egret/src/Panels/Guide.ts
+2
-1
NewUserPanel.ts
egret/src/Panels/NewUserPanel.ts
+5
-1
OldUserPanel.ts
egret/src/Panels/OldUserPanel.ts
+5
-1
ShopPanel.ts
egret/src/Panels/ShopPanel.ts
+7
-4
WareHousePanel.ts
egret/src/Panels/WareHousePanel.ts
+144
-13
ToastPanel.ts
egret/src/Panels/toastPanel/ToastPanel.ts
+2
-20
Home.ts
egret/src/Scenes/Home.ts
+31
-19
MainUI.ts
egret/src/Scenes/MainScene/MainUI.ts
+38
-12
OptionPanel.ts
egret/src/Scenes/MainScene/Objs/OptionPanel.ts
+49
-11
UtilsConst.ts
egret/src/comm/UtilsConst.ts
+2
-2
topLayerCtrl.ts
egret/src/ctrls/topLayerCtrl.ts
+7
-7
consumerInfo.json
mock/joyousManor/consumerInfo.json
+13
-8
getLandInfo.json
mock/joyousManor/getLandInfo.json
+0
-1
propInfo.json
mock/joyousManor/propInfo.json
+0
-6
taskInfo.json
mock/joyousManor/taskInfo.json
+1
-1
getUserSpList.json
mock/projectX/getUserSpList.json
+12
-6
No files found.
.idea/workspace.xml
View file @
dcc46ad4
This diff is collapsed.
Click to expand it.
egret/index.html
View file @
dcc46ad4
...
@@ -55,8 +55,8 @@
...
@@ -55,8 +55,8 @@
window
[
'taskUi'
]
=
{
window
[
'taskUi'
]
=
{
1
:
{
1
:
{
icon
:
'签到 icon_png'
,
icon
:
'签到 icon_png'
,
btnLabel
:
'
去签到
'
,
btnLabel
:
'
登陆
'
,
label
:
'每日
签到
'
,
label
:
'每日
登陆
'
,
bid
:
12
,
bid
:
12
,
},
},
2
:
{
2
:
{
...
...
egret/resource/assets/warehouse_panel/warehouse_none_seed.png
0 → 100644
View file @
dcc46ad4
16.6 KB
egret/resource/default.res.json
View file @
dcc46ad4
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
"name"
:
"task_panel"
"name"
:
"task_panel"
},
},
{
{
"keys"
:
"corn_bg_png,egg_bg_png,milk_bg_png,仓库_png,兑换_png,出售_png,出售记录_png,warehouse_none_png,wheat_bg_png,potato_bg_png,walnut_bg_png,warehouse_item_bg_png,warehouse_crop_png,warehouse_crop_dis_png,warehouse_bg_png,warehouse_seed_png,warehouse_seed_dis_png"
,
"keys"
:
"corn_bg_png,egg_bg_png,milk_bg_png,仓库_png,兑换_png,出售_png,出售记录_png,warehouse_none_png,wheat_bg_png,potato_bg_png,walnut_bg_png,warehouse_item_bg_png,warehouse_crop_png,warehouse_crop_dis_png,warehouse_bg_png,warehouse_seed_png,warehouse_seed_dis_png
,warehouse_none_seed_png
"
,
"name"
:
"warehouse"
"name"
:
"warehouse"
},
},
{
{
...
@@ -99,10 +99,6 @@
...
@@ -99,10 +99,6 @@
{
{
"keys"
:
"shopPanel_table_prop_png,shopPanel_bg_png,shopPanel_table_seed_png,shopPanel_table_prop_dis_png,shopPanel_table_seed_dis_png,shop_item_bg_png,shop_item_btn_png,shop_item_btn_dis_png"
,
"keys"
:
"shopPanel_table_prop_png,shopPanel_bg_png,shopPanel_table_seed_png,shopPanel_table_prop_dis_png,shopPanel_table_seed_dis_png,shop_item_bg_png,shop_item_btn_png,shop_item_btn_dis_png"
,
"name"
:
"shop"
"name"
:
"shop"
},
{
"keys"
:
"warehouse_bg_png,warehouse_crop_dis_png,warehouse_crop_png,warehouse_item_bg_png,warehouse_seed_dis_png,warehouse_seed_png"
,
"name"
:
"preload"
}
}
],
],
"resources"
:
[
"resources"
:
[
...
@@ -1170,6 +1166,11 @@
...
@@ -1170,6 +1166,11 @@
"url"
:
"assets/warehouse_panel/warehouse_seed.png"
,
"url"
:
"assets/warehouse_panel/warehouse_seed.png"
,
"type"
:
"image"
,
"type"
:
"image"
,
"name"
:
"warehouse_seed_png"
"name"
:
"warehouse_seed_png"
},
{
"url"
:
"assets/warehouse_panel/warehouse_none_seed.png"
,
"type"
:
"image"
,
"name"
:
"warehouse_none_seed_png"
}
}
]
]
}
}
\ No newline at end of file
egret/resource/default.thm.json
View file @
dcc46ad4
...
@@ -33,6 +33,7 @@
...
@@ -33,6 +33,7 @@
"resource/skins/ToastPanelSkin.exml"
,
"resource/skins/ToastPanelSkin.exml"
,
"resource/skins/WareHouseSkin.exml"
,
"resource/skins/WareHouseSkin.exml"
,
"resource/skins/WareHouseCropItemSkin.exml"
,
"resource/skins/WareHouseCropItemSkin.exml"
,
"resource/skins/WareHouseSeedItemSkin.exml"
,
"resource/skins/Component/BarSkin.exml"
,
"resource/skins/Component/BarSkin.exml"
,
"resource/skins/Component/ProgressNumSkin.exml"
,
"resource/skins/Component/ProgressNumSkin.exml"
,
"resource/skins/Component/TimeProgressBarSkin.exml"
,
"resource/skins/Component/TimeProgressBarSkin.exml"
,
...
...
egret/resource/skins/Objs/OptionPanelSkin.exml
View file @
dcc46ad4
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<e:Skin
class=
"OptionPanel"
width=
"596"
height=
"400"
xmlns:e=
"http://ns.egret.com/eui"
xmlns:w=
"http://ns.egret.com/wing"
>
<e:Skin
class=
"OptionPanel"
width=
"596"
height=
"400"
xmlns:e=
"http://ns.egret.com/eui"
xmlns:w=
"http://ns.egret.com/wing"
>
<e:Image
source=
"option_panel_png"
horizontalCenter=
"0"
verticalCenter=
"0"
alpha=
"0.8"
/>
<e:Image
source=
"option_panel_png"
horizontalCenter=
"0"
verticalCenter=
"0"
alpha=
"0.8"
top=
"0"
bottom=
"0"
right=
"0"
left=
"0"
/>
<e:Image
id=
"chickBtn"
source=
"option_chicken_png"
x=
"112"
anchorOffsetX=
"41"
anchorOffsetY=
"56"
bottom=
"235"
/>
<e:Image
id=
"chickBtn"
source=
"option_chicken_png"
x=
"112"
anchorOffsetX=
"41"
anchorOffsetY=
"56"
bottom=
"235"
/>
<e:Image
id=
"cattleBtn"
source=
"option_cattle_png"
anchorOffsetX=
"48.5"
anchorOffsetY=
"58.5"
x=
"298"
bottom=
"235"
/>
<e:Image
id=
"cattleBtn"
source=
"option_cattle_png"
anchorOffsetX=
"48.5"
anchorOffsetY=
"58.5"
x=
"298"
bottom=
"235"
/>
<e:Image
id=
"cornBtn"
source=
"option_corn_png"
x=
"460"
anchorOffsetX=
"47.5"
anchorOffsetY=
"65"
bottom=
"235"
/>
<e:Image
id=
"cornBtn"
source=
"option_corn_png"
x=
"460"
anchorOffsetX=
"47.5"
anchorOffsetY=
"65"
bottom=
"235"
/>
<e:Image
id=
"wheatBtn"
source=
"option_wheat_png"
anchorOffsetX=
"43"
anchorOffsetY=
"59"
x=
"114"
bottom=
"55"
/>
<e:Image
id=
"wheatBtn"
source=
"option_wheat_png"
anchorOffsetX=
"43"
anchorOffsetY=
"59"
x=
"114"
bottom=
"55"
/>
<e:Image
id=
"potatoBtn"
anchorOffsetX=
"43"
anchorOffsetY=
"59"
x=
"292.5"
source=
"option_potato_png"
bottom=
"55"
/>
<e:Group
id=
"walnutBtn"
x=
"405.5"
y=
"231"
anchorOffsetY=
"0"
height=
"119"
touchChildren=
"false"
>
<e:Image
id=
"walnutBtn"
anchorOffsetX=
"43"
anchorOffsetY=
"59"
x=
"456.5"
source=
"option_walnut_png"
bottom=
"55"
/>
<e:Image
anchorOffsetX=
"43"
anchorOffsetY=
"59"
source=
"option_walnut_png"
horizontalCenter=
"0"
verticalCenter=
"0"
/>
<e:Image
source=
"免费邮寄到家_png"
x=
"241.5"
y=
"190"
/>
<e:Image
source=
"免费邮寄到家_png"
x=
"0"
y=
"-37"
/>
<e:Image
source=
"免费邮寄到家_png"
x=
"405.5"
y=
"190"
/>
</e:Group>
<e:Group
id=
"potatoBtn"
x=
"245.5"
y=
"234"
anchorOffsetY=
"0"
height=
"113"
touchChildren=
"false"
>
<e:Image
source=
"免费邮寄到家_png"
y=
"-40"
horizontalCenter=
"0"
/>
<e:Image
anchorOffsetX=
"43"
anchorOffsetY=
"59"
source=
"option_potato_png"
horizontalCenter=
"0"
verticalCenter=
"0"
/>
</e:Group>
</e:Skin>
</e:Skin>
\ No newline at end of file
egret/resource/skins/TaskToastSkin.exml
View file @
dcc46ad4
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<e:Skin
class=
"ToastPanel"
width=
"388"
height=
"238"
xmlns:e=
"http://ns.egret.com/eui"
xmlns:w=
"http://ns.egret.com/wing"
>
<e:Skin
class=
"ToastPanel"
width=
"388"
height=
"238"
xmlns:e=
"http://ns.egret.com/eui"
xmlns:w=
"http://ns.egret.com/wing"
>
<e:Image
source=
"task_toast_png"
horizontalCenter=
"0"
verticalCenter=
"0"
/>
<e:Image
source=
"task_toast_png"
horizontalCenter=
"0"
verticalCenter=
"0"
/>
<e:Label
id=
"title"
text=
"签到成功"
y=
"1
0
"
size=
"26"
horizontalCenter=
"0"
/>
<e:Label
id=
"title"
text=
"签到成功"
y=
"1
3
"
size=
"26"
horizontalCenter=
"0"
/>
<e:Group
id=
"foodGroup"
x=
"119.5"
y=
"119"
width=
"64"
>
<e:Group
id=
"foodGroup"
x=
"119.5"
y=
"119"
width=
"64"
>
<e:Image
source=
"饲料 拷贝_png"
y=
"0"
scaleX=
"1.3"
scaleY=
"1.3"
horizontalCenter=
"0"
/>
<e:Image
source=
"饲料 拷贝_png"
y=
"0"
scaleX=
"1.3"
scaleY=
"1.3"
horizontalCenter=
"0"
/>
<e:Label
id=
"foodLabel"
text=
"×30"
y=
"64"
size=
"26"
horizontalCenter=
"0"
/>
<e:Label
id=
"foodLabel"
text=
"×30"
y=
"64"
size=
"26"
horizontalCenter=
"0"
/>
...
...
egret/resource/skins/WareHouseSeedItemSkin.exml
0 → 100644
View file @
dcc46ad4
<?xml version="1.0" encoding="utf-8"?>
<e:Skin
class=
"CreditsTip"
width=
"312"
height=
"360"
xmlns:e=
"http://ns.egret.com/eui"
xmlns:w=
"http://ns.egret.com/wing"
>
<e:Image
horizontalCenter=
"0"
y=
"0"
source=
"warehouse_item_bg_png"
/>
<e:Label
id=
"nameTxt"
text=
"0"
x=
"0"
y=
"182"
size=
"24"
textAlign=
"center"
anchorOffsetX=
"0"
width=
"312"
textColor=
"0x66492f"
/>
<e:Image
id=
"img"
source=
"prop_food_png"
left=
"29.5"
top=
"22"
/>
<e:Label
id=
"tipTxt"
text=
"数量:0"
x=
"0"
y=
"260"
size=
"22"
textAlign=
"center"
anchorOffsetX=
"0"
width=
"312"
textColor=
"0x9a9a9a"
/>
</e:Skin>
\ No newline at end of file
egret/resource/skins/WareHouseSkin.exml
View file @
dcc46ad4
...
@@ -2,16 +2,19 @@
...
@@ -2,16 +2,19 @@
<e:Skin
class=
"CreditsTip"
width=
"750"
height=
"850"
xmlns:e=
"http://ns.egret.com/eui"
xmlns:w=
"http://ns.egret.com/wing"
>
<e:Skin
class=
"CreditsTip"
width=
"750"
height=
"850"
xmlns:e=
"http://ns.egret.com/eui"
xmlns:w=
"http://ns.egret.com/wing"
>
<e:Image
horizontalCenter=
"0"
source=
"warehouse_bg_png"
y=
"76"
/>
<e:Image
horizontalCenter=
"0"
source=
"warehouse_bg_png"
y=
"76"
/>
<e:Image
id=
"closeBtn"
source=
"closeBtn_png"
x=
"642"
y=
"0"
/>
<e:Image
id=
"closeBtn"
source=
"closeBtn_png"
x=
"642"
y=
"0"
/>
<e:Group
id=
"cropGroup"
left=
"0"
top=
"314"
right=
"0"
bottom=
"0"
visible=
"false"
>
<e:Group
id=
"cropGroup"
left=
"0"
top=
"314"
right=
"0"
bottom=
"0"
>
<e:Image
id=
"record_btn"
source=
"出售记录_png"
x=
"318"
y=
"10"
scaleX=
"1"
scaleY=
"1"
/>
<e:Image
id=
"record_btn"
source=
"出售记录_png"
x=
"318"
y=
"10"
scaleX=
"1"
scaleY=
"1"
/>
<e:Image
id=
"cropNoneImg"
source=
"warehouse_none_png"
x=
"138"
y=
"120"
/>
<e:Image
id=
"cropNoneImg"
source=
"warehouse_none_png"
x=
"138"
y=
"120"
/>
<e:Scroller
id=
"crops"
anchorOffsetX=
"0"
anchorOffsetY=
"0"
scaleX=
"1"
scaleY=
"1"
left=
"42"
bottom=
"0"
right=
"42"
top=
"54"
>
<e:Scroller
id=
"crops"
anchorOffsetX=
"0"
anchorOffsetY=
"0"
scaleX=
"1"
scaleY=
"1"
left=
"42"
bottom=
"0"
right=
"42"
top=
"54"
>
<e:Group
anchorOffsetX=
"0"
anchorOffsetY=
"0"
/>
<e:Group
anchorOffsetX=
"0"
anchorOffsetY=
"0"
>
</e:Group>
</e:Scroller>
</e:Scroller>
</e:Group>
</e:Group>
<e:Group
id=
"seedGroup"
left=
"0"
top=
"314"
bottom=
"0"
right=
"0"
>
<e:Group
id=
"seedGroup"
left=
"0"
top=
"314"
bottom=
"0"
right=
"0"
>
<e:Image
id=
"seedNoneImg"
source=
"warehouse_none_seed_png"
x=
"138"
y=
"120"
scaleX=
"1"
scaleY=
"1"
/>
<e:Scroller
id=
"seeds"
anchorOffsetX=
"0"
anchorOffsetY=
"0"
scaleX=
"1"
scaleY=
"1"
top=
"0"
bottom=
"0"
right=
"42"
left=
"42"
>
<e:Scroller
id=
"seeds"
anchorOffsetX=
"0"
anchorOffsetY=
"0"
scaleX=
"1"
scaleY=
"1"
top=
"0"
bottom=
"0"
right=
"42"
left=
"42"
>
<e:Group
anchorOffsetX=
"0"
anchorOffsetY=
"0"
/>
<e:Group
anchorOffsetX=
"0"
anchorOffsetY=
"0"
>
</e:Group>
</e:Scroller>
</e:Scroller>
</e:Group>
</e:Group>
<e:Button
id=
"tableSeed"
label=
""
x=
"149"
y=
"254"
enabled=
"true"
>
<e:Button
id=
"tableSeed"
label=
""
x=
"149"
y=
"254"
enabled=
"true"
>
...
...
egret/src/Main.ts
View file @
dcc46ad4
...
@@ -104,6 +104,7 @@ class Main extends eui.UILayer {
...
@@ -104,6 +104,7 @@ class Main extends eui.UILayer {
private
async
getGameRes
()
{
private
async
getGameRes
()
{
await
RES
.
loadGroup
(
'common'
);
await
RES
.
loadGroup
(
'common'
);
await
RES
.
loadGroup
(
'main_scene'
);
await
RES
.
loadGroup
(
'main_scene'
);
await
RES
.
loadGroup
(
'task_panel'
);
// GDispatcher.dispatchEvent('progress', [100]);
// GDispatcher.dispatchEvent('progress', [100]);
}
}
}
}
...
...
egret/src/Panels/Guide.ts
View file @
dcc46ad4
...
@@ -80,7 +80,8 @@ export default class Guide extends Panel {
...
@@ -80,7 +80,8 @@ export default class Guide extends Panel {
break
;
break
;
case
this
.
guide3_btn
:
case
this
.
guide3_btn
:
this
.
data
.
call
();
const
popup
=
this
.
data
.
call
();
popup
?
0
:
(
this
.
hidePanel
(),
this
.
data
.
f
());
break
;
break
;
}
}
}
}
...
...
egret/src/Panels/NewUserPanel.ts
View file @
dcc46ad4
...
@@ -6,6 +6,7 @@ import {getToken} from "../Scenes/MainScene/Const";
...
@@ -6,6 +6,7 @@ import {getToken} from "../Scenes/MainScene/Const";
import
{
G_UpdateHomeData
}
from
"../Scenes/Home"
;
import
{
G_UpdateHomeData
}
from
"../Scenes/Home"
;
import
{
MainIns
}
from
"../Scenes/MainScene/MainScene"
;
import
{
MainIns
}
from
"../Scenes/MainScene/MainScene"
;
import
{
getlogItem
}
from
"../comm/getlogItem"
;
import
{
getlogItem
}
from
"../comm/getlogItem"
;
import
{
wait
}
from
"../comm/GameConst"
;
export
default
class
NewUserPanel
extends
Panel
{
export
default
class
NewUserPanel
extends
Panel
{
public
closeBtn
:
eui
.
Button
;
public
closeBtn
:
eui
.
Button
;
...
@@ -46,7 +47,7 @@ export default class NewUserPanel extends Panel {
...
@@ -46,7 +47,7 @@ export default class NewUserPanel extends Panel {
showToast
(
'网络异常,请刷新页面重试'
);
showToast
(
'网络异常,请刷新页面重试'
);
return
;
return
;
}
}
NetManager
.
ins
.
newUserPrize
((
res
,
success
)
=>
{
NetManager
.
ins
.
newUserPrize
(
async
(
res
,
success
)
=>
{
if
(
!
success
)
{
if
(
!
success
)
{
showToast
(
'网络异常,请稍后再试'
);
showToast
(
'网络异常,请稍后再试'
);
return
;
return
;
...
@@ -57,6 +58,9 @@ export default class NewUserPanel extends Panel {
...
@@ -57,6 +58,9 @@ export default class NewUserPanel extends Panel {
});
});
super
.
hidePanel
();
super
.
hidePanel
();
await
wait
(
500
);
this
.
data
.
f
();
},
token
)
},
token
)
});
});
}
}
...
...
egret/src/Panels/OldUserPanel.ts
View file @
dcc46ad4
...
@@ -2,6 +2,7 @@ import Panel from "../views/Panel";
...
@@ -2,6 +2,7 @@ import Panel from "../views/Panel";
import
TouchEvent
=
egret
.
TouchEvent
;
import
TouchEvent
=
egret
.
TouchEvent
;
import
{
NetManager
}
from
"../../libs/tw/manager/NetManager"
;
import
{
NetManager
}
from
"../../libs/tw/manager/NetManager"
;
import
{
getlogItem
}
from
"../comm/getlogItem"
;
import
{
getlogItem
}
from
"../comm/getlogItem"
;
import
{
wait
}
from
"../comm/GameConst"
;
export
default
class
OldUserPanel
extends
Panel
{
export
default
class
OldUserPanel
extends
Panel
{
public
closeBtn
:
eui
.
Button
;
public
closeBtn
:
eui
.
Button
;
...
@@ -35,8 +36,11 @@ export default class OldUserPanel extends Panel {
...
@@ -35,8 +36,11 @@ export default class OldUserPanel extends Panel {
this
.
btn
.
removeEventListener
(
TouchEvent
.
TOUCH_TAP
,
this
.
hidePanel
,
this
);
this
.
btn
.
removeEventListener
(
TouchEvent
.
TOUCH_TAP
,
this
.
hidePanel
,
this
);
}
}
hidePanel
()
{
async
hidePanel
()
{
super
.
hidePanel
();
super
.
hidePanel
();
NetManager
.
ins
.
clickLog
(
getlogItem
(
27
));
NetManager
.
ins
.
clickLog
(
getlogItem
(
27
));
await
wait
(
500
);
this
.
data
.
f
();
}
}
}
}
egret/src/Panels/ShopPanel.ts
View file @
dcc46ad4
...
@@ -208,7 +208,7 @@ export default class ShopPanel extends Panel {
...
@@ -208,7 +208,7 @@ export default class ShopPanel extends Panel {
for
(
let
i
=
0
;
i
<
seedData
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
seedData
.
length
;
i
++
)
{
const
d
=
seedData
[
i
];
const
d
=
seedData
[
i
];
d
.
price
=
data
[
d
.
spId
].
price
;
d
.
price
=
data
[
d
.
spId
].
price
;
d
.
stock
=
data
[
d
.
spId
].
stock
;
d
.
stock
=
-
1
;
// stock == -1 则是种子,种子无库存
}
}
resolve
();
resolve
();
});
});
...
@@ -287,13 +287,16 @@ class ShopItem extends Component {
...
@@ -287,13 +287,16 @@ class ShopItem extends Component {
this
.
setNum
(
this
.
num
);
this
.
setNum
(
this
.
num
);
}
}
// stock == -1 则是种子,种子无库存
private
setNum
(
num
)
{
private
setNum
(
num
)
{
if
(
num
>
this
.
data
.
stock
)
{
const
{
stock
}
=
this
.
data
;
num
=
this
.
data
.
stock
;
if
(
stock
!=
-
1
&&
num
>
stock
)
{
num
=
stock
;
}
}
this
.
subBtn
.
enabled
=
(
num
>
0
);
this
.
subBtn
.
enabled
=
(
num
>
0
);
this
.
addBtn
.
enabled
=
(
num
<
this
.
data
.
stock
);
stock
!=
-
1
&&
(
this
.
addBtn
.
enabled
=
(
num
<
stock
)
);
this
.
buyBtn
.
enabled
=
(
num
>
0
);
this
.
buyBtn
.
enabled
=
(
num
>
0
);
this
.
num
=
num
;
this
.
num
=
num
;
...
...
egret/src/Panels/WareHousePanel.ts
View file @
dcc46ad4
...
@@ -69,16 +69,63 @@ export const productData = {
...
@@ -69,16 +69,63 @@ export const productData = {
}
}
};
};
export
const
seedData
=
{
'sp_seed_1'
:
{
// 鸡
key
:
'sp_seed_1'
,
name
:
'chicken'
,
nameLabel
:
'鸡'
,
total
:
0
,
item
:
null
,
},
'sp_seed_2'
:
{
// 麦粉
key
:
'sp_seed_2'
,
name
:
'wheat'
,
nameLabel
:
'小麦'
,
total
:
0
,
item
:
null
,
},
'sp_seed_3'
:
{
// 玉米
key
:
'sp_seed_3'
,
name
:
'corn'
,
nameLabel
:
'玉米'
,
total
:
0
,
item
:
null
,
},
'sp_seed_4'
:
{
// 牛奶
key
:
'sp_seed_4'
,
name
:
'cattle'
,
nameLabel
:
'牛'
,
total
:
0
,
item
:
null
,
},
'sp_seed_5'
:
{
// 土豆
key
:
'sp_seed_5'
,
name
:
'potato'
,
nameLabel
:
'土豆'
,
total
:
0
,
item
:
null
,
},
'sp_seed_6'
:
{
// 核桃
key
:
'sp_seed_6'
,
name
:
'walnut'
,
nameLabel
:
'核桃'
,
total
:
0
,
item
:
null
,
}
};
export
default
class
WareHousePanel
extends
Panel
{
export
default
class
WareHousePanel
extends
Panel
{
public
closeBtn
:
eui
.
Image
;
public
closeBtn
:
eui
.
Image
;
public
tableSeed
:
eui
.
Button
;
public
cropGroup
:
eui
.
Group
;
public
tableCrop
:
eui
.
Button
;
public
record_btn
:
eui
.
Image
;
public
cropGroup
:
eui
.
Group
;
public
cropNoneImg
:
eui
.
Image
;
public
record_btn
:
eui
.
Image
;
public
crops
:
eui
.
Scroller
;
public
cropNoneImg
:
eui
.
Image
;
public
seedGroup
:
eui
.
Group
;
public
crops
:
eui
.
Scroller
;
public
seedNoneImg
:
eui
.
Image
;
public
seedGroup
:
eui
.
Group
;
public
seeds
:
eui
.
Scroller
;
public
seeds
:
eui
.
Scroller
;
public
tableSeed
:
eui
.
Button
;
public
tableCrop
:
eui
.
Button
;
public
get
skinKey
()
{
public
get
skinKey
()
{
return
'WareHouse'
return
'WareHouse'
...
@@ -161,6 +208,18 @@ export default class WareHousePanel extends Panel {
...
@@ -161,6 +208,18 @@ export default class WareHousePanel extends Panel {
i
++
;
i
++
;
}
}
for
(
let
k
in
seedData
)
{
const
data
=
seedData
[
k
];
const
item
=
new
WareHouseSeed
(
data
);
//@ts-ignore
this
.
seeds
.
viewport
.
addChild
(
item
);
item
.
x
=
i
%
2
*
354
;
item
.
y
=
~~
(
i
/
2
)
*
359
;
item
.
visible
=
false
;
seedData
[
k
].
item
=
item
;
i
++
;
}
this
.
showSeed
(
true
);
this
.
showSeed
(
true
);
}
}
...
@@ -207,24 +266,44 @@ export default class WareHousePanel extends Panel {
...
@@ -207,24 +266,44 @@ export default class WareHousePanel extends Panel {
*/
*/
private
setUI
()
{
private
setUI
()
{
const
show
Item
=
[];
const
show
Prop
=
[];
for
(
let
k
in
productData
)
{
for
(
let
k
in
productData
)
{
const
{
total
,
item
}
=
productData
[
k
];
const
{
total
,
item
}
=
productData
[
k
];
if
(
total
>
0
)
{
if
(
total
>
0
)
{
show
Item
.
push
(
item
);
show
Prop
.
push
(
item
);
}
else
{
}
else
{
item
.
x
=
item
.
y
=
0
;
item
.
x
=
item
.
y
=
0
;
}
}
item
.
updateData
(
productData
[
k
]);
item
.
updateData
(
productData
[
k
]);
}
}
showItem
.
forEach
((
v
,
i
)
=>
{
showProp
.
forEach
((
v
,
i
)
=>
{
v
.
x
=
i
%
2
*
354
;
v
.
y
=
~~
(
i
/
2
)
*
359
;
v
.
visible
=
true
;
});
this
.
cropNoneImg
.
visible
=
(
showProp
.
length
<=
0
);
const
showSeed
=
[];
for
(
let
k
in
seedData
)
{
const
{
total
,
item
}
=
seedData
[
k
];
if
(
total
>
0
)
{
showSeed
.
push
(
item
);
}
else
{
item
.
x
=
item
.
y
=
0
;
}
item
.
updateData
(
seedData
[
k
]);
}
showSeed
.
forEach
((
v
,
i
)
=>
{
v
.
x
=
i
%
2
*
354
;
v
.
x
=
i
%
2
*
354
;
v
.
y
=
~~
(
i
/
2
)
*
359
;
v
.
y
=
~~
(
i
/
2
)
*
359
;
v
.
visible
=
true
;
v
.
visible
=
true
;
});
});
this
.
cropNoneImg
.
visible
=
(
showItem
.
length
<=
0
);
this
.
seedNoneImg
.
visible
=
(
showSeed
.
length
<=
0
);
}
}
private
async
getWareHouseInfo
()
{
private
async
getWareHouseInfo
()
{
...
@@ -234,6 +313,11 @@ export default class WareHousePanel extends Panel {
...
@@ -234,6 +313,11 @@ export default class WareHousePanel extends Panel {
productData
[
k
].
total
=
product
[
k
];
productData
[
k
].
total
=
product
[
k
];
}
}
const
seed
=
G_GetHomeDataByKey
(
HOME
.
SEED
);
for
(
let
k
in
seed
)
{
seedData
[
k
].
total
=
seed
[
k
];
}
this
.
setUI
();
this
.
setUI
();
}
}
}
}
...
@@ -304,3 +388,50 @@ class WareHouseCrop extends Component {
...
@@ -304,3 +388,50 @@ class WareHouseCrop extends Component {
}
}
}
}
/**
* 仓库种子item
*/
class
WareHouseSeed
extends
Component
{
public
nameTxt
:
eui
.
Label
;
public
img
:
eui
.
Image
;
public
tipTxt
:
eui
.
Label
;
constructor
(
private
data
?
)
{
super
();
this
.
skinName
=
getSkinPath
(
'WareHouseSeedItem'
);
this
.
initUi
(
data
);
this
.
initEvent
();
}
private
initUi
(
data
?)
{
this
.
img
.
source
=
`prop_
${
data
.
name
}
_png`
;
this
.
nameTxt
.
text
=
data
.
nameLabel
;
this
.
updateUI
();
}
private
updateUI
()
{
this
.
tipTxt
.
text
=
`数量:
${
this
.
data
.
total
}
`
;
}
private
initEvent
()
{
}
/**
* 更新一下数据
* @param data
* @private
*/
public
updateData
(
data
)
{
this
.
data
=
data
;
this
.
updateUI
();
}
}
egret/src/Panels/toastPanel/ToastPanel.ts
View file @
dcc46ad4
...
@@ -30,33 +30,15 @@ export default class ToastPanel extends Panel {
...
@@ -30,33 +30,15 @@ export default class ToastPanel extends Panel {
initEvents
()
{
initEvents
()
{
super
.
initEvents
();
super
.
initEvents
();
// this.addEventListener(egret.TouchEvent.TOUCH_TAP, this.ontap_this, this);
}
}
removeEvents
()
{
removeEvents
()
{
super
.
removeEvents
();
super
.
removeEvents
();
// this.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.ontap_this, this);
}
private
ontap_this
():
void
{
}
}
private
onLoad
():
void
{
private
onLoad
():
void
{
if
(
this
.
mdata
)
{
if
(
this
.
mdata
)
{
// if(this.mdata.line > 2){
// this.bgRect.height = 150 + (this.mdata.line - 2) * 30;
// }
this
.
msgLb
.
text
=
this
.
mdata
.
msg
;
this
.
msgLb
.
text
=
this
.
mdata
.
msg
;
// if(this.mdata.width){
// this.bgRect.width = this.mdata.width;
// }
// if(this.mdata.height){
// this.bgRect.height = this.mdata.height;
// }
}
}
const
canvasW
=
750
/
window
.
innerWidth
*
window
.
innerWidth
;
const
canvasW
=
750
/
window
.
innerWidth
*
window
.
innerWidth
;
...
@@ -68,9 +50,9 @@ export default class ToastPanel extends Panel {
...
@@ -68,9 +50,9 @@ export default class ToastPanel extends Panel {
egret
.
Tween
.
removeTweens
(
this
);
egret
.
Tween
.
removeTweens
(
this
);
egret
.
Tween
.
get
(
this
)
egret
.
Tween
.
get
(
this
)
.
set
({
scaleX
:
0
,
scaleY
:
0
})
.
set
({
scaleX
:
0
,
scaleY
:
0
})
.
to
({
scaleX
:
1
,
scaleY
:
1
},
3
30
,
egret
.
Ease
.
backOut
)
.
to
({
scaleX
:
1
,
scaleY
:
1
},
2
30
,
egret
.
Ease
.
backOut
)
.
wait
(
800
)
.
wait
(
800
)
.
to
({
alpha
:
0
},
5
00
,
egret
.
Ease
.
quadInOut
)
.
to
({
alpha
:
0
},
4
00
,
egret
.
Ease
.
quadInOut
)
.
call
(
this
.
onTouchClose
.
bind
(
this
));
.
call
(
this
.
onTouchClose
.
bind
(
this
));
}
}
}
}
\ No newline at end of file
egret/src/Scenes/Home.ts
View file @
dcc46ad4
import
{
NetManager
}
from
"../../libs/tw/manager/NetManager"
;
import
{
NetManager
}
from
"../../libs/tw/manager/NetManager"
;
import
PanelCtrl
from
"../ctrls/panelCtrl"
;
import
PanelCtrl
from
"../ctrls/panelCtrl"
;
import
{
ModuleTypes
}
from
"../types/sceneTypes"
;
import
{
ModuleTypes
}
from
"../types/sceneTypes"
;
import
{
MainIns
}
from
"./MainScene/MainScene"
;
import
{
MainIns
}
from
"./MainScene/MainScene"
;
let
HomeData
=
{
let
HomeData
=
{
gold
:
0
,
// 欢趣豆
gold
:
0
,
// 欢趣豆
...
@@ -18,6 +18,14 @@ let HomeData = {
...
@@ -18,6 +18,14 @@ let HomeData = {
sp_5
:
0
,
// 土豆
sp_5
:
0
,
// 土豆
sp_6
:
0
,
// 核桃
sp_6
:
0
,
// 核桃
},
},
seed
:
{
sp_seed_1
:
0
,
// 鸡
sp_seed_2
:
0
,
// 麦子
sp_seed_3
:
0
,
// 玉米
sp_seed_4
:
0
,
// 牛
sp_seed_5
:
0
,
// 土豆
sp_seed_6
:
0
,
// 核桃
},
medals
:
{
medals
:
{
sp_achv_1
:
{
sp_achv_1
:
{
name
:
'进击的农夫'
,
name
:
'进击的农夫'
,
...
@@ -35,16 +43,17 @@ export enum HOME {
...
@@ -35,16 +43,17 @@ export enum HOME {
PROP
=
'prop'
,
PROP
=
'prop'
,
PRODUCT
=
'product'
,
PRODUCT
=
'product'
,
MEDALS
=
'medals'
,
MEDALS
=
'medals'
,
SEED
=
'seed'
,
}
}
/**
/**
* 刷新拥有的产物,使用数据之前要刷新,如打开仓库、打开商店
* 刷新拥有的产物,使用数据之前要刷新,如打开仓库、打开商店
*/
*/
export
const
G_UpdateHomeData
=
function
()
{
export
const
G_UpdateHomeData
=
function
()
{
const
updateGold
=
new
Promise
((
resolve
,
reject
)
=>
{
const
updateGold
=
new
Promise
((
resolve
,
reject
)
=>
{
NetManager
.
ins
.
getProjectUserInfo
((
success
,
res
)
=>
{
NetManager
.
ins
.
getProjectUserInfo
((
success
,
res
)
=>
{
if
(
!
success
)
{
if
(
!
success
)
{
return
;
return
;
}
}
G_SetHomeDataByKey
(
HOME
.
GOLD
,
res
.
data
.
consumerCredits
);
G_SetHomeDataByKey
(
HOME
.
GOLD
,
res
.
data
.
consumerCredits
);
...
@@ -54,19 +63,22 @@ export const G_UpdateHomeData = function() {
...
@@ -54,19 +63,22 @@ export const G_UpdateHomeData = function() {
const
updateSp
=
new
Promise
((
resolve
,
reject
)
=>
{
const
updateSp
=
new
Promise
((
resolve
,
reject
)
=>
{
NetManager
.
ins
.
queryUserSpList
((
success
,
res
)
=>
{
NetManager
.
ins
.
queryUserSpList
((
success
,
res
)
=>
{
if
(
!
success
)
{
if
(
!
success
)
{
return
;
return
;
}
}
for
(
const
k
in
HomeData
.
prop
)
{
for
(
const
k
in
HomeData
.
prop
)
{
HomeData
.
prop
[
k
]
=
res
.
data
[
k
];
HomeData
.
prop
[
k
]
=
res
.
data
[
k
]
||
0
;
}
for
(
const
k
in
HomeData
.
product
)
{
HomeData
.
product
[
k
]
=
res
.
data
[
k
]
||
0
;
}
}
for
(
const
k
in
HomeData
.
product
)
{
for
(
const
k
in
HomeData
.
seed
)
{
HomeData
.
product
[
k
]
=
res
.
data
[
k
]
;
HomeData
.
seed
[
k
]
=
res
.
data
[
k
]
||
0
;
}
}
for
(
const
k
in
HomeData
.
medals
)
{
for
(
const
k
in
HomeData
.
medals
)
{
HomeData
.
medals
[
k
].
count
=
res
.
data
[
k
];
HomeData
.
medals
[
k
].
count
=
res
.
data
[
k
]
||
0
;
}
}
if
(
MainIns
())
{
if
(
MainIns
())
{
MainIns
().
mainUI
.
setPropInfo
();
MainIns
().
mainUI
.
setPropInfo
();
}
}
resolve
();
resolve
();
...
@@ -75,27 +87,27 @@ export const G_UpdateHomeData = function() {
...
@@ -75,27 +87,27 @@ export const G_UpdateHomeData = function() {
return
Promise
.
all
([
updateGold
,
updateSp
]);
return
Promise
.
all
([
updateGold
,
updateSp
]);
};
};
export
const
G_GetHomeData
=
function
()
{
export
const
G_GetHomeData
=
function
()
{
return
JSON
.
parse
(
JSON
.
stringify
(
HomeData
));
return
JSON
.
parse
(
JSON
.
stringify
(
HomeData
));
};
};
export
const
G_GetHomeDataByKey
=
function
(
key
:
HOME
)
{
export
const
G_GetHomeDataByKey
=
function
(
key
:
HOME
)
{
return
JSON
.
parse
(
JSON
.
stringify
(
HomeData
[
key
]))
||
null
;
return
JSON
.
parse
(
JSON
.
stringify
(
HomeData
[
key
]))
||
null
;
};
};
export
const
G_SetHomeDataByKey
=
function
(
key
:
HOME
,
val
)
{
export
const
G_SetHomeDataByKey
=
function
(
key
:
HOME
,
val
)
{
HomeData
[
key
]
=
val
;
HomeData
[
key
]
=
val
;
};
};
/**
/**
* 检查是否可以弹出勋章弹窗
* 检查是否可以弹出勋章弹窗
*/
*/
export
const
G_JudgeMedalPanel
=
function
()
{
export
const
G_JudgeMedalPanel
=
function
()
{
const
oldData
=
G_GetHomeDataByKey
(
HOME
.
MEDALS
);
const
oldData
=
G_GetHomeDataByKey
(
HOME
.
MEDALS
);
G_UpdateHomeData
().
then
(()
=>
{
G_UpdateHomeData
().
then
(()
=>
{
const
newData
=
G_GetHomeDataByKey
(
HOME
.
MEDALS
);
const
newData
=
G_GetHomeDataByKey
(
HOME
.
MEDALS
);
for
(
const
k
in
newData
)
{
for
(
const
k
in
newData
)
{
if
(
newData
[
k
].
count
>
oldData
[
k
].
count
)
{
if
(
newData
[
k
].
count
>
oldData
[
k
].
count
)
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
MEDAL_PANEL
,
k
);
PanelCtrl
.
instance
.
show
(
ModuleTypes
.
MEDAL_PANEL
,
k
);
},
500
);
},
500
);
...
...
egret/src/Scenes/MainScene/MainUI.ts
View file @
dcc46ad4
...
@@ -3,7 +3,7 @@ import {M_HideOption} from "./Objs/OptionPanel";
...
@@ -3,7 +3,7 @@ import {M_HideOption} from "./Objs/OptionPanel";
import
PanelCtrl
from
"../../ctrls/panelCtrl"
;
import
PanelCtrl
from
"../../ctrls/panelCtrl"
;
import
{
ModuleTypes
}
from
"../../types/sceneTypes"
;
import
{
ModuleTypes
}
from
"../../types/sceneTypes"
;
import
{
btnDelay
,
showToast
}
from
"../../comm/UtilsConst"
;
import
{
btnDelay
,
showToast
}
from
"../../comm/UtilsConst"
;
import
{
MainIns
}
from
"./MainScene"
;
import
{
Main
Dispatcher
,
Main
Ins
}
from
"./MainScene"
;
import
{
NetManager
}
from
"../../../libs/tw/manager/NetManager"
;
import
{
NetManager
}
from
"../../../libs/tw/manager/NetManager"
;
import
{
DataManager
}
from
"../../../libs/tw/manager/DataManager"
;
import
{
DataManager
}
from
"../../../libs/tw/manager/DataManager"
;
import
{
loadSvga
}
from
"../../comm/loadSvga"
;
import
{
loadSvga
}
from
"../../comm/loadSvga"
;
...
@@ -18,6 +18,7 @@ import OldUserPanel from "../../Panels/OldUserPanel";
...
@@ -18,6 +18,7 @@ import OldUserPanel from "../../Panels/OldUserPanel";
import
GameGroupPanel
from
"../../Panels/GameGroupPanel"
;
import
GameGroupPanel
from
"../../Panels/GameGroupPanel"
;
import
Guide
from
"../../Panels/Guide"
;
import
Guide
from
"../../Panels/Guide"
;
import
ShopPanel
from
"../../Panels/ShopPanel"
;
import
ShopPanel
from
"../../Panels/ShopPanel"
;
import
TopLayerCtrl
from
"../../ctrls/topLayerCtrl"
;
export
let
propData
=
{
export
let
propData
=
{
sp_food_1
:
{
name
:
'food'
,},
sp_food_1
:
{
name
:
'food'
,},
...
@@ -249,6 +250,7 @@ export default class MainUI extends ComponentBase {
...
@@ -249,6 +250,7 @@ export default class MainUI extends ComponentBase {
}
else
{
}
else
{
this
[
`
${
propData
[
'sp_prop_1'
].
name
}
Group`
].
visible
=
false
;
this
[
`
${
propData
[
'sp_prop_1'
].
name
}
Group`
].
visible
=
false
;
}
}
}
}
public
setPropInfo
()
{
public
setPropInfo
()
{
...
@@ -278,21 +280,45 @@ export default class MainUI extends ComponentBase {
...
@@ -278,21 +280,45 @@ export default class MainUI extends ComponentBase {
return
;
return
;
}
}
const
data
=
res
.
data
;
const
data
=
res
.
data
;
this
.
userName
.
text
=
(
!
data
||
!
data
.
nickname
||
(
data
.
nickname
==
'null'
))
const
{
newUser
,
nickname
,
ifLogin
,
popup
,
loginPresent
}
=
data
;
?
'欢趣使者'
:
((
data
.
nickname
.
length
>
7
)
?
data
.
nickname
.
slice
(
0
,
7
)
+
'...'
:
data
.
nickname
);
this
.
userName
.
text
=
(
!
data
||
!
nickname
||
(
nickname
==
'null'
))
?
'欢趣使者'
:
((
nickname
.
length
>
7
)
?
nickname
.
slice
(
0
,
7
)
+
'...'
:
nickname
);
if
(
data
.
newUser
)
{
// 登陆奖励
const
loginPrize
=
()
=>
{
// NetManager.ins.doTask((success, res) => {
// if (!success) {
// return;
// }
// TopLayerCtrl.instance.show(ModuleTypes.TASK_TOAST, {
// title: '登陆奖励',
// food: loginPresent.spFood1RewardNum,
// water: loginPresent.spFood2RewardNum,
// });
// MainIns().mainUI.getPropInfo();
// }, 1);
TopLayerCtrl
.
instance
.
show
(
ModuleTypes
.
TASK_TOAST
,
{
title
:
'登陆奖励'
,
food
:
loginPresent
.
spFood1RewardNum
,
water
:
loginPresent
.
spFood2RewardNum
,
});
};
if
(
newUser
)
{
// 新用户出引导,TODO 因为换了活动,则不存在老用户
PanelCtrl
.
instance
.
show
(
Guide
,
{
PanelCtrl
.
instance
.
show
(
Guide
,
{
call
:
()
=>
{
call
:
()
=>
{
if
(
data
.
popup
)
{
if
(
popup
)
{
if
(
data
.
newUser
)
{
PanelCtrl
.
instance
.
show
(
NewUserPanel
,
{
f
:
loginPrize
});
PanelCtrl
.
instance
.
show
(
NewUserPanel
);
}
else
{
PanelCtrl
.
instance
.
show
(
OldUserPanel
);
}
}
}
}
return
popup
;
},
f
:
loginPrize
},
false
);
},
false
);
}
else
if
(
popup
)
{
// 不是新用户,但是要弹弹窗
PanelCtrl
.
instance
.
show
(
OldUserPanel
,
{
f
:
loginPrize
});
}
else
if
(
ifLogin
)
{
// 首次登陆
loginPrize
();
}
}
});
});
}
}
...
...
egret/src/Scenes/MainScene/Objs/OptionPanel.ts
View file @
dcc46ad4
import
{
getSkinPath
}
from
"../../../utils"
;
import
{
getSkinPath
}
from
"../../../utils"
;
import
{
MainDispatcher
,
MainIns
}
from
"../MainScene"
;
import
{
MainDispatcher
,
MainIns
}
from
"../MainScene"
;
import
{
NetManager
}
from
"../../../../libs/tw/manager/NetManager"
;
import
{
NetManager
}
from
"../../../../libs/tw/manager/NetManager"
;
import
{
btnDelay
}
from
"../../../comm/UtilsConst"
;
import
{
btnDelay
,
showToast
}
from
"../../../comm/UtilsConst"
;
import
{
M_Plant
}
from
"../LandMgr"
;
import
{
M_Plant
}
from
"../LandMgr"
;
import
M_EVENT
from
"../MSceneEnum"
;
import
M_EVENT
from
"../MSceneEnum"
;
import
{
G_
JudgeMedalPanel
}
from
"../../Home"
;
import
{
G_
GetHomeDataByKey
,
G_JudgeMedalPanel
,
HOME
}
from
"../../Home"
;
import
PanelCtrl
from
"../../../ctrls/panelCtrl"
;
import
PanelCtrl
from
"../../../ctrls/panelCtrl"
;
import
IntroducePanel
from
"../../../Panels/IntroducePanel"
;
import
IntroducePanel
from
"../../../Panels/IntroducePanel"
;
import
Tween
=
egret
.
Tween
;
import
Tween
=
egret
.
Tween
;
import
Ease
=
egret
.
Ease
;
import
Ease
=
egret
.
Ease
;
import
{
CROP_TYPE
}
from
"../Const"
;
import
{
CROP_TYPE
}
from
"../Const"
;
import
TouchEvent
=
egret
.
TouchEvent
;
import
TouchEvent
=
egret
.
TouchEvent
;
import
Image
=
eui
.
Image
;
import
Component
=
eui
.
Component
;
import
Component
=
eui
.
Component
;
import
{
seedData
}
from
"../../../Panels/WareHousePanel"
;
// 触发Option隐藏
// 触发Option隐藏
const
M_HideOption
=
function
()
{
const
M_HideOption
=
function
()
{
...
@@ -24,18 +24,25 @@ const M_ShowOption = function (data: { index: number }) {
...
@@ -24,18 +24,25 @@ const M_ShowOption = function (data: { index: number }) {
};
};
export
{
M_HideOption
,
M_ShowOption
};
export
{
M_HideOption
,
M_ShowOption
};
const
seedKV
=
{
sp_seed_1
:
'chick'
,
// 鸡
sp_seed_2
:
'wheat'
,
// 麦子
sp_seed_3
:
'corn'
,
// 玉米
sp_seed_4
:
'cattle'
,
// 牛
sp_seed_5
:
'potato'
,
// 土豆
sp_seed_6
:
'walnut'
,
// 核桃
}
/**
/**
* 操作面板
* 操作面板
*/
*/
export
default
class
OptionPanel
extends
Component
{
export
default
class
OptionPanel
extends
Component
{
public
chickBtn
:
Image
;
public
chickBtn
:
eui
.
Image
;
public
cattleBtn
:
Image
;
public
cattleBtn
:
eui
.
Image
;
public
cornBtn
:
Image
;
public
cornBtn
:
eui
.
Image
;
public
wheatBtn
:
Image
;
public
wheatBtn
:
eui
.
Image
;
public
potatoBtn
:
Image
;
public
walnutBtn
:
eui
.
Group
;
public
walnutBtn
:
Image
;
public
potatoBtn
:
eui
.
Group
;
private
data
=
null
;
private
data
=
null
;
...
@@ -95,7 +102,11 @@ export default class OptionPanel extends Component {
...
@@ -95,7 +102,11 @@ export default class OptionPanel extends Component {
private
showOption
(
data
?)
{
private
showOption
(
data
?)
{
console
.
log
(
data
);
console
.
log
(
data
);
this
.
data
=
data
;
this
.
data
=
data
;
M_HideOption
();
// 先触发隐藏,保证地块正常显示
M_HideOption
();
// 先触发隐藏,保证地块正常显示
this
.
showSeed
();
// 根据有的种植展示
Tween
.
removeTweens
(
this
);
Tween
.
removeTweens
(
this
);
this
.
touchEnabled
=
true
;
this
.
touchEnabled
=
true
;
...
@@ -108,6 +119,30 @@ export default class OptionPanel extends Component {
...
@@ -108,6 +119,30 @@ export default class OptionPanel extends Component {
Tween
.
get
(
this
).
set
({
alpha
:
0
}).
to
({
alpha
:
1
},
170
);
Tween
.
get
(
this
).
set
({
alpha
:
0
}).
to
({
alpha
:
1
},
170
);
}
}
// 查查有几个种子
private
showSeed
()
{
let
colorMatrix
=
[
0.3
,
0.3
,
0.3
,
0
,
0
,
0.3
,
0.3
,
0.3
,
0
,
0
,
0.3
,
0.3
,
0.3
,
0
,
0
,
0
,
0
,
0
,
1
,
0
];
let
colorFilter
=
new
egret
.
ColorMatrixFilter
(
colorMatrix
);
const
seeds
=
G_GetHomeDataByKey
(
HOME
.
SEED
);
for
(
let
k
in
seeds
)
{
if
(
seeds
[
k
]
>
0
)
{
this
[
`
${
seedKV
[
k
]}
Btn`
].
filters
=
[];
}
else
{
this
[
`
${
seedKV
[
k
]}
Btn`
].
filters
=
[
colorFilter
];
}
this
[
`
${
seedKV
[
k
]}
Btn`
].
seedNum
=
seeds
[
k
];
}
}
private
hideOption
()
{
private
hideOption
()
{
if
(
!
this
.
visible
)
{
if
(
!
this
.
visible
)
{
return
;
return
;
...
@@ -120,9 +155,12 @@ export default class OptionPanel extends Component {
...
@@ -120,9 +155,12 @@ export default class OptionPanel extends Component {
});
});
}
}
/// TODO 定义详细的操作
private
onTap
(
e
:
TouchEvent
)
{
private
onTap
(
e
:
TouchEvent
)
{
const
target
=
e
.
target
;
const
target
=
e
.
target
;
if
(
e
.
target
.
seedNum
<=
0
)
{
showToast
(
'这个没有了,快去商店购买吧'
);
return
;
}
btnDelay
(
target
);
btnDelay
(
target
);
let
petId
;
let
petId
;
switch
(
target
)
{
switch
(
target
)
{
...
...
egret/src/comm/UtilsConst.ts
View file @
dcc46ad4
...
@@ -3,8 +3,8 @@ import {ModuleTypes} from "../types/sceneTypes";
...
@@ -3,8 +3,8 @@ import {ModuleTypes} from "../types/sceneTypes";
import
{
DataManager
}
from
"../../libs/tw/manager/DataManager"
;
import
{
DataManager
}
from
"../../libs/tw/manager/DataManager"
;
import
Tween
=
egret
.
Tween
;
import
Tween
=
egret
.
Tween
;
export
function
showToast
(
msg
)
{
export
function
showToast
(
msg
,
maskAlpha
:
number
=
0
)
{
TopLayerCtrl
.
instance
.
show
(
ModuleTypes
.
TOAST_PANEL
,
{
msg
:
msg
});
TopLayerCtrl
.
instance
.
show
(
ModuleTypes
.
TOAST_PANEL
,
{
msg
:
msg
}
,
maskAlpha
);
}
}
export
function
btnDelay
(
targe
:
any
,
dtime
:
number
=
500
)
{
export
function
btnDelay
(
targe
:
any
,
dtime
:
number
=
500
)
{
...
...
egret/src/ctrls/topLayerCtrl.ts
View file @
dcc46ad4
import
{
ModuleTypes
}
from
"../types/sceneTypes"
;
import
{
ModuleTypes
}
from
"../types/sceneTypes"
;
import
Panel
from
"../views/Panel"
;
import
Panel
from
"../views/Panel"
;
import
Loading
from
"../loading/Loading"
;
import
Loading
from
"../loading/Loading"
;
...
@@ -19,7 +19,7 @@ export default class TopLayerCtrl {
...
@@ -19,7 +19,7 @@ export default class TopLayerCtrl {
}
}
show
(
type
:
ModuleTypes
,
data
?,
maskAlpha
:
number
=
0
)
{
show
(
type
:
ModuleTypes
,
data
?,
maskAlpha
:
number
=
0
)
{
if
(
this
.
_current
)
{
if
(
this
.
_current
)
{
this
.
remove
(
this
.
_current
);
this
.
remove
(
this
.
_current
);
// this._current = null;
// this._current = null;
}
}
...
@@ -41,7 +41,7 @@ export default class TopLayerCtrl {
...
@@ -41,7 +41,7 @@ export default class TopLayerCtrl {
*/
*/
private
addMask
(
maskAlpha
:
number
)
{
private
addMask
(
maskAlpha
:
number
)
{
/// TODO 临时改造,将生成的mask alpha 设置为 1,使用生成后的Sprite来设置透明度,比免重复的移除和生成
/// TODO 临时改造,将生成的mask alpha 设置为 1,使用生成后的Sprite来设置透明度,比免重复的移除和生成
if
(
!
this
.
_mask
)
{
if
(
!
this
.
_mask
)
{
this
.
_mask
=
new
egret
.
Sprite
();
this
.
_mask
=
new
egret
.
Sprite
();
this
.
_mask
.
touchEnabled
=
true
;
this
.
_mask
.
touchEnabled
=
true
;
this
.
_mask
.
graphics
.
beginFill
(
0
,
1
);
this
.
_mask
.
graphics
.
beginFill
(
0
,
1
);
...
@@ -58,7 +58,7 @@ export default class TopLayerCtrl {
...
@@ -58,7 +58,7 @@ export default class TopLayerCtrl {
removeMask
()
{
removeMask
()
{
/// TODO 不知道谁干的。 暂时认为没必要移除,且移除易造成_mask不是_parent的子渲染项
/// TODO 不知道谁干的。 暂时认为没必要移除,且移除易造成_mask不是_parent的子渲染项
// if(this._mask) {
// if(this._mask) {
// this._parent.removeChild(this._mask);
// this._parent.removeChild(this._mask);
// }
// }
this
.
_parent
.
visible
=
false
;
this
.
_parent
.
visible
=
false
;
}
}
...
@@ -92,7 +92,7 @@ export default class TopLayerCtrl {
...
@@ -92,7 +92,7 @@ export default class TopLayerCtrl {
panel
.
removeEventListener
(
'onDestroy'
,
this
.
onPanelHide
,
this
);
panel
.
removeEventListener
(
'onDestroy'
,
this
.
onPanelHide
,
this
);
this
.
remove
(
panel
);
this
.
remove
(
panel
);
this
.
removeMask
();
this
.
removeMask
();
if
(
this
.
_parent
.
numChildren
==
0
)
{
if
(
this
.
_parent
.
numChildren
==
0
)
{
this
.
_parent
.
visible
=
false
;
this
.
_parent
.
visible
=
false
;
}
}
}
}
...
@@ -101,7 +101,7 @@ export default class TopLayerCtrl {
...
@@ -101,7 +101,7 @@ export default class TopLayerCtrl {
panel
.
removeEventListener
(
'onDestroy'
,
this
.
onPanelHide
,
this
);
panel
.
removeEventListener
(
'onDestroy'
,
this
.
onPanelHide
,
this
);
this
.
remove
(
panel
);
this
.
remove
(
panel
);
if
(
this
.
_parent
.
numChildren
==
0
)
{
if
(
this
.
_parent
.
numChildren
==
0
)
{
this
.
_parent
.
visible
=
false
;
this
.
_parent
.
visible
=
false
;
}
}
}
}
...
@@ -121,7 +121,7 @@ export default class TopLayerCtrl {
...
@@ -121,7 +121,7 @@ export default class TopLayerCtrl {
private
_current
:
Panel
;
private
_current
:
Panel
;
closeCurrent
()
{
closeCurrent
()
{
if
(
this
.
_current
)
if
(
this
.
_current
)
this
.
remove
(
this
.
_current
);
this
.
remove
(
this
.
_current
);
}
}
}
}
\ No newline at end of file
mock/joyousManor/consumerInfo.json
View file @
dcc46ad4
{
{
"code"
:
null
,
"code"
:
null
,
"data"
:
{
"data"
:
{
"nickname"
:
"啊啊啊啊啊啊啊啊啊啊"
,
"nickname"
:
"啊啊啊啊啊啊啊啊啊啊"
,
"newUser"
:
false
,
"newUser"
:
false
,
"popup"
:
false
"popup"
:
false
,
},
"ifLogin"
:
true
,
"message"
:
null
,
"loginPresent"
:
{
"success"
:
true
"spFood1RewardNum"
:
2
,
"spFood2RewardNum"
:
2
}
},
"message"
:
null
,
"success"
:
true
}
}
mock/joyousManor/getLandInfo.json
View file @
dcc46ad4
...
@@ -41,7 +41,6 @@
...
@@ -41,7 +41,6 @@
"petId"
:
6
,
"petId"
:
6
,
"lock"
:
false
"lock"
:
false
},
},
{
{
"canFeed"
:
true
,
"canFeed"
:
true
,
"canGather"
:
false
,
"canGather"
:
false
,
...
...
mock/joyousManor/propInfo.json
View file @
dcc46ad4
...
@@ -40,32 +40,26 @@
...
@@ -40,32 +40,26 @@
},
},
{
{
"spId"
:
"sp_seed_1"
,
"spId"
:
"sp_seed_1"
,
"stock"
:
500
,
"price"
:
10
"price"
:
10
},
},
{
{
"spId"
:
"sp_seed_2"
,
"spId"
:
"sp_seed_2"
,
"stock"
:
2
,
"price"
:
10
"price"
:
10
},
},
{
{
"spId"
:
"sp_seed_3"
,
"spId"
:
"sp_seed_3"
,
"stock"
:
0
,
"price"
:
300
"price"
:
300
},
},
{
{
"spId"
:
"sp_seed_4"
,
"spId"
:
"sp_seed_4"
,
"stock"
:
500
,
"price"
:
700
"price"
:
700
},
},
{
{
"spId"
:
"sp_seed_5"
,
"spId"
:
"sp_seed_5"
,
"stock"
:
10
,
"price"
:
100
"price"
:
100
},
},
{
{
"spId"
:
"sp_seed_6"
,
"spId"
:
"sp_seed_6"
,
"stock"
:
0
,
"price"
:
300
"price"
:
300
}
}
]
]
...
...
mock/joyousManor/taskInfo.json
View file @
dcc46ad4
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
"id"
:
1
,
"id"
:
1
,
"spFood1RewardNum"
:
50
,
"spFood1RewardNum"
:
50
,
"spFood2RewardNum"
:
60
,
"spFood2RewardNum"
:
60
,
"status"
:
0
,
"status"
:
1
,
"type"
:
0
"type"
:
0
},
},
{
{
...
...
mock/projectX/getUserSpList.json
View file @
dcc46ad4
...
@@ -3,18 +3,24 @@
...
@@ -3,18 +3,24 @@
"message"
:
null
,
"message"
:
null
,
"code"
:
null
,
"code"
:
null
,
"data"
:
{
"data"
:
{
"sp_1"
:
10
0
,
"sp_1"
:
10
,
"sp_2"
:
11
,
"sp_2"
:
0
,
"sp_3"
:
10
,
"sp_3"
:
10
,
"sp_4"
:
111
,
"sp_4"
:
0
,
"sp_5"
:
0
,
"sp_5"
:
1
0
,
"sp_6"
:
0
,
"sp_6"
:
0
,
"sp_food_1"
:
100
,
"sp_food_1"
:
100
,
"sp_food_2"
:
100
,
"sp_food_2"
:
100
,
"sp_prop_1"
:
100
,
"sp_prop_1"
:
100
,
"sp_task_1"
:
10
,
"sp_task_1"
:
10
,
"sp_task_2"
:
100
,
"sp_task_2"
:
100
,
"sp_achv_1"
:
1
,
"sp_achv_1"
:
0
,
"sp_achv_2"
:
1
"sp_achv_2"
:
0
,
"sp_seed_1"
:
0
,
"sp_seed_2"
:
1
,
"sp_seed_3"
:
0
,
"sp_seed_4"
:
0
,
"sp_seed_5"
:
0
,
"sp_seed_6"
:
0
}
}
}
}
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