internal void Show()
 {
     uGUI.main.userInput.RequestString(ExStorageDepotBuildable.RenameStorage(), ExStorageDepotBuildable.Submit(), _currentName, 25, new uGUI_UserInput.UserInputCallback(SetLabel));
 }
Exemplo n.º 2
0
        public override bool FindAllComponents()
        {
            try
            {
                #region Canvas

                var canvas = gameObject.GetComponentInChildren <Canvas>()?.gameObject;

                if (canvas == null)
                {
                    QuickLogger.Error("Canvas could not be found!");
                    return(false);
                }

                #endregion

                #region Home Screen

                var home = InterfaceHelpers.FindGameObject(canvas, "Home");

                #endregion

                #region Multiplier

                var multiplier = InterfaceHelpers.FindGameObject(home, "Multiplier");

                #endregion

                #region Item Count

                _itemCount = InterfaceHelpers.FindGameObject(home, "StorageAmount")?.GetComponent <Text>();

                #endregion

                #region Plier

                _plier = InterfaceHelpers.FindGameObject(multiplier, "plier")?.GetComponent <Text>();

                #endregion

                #region Storage Labels

                _storageLabels = InterfaceHelpers.FindGameObject(home, "Storage_Labels");

                #endregion

                #region Grid

                var grid = InterfaceHelpers.FindGameObject(home, "Grid");
                _grid = _mono.gameObject.AddComponent <GridHelper>();
                _grid.OnLoadDisplay += OnLoadDisplay;
                _grid.Setup(16, ExStorageDepotBuildable.ItemPrefab, home, _startColor, _hoverColor, OnButtonClick);

                #endregion

                #region Dump Button

                var dumpBTN = InterfaceHelpers.FindGameObject(home, "Dump_Button");
                InterfaceHelpers.CreateButton(dumpBTN, "DumpBTN", InterfaceButtonMode.Background,
                                              OnButtonClick, _startColor, _hoverColor, MAX_INTERACTION_DISTANCE, ExStorageDepotBuildable.AddToExStorage());

                #endregion

                #region Rename Button

                var renameBTN = InterfaceHelpers.FindGameObject(home, "Rename_Button");
                InterfaceHelpers.CreateButton(renameBTN, "RenameBTN", InterfaceButtonMode.Background,
                                              OnButtonClick, _startColor, _hoverColor, MAX_INTERACTION_DISTANCE, ExStorageDepotBuildable.RenameStorage());

                #endregion

                #region Multiplier Previous Button

                var multiplierPrevBtn = InterfaceHelpers.FindGameObject(multiplier, "Prev_BTN");
                InterfaceHelpers.CreateButton(multiplierPrevBtn, "LButton", InterfaceButtonMode.Background,
                                              OnButtonClick, _startColor, _hoverColor, MAX_INTERACTION_DISTANCE, "");

                #endregion

                #region Multiplier Next Button

                var multiplierNextBtn = InterfaceHelpers.FindGameObject(multiplier, "Next_BTN");
                InterfaceHelpers.CreateButton(multiplierNextBtn, "RButton", InterfaceButtonMode.Background,
                                              OnButtonClick, _startColor, _hoverColor, MAX_INTERACTION_DISTANCE, "");

                #endregion

                _unitID = GameObjectHelpers.FindGameObject(home, "UnitID")?.GetComponent <Text>();
            }
            catch (Exception e)
            {
                QuickLogger.Error($"{e.Message}:\n{e.StackTrace}");
                return(false);
            }
            return(true);
        }