void Update()
 {
     if (CrockoInput.GetAdminMenuKeyComboDown())
     {
         this.showSetup(!this.allMenu.gameObject.activeSelf);
     }
 }
Ejemplo n.º 2
0
    private void Update()
    {
        UpdateBackground();

        bool aGameIsRunning = ProcessRunner.instance.IsGameRunning();

        if (aGameIsRunning)
        {
        }
        else
        {
            //--- LEGACY INPUT STYLE, JUST SLIDING THE BACKGROUND -----------------------
            int selectionDirection = 0;
            selectionDirection = CrockoInput.PrelaunchMenuInput.OnSelectRight() ? 1 : CrockoInput.PrelaunchMenuInput.OnSelectLeft() ? -1 : 0;
            if (selectionDirection != 0)
            {
                onCycleButtonPressed(selectionDirection);
            }
            //----------------------------------------------------------------------------

            if (CrockoInput.GetOpenGameButtonDown())
            {
                onStartGameButtonPress();
            }

            autoCycleGamesIfNoInput();
        }

        if (attemptedLaunchTimer >= 0)
        {
            attemptedLaunchTimer -= Time.deltaTime;
        }
    }
Ejemplo n.º 3
0
    void LateUpdate()
    {
        sb.Clear();
        int targetIdleOpacity = SwitcherApplicationController.isIdle ? 1 : 0;

        if (this._attractAmt != targetIdleOpacity)
        {
            this._attractAmt = Mathf.MoveTowards(this._attractAmt, targetIdleOpacity, Time.deltaTime);
        }


        //Test attract cycling of games
        //if (Input.GetKeyDown(KeyCode.Alpha0))
        //{
        //    AttractCycleNextGame();
        //}

        float speed    = Mathf.Lerp(_normalSpeed, _quickSpeed, Mathf.InverseLerp(.25f, 1, _speedAccumulator));
        float lastFuzz = _fuzzyIdx;

        keyHeld = false;

        _autoKeyCounter = Mathf.MoveTowards(_autoKeyCounter, 0, Time.deltaTime);


        if (!PreLaunchGameInfo.Instance.open)
        {
            float scrollAmount = Mathf.Clamp(CrockoInput.GetListScroll() + _autoKeyCounter, -1, 1);

            if (Mathf.Abs(scrollAmount) > 0)
            {
                _scrollMomentumDirection = scrollAmount < 0 ? -1 : 1;
                lastMovedDirection       = _scrollMomentumDirection;
                keyHeld    = true;
                _fuzzyIdx += scrollAmount * Time.deltaTime * speed;
            }
        }


        if (GameCatalog.Instance.gameCount > 0)
        {
            _fuzzyIdx %= GameCatalog.Instance.gameCount;
        }

        if (_fuzzyIdx < 0)
        {
            _fuzzyIdx += GameCatalog.Instance.gameCount;
        }


        int lastSelectedIdx = stopIndex;

        if (!keyHeld)
        {
            _fuzzyIdx = Mathf.MoveTowards(_fuzzyIdx, stopIndex, Time.deltaTime * speed);
        }

        bool shoulShowAlphaHelper = keyHeld && _keyHeldTimer > .75f && !smallNumberOfGames;

        _alphaHelperCanvasGroup.alpha = Mathf.MoveTowards(_alphaHelperCanvasGroup.alpha,
                                                          (shoulShowAlphaHelper ? 1 : 0),
                                                          (keyHeld ? Time.deltaTime * 2 : Time.deltaTime * 1f));

        if ((int)lastFuzz != (int)_fuzzyIdx)
        {
            OnPassedItem.Invoke();
            OnRepopulated();
        }

        if (_stabilizedStartTime <= 0 && stopIndex != _stabilizedIdx && (Mathf.Approximately(_fuzzyIdx, stopIndex)) && Mathf.Abs(_speedAccumulator) <= _quickSpeed)
        {
            _stabilizedStartTime = .25f;
            _stabilizedIdx       = stopIndex;
            OnStoppedAtItem.Invoke();
        }
        if (_stabilizedStartTime > 0)
        {
            _stabilizedStartTime = Mathf.Max(0, _stabilizedStartTime - Time.deltaTime);
        }


        float fuzzIdxOffset = _fuzzyIdx % 1;

        _container.anchoredPosition = _startAp + Vector2.up * fuzzIdxOffset * _height;

        float prevSpeed = _speedAccumulator;

        if (keyHeld)
        {
            _keyHeldTimer    += Time.deltaTime;
            _speedAccumulator = Mathf.MoveTowards(_speedAccumulator, 1, Time.deltaTime / 1.75f);
        }
        else
        {
            _keyHeldTimer     = Mathf.Max(0, _keyHeldTimer - 2 * Time.deltaTime);
            _speedAccumulator = Mathf.MoveTowards(_speedAccumulator, 0, Time.deltaTime * 2f);
        }

        //if (Mathf.Abs(_speedAccumulator) == 0 && Mathf.Abs(prevSpeed) != 0)
        //{
        //    OnItemPassed.Invoke();
        //}

        UpdateTextViz();
    }