Пример #1
0
        /// <summary>
        /// 清理所有建筑内的工作人员(排除列表中的除外)
        /// 如果某个建筑在排除列表中,那么其中的工作人员也会同时添加到排除列表中
        /// </summary>
        /// <param name="partId"></param>
        /// <param name="placeId"></param>
        /// <param name="excludedBuildings"></param>
        /// <param name="excludedWorkers"></param>
        public static void RemoveWorkersFromBuildings(int partId, int placeId, HashSet <int> excludedBuildings, HashSet <int> excludedWorkers)
        {
            var buildings = DateFile.instance.homeBuildingsDate[partId][placeId];

            foreach (int buildingIndex in buildings.Keys)
            {
                if (excludedBuildings.Contains(buildingIndex))
                {
                    if (DateFile.instance.actorsWorkingDate.ContainsKey(partId) &&
                        DateFile.instance.actorsWorkingDate[partId].ContainsKey(placeId) &&
                        DateFile.instance.actorsWorkingDate[partId][placeId].ContainsKey(buildingIndex))
                    {
                        int workerId = DateFile.instance.actorsWorkingDate[partId][placeId][buildingIndex];
                        excludedWorkers.Add(workerId);
                    }
                }
                else
                {
                    Original.RemoveBuildingWorker(partId, placeId, buildingIndex);
                }
            }
        }