コード例 #1
0
        private static void ObserveForInfo(ushort buildingId, TransportInfo transportInfo)
        {
            if (transportInfo == null || !DepotUtil.IsValidDepot(ref BuildingManager.instance.m_buildings.m_buffer[buildingId], transportInfo))
            {
                return;
            }
            var itemClassTriplet = new ItemClassTriplet(transportInfo.GetService(), transportInfo.GetSubService(),
                                                        transportInfo.GetClassLevel());

            if (!_depotMap.TryGetValue(itemClassTriplet, out HashSet <ushort> depots))
            {
                depots = new HashSet <ushort>();
                _depotMap.Add(itemClassTriplet, depots);
            }
            if (depots.Contains(buildingId))
            {
                return;
            }
            depots.Add(buildingId);
            OnDepotAdded?.Invoke(itemClassTriplet.Service, itemClassTriplet.SubService, itemClassTriplet.Level);
        }
コード例 #2
0
        private static void ObserveBuilding(ushort buildingId)
        {
            TransportInfo transportInfo = null;

            if (!DepotUtil.IsValidDepot(ref BuildingManager.instance.m_buildings.m_buffer[buildingId],
                                        ref transportInfo,
                                        out ItemClass.Service service, out ItemClass.SubService subService, out ItemClass.Level level))
            {
                return;
            }
            var itemClassTriplet = new ItemClassTriplet(service, subService, level);

            if (!_depotMap.TryGetValue(itemClassTriplet, out HashSet <ushort> depots))
            {
                depots = new HashSet <ushort>();
                _depotMap.Add(itemClassTriplet, depots);
            }
            if (depots.Contains(buildingId))
            {
                return;
            }
            depots.Add(buildingId);
            OnDepotAdded?.Invoke(service, subService, level);
        }