|
|
|
@ -29,12 +29,36 @@ namespace ET
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static async ETTask<int> GoFarmlandPlant(Unit unit,People people,long farmlandId) |
|
|
|
|
public static async ETTask<int> GoFarmlandPlant(Unit unit,People people,Farmland farmland) |
|
|
|
|
{ |
|
|
|
|
return await PeopleHelper.ChangeBehave(unit, people, farmlandId, ConstBehaveType.BEHAVE_PREPARE_PLANT); |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
C2M_GoFarmlandPlant msg = new C2M_GoFarmlandPlant() { PeopleId = people.Id,FarmlandId = farmland.Id}; |
|
|
|
|
M2C_GoFarmlandPlant resp = await unit.ZoneScene().GetComponent<SessionComponent>().Session.Call(msg) as M2C_GoFarmlandPlant; |
|
|
|
|
if (resp.Error == ErrorCode.ERR_Success) |
|
|
|
|
{ |
|
|
|
|
FarmlandOperate.GoPlant(unit, farmland,people); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
Log.Error(resp.Error.ToString()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return resp.Error; |
|
|
|
|
} |
|
|
|
|
catch (Exception e) |
|
|
|
|
{ |
|
|
|
|
Log.Error(e.ToString()); |
|
|
|
|
throw; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static async ETTask<int> StartFarmlandPlant(Unit unit, People people, Farmland farmland) |
|
|
|
|
{ |
|
|
|
|
return await PeopleHelper.ChangeBehave(unit, people, ConstBehaveType.BEHAVE_PLANT,farmland.Id); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static async ETTask<int> StartFarmlandPlant(Unit unit, Farmland farmland,People people) |
|
|
|
|
public static async ETTask<int> FinishFarmlandPlant(Unit unit, Farmland farmland,People people) |
|
|
|
|
{ |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
@ -42,7 +66,7 @@ namespace ET
|
|
|
|
|
M2C_FarmlandPlant resp = await unit.ZoneScene().GetComponent<SessionComponent>().Session.Call(msg) as M2C_FarmlandPlant; |
|
|
|
|
if (resp.Error == ErrorCode.ERR_Success) |
|
|
|
|
{ |
|
|
|
|
FarmlandOperate.Plant(unit, farmland,people); |
|
|
|
|
FarmlandOperate.FinishPlant(unit, farmland,people); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
@ -57,14 +81,35 @@ namespace ET
|
|
|
|
|
throw; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
public static async ETTask<int> FinishFarmlandPlant(Unit unit,People people) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static async ETTask<int> GoFarmlandHarvest(Unit unit,People people,Farmland farmland) |
|
|
|
|
{ |
|
|
|
|
return await PeopleHelper.ChangeBehave(unit, people, 0, ConstBehaveType.BEHAVE_IDLE); |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
C2M_GoFarmlandHarvest msg = new C2M_GoFarmlandHarvest() { PeopleId = people.Id,FarmlandId = farmland.Id}; |
|
|
|
|
M2C_GoFarmlandHarvest resp = await unit.ZoneScene().GetComponent<SessionComponent>().Session.Call(msg) as M2C_GoFarmlandHarvest; |
|
|
|
|
if (resp.Error == ErrorCode.ERR_Success) |
|
|
|
|
{ |
|
|
|
|
FarmlandOperate.GoHarvest(unit, farmland,people); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
Log.Error(resp.Error.ToString()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return resp.Error; |
|
|
|
|
} |
|
|
|
|
catch (Exception e) |
|
|
|
|
{ |
|
|
|
|
Log.Error(e.ToString()); |
|
|
|
|
throw; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static async ETTask<int> GoFarmlandHarvest(Unit unit,People people) |
|
|
|
|
public static async ETTask<int> StartFarmlandHarvest(Unit unit, People people, Farmland farmland) |
|
|
|
|
{ |
|
|
|
|
return await PeopleHelper.ChangeBehave(unit, people, 0, ConstBehaveType.BEHAVE_PREPARE_HARVEST); |
|
|
|
|
return await PeopleHelper.ChangeBehave(unit, people, ConstBehaveType.BEHAVE_PREPARE_HARVEST,farmland.Id); |
|
|
|
|
} |
|
|
|
|
public static async ETTask<int> FarmlandHarvest(Unit unit, Farmland farmland,People people) |
|
|
|
|
{ |
|
|
|
@ -74,7 +119,7 @@ namespace ET
|
|
|
|
|
M2C_FarmlandPlant resp = await unit.ZoneScene().GetComponent<SessionComponent>().Session.Call(msg) as M2C_FarmlandPlant; |
|
|
|
|
if (resp.Error == ErrorCode.ERR_Success) |
|
|
|
|
{ |
|
|
|
|
FarmlandOperate.Harvest(unit, farmland,people); |
|
|
|
|
FarmlandOperate.FinishHarvest(unit, farmland,people); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|