Ejemplo n.º 1
0
        private void ToggleDefaultTint(bool on)
        {
            ImmutableList <VehicleStation> allStations = LazyManager <BuildingManager> .Current.GetAll <VehicleStation>();

            for (int i = 0; i < allStations.Count; i++)
            {
                VehicleStation station = allStations[i];
                if (DisabledStations?.Contains(station) == true)
                {
                    continue;
                }
                LazyManager <BuildingTintManager> .Current.SetDefaultColor(station, on?new Color?(GameColors.WhiteModeCompanyTintColor) : null);

                station.SetTint(null);
            }
        }
Ejemplo n.º 2
0
        public bool OnUpdate()
        {
            bool key = LazyManager <InputManager> .Current.GetKey(LazyManager <VoxelTycoon.Settings> .Current.MultipleModeKey);

            if (this._deactivate && !key)
            {
                return(true);
            }
            VehicleStation station = null;

            if (!InputHelper.OverUI)
            {
                station = ObjectRaycaster.Get <VehicleStation>();
            }
            if (station != null)
            {
                if (this._station != station)
                {
                    if (this._station != null)
                    {
                        this._station.SetTint(null);
                    }
                    this._station = station;
                    this._canPick = this.CanPick(station);
                    if (_canPick)
                    {
                        this._tooltip.Background = new PanelColor(ReadyToPickTooltipColor, 0f);
                        this._tooltip.Text       = LazyManager <LocaleManager> .Current.Locale.GetString("schedule_stopwatch/add_connected_station");
                    }
                    else
                    {
                        this._tooltip.Background = new PanelColor(WrongReadyToPickHighlightColor, 0f);
                        this._tooltip.Text       = LazyManager <LocaleManager> .Current.Locale.GetString("schedule_stopwatch/already_added");

                        station.SetTint(new Color?(WrongReadyToPickHighlightColor));
                    }
                }
                if (_canPick)
                {
                    UIManager.Current.SetCursor(Cursors.Pointer);
                    if (InputHelper.WorldMouseDown)
                    {
                        this.OnStationPicked?.Invoke(station);
                        Manager <SoundManager> .Current.PlayOnce(R.Audio.Click, null);

                        if (!key)
                        {
                            return(true);
                        }
                        this._deactivate = true;
                    }
                }
            }
            else
            {
                if (this._station != null)
                {
                    this._station.SetTint(null);
                    this._station = null;
                }
                this._tooltip.Background = new PanelColor(PickingTooltipColor, 0f);
                this._tooltip.Text       = LazyManager <LocaleManager> .Current.Locale.GetString("schedule_stopwatch/pick_station");
            }
            this._tooltip.RectTransform.anchoredPosition = (new Vector2(Input.mousePosition.x, Input.mousePosition.y) + new Vector2(-10f, -16f)) / UIManager.Current.Scale;
            this._tooltip.ClampPositionToScreen();
            return(InputHelper.MouseDown && !key);
        }