/// <summary> /// 获取当前据点需要工作人员的建筑,以及该建筑的工作相关信息 /// </summary> /// <returns></returns> private Dictionary <int, List <BuildingWorkInfo> > GetBuildingsNeedWorker() { // requiredAttrId -> [BuildingWorkInfo, ] var attrBuildings = new Dictionary <int, List <BuildingWorkInfo> >(); var buildings = DateFile.instance.homeBuildingsDate[this.partId][this.placeId]; var validBuildings = buildings.Where(entry => !this.excludedBuildings.Contains(entry.Key)); foreach (var entry in validBuildings) { int buildingIndex = entry.Key; int[] building = entry.Value; int baseBuildingId = building[0]; var baseBuilding = DateFile.instance.basehomePlaceDate[baseBuildingId]; bool needWorker = int.Parse(baseBuilding[3]) == 1; if (!needWorker) { continue; } int requiredAttrId = int.Parse(baseBuilding[33]); BuildingWorkInfo info = new BuildingWorkInfo { buildingIndex = buildingIndex, requiredAttrId = requiredAttrId, priority = HumanResource.GetBuildingWorkingPriority(this.partId, this.placeId, buildingIndex), halfWorkingAttrValue = 0, fullWorkingAttrValue = 0, }; if (requiredAttrId != 0) { int[] requiredAttrValues = Original.GetRequiredAttributeValues(this.partId, this.placeId, buildingIndex); info.halfWorkingAttrValue = requiredAttrValues[0]; info.fullWorkingAttrValue = requiredAttrValues[1]; } if (!attrBuildings.ContainsKey(requiredAttrId)) { attrBuildings[requiredAttrId] = new List <BuildingWorkInfo>(); } attrBuildings[requiredAttrId].Add(info); } return(attrBuildings); }
/// <summary> /// 返回建筑指派工作人员的优先级 /// /// 优先级 = 建筑种类因子 * 标准状态下满效率需求的标准化能力值 /// 对于厢房,“标准状态下满效率需求的标准化能力值” 即为其等级 /// 虽然这会导致方向的优先级和其他建筑没有可比性,但是厢房优先级本来就不会与其他建筑比较,所以没有问题 /// </summary> /// <param name="partId"></param> /// <param name="placeId"></param> /// <param name="buildingIndex"></param> /// <param name="withAdjacentBedrooms">是否考虑邻接厢房的影响</param> /// <returns></returns> private static float GetBuildingWorkingPriority(int partId, int placeId, int buildingIndex, bool withAdjacentBedrooms) { int[] requiredAttrValues = Original.GetRequiredAttributeValues(partId, placeId, buildingIndex, withAdjacentBedrooms, getStandardAttrValue: true); int fullWorkingAttrValue = requiredAttrValues[1]; // 对于厢房,“标准状态下满效率需求的标准化能力值” 即为其等级 int[] building = DateFile.instance.homeBuildingsDate[partId][placeId][buildingIndex]; int baseBuildingId = building[0]; int buildingLevel = building[1]; int requiredAttrId = int.Parse(DateFile.instance.basehomePlaceDate[baseBuildingId][33]); if (requiredAttrId <= 0) { fullWorkingAttrValue = buildingLevel; } float typeFactor = HumanResource.GetBuildingPriorityFactor(baseBuildingId); return(typeFactor * fullWorkingAttrValue); }