public override bool FindAllComponents() { #region Canvas var canvasGameObject = gameObject.GetComponentInChildren <Canvas>()?.gameObject; if (canvasGameObject == null) { QuickLogger.Error("Canvas cannot be found"); return(false); } #endregion #region L_Panel var lPanel = canvasGameObject.FindChild("Left_Panel")?.gameObject; if (lPanel == null) { QuickLogger.Error("Unable to find L_Panel GameObject"); return(false); } #endregion #region R_Panel var rPanel = canvasGameObject.FindChild("Right_Panel")?.gameObject; if (rPanel == null) { QuickLogger.Error("Unable to find R_Panel GameObject"); return(false); } #endregion #region Home var home = canvasGameObject.FindChild("Home")?.gameObject; if (home == null) { QuickLogger.Error("Unable to find Home GameObject"); return(false); } #endregion #region confirmation var confirmation = canvasGameObject.FindChild("Confirmation")?.gameObject; if (confirmation == null) { QuickLogger.Error("Unable to find Home GameObject"); return(false); } #endregion #region ColorPicker var colorPicker = canvasGameObject.FindChild("ColorPicker")?.gameObject; if (colorPicker == null) { QuickLogger.Error("Unable to find colorPicker GameObject"); return(false); } #endregion #region Color Picker Button var colorPickerBtn = InterfaceHelpers.FindGameObject(rPanel, "ColorPickerBTN"); if (colorPickerBtn == null) { return(false); } InterfaceHelpers.CreateButton(colorPickerBtn, "ColorPageBTN", InterfaceButtonMode.Background, OnButtonClick, _startColor, _hoverColor, MaxInteractionRange); #endregion #region Color Picker Button var renameBtn = InterfaceHelpers.FindGameObject(rPanel, "RenameBTN"); if (renameBtn == null) { return(false); } InterfaceHelpers.CreateButton(renameBtn, "RenameBTN", InterfaceButtonMode.Background, OnButtonClick, _startColor, _hoverColor, MaxInteractionRange); #endregion #region Text Field _textField = InterfaceHelpers.FindGameObject(lPanel, "UnitName")?.GetComponent <Text>(); #endregion #region Grid _teleportGrid.Setup(7, QuantumTeleporterBuildable.ItemPrefab, home, _startColor, _hoverColor, OnButtonClick, 5, "PrevBTN", "NextBTN", "Grid", "Paginator", string.Empty); _teleportGrid.OnLoadDisplay += OnLoadDisplay; #endregion #region Color Grid var _colorGrid = InterfaceHelpers.FindGameObject(colorPicker, "Grid"); if (_colorGrid == null) { QuickLogger.Error <QTDisplayManager>("Cant find color page on home page"); return(false); } #endregion #region Color Paginator var _colorPaginator = InterfaceHelpers.FindGameObject(colorPicker, "Paginator"); if (_colorPaginator == null) { QuickLogger.Error <QTDisplayManager>("Cant find paginator on color picker page"); return(false); } #endregion #region ColorPage _colorPage.SetupGrid(30, QuantumTeleporterBuildable.ColorItemPrefab, _colorGrid, _colorPaginator.GetComponent <Text>(), OnButtonClick); #endregion #region Home Button var homeBtn = InterfaceHelpers.FindGameObject(colorPicker, "HomeBTN"); if (homeBtn == null) { return(false); } InterfaceHelpers.CreateButton(homeBtn, "HomeBTN", InterfaceButtonMode.Background, OnButtonClick, _startColor, _hoverColor, MaxInteractionRange); #endregion #region Prev Color Button var prevColorBtn = InterfaceHelpers.FindGameObject(colorPicker, "PrevBTN"); if (prevColorBtn == null) { return(false); } InterfaceHelpers.CreatePaginator(prevColorBtn, -1, _colorPage.ChangeColorPageBy, _startColor, _hoverColor); #endregion #region Next Color Button var nextColorBtn = InterfaceHelpers.FindGameObject(colorPicker, "NextBTN"); if (nextColorBtn == null) { return(false); } InterfaceHelpers.CreatePaginator(nextColorBtn, 1, _colorPage.ChangeColorPageBy, _startColor, _hoverColor); #endregion #region Global Toggle var isGlobalToggle = InterfaceHelpers.FindGameObject(lPanel, "Toggle"); if (isGlobalToggle == null) { return(false); } var globalToggleLabel = InterfaceHelpers.FindGameObject(isGlobalToggle, "Label"); if (globalToggleLabel == null) { return(false); } globalToggleLabel.GetComponent <Text>().text = QuantumTeleporterBuildable.MakeGlobalUnit(); _isGlobalToggle = isGlobalToggle.GetComponent <Toggle>(); _isGlobalToggle.onValueChanged.AddListener(delegate { ToggleValueChanged(_isGlobalToggle); }); #endregion #region Intra Tele Button var intraTele = InterfaceHelpers.FindGameObject(home, "Intra_TeleBtn"); if (intraTele == null) { return(false); } _intraTeleBtn = InterfaceHelpers.CreateButton(intraTele, "IntraTeleBtn", InterfaceButtonMode.Background, OnButtonClick, Color.black, Color.white, MaxInteractionRange); _intraTeleBtn.ChangeText(QuantumTeleporterBuildable.LocalNetwork()); #endregion #region GLobal Tele Button var globalTele = InterfaceHelpers.FindGameObject(home, "Global_TeleBtn"); if (globalTele == null) { return(false); } _globalTeleBtn = InterfaceHelpers.CreateButton(globalTele, "GlobalTeleBtn", InterfaceButtonMode.Background, OnButtonClick, Color.black, Color.white, MaxInteractionRange); _globalTeleBtn.ChangeText(QuantumTeleporterBuildable.GlobalNetwork()); #endregion #region Information Label var unitInfo = InterfaceHelpers.FindGameObject(lPanel, "UnitNameInfo"); if (unitInfo == null) { return(false); } var infoText = unitInfo.GetComponent <Text>(); infoText.text = LeftPanelText(); #endregion #region Yes Button var yesBTNGO = InterfaceHelpers.FindGameObject(confirmation, "YesBTN"); if (yesBTNGO == null) { return(false); } var yesBTN = InterfaceHelpers.CreateButton(yesBTNGO, "ConfirmYesBtn", InterfaceButtonMode.Background, OnButtonClick, Color.black, Color.white, MaxInteractionRange); yesBTN.ChangeText(QuantumTeleporterBuildable.Confirm()); #endregion #region No Button var noBTNGO = InterfaceHelpers.FindGameObject(confirmation, "NoBTN"); if (noBTNGO == null) { return(false); } var noBTN = InterfaceHelpers.CreateButton(noBTNGO, "ConfirmNoBtn", InterfaceButtonMode.Background, OnButtonClick, Color.black, Color.white, MaxInteractionRange); noBTN.ChangeText(QuantumTeleporterBuildable.Cancel()); #endregion #region Confirmation var confirmMessage = InterfaceHelpers.FindGameObject(confirmation, "Message"); if (confirmMessage == null) { return(false); } confirmMessage.GetComponent <Text>().text = QuantumTeleporterBuildable.ConfirmMessage(); #endregion #region Destination var destination = InterfaceHelpers.FindGameObject(confirmation, "Destination"); if (destination == null) { return(false); } _destination = destination.GetComponent <Text>(); #endregion return(true); }
internal void UpdateCookingButton() { _startButton.ChangeText(_mono.FoodManager.IsCooking() ? SeaCookerBuildable.Cancel() : SeaCookerBuildable.Start()); }