예제 #1
0
        public override void OnButtonClick(string btnName, object tag)
        {
            if (btnName == string.Empty)
            {
                return;
            }

            switch (btnName)
            {
            case "BaseBTN":
                if (!SubrootCheck())
                {
                    return;
                }
                _currentBase        = ((TransferData)tag).Manager;
                _currentData        = (TransferData)tag;
                _baseNameLabel.text = _currentBase.GetBaseName();

                if (_currentData.ButtonType == ButtonType.Home)
                {
                    GoToPage(TerminalPages.BaseItemsDirect);
                }
                else if (_currentData.ButtonType == ButtonType.Base)
                {
                    _gettingData.text = string.Format(AuxPatchers.GettingData(), _currentBase.GetBaseName());
                    GoToPage(TerminalPages.BaseItems);
                }

                Refresh();
                break;

            case "HomeBTN":
                GoToPage(TerminalPages.Home);
                break;

            case "ItemBTN":
                _currentBase?.RemoveItemFromContainer((TechType)tag);
                break;

            case "DumpBTN":
                _currentBase?.OpenDump(_currentData);
                break;

            case "VehicleDumpBTN":
                _vehicleContainersGrid.DrawPage();
                GoToPage(TerminalPages.StorageContainer);
                break;

            case "VehicleContainerBTN":
                _mono.Manager.DockingManager.OpenContainer(_currentVehicle, ((TransferData)tag).Container);
                break;

            case "TerminalColorBTN":
                GoToPage(TerminalPages.TerminalColorPage);
                _currentColorPage = ColorPage.Terminal;
                break;

            case "AntennaColorBTN":
                var antennas = _mono.Manager.GetCurrentBaseAntenna();

                if (antennas != null)
                {
                    GoToPage(TerminalPages.AntennaColorPage);
                    _currentColorPage = ColorPage.Antenna;
                    UpdateAntennaColorPage();
                }
                else if (_mono.Manager.Habitat.isBase)
                {
                    QuickLogger.Message(AuxPatchers.NoAntennaOnBase(), true);
                }
                else if (_mono.Manager.Habitat.isCyclops)
                {
                    QuickLogger.Message(AuxPatchers.CannotChangeCyclopsAntenna(), true);
                }
                break;

            case "ColorPickerBTN":
                GoToPage(TerminalPages.ColorPageMain);
                break;

            case "ColorItem":
                if (_currentColorPage == ColorPage.Terminal)
                {
                    _mono.TerminalColorManager.ChangeColorMask((Color)tag);
                }
                else
                {
                    ChangeAntennaColor((Color)tag);
                }
                break;

            case "RenameBTN":
                _mono.Manager.ChangeBaseName();
                break;

            case "PowerBTN":
                _mono.Manager.ToggleBreaker();
                break;

            case "SettingsBTN":
                GoToPage(TerminalPages.SettingsPage);
                break;

            case "VehiclesPageBTN":
                if (_mono.Manager.DockingManager.HasVehicles(true))
                {
                    _vehicleGrid.DrawPage();
                    GoToPage(TerminalPages.VehiclesPage);
                }
                else
                {
                    GoToPage(TerminalPages.Home);
                }
                break;

            case "VehicleBTN":
                _currentVehicle = ((TransferData)tag).Vehicle;
                _vehicleContainersGrid.DrawPage();
                GoToPage(TerminalPages.StorageContainer);
                break;

            case "AutoDockBTN":
                _toggle.isOn = _mono.Manager.DockingManager.GetToggleState();
                GoToPage(TerminalPages.DockSettingPage);
                break;

            case "FilterBTN":
                var data = (FilterTransferData)tag;
                if (Mod.IsFilterAdded(data.Filter))
                {
                    Mod.RemoveBlackListFilter(data.Filter);
                    return;
                }
                Mod.AddBlackListFilter(data.Filter);
                break;
            }
        }