コード例 #1
0
        public void StoreResource(IndustryResource resource)
        {
            if (stockpileMap.TryGetValue(resource.Key, out IndustryResource stock))
            {
                stock.Amount += resource.Amount;
                return;
            }

            DVIndustry.ModEntry.Logger.Warning($"Tried to store a resource ({resource.AcceptedItems.ID}) that this industry doesn't use");
        }
コード例 #2
0
        private static bool TryConvertResource(string key, float amount, out IndustryResource resource)
        {
            if (ResourceClass.TryParse(key, out ResourceClass rClass))
            {
                resource = new IndustryResource(rClass, amount);
                return(true);
            }

            resource = null;
            DVIndustry.ModEntry.Logger.Critical($"Unrecognized resource class \"{key}\"");
            return(false);
        }