You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

32 lines
851 B

using System.Collections.Generic;
namespace ET
{
[FriendClass(typeof(People))]
[FriendClass(typeof(Cabin))]
public static class CabinOperate
{
public static void CabinUpdateFarmlands(Unit unit,Cabin cabin, List<long> farmlandIds)
{
foreach (var v in cabin.FarmlandIds)
{
var farmland = unit.GetGrandChild<Farmland>(v);
if (farmland != null)
{
farmland.SetCabinId(0);
}
}
foreach (var v in farmlandIds)
{
var farmland = unit.GetGrandChild<Farmland>(v);
if (farmland != null)
{
farmland.SetCabinId(cabin.Id);
}
}
cabin.FarmlandIds = farmlandIds;
}
}
}