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
22c0a3ab
Commit
22c0a3ab
authored
Jun 09, 2020
by
haiyoucuv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
初始化土地信息,更新土地信息
parent
0bb2e710
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
192 additions
and
473 deletions
+192
-473
workspace.xml
.idea/workspace.xml
+43
-402
aaa.json
mock/miniTb/aaa.json
+0
-5
qiaqiaHome.doPlant.json
mock/miniTb/qiaqiaHome.doPlant.json
+11
-0
qiaqiaHome.doWater.json
mock/miniTb/qiaqiaHome.doWater.json
+11
-0
qiaqiaHome.getGameInfo.json
mock/miniTb/qiaqiaHome.getGameInfo.json
+15
-11
rule.json
mock/miniTb/rule.json
+0
-5
TaoBaoNet.ts
src/TaoBaoNet.ts
+1
-0
GameLayer.ts
src/parts/Game/GameLayer.ts
+37
-31
Land.ts
src/parts/Game/Land.ts
+54
-14
Plant.ts
src/parts/Game/Plant.ts
+13
-1
ProgressBar.ts
src/parts/Game/ProgressBar.ts
+5
-1
LoadingScene.ts
src/scenes/LoadingScene.ts
+2
-3
No files found.
.idea/workspace.xml
View file @
22c0a3ab
This diff is collapsed.
Click to expand it.
mock/miniTb/aaa.json
deleted
100644 → 0
View file @
0bb2e710
{
"success"
:
true
,
"code"
:
"1111"
,
"data"
:
{}
}
\ No newline at end of file
mock/miniTb/qiaqiaHome.doPlant.json
0 → 100644
View file @
22c0a3ab
{
"success"
:
true
,
"data"
:
{
"index"
:
2
,
"plant"
:
true
,
"level"
:
1
,
"plantType"
:
"CASHEWNUT"
,
"waterTime"
:
""
,
"waterRestCount"
:
0
}
}
mock/miniTb/qiaqiaHome.doWater.json
0 → 100644
View file @
22c0a3ab
{
"success"
:
true
,
"data"
:
{
"index"
:
2
,
"plant"
:
true
,
"level"
:
1
,
"plantType"
:
"CASHEWNUT"
,
"waterTime"
:
""
,
"waterRestCount"
:
0
}
}
mock/miniTb/qiaqiaHome.getGameInfo.json
View file @
22c0a3ab
...
...
@@ -10,27 +10,30 @@
"plants"
:
[
{
"index"
:
1
,
"plant"
:
false
,
"level"
:
""
,
"plantType"
:
""
,
"waterTime"
:
""
,
"waterRestCount"
:
""
"plant"
:
true
,
"level"
:
3
,
"plantType"
:
"PEANUT"
,
"waterTime"
:
1591790173326
,
"totalTime"
:
30000000
,
"waterRestCount"
:
0
},
{
"index"
:
2
,
"plant"
:
true
,
"level"
:
1
,
"plantType"
:
"CASHEWNUT"
,
"waterTime"
:
""
,
"waterTime"
:
0
,
"totalTime"
:
3000
,
"waterRestCount"
:
0
},
{
"index"
:
3
,
"plant"
:
false
,
"level"
:
""
,
"plantType"
:
""
,
"waterTime"
:
""
,
"waterRestCount"
:
""
"plant"
:
true
,
"level"
:
1
,
"plantType"
:
"PECAN"
,
"waterTime"
:
2
,
"totalTime"
:
3000
,
"waterRestCount"
:
0
},
{
"index"
:
4
,
...
...
@@ -38,6 +41,7 @@
"level"
:
""
,
"plantType"
:
""
,
"waterTime"
:
""
,
"totalTime"
:
""
,
"waterRestCount"
:
""
}
]
...
...
mock/miniTb/rule.json
deleted
100644 → 0
View file @
0bb2e710
{
"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/TaoBaoNet.ts
View file @
22c0a3ab
...
...
@@ -2,6 +2,7 @@ import { showToast, wait, clearWait } from "../module/ctrls";
export
const
activityId
=
111
;
export
const
sellerId
=
742982950
;
//接口枚举,包括需要调用淘宝的api,用是否含有兑吧区分,或者单独区分
export
enum
TbNetName
{
...
...
src/parts/Game/GameLayer.ts
View file @
22c0a3ab
...
...
@@ -7,7 +7,7 @@ import { PLANT_STATE, PLANT_TYPE, s_PlantData } from "../../const/staticData";
import
{
Tool
}
from
"../../Tools"
;
import
{
layers
}
from
"../../../module/views/layers"
;
import
{
G_wareHouseEffect
}
from
"../UI/UILayer"
;
import
{
getTbData
,
TbNetName
}
from
"../../TaoBaoNet"
;
import
{
activityId
,
getTbData
,
sendTbNet
,
TbNetName
}
from
"../../TaoBaoNet"
;
/**
...
...
@@ -38,31 +38,11 @@ export default class GameLayer extends Container {
this
.
initLand
();
const
gameInfo
=
getTbData
(
TbNetName
.
gameInfo
).
data
;
// 种植列表
this
.
plantList
=
this
.
addChild
(
new
PlantList
());
const
initData
=
[
{
type
:
PLANT_TYPE
.
PISTACHIONUT
,
state
:
PLANT_STATE
.
STATE1
,
},
{
type
:
PLANT_TYPE
.
NONE
,
state
:
0
,
},
{
type
:
PLANT_TYPE
.
MELON
,
state
:
PLANT_STATE
.
STATE2
,
},
{
type
:
PLANT_TYPE
.
PEANUT
,
state
:
PLANT_STATE
.
STATE3
,
},
];
this
.
initPlant
(
initData
);
const
gameInfo
=
getTbData
(
TbNetName
.
gameInfo
).
data
;
this
.
initPlant
(
gameInfo
.
plants
);
}
/**
...
...
@@ -71,7 +51,7 @@ export default class GameLayer extends Container {
* @param {PLANT_TYPE} type 植物类型
*/
public
addPlant
(
landId
:
number
,
type
:
PLANT_TYPE
)
{
this
.
landList
[
landId
-
1
].
addPlant
(
type
);
/// TODO 看后端从几号开始
this
.
landList
[
landId
].
addPlant
(
type
);
/// TODO 看后端从几号开始
}
/**
...
...
@@ -79,8 +59,26 @@ export default class GameLayer extends Container {
* @param {number} landId
* @param {PLANT_STATE} state
*/
public
updatePlant
(
landId
:
number
,
state
:
PLANT_STATE
)
{
this
.
landList
[
landId
-
1
].
updatePlant
(
state
);
public
upPlant
(
landId
:
number
,
state
:
PLANT_STATE
)
{
this
.
landList
[
landId
].
upPlant
(
state
);
}
/**
* 更新植物信息
* @param {number} landId
* @param {PLANT_STATE} state
*/
public
updatePlant
(
landId
:
number
)
{
sendTbNet
(
TbNetName
.
gameInfo
,
{
activityId
:
activityId
},
(
success
,
res
)
=>
{
for
(
let
i
=
0
;
i
<
res
.
data
.
plants
.
length
;
i
++
)
{
if
(
res
.
data
.
plants
[
i
].
index
==
landId
)
{
this
.
landList
[
landId
].
updatePlant
(
res
.
data
.
plants
[
i
]);
break
;
}
}
});
}
/**
...
...
@@ -88,7 +86,7 @@ export default class GameLayer extends Container {
* @param {number} landId
*/
public
clearPlant
(
landId
:
number
)
{
this
.
landList
[
landId
-
1
].
clearPlant
();
this
.
landList
[
landId
].
clearPlant
();
}
/**
...
...
@@ -96,15 +94,22 @@ export default class GameLayer extends Container {
* @param initData
*/
public
initPlant
(
initData
)
{
this
.
landList
.
forEach
((
land
:
Land
,
index
:
number
)
=>
{
land
.
initPlant
(
initData
[
index
].
type
,
initData
[
index
].
state
);
initData
.
forEach
((
data
)
=>
{
if
(
!
data
.
plant
)
return
;
this
.
landList
[
data
.
index
].
initPlant
({
type
:
data
.
plantType
,
state
:
data
.
level
,
time
:
data
.
waterTime
,
totalTime
:
data
.
totalTime
,
waterRestCount
:
data
.
waterRestCount
});
});
}
public
getEffect
(
type
:
PLANT_TYPE
,
id
:
number
)
{
let
getEffect
=
this
.
addChild
(
Tool
.
getSprite
(
`种植框_
${
s_PlantData
[
type
].
name
}
.png`
));
getEffect
.
mouseEnable
=
false
;
getEffect
.
position
.
set
(
this
.
landList
[
id
-
1
].
x
+
185
,
this
.
landList
[
id
-
1
].
y
+
55
);
getEffect
.
position
.
set
(
this
.
landList
[
id
].
x
+
185
,
this
.
landList
[
id
].
y
+
55
);
let
_x
=
375
-
getEffect
.
width
/
2
;
let
_y
=
layers
.
stageHeight
-
layers
.
stageOffsetY
-
205
;
let
__y
=
getEffect
.
y
;
...
...
@@ -146,7 +151,8 @@ export default class GameLayer extends Container {
let
newLand
=
this
.
addChild
(
new
Land
());
newLand
.
position
.
set
(
v
[
0
],
v
[
1
]);
newLand
.
id
=
index
+
1
;
/// TODO 看后端从几号开始
this
.
landList
.
push
(
newLand
);
this
.
landList
[
index
+
1
]
=
newLand
;
// this.landList.push(newLand);
});
}
}
src/parts/Game/Land.ts
View file @
22c0a3ab
...
...
@@ -2,6 +2,8 @@ import Container = FYGE.Container;
import
Sprite
=
FYGE
.
Sprite
;
import
DisplayObject
=
FYGE
.
DisplayObject
;
import
MouseEvent
=
FYGE
.
MouseEvent
;
import
Event
=
FYGE
.
Event
;
import
MovieClip
=
FYGE
.
MovieClip
;
import
{
RES
}
from
"../../../module/RES"
;
import
GameLayer
from
"./GameLayer"
;
import
OptionPool
from
"../../const/OptionPool"
;
...
...
@@ -10,8 +12,6 @@ import { OPTION_TYPE, PLANT_STATE, PLANT_TYPE } from "../../const/staticData";
import
Plant
from
"./Plant"
;
import
ProgressBar
from
"./ProgressBar"
;
import
{
Tool
}
from
"../../Tools"
;
import
Event
=
FYGE
.
Event
;
import
MovieClip
=
FYGE
.
MovieClip
;
export
enum
LAND_STATE
{
DEFAULT
=
'default'
,
...
...
@@ -39,6 +39,8 @@ export class Land extends Container {
private
option
:
OptionEffect
=
null
;
// 当前显示的 OptionEffect
private
waterRestCount
:
number
;
// id
private
_id
:
number
;
public
set
id
(
id
:
number
)
{
...
...
@@ -104,8 +106,8 @@ export class Land extends Container {
* 升级植物
* @param {PLANT_STATE} state
*/
public
up
date
Plant
(
state
:
PLANT_STATE
)
{
this
.
plant
.
up
date
Plant
(
state
);
public
upPlant
(
state
:
PLANT_STATE
)
{
this
.
plant
.
upPlant
(
state
);
this
.
progressBar
.
setData
({
type
:
this
.
plant
.
type
,
timestamp
:
Date
.
now
(),
...
...
@@ -114,23 +116,61 @@ export class Land extends Container {
this
.
progressBar
.
show
();
}
/**
* 更新土地信息
* @param data
*/
public
updatePlant
(
data
)
{
console
.
log
(
data
);
this
.
plant
.
updatePlant
(
data
);
this
.
waterRestCount
=
+
data
.
waterRestCount
;
// 收获和浇水?
if
(
this
.
waterRestCount
<=
0
&&
data
.
waterTime
<=
0
)
{
this
.
addOption
(
this
.
plant
.
state
==
PLANT_STATE
.
STATE3
?
OPTION_TYPE
.
GET
:
OPTION_TYPE
.
WATER
);
return
;
}
this
.
progressBar
.
setData
({
type
:
data
.
plantType
,
timestamp
:
+
data
.
waterTime
,
fullTime
:
+
data
.
totalTime
,
});
}
/**
* 初始化一个植物,比如刚进游戏当时候
* @param {PLANT_TYPE} type
* @param {PLANT_STATE} state
*/
public
initPlant
(
type
:
PLANT_TYPE
,
state
:
PLANT_STATE
)
{
if
(
type
===
PLANT_TYPE
.
NONE
)
{
public
initPlant
(
data
)
{
if
(
data
.
type
===
PLANT_TYPE
.
NONE
)
{
return
;
}
this
.
plant
.
initPlant
(
type
,
state
);
this
.
plant
.
initPlant
(
data
.
type
,
data
.
state
);
this
.
changeState
(
LAND_STATE
.
PLANT
);
this
.
waterRestCount
=
+
data
.
waterRestCount
;
// 收获和浇水?
if
(
this
.
waterRestCount
<=
0
&&
data
.
time
<=
0
)
{
this
.
addOption
(
this
.
plant
.
state
==
PLANT_STATE
.
STATE3
?
OPTION_TYPE
.
GET
:
OPTION_TYPE
.
WATER
);
return
;
}
this
.
progressBar
.
setData
({
type
:
type
,
timestamp
:
Date
.
now
()
,
fullTime
:
3
,
type
:
data
.
type
,
timestamp
:
+
data
.
time
,
fullTime
:
+
data
.
totalTime
,
});
this
.
progressBar
.
show
();
}
/**
...
...
@@ -182,7 +222,7 @@ export class Land extends Container {
mv
.
addEventListener
(
Event
.
END_FRAME
,
()
=>
{
mv
.
stop
();
this
.
removeChild
(
mv
);
this
.
up
date
Plant
(
this
.
plant
.
state
+
1
);
this
.
upPlant
(
this
.
plant
.
state
+
1
);
});
mv
.
gotoAndPlay
(
0
,
true
);
});
...
...
@@ -256,7 +296,7 @@ export class Land extends Container {
private
endTime
()
{
console
.
log
(
this
.
id
,
'倒计时结束'
);
this
.
addOption
(
Math
.
random
()
>
0.5
?
OPTION_TYPE
.
WATER
:
OPTION_TYPE
.
GET
);
GameLayer
.
ins
.
updatePlant
(
this
.
id
);
}
/**
...
...
src/parts/Game/Plant.ts
View file @
22c0a3ab
...
...
@@ -120,7 +120,7 @@ export default class Plant extends Container {
* 更新一下植物(升级)
* @param {PLANT_STATE} state
*/
public
up
date
Plant
(
state
:
PLANT_STATE
)
{
public
upPlant
(
state
:
PLANT_STATE
)
{
const
type
=
this
.
type
;
if
(
state
<
PLANT_STATE
.
STATE1
||
state
>
PLANT_STATE
.
STATE3
)
{
...
...
@@ -152,6 +152,18 @@ export default class Plant extends Container {
});
}
/**
* 更新植物信息
* @param data
*/
public
updatePlant
(
data
)
{
if
(
this
.
type
!=
data
.
plantType
)
{
this
.
initPlant
(
data
.
plantType
,
+
data
.
level
);
}
else
if
(
this
.
state
!=
+
data
.
level
)
{
this
.
upPlant
(
data
.
level
);
}
}
/**
* 收获植物,清除植物
*/
...
...
src/parts/Game/ProgressBar.ts
View file @
22c0a3ab
...
...
@@ -62,10 +62,14 @@ export default class ProgressBar extends Container {
this
.
visible
=
false
;
return
;
}
if
(
data
.
timestamp
<=
0
){
this
.
dispatchEvent
(
'endTime'
);
return
;
}
this
.
nameLabel
.
text
=
s_PlantData
[
data
.
type
].
name
;
this
.
nameLabel
.
position
.
set
(
80
+
(
56
-
this
.
nameLabel
.
textWidth
)
/
2
,
139
);
this
.
fullTime
=
data
.
fullTime
;
this
.
fullTime
=
data
.
fullTime
/
1000
;
this
.
cutTime
=
(
data
.
timestamp
-
Date
.
now
())
/
1000
+
3
;
if
(
this
.
cutTime
<=
3
)
{
...
...
src/scenes/LoadingScene.ts
View file @
22c0a3ab
import
{
Scene
}
from
"../../module/views/Scene"
;
import
{
Tool
}
from
"../Tools"
;
import
{
activityId
,
sendTbNet
,
setTbData
,
TbNetName
}
from
"../TaoBaoNet"
;
import
{
activityId
,
se
llerId
,
se
ndTbNet
,
setTbData
,
TbNetName
}
from
"../TaoBaoNet"
;
import
{
getAdjustTopHeight
}
from
"../const/myLab"
;
import
SceneCtrl
from
"../../module/ctrls/sceneCtrl"
;
import
{
GameScene
}
from
"./GameScene"
;
...
...
@@ -15,7 +15,6 @@ import Ease = FYGE.Ease;
import
Graphics
=
FYGE
.
Graphics
;
import
TextField
=
FYGE
.
TextField
;
import
{
checkShopFavoredStatus
,
getAuthUserInfo
}
from
"../utils"
;
import
{
ancestorWhere
}
from
"tslint"
;
export
class
LoadingScene
extends
Scene
{
...
...
@@ -47,7 +46,7 @@ export class LoadingScene extends Scene {
});
// 是否关注店铺
await
checkShopFavoredStatus
(
111
).
then
(
async
(
isFollow
)
=>
{
await
checkShopFavoredStatus
(
sellerId
).
then
(
async
(
isFollow
)
=>
{
console
.
log
(
'isFollow'
,
isFollow
);
setTbData
(
TbNetName
.
isFollow
,
{
data
:
isFollow
...
...
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