예제 #1
0
    private void EnterInitialsUpdate()
    {
        // Check for the confirm button, to move onto the next initial or save and show table
        // This needs to run every tick....
        if (m_PlayerActionsBindings.UI_Confirm.WasPressed)
        {
            m_sFinalInitials.Insert((int)m_iEntry, Types.s_sHS_English.Substring(m_iAlphabetIndex, 1));

            ++m_iEntry;
            if (m_iEntry < 3)
            {
                m_gcEntryInitial = m_gcHighScoreUI.GetTextEntry(m_iEntry);
                m_iAlphabetIndex = 0;
            }
            else
            {
                GameGlobals.SaveCecconoidScore(m_gcHighScoreUI.GetFinalString());
                m_gcHighScoreUI.OnShowTable();
                m_iState     = Types.EHighScoreMenuState._SHOW_TABLE;
                m_fEventTime = TimerManager.fGameTime + Types.s_fDUR_GameOverScreen;
            }
        }


        // Now reduce update frequency, don't care about scrolling quickly
        {
            ++m_iFrameCounter;
            if (m_iFrameCounter < 4)
            {
                return;
            }
            m_iFrameCounter = 0;
        }


        // Get the player's input
        Vector2 vMovementTrajectory = m_PlayerActionsBindings.GE_Move;

        // Deadzone it, same as in-game.
        if (vMovementTrajectory.magnitude < Types.s_fDeadZone_Movement)
        {
            vMovementTrajectory = Vector2.zero;
        }
        else
        {
            vMovementTrajectory = vMovementTrajectory.normalized * ((vMovementTrajectory.magnitude - Types.s_fDeadZone_Movement) / (1.0f - Types.s_fDeadZone_Movement));
        }

        // Move through the list of available letters
        if (vMovementTrajectory.x > Types.s_fDeadZone_Movement)
        {
            ++m_iAlphabetIndex;
        }
        else if (vMovementTrajectory.x < -Types.s_fDeadZone_Movement)
        {
            --m_iAlphabetIndex;
        }

        // Clamp (Roll round?)
        if (m_iAlphabetIndex < 0)
        {
            m_iAlphabetIndex = 0;
        }
        if (m_iAlphabetIndex > 26)
        {
            m_iAlphabetIndex = 26;
        }

        // Set the initial visibile on-screen
        m_gcEntryInitial.text = Types.s_sHS_English.Substring(m_iAlphabetIndex, 1);
    }