public override void Initialize() { if (NameController == null) { NameController = new ExStorageDepotNameManager(); NameController.Initialize(this); } if (AnimationManager == null) { AnimationManager = gameObject.AddComponent <ExStorageDepotAnimationManager>(); } if (Storage == null) { Storage = gameObject.AddComponent <ExStorageDepotStorageManager>(); Storage.Initialize(this); } if (DumpContainer == null) { DumpContainer = gameObject.AddComponent <DumpContainer>(); DumpContainer.Initialize(transform, ExStorageDepotBuildable.DumpContainerLabel(), ExStorageDepotBuildable.FoodNotAllowed(), ExStorageDepotBuildable.ContainerFullMessage(), Storage); DumpContainer.OnDumpContainerClosed += Storage.OnDumpContainerClosed; } if (Display == null) { Display = gameObject.AddComponent <ExStorageDepotDisplayManager>(); Display.Initialize(this); } var locker = GameObjectHelpers.FindGameObject(gameObject, "Locker", SearchOption.StartsWith); var sRoot = GameObjectHelpers.FindGameObject(gameObject, "StorageRoot"); if (locker != null) { Destroy(locker); } if (sRoot != null) { Destroy(sRoot); } if (FCSConnectableDevice == null) { FCSConnectableDevice = gameObject.AddComponent <FCSConnectableDevice>(); FCSConnectableDevice.Initialize(this, Storage, new ExStoragePowerManager(), true); FCSTechFabricator.FcTechFabricatorService.PublicAPI.RegisterDevice(FCSConnectableDevice, GetPrefabID(), Mod.ExStorageTabID); } _initialized = true; }
public override void Initialize() { if (NameController == null) { NameController = new ExStorageDepotNameManager(); NameController.Initialize(this); } if (AnimationManager == null) { AnimationManager = gameObject.AddComponent <ExStorageDepotAnimationManager>(); } if (Storage == null) { Storage = gameObject.AddComponent <ExStorageDepotStorageManager>(); Storage.Initialize(this); } if (DumpContainer == null) { DumpContainer = gameObject.AddComponent <DumpContainer>(); DumpContainer.Initialize(transform, ExStorageDepotBuildable.DumpContainerLabel(), ExStorageDepotBuildable.FoodNotAllowed(), ExStorageDepotBuildable.ContainerFullMessage(), Storage); DumpContainer.OnDumpContainerClosed += Storage.OnDumpContainerClosed; } if (Display == null) { Display = gameObject.AddComponent <ExStorageDepotDisplayManager>(); Display.Initialize(this); } if (FCSConnectableDevice == null) { FCSConnectableDevice = gameObject.AddComponent <FCSConnectableDevice>(); FCSConnectableDevice.Initialize(this, Storage); } _initialized = true; }
internal void Initialize(ExStorageDepotController mono) { _mono = mono; _containerHeight = _maxItems = QPatch.Config.MaxStorage; if (_containerRoot == null) { QuickLogger.Debug("Ex-Storage Root"); var storageRoot = new GameObject("ExStorageRoot"); storageRoot.transform.SetParent(mono.transform, false); _containerRoot = storageRoot.AddComponent <ChildObjectIdentifier>(); _mono = mono; } if (_container == null) { QuickLogger.Debug("Initializing Storage Container"); _container = _mono.gameObject.GetComponentInChildren <StorageContainer>(); _container.width = _containerWidth; _container.height = _containerHeight; _container.container.onRemoveItem += ContainerOnRemoveItem; _container.container.onAddItem += ContainerOnAddItem; _container.container.Resize(_containerWidth, _containerHeight); _container.storageLabel = ExStorageDepotBuildable.StorageContainerLabel(); } if (_dumpContainer == null) { QuickLogger.Debug("Initializing Dump Container"); _dumpContainer = new ItemsContainer(DumpContainerWidth, DumpContainerHeight, _containerRoot.transform, ExStorageDepotBuildable.DumpContainerLabel(), null); _dumpContainer.Resize(DumpContainerWidth, DumpContainerHeight); _dumpContainer.isAllowedToAdd += IsAllowedToAdd; } InvokeRepeating("UpdateStorageDisplayCount", 1, 0.5f); }