Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
W
wdlc_mjb_unity
Project
Project
Details
Activity
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王雪伟
wdlc_mjb_unity
Commits
73099e98
Commit
73099e98
authored
May 07, 2021
by
王雪伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
加入动态种植接口
parent
8676e81f
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
76 additions
and
17 deletions
+76
-17
CarContract.cs
Assets/Game/Main/Scripts/Contract/CarContract.cs
+6
-1
MyEventType.cs
Assets/Game/Main/Scripts/EventUtil/MyEventType.cs
+8
-0
CarPresenter.cs
Assets/Game/Main/Scripts/Presenter/CarPresenter.cs
+28
-1
CarTypeControl.cs
Assets/Game/Main/Scripts/Utils/CarTypeControl.cs
+10
-12
CarDataControl.cs
Assets/Game/Main/Scripts/View/CarDataControl.cs
+24
-3
No files found.
Assets/Game/Main/Scripts/Contract/CarContract.cs
View file @
73099e98
...
@@ -32,7 +32,12 @@ public class CarContract
...
@@ -32,7 +32,12 @@ public class CarContract
/// </summary>
/// </summary>
/// <param name="parkingSpaceId"></param>
/// <param name="parkingSpaceId"></param>
void
GetPickInCar
(
int
parkingSpaceId
);
void
GetPickInCar
(
int
parkingSpaceId
);
/// <summary>
/// 种植动态作物
/// </summary>
/// <param name="landId"></param>
/// <param name="plantId"></param>
void
GetPlantLandV2
(
int
landId
,
int
plantId
);
/// <summary>
/// <summary>
/// 加速
/// 加速
/// </summary>
/// </summary>
...
...
Assets/Game/Main/Scripts/EventUtil/MyEventType.cs
View file @
73099e98
...
@@ -115,6 +115,14 @@ public enum MyEventType
...
@@ -115,6 +115,14 @@ public enum MyEventType
/// 更新单个地块信息
/// 更新单个地块信息
/// </summary>
/// </summary>
UPDATE_LAND_DATA
,
UPDATE_LAND_DATA
,
/// <summary>
/// 种植地块信息
/// </summary>
PLANT_LAND_DATA
,
/// <summary>
/// 点击种植地块
/// </summary>
CLICK_PLANT_LAND
,
//更新收获奖励列表
//更新收获奖励列表
UPDATE_HARVEST_DATA
,
UPDATE_HARVEST_DATA
,
//更新任务列表
//更新任务列表
...
...
Assets/Game/Main/Scripts/Presenter/CarPresenter.cs
View file @
73099e98
...
@@ -55,10 +55,13 @@ public class CarPresenter : CarContract.Presenter
...
@@ -55,10 +55,13 @@ public class CarPresenter : CarContract.Presenter
}));
}));
}
}
public
void
GetPlantLandV2
(
int
landId
,
int
plantId
)
{
MonoMgr
.
Getinstance
().
StartCoroutine
(
NextActionV2
(
landId
,
plantId
));
}
public
void
GetPickInCar
(
int
landId
)
public
void
GetPickInCar
(
int
landId
)
{
{
MonoMgr
.
Getinstance
().
StartCoroutine
(
NextAction
(
landId
));
MonoMgr
.
Getinstance
().
StartCoroutine
(
NextAction
(
landId
));
}
}
IEnumerator
NextAction
(
int
landId
)
IEnumerator
NextAction
(
int
landId
)
...
@@ -83,6 +86,29 @@ public class CarPresenter : CarContract.Presenter
...
@@ -83,6 +86,29 @@ public class CarPresenter : CarContract.Presenter
}));
}));
}
}
IEnumerator
NextActionV2
(
int
landId
,
int
plantId
)
{
mView
.
showSeed
();
yield
return
new
WaitForSeconds
(
0.6f
);
EventCenter
.
Broadcast
(
MyEventType
.
LastspeedFloat
,
landId
);
parm
.
Clear
();
parm
.
Add
(
"landId"
,
landId
);
parm
.
Add
(
"plantId"
,
plantId
);
HttpTool
.
Instance
.
_Post
(
"app/v2/wdlc/seed"
,
parm
,
new
Action
<
LandListData
>((
bean
)
=>
{
Guide
.
guide
.
onClickStep1
();
// Guide.guide.showStep7();
mView
.
CarInfo
(
bean
);
}),
new
Action
<
string
,
string
>((
code
,
errMsg
)
=>
{
}));
}
public
void
GetPickUpCar
(
int
landId
)
public
void
GetPickUpCar
(
int
landId
)
{
{
parm
.
Clear
();
parm
.
Clear
();
...
@@ -164,4 +190,5 @@ public class CarPresenter : CarContract.Presenter
...
@@ -164,4 +190,5 @@ public class CarPresenter : CarContract.Presenter
}
}
}
}
Assets/Game/Main/Scripts/Utils/CarTypeControl.cs
View file @
73099e98
...
@@ -55,21 +55,19 @@ public class CarTypeControl : MonoBehaviour
...
@@ -55,21 +55,19 @@ public class CarTypeControl : MonoBehaviour
{
{
if
(
arg
.
landId
==
m_LandPos
)
if
(
arg
.
landId
==
m_LandPos
)
{
{
Debug
.
unityLogger
.
Log
(
"种植物"
+
arg
.
landId
);
Debug
.
unityLogger
.
Log
(
"
1
种植物"
+
arg
.
landId
);
if
(
arg
.
landPlantData
!=
null
)
if
(
arg
.
landPlantData
!=
null
)
{
{
Debug
.
unityLogger
.
Log
(
"种植物"
+
arg
.
landPlantData
.
plantId
);
Debug
.
unityLogger
.
Log
(
"2种植物"
+
arg
.
landPlantData
.
plantId
);
//土地显示
PlantLandFruit
.
sprite
=
LandFruitSprites
[
arg
.
landPlantData
.
plantId
];
//0-8
RewardLandFruit
.
sprite
=
LandFruitSprites
[
arg
.
landPlantData
.
plantId
];
//小的图片
FlyRewardFruit
.
sprite
=
FloatFruitSprites
[
arg
.
landPlantData
.
plantId
];
FlyRewardFruit2
.
sprite
=
FloatFruitSprites
[
arg
.
landPlantData
.
plantId
];
FlyRewardFruit2
.
sprite
=
FloatFruitSprites
[
arg
.
landPlantData
.
plantId
];
}
}
Debug
.
unityLogger
.
Log
(
"种植物"
+
m_LandPos
);
Debug
.
unityLogger
.
Log
(
"3种植物"
+
m_LandPos
);
////土地显示
//PlantLandFruit.sprite = LandFruitSprites[arg.landPlantData.plantId];//0-8
//RewardLandFruit.sprite = LandFruitSprites[arg.landPlantData.plantId];
////小的图片
//FlyRewardFruit.sprite = FloatFruitSprites[arg.landPlantData.plantId];
//FlyRewardFruit2.sprite = FloatFruitSprites[arg.landPlantData.plantId];
//FlyRewardFruit2.sprite = FloatFruitSprites[arg.landPlantData.plantId];
//种植物的名字
//种植物的名字
...
...
Assets/Game/Main/Scripts/View/CarDataControl.cs
View file @
73099e98
...
@@ -26,10 +26,10 @@ public class CarDataControl : MonoBehaviour, CarContract.View
...
@@ -26,10 +26,10 @@ public class CarDataControl : MonoBehaviour, CarContract.View
EventCenter
.
AddListener
<
LandListData
>(
MyEventType
.
ALL_SPEED_FLY_COIN
,
OnShowAllSpeedUp
);
EventCenter
.
AddListener
<
LandListData
>(
MyEventType
.
ALL_SPEED_FLY_COIN
,
OnShowAllSpeedUp
);
EventCenter
.
AddListener
<
LandListData
>(
MyEventType
.
UPDATE_LAND_DATA
,
OnUpdateLandData
);
EventCenter
.
AddListener
<
LandListData
>(
MyEventType
.
UPDATE_LAND_DATA
,
OnUpdateLandData
);
EventCenter
.
AddListener
<
int
>(
MyEventType
.
AllspeedTime
,
allspeedTime
);
EventCenter
.
AddListener
<
int
>(
MyEventType
.
AllspeedTime
,
allspeedTime
);
EventCenter
.
AddListener
<
string
>(
MyEventType
.
PLANT_LAND_DATA
,
OnPlantLandV2
);
}
}
private
void
Start
()
private
void
Start
()
{
{
...
@@ -42,6 +42,7 @@ public class CarDataControl : MonoBehaviour, CarContract.View
...
@@ -42,6 +42,7 @@ public class CarDataControl : MonoBehaviour, CarContract.View
EventCenter
.
RemoveListener
<
LandListData
>(
MyEventType
.
ALL_SPEED_FLY_COIN
,
OnShowAllSpeedUp
);
EventCenter
.
RemoveListener
<
LandListData
>(
MyEventType
.
ALL_SPEED_FLY_COIN
,
OnShowAllSpeedUp
);
EventCenter
.
RemoveListener
<
LandListData
>(
MyEventType
.
UPDATE_LAND_DATA
,
OnUpdateLandData
);
EventCenter
.
RemoveListener
<
LandListData
>(
MyEventType
.
UPDATE_LAND_DATA
,
OnUpdateLandData
);
EventCenter
.
RemoveListener
<
int
>(
MyEventType
.
AllspeedTime
,
allspeedTime
);
EventCenter
.
RemoveListener
<
int
>(
MyEventType
.
AllspeedTime
,
allspeedTime
);
EventCenter
.
RemoveListener
<
string
>(
MyEventType
.
PLANT_LAND_DATA
,
OnPlantLandV2
);
}
}
private
void
OnShowAllSpeedUp
(
LandListData
arg
)
private
void
OnShowAllSpeedUp
(
LandListData
arg
)
...
@@ -134,8 +135,28 @@ public class CarDataControl : MonoBehaviour, CarContract.View
...
@@ -134,8 +135,28 @@ public class CarDataControl : MonoBehaviour, CarContract.View
EventUtils
.
OnEvent
(
"park_click"
);
EventUtils
.
OnEvent
(
"park_click"
);
AudioUtils
.
ins
.
PlayBtnAudio
();
AudioUtils
.
ins
.
PlayBtnAudio
();
mPresenter
.
GetPickInCar
(
carId
);
//mPresenter.GetPickInCar(carId);
EventCenter
.
Broadcast
(
MyEventType
.
CLICK_PLANT_LAND
,
carId
);
}
}
/// <summary>
/// 动态种植地块V2
/// </summary>
/// <param name="arg">=号分割 前面地块id 后面种植id</param>
private
void
OnPlantLandV2
(
string
arg
)
{
string
[]
parm
=
arg
.
Split
(
'='
);
int
landId
=
int
.
Parse
(
parm
[
0
]);
int
plantId
=
int
.
Parse
(
parm
[
1
]);
if
(
landId
==
carId
)
{
//调用种植接口
mPresenter
.
GetPlantLandV2
(
landId
,
plantId
);
}
}
///// <summary>
///// <summary>
///// 列表刷新数据收到的数据
///// 列表刷新数据收到的数据
///// </summary>
///// </summary>
...
...
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