示例#1
0
        /// <summary>
        /// Do score align after updating score.
        /// </summary>
        private void DoScoreAlign(int targetScore)
        {
            // digit cannot be zero, must at least be one.
            int newDigitCount = JCS_Mathf.DigitCountIncludeZero(targetScore);

            int diffDigitCount = newDigitCount - mCurrentDigitCount;

            // No difference, no need to do anything.
            if (diffDigitCount == 0)
            {
                return;
            }

            mCurrentDigitCount = newDigitCount;

            // We don't need to do align if the visible
            // digit count would not change.
            if (!mClearEmptyLeftZero)
            {
                return;
            }

            switch (mTextAlign)
            {
            case JCS_TextAlign.CENTER:
            {
                MoveDigits(mDigitInterval * diffDigitCount / 2);
            }
            break;

            case JCS_TextAlign.RIGHT:
            {
                // Default is right, no need to do anything.
            }
            break;

            case JCS_TextAlign.LEFT:
            {
                MoveDigits(mDigitInterval * diffDigitCount);
            }
            break;
            }
        }