示例#1
0
    //receipt - confirm 버튼 누를시.
    public void ConfirmPay()
    {
        if (GS == GameState.Play)
        {
            if (!onFeverMode)
            {
                int valueOnTray = trayWithDecks.GetValueOnTray();

                //방금 turn에서 success 했는지 check.
                bool isSuccess = CheckSuccessTurn(valueOnTray);
                bool isPerfect = true;

                wallet.ShowConfirm(isSuccess);
                if (isSuccess)
                {
                    if (!onCombo)
                    {
                        ComboOn();
                        feverCount = 0;
                        level      = 1;
                        levelCount = 0;
                        isPerfect  = false;
                    }
                    combo++;
                    comboCtrl.ShowCombo();
                    comboCtrl.ShowComment(isSuccess, isPerfect);
                    comboTimer = comboInterval;
                    feverCount++;

                    levelCount++;
                    if (level < 4)
                    {
                        if (levelCount >= 1)
                        {
                            levelCount = 0;
                            level++;
                        }
                    }
                    else if (level < 15)
                    {
                        if (levelCount >= 2)
                        {
                            levelCount = 0;
                            level++;
                        }
                    }
                    else
                    {
                        if (levelCount >= 3)
                        {
                            levelCount = 0;
                            level++;
                        }
                    }
                    CountScore(isSuccess);

                    if (feverCount >= feverInterval && !onFeverMode)
                    {
                        onFeverMode = true;                         // update에서 fevermode를 켜줌(game end에서 fevermodeOn과 동시에 시작되는 현상을 방지).
                        customersQ.EndPayment(true, isPerfect, true);
                    }
                    else
                    {
                        customersQ.EndPayment(true, isPerfect, false);
                    }
                    SuccessTurn();
                }
                else
                {
                    if (onCombo)
                    {
                        ComboOff();
                        feverCount = 0;
                    }
                    comboCtrl.ShowComment(false, false);

                    level = 1;
                    CountScore(isSuccess);
                    customersQ.EndPayment(false, false, false);
                    FailTurn();
                    ComboOn();
                }

                //Initialize tray...
                trayWithDecks.InitializeTray();
                receipt.AfterEndPayment();
            }
            else               // fever

            {
                bool isPerfect = true;
                feverCustomerCount++;

                if (!onCombo)
                {
                    ComboOn();
                    feverCount = 0;
                    isPerfect  = false;
                }

                combo++;
                comboCtrl.ShowFeverCombo();
                comboCtrl.ShowComment(true, isPerfect);
                comboTimer = comboInterval;


                CountScore(true);
                customersQ.EndPayment(true, true, true);
                SuccessTurn();
            }
        }
    }