public override bool FindAllComponents() { try { #region Canvas var canvasGameObject = gameObject.GetComponentInChildren <Canvas>()?.gameObject; if (canvasGameObject == null) { QuickLogger.Error("Canvas cannot be found"); return(false); } #endregion #region Home var home = InterfaceHelpers.FindGameObject(canvasGameObject, "Home"); #endregion #region VehiclesPage var vehiclesPage = InterfaceHelpers.FindGameObject(canvasGameObject, "VehiclesPage"); #endregion #region VehicleDockingSettingsPage var vehiclesDockingSettingsPage = InterfaceHelpers.FindGameObject(canvasGameObject, "VehicleDockingSettingsPage"); #endregion #region Item Page var itemPage = InterfaceHelpers.FindGameObject(vehiclesDockingSettingsPage, "ItemPage"); #endregion #region Category Page var categoryPage = InterfaceHelpers.FindGameObject(vehiclesDockingSettingsPage, "CategoryPage"); #endregion #region VehiclesContainersPage var vehiclesContainersPage = InterfaceHelpers.FindGameObject(canvasGameObject, "VehiclesContainersPage"); #endregion #region BaseItemsPage var baseItemsPage = InterfaceHelpers.FindGameObject(canvasGameObject, "BaseItemsPage"); #endregion #region GettingDataPage var gettingDataPage = InterfaceHelpers.FindGameObject(canvasGameObject, "GettingData"); #endregion #region Settings var settings = InterfaceHelpers.FindGameObject(canvasGameObject, "SettingsPage"); #endregion #region PoweredOff var poweredOff = InterfaceHelpers.FindGameObject(canvasGameObject, "PowerOffPage"); #endregion #region ColorPageMain var colorMainPage = InterfaceHelpers.FindGameObject(canvasGameObject, "ColorPageMain"); #endregion #region ScreenColorPicker var screenColorPicker = InterfaceHelpers.FindGameObject(canvasGameObject, "TerminalColorPage"); #endregion #region AntennnaColorPicker _antennaColorPicker = InterfaceHelpers.FindGameObject(canvasGameObject, "AntennaColorPage"); #endregion #region Base Grid _baseGrid = _mono.gameObject.AddComponent <GridHelper>(); _baseGrid.OnLoadDisplay += OnLoadBaseGrid; _baseGrid.Setup(12, DSSModelPrefab.BaseItemPrefab, home, _startColor, _hoverColor, OnButtonClick); //Minus 2 ItemPerPage because of the added Home button #endregion #region Vehicle Grid _vehicleGrid = _mono.gameObject.AddComponent <GridHelper>(); _vehicleGrid.OnLoadDisplay += OnLoadVehicleGrid; _vehicleGrid.Setup(12, DSSModelPrefab.VehicleItemPrefab, vehiclesPage, _startColor, _hoverColor, OnButtonClick); //Minus 1 ItemPerPage because of the added Home button #endregion #region Vehicle Containers Grid _vehicleContainersGrid = _mono.gameObject.AddComponent <GridHelper>(); _vehicleContainersGrid.OnLoadDisplay += OnLoadVehicleContainersGrid; _vehicleContainersGrid.Setup(12, DSSModelPrefab.VehicleItemPrefab, vehiclesContainersPage, _startColor, _hoverColor, OnButtonClick, 5, "PrevBTN", "NextBTN", "Grid", "Paginator", "HomeBTN", "VehiclesPageBTN"); //Minus 1 ItemPerPage because of the added Home button #endregion #region Item Grid _itemGrid = _mono.gameObject.AddComponent <GridHelper>(); _itemGrid.OnLoadDisplay += OnLoadItemsGrid; _itemGrid.Setup(4, DSSModelPrefab.FilterItemPrefab, itemPage, _startColor, _hoverColor, OnButtonClick); //Minus 1 ItemPerPage because of the added Home button #endregion #region Category Grid _categoryGrid = _mono.gameObject.AddComponent <GridHelper>(); _categoryGrid.OnLoadDisplay += OnLoadCategoryGrid; _categoryGrid.Setup(4, DSSModelPrefab.FilterItemPrefab, categoryPage, _startColor, _hoverColor, OnButtonClick); //Minus 1 ItemPerPage because of the added Home button #endregion #region Base Items Page _baseItemsGrid = _mono.gameObject.AddComponent <GridHelper>(); _baseItemsGrid.OnLoadDisplay += OnLoadBaseItemsGrid; _baseItemsGrid.Setup(44, DSSModelPrefab.ItemPrefab, baseItemsPage, _startColor, _hoverColor, OnButtonClick); _counter = GameObjectHelpers.FindGameObject(baseItemsPage, "Counter").GetComponent <Text>(); #endregion #region DumpBTNButton var closeBTN = InterfaceHelpers.FindGameObject(baseItemsPage, "DumpButton"); InterfaceHelpers.CreateButton(closeBTN, "DumpBTN", InterfaceButtonMode.Background, OnButtonClick, _startColor, _hoverColor, MAX_INTERACTION_DISTANCE, AuxPatchers.DumpToBase()); #endregion #region ColorPickerBTN var colorPickerBTN = InterfaceHelpers.FindGameObject(settings, "ColorPickerBTN"); InterfaceHelpers.CreateButton(colorPickerBTN, "ColorPickerBTN", InterfaceButtonMode.Background, OnButtonClick, _startColor, _hoverColor, MAX_INTERACTION_DISTANCE, AuxPatchers.ColorPage()); #endregion #region RenameBTN var renameBTN = InterfaceHelpers.FindGameObject(settings, "RenameBaseBTN"); InterfaceHelpers.CreateButton(renameBTN, "RenameBTN", InterfaceButtonMode.Background, OnButtonClick, _startColor, _hoverColor, MAX_INTERACTION_DISTANCE, AuxPatchers.Rename()); #endregion #region SettingsBTN var settingsBTN = InterfaceHelpers.FindGameObject(home, "SettingsBTN"); InterfaceHelpers.CreateButton(settingsBTN, "SettingsBTN", InterfaceButtonMode.Background, OnButtonClick, _startColor, _hoverColor, MAX_INTERACTION_DISTANCE, AuxPatchers.SettingPage()); #endregion #region HomePowerBTN var homePowerBTN = InterfaceHelpers.FindGameObject(home, "PowerBTN"); InterfaceHelpers.CreateButton(homePowerBTN, "PowerBTN", InterfaceButtonMode.Background, OnButtonClick, _startColor, _hoverColor, MAX_INTERACTION_DISTANCE, AuxPatchers.PowerButton()); #endregion #region PoweredOffPowerBTN var poweredOffPowerBTN = InterfaceHelpers.FindGameObject(poweredOff, "PowerBTN"); InterfaceHelpers.CreateButton(poweredOffPowerBTN, "PowerBTN", InterfaceButtonMode.Background, OnButtonClick, _startColor, _hoverColor, MAX_INTERACTION_DISTANCE, AuxPatchers.PowerButton()); #endregion #region ColorPickerMainHomeBTN var colorPickerMainHomeBTN = InterfaceHelpers.FindGameObject(colorMainPage, "HomeBTN"); InterfaceHelpers.CreateButton(colorPickerMainHomeBTN, "SettingsBTN", InterfaceButtonMode.Background, OnButtonClick, _startColor, _hoverColor, MAX_INTERACTION_DISTANCE, AuxPatchers.SettingPage()); #endregion #region SettingHomeBTN var settingsHomeBTN = InterfaceHelpers.FindGameObject(settings, "HomeBTN"); InterfaceHelpers.CreateButton(settingsHomeBTN, "HomeBTN", InterfaceButtonMode.Background, OnButtonClick, _startColor, _hoverColor, MAX_INTERACTION_DISTANCE, AuxPatchers.GoToHome()); #endregion #region Terminal Color BTN var terminalColorBTN = InterfaceHelpers.FindGameObject(colorMainPage, "TerminalColorBTN"); InterfaceHelpers.CreateButton(terminalColorBTN, "TerminalColorBTN", InterfaceButtonMode.Background, OnButtonClick, _startColor, _hoverColor, MAX_INTERACTION_DISTANCE, string.Format(AuxPatchers.ColorPageFormat(), AuxPatchers.Terminal())); #endregion #region VehicleSettingsBTN var vehicleSettingBTN = InterfaceHelpers.FindGameObject(settings, "AutoDockBTN"); InterfaceHelpers.CreateButton(vehicleSettingBTN, "AutoDockBTN", InterfaceButtonMode.Background, OnButtonClick, _startColor, _hoverColor, MAX_INTERACTION_DISTANCE, AuxPatchers.GoToDockedVehiclesSettings()); #endregion #region Toggle _toggle = InterfaceHelpers.FindGameObject(vehiclesDockingSettingsPage, "Toggle").GetComponent <Toggle>(); _toggle.onValueChanged.AddListener(OnAutoPullToggled); #endregion #region Search var inputField = InterfaceHelpers.FindGameObject(baseItemsPage, "InputField"); if (inputField != null) { var text = InterfaceHelpers.FindGameObject(inputField, "Placeholder")?.GetComponent <Text>(); if (text != null) { text.text = AuxPatchers.SearchForItemsMessage(); } else { return(false); } var searchField = inputField.AddComponent <SearchField>(); searchField.OnSearchValueChanged += UpdateSearch; } else { //throw new MissingComponentException("Cannot find Input Field"); return(false); } #endregion #region Antenna Color BTN var antennaColorBTN = InterfaceHelpers.FindGameObject(colorMainPage, "AntennaColorBTN"); InterfaceHelpers.CreateButton(antennaColorBTN, "AntennaColorBTN", InterfaceButtonMode.Background, OnButtonClick, _startColor, _hoverColor, MAX_INTERACTION_DISTANCE, string.Format(AuxPatchers.ColorPageFormat(), AuxPatchers.Antenna())); #endregion #region ColorPage _terminalColorPage.SetupGrid(90, DSSModelPrefab.ColorItemPrefab, screenColorPicker, OnButtonClick, _startColor, _hoverColor, 5, "PrevBTN", "NextBTN", "Grid", "Paginator", "HomeBTN", "ColorPickerBTN"); #endregion #region BaseItemDecription var baseItemPageDesc = InterfaceHelpers.FindGameObject(colorMainPage, "Title")?.GetComponent <Text>(); baseItemPageDesc.text = AuxPatchers.ColorMainPageDesc(); #endregion #region BaseName _baseNameLabel = InterfaceHelpers.FindGameObject(baseItemsPage, "BaseLabel")?.GetComponent <Text>(); #endregion #region BaseItemsLoading _gettingData = InterfaceHelpers.FindGameObject(gettingDataPage, "Title")?.GetComponent <Text>(); #endregion #region DockSettingsHomeBTN var dockSettingsHomeBTN = InterfaceHelpers.FindGameObject(vehiclesDockingSettingsPage, "HomeBTN"); InterfaceHelpers.CreateButton(dockSettingsHomeBTN, "SettingsBTN", InterfaceButtonMode.Background, OnButtonClick, _startColor, _hoverColor, MAX_INTERACTION_DISTANCE, AuxPatchers.SettingPage()); #endregion return(true); } catch (Exception e) { QuickLogger.Error(e.Message); QuickLogger.Error(e.StackTrace); return(false); } }