예제 #1
0
        private static void ApplyColorToBuilding(BuildingComplete building, Color color)
        {
            TreeFilterable      treeFilterable;
            Ownable             ownable;
            KAnimControllerBase kAnimBase;

            if ((ownable = building.GetComponent <Ownable>()) != null)
            {
                Traverse.Create(ownable).Field("ownedTint").SetValue(color);
                Traverse.Create(ownable).Method("UpdateTint").GetValue();
            }
            else if ((treeFilterable = building.GetComponent <TreeFilterable>()) != null)
            {
                FilteredStorage filteredStorage = ExtractFilteredStorage(treeFilterable);

                if (filteredStorage != null)
                {
                    filteredStorage.filterTint = color;
                    filteredStorage.FilterChanged();
                }
            }
            else if ((kAnimBase = building.GetComponent <KAnimControllerBase>()) != null)
            {
                kAnimBase.TintColour = color;
            }
            else
            {
                State.Common.Logger.LogOnce("Invalid building <{building}> and its not a registered tile.");
            }
        }
 protected void Initialize()
 {
     base.OnPrefabInit();
     log             = new LoggerFS("ObjectDispenser", 35);
     filteredStorage = new FilteredStorage(this, null, null, this, false, Db.Get().ChoreTypes.StorageFetch);
     Subscribe(-905833192, OnCopySettingsDelegate);
 }
예제 #3
0
 protected override void OnPrefabInit()
 {
     filteredStorage = new FilteredStorage(this, null, new Tag[]
     {
         GameTags.Compostable
     }, this, true, Db.Get().ChoreTypes.FoodFetch);
 }
예제 #4
0
 protected override void OnPrefabInit()
 {
     this.filteredStorage = new FilteredStorage((KMonoBehaviour)this, (Tag[])null, new Tag[1]
     {
         GameTags.Compostable
     }, (IUserControlledCapacity)this, true, Db.Get().ChoreTypes.FoodFetch);
 }
예제 #5
0
 private static void SetFilteredStorageColors(
     [NotNull] FilteredStorage storage,
     Color32 color,
     Color32 dimmedColor)
 {
     storage.filterTint   = color;
     storage.noFilterTint = dimmedColor;
     storage.FilterChanged();
 }
예제 #6
0
        protected void Initialize(bool use_logic_meter)
        {
            base.OnPrefabInit();
            log             = new LoggerFS("StorageCompressor");
            filteredStorage = new FilteredStorage(this, null, null, this, use_logic_meter, Db.Get().ChoreTypes.StorageFetch);
            int eventHash = (int)GameHashes.CopySettings;

            Subscribe(eventHash, OnCopySettingsDelegate);
        }
 protected override void OnPrefabInit()
 {
     filteredStorage = new FilteredStorage(this, null, new Tag[1]
     {
         GameTags.Compostable
     }, this, false, Db.Get().ChoreTypes.FoodFetch);
     Subscribe(-592767678, OnOperationalChangedDelegate);
     Subscribe(-905833192, OnCopySettingsDelegate);
     WorldInventory.Instance.Discover("FieldRation".ToTag(), GameTags.Edible);
 }
        protected override void OnPrefabInit()
        {
            base.OnPrefabInit();

            try {
                filteredStorage = (FilteredStorage)AccessTools.Field(typeof(SolidConduitInbox), "filteredStorage").GetValue(this.GetComponent <SolidConduitInbox>());
                AccessTools.Field(typeof(FilteredStorage), "capacityControl").SetValue(filteredStorage, this);
            } catch (Exception) {
                Debug.LogWarning("[CustomizeBuildings] Wups. UserControlledConduitInbox couldn't be set up.");
            }
        }
예제 #9
0
        private static void SetFilteredStorageColors(
            [NotNull] object _storage,
            Color32 color,
            Color32 dimmedColor)
        {
            FilteredStorage storage = (FilteredStorage)GetField(_storage, "filteredStorage");

            //storage.filterTint   = color;
            SetField(storage, "filterTint", color);
            //storage.noFilterTint = dimmedColor;
            SetField(storage, "noFilterTint", dimmedColor);
            storage.FilterChanged();
        }
    public FilteredStorage(KMonoBehaviour root, Tag[] required_tags, Tag[] forbidden_tags, IUserControlledCapacity capacity_control, bool use_logic_meter, ChoreType fetch_chore_type)
    {
        this.root       = root;
        requiredTags    = required_tags;
        forbiddenTags   = forbidden_tags;
        capacityControl = capacity_control;
        useLogicMeter   = use_logic_meter;
        choreType       = fetch_chore_type;
        root.Subscribe(-1697596308, OnStorageChanged);
        root.Subscribe(-543130682, OnUserSettingsChanged);
        filterable = root.FindOrAdd <TreeFilterable>();
        TreeFilterable treeFilterable = filterable;

        treeFilterable.OnFilterChanged = (Action <Tag[]>)Delegate.Combine(treeFilterable.OnFilterChanged, new Action <Tag[]>(OnFilterChanged));
        storage = root.GetComponent <Storage>();
        storage.Subscribe(644822890, OnOnlyFetchMarkedItemsSettingChanged);
        if (capacityStatusItem == null)
        {
            capacityStatusItem = new StatusItem("StorageLocker", "BUILDING", string.Empty, StatusItem.IconType.Info, NotificationType.Neutral, false, OverlayModes.None.ID, true, 129022);
            capacityStatusItem.resolveStringCallback = delegate(string str, object data)
            {
                FilteredStorage filteredStorage = (FilteredStorage)data;
                float           amountStored    = filteredStorage.GetAmountStored();
                float           num             = filteredStorage.storage.capacityKg;
                amountStored = ((!(amountStored > num - filteredStorage.storage.storageFullMargin) || !(amountStored < num)) ? Mathf.Floor(amountStored) : num);
                string newValue = Util.FormatWholeNumber(amountStored);
                IUserControlledCapacity component = filteredStorage.root.GetComponent <IUserControlledCapacity>();
                if (component != null)
                {
                    num = Mathf.Min(component.UserMaxCapacity, num);
                }
                string newValue2 = Util.FormatWholeNumber(num);
                str = str.Replace("{Stored}", newValue);
                str = str.Replace("{Capacity}", newValue2);
                str = ((component == null) ? str.Replace("{Units}", GameUtil.GetCurrentMassUnit(false)) : str.Replace("{Units}", component.CapacityUnits));
                return(str);
            };
            noFilterStatusItem = new StatusItem("NoStorageFilterSet", "BUILDING", "status_item_no_filter_set", StatusItem.IconType.Custom, NotificationType.BadMinor, false, OverlayModes.None.ID, true, 129022);
        }
        root.GetComponent <KSelectable>().SetStatusItem(Db.Get().StatusItemCategories.Main, capacityStatusItem, this);
    }
예제 #11
0
 protected override void OnPrefabInit()
 {
     base.OnPrefabInit();
     filteredStorage = new FilteredStorage(this, null, null, null, false, Db.Get().ChoreTypes.StorageFetch);
 }
예제 #12
0
 protected void Initialize(bool use_logic_meter)
 {
     base.OnPrefabInit();
     this.log             = new LoggerFS(nameof(StorageLocker), 35);
     this.filteredStorage = new FilteredStorage((KMonoBehaviour)this, (Tag[])null, (Tag[])null, (IUserControlledCapacity)this, use_logic_meter, Db.Get().ChoreTypes.StorageFetch);
 }
예제 #13
0
 public static void Postfix(FilteredStorage __instance, StorageLocker ___root)
 {
     ___root.Trigger(StorageSecondaryMeter.OnOriginalMeterUpdate, null);
 }
 protected override void OnCleanUp()
 {
     filteredStorage = null;
     base.OnCleanUp();
 }
 protected void Initialize(bool use_logic_meter)
 {
     base.OnPrefabInit();
     //log = new LoggerFS("StorageLocker", 35);
     filteredStorage = new FilteredStorage(this, null, null, this, use_logic_meter, Db.Get().ChoreTypes.StorageFetch);
 }