Ejemplo n.º 1
0
 private void HandleOperandButton(OperandButton operandButton)
 {
     if (isAnimation || operandButton.isSelected || !formula.CanAppendOperand(operandButton.Operand))
     {
         SoundWareHouse.Instance.seButtonError.GetComponent <AudioSource>().Play();
         return;
     }
     SoundWareHouse.Instance.seTermButton.GetComponent <AudioSource>().Play();
     formula.AppendOperand(operandButton.Operand);
     formulaText.AppendOperand(operandButton.Operand);
     HandleTermButton(operandButton);
     if (formula.IsCorrect)
     {
         isAnimation = true;
         var targets = new List <List <Vector2Int> >()
         {
             selectedPositions
         };
         RemoveTermButtons(targets, () =>
         {
             isAnimation = false;
             selectedPositions.Clear();
             formula.Clear();
             formulaText.text = "";
             ++moves;
             movesText.text = moves.ToString() + "/" + stageData.moves.ToString() + "手";
             snapShots.RemoveAt(snapShots.Count - 1);
             if (IsClear)
             {
                 gameDirector.PerformClearTask();
             }
             else if ((!IsEmpty && (stageData.moves <= moves)) || (IsEmpty && (moves != stageData.moves)) || (stageData.moves < moves))
             {
                 gameDirector.ShowGameOverAlert();
             }
             else
             {
                 SaveSnapShot();
             }
             return(true);
         });
     }
 }