private void OnFilterChanged(Tag[] tags) { KBatchedAnimController component = root.GetComponent <KBatchedAnimController>(); bool flag = tags != null && tags.Length != 0; component.TintColour = ((!flag) ? noFilterTint : filterTint); if (fetchList != null) { fetchList.Cancel(string.Empty); fetchList = null; } float maxCapacityMinusStorageMargin = GetMaxCapacityMinusStorageMargin(); float amountStored = GetAmountStored(); float num = Mathf.Max(0f, maxCapacityMinusStorageMargin - amountStored); if (num > 0f && flag) { num = Mathf.Max(0f, GetMaxCapacity() - amountStored); fetchList = new FetchList2(storage, choreType); fetchList.ShowStatusItem = false; fetchList.Add(tags, requiredTags, forbiddenTags, num, FetchOrder2.OperationalRequirement.Functional); fetchList.Submit(OnFetchComplete, false); } root.GetComponent <KSelectable>().ToggleStatusItem(noFilterStatusItem, !flag, this); }
private void SetFetchList() { fetchList = new FetchList2(storage, Db.Get().ChoreTypes.BuildFetch); Tag insulation = ElementLoader.FindElementByHash(SimHashes.SuperInsulator).tag; float massNeeded = MassToInsulate - StoredInsulation(); fetchList.Add(insulation, null, null, MassToInsulate); MaterialNeeds.Instance.UpdateNeed(insulation, massNeeded); submittedNeedAmount = massNeeded; fetchList.Submit(onFetchComplete, true); Prioritizable.AddRef(gameObject); }
private void UpdateFetches(DictionaryPool <Tag, float, ComplexFabricator> .PooledDictionary missingAmounts) { ChoreType byHash = Db.Get().ChoreTypes.GetByHash(fetchChoreTypeIdHash); foreach (KeyValuePair <Tag, float> missingAmount in missingAmounts) { if (missingAmount.Value >= PICKUPABLETUNING.MINIMUM_PICKABLE_AMOUNT && !HasPendingFetch(missingAmount.Key)) { FetchList2 fetchList = new FetchList2(inStorage, byHash); FetchList2 fetchList2 = fetchList; Tag key = missingAmount.Key; float value = missingAmount.Value; fetchList2.Add(key, null, null, value, FetchOrder2.OperationalRequirement.None); fetchList.ShowStatusItem = false; fetchList.Submit(OnFetchComplete, false); fetchListList.Add(fetchList); } } }