public void Initialize()
        {
            _puzzle                       = _puzzleGenerator.Generate();
            _attemptResult                = new AttemptResult();
            _attemptResult.Guess          = new Guess(_puzzle.Pieces.Count);
            _attemptResult.OveralFeedback = new OverallFeedback();
            _attemptResult.Feedbacks      = new List <Feedback>();

            _overallFeedbackGenerator = new OverallFeedbackGenerator(_puzzle);

            foreach (var feedbackUI in _attemptResultUI.FeedbackUIs)
            {
                _feedbackGenerators.Add(
                    new FeedbackGenerator(
                        _puzzle,
                        feedbackUI.ReferencingPieces));
            }
        }
        public void Init(AttemptResult result)
        {
            for (int i = 0; i < result.Guess.Pieces.Count; i++)
            {
                _pieceUIs[i].Init(result.Guess.Pieces[i]);
            }

            OveralFeedbackUI.CorrectPieces.text   = result.OveralFeedback.CorrectPieces.ToString();
            OveralFeedbackUI.SimilarPieces.text   = result.OveralFeedback.SimilarPieces.ToString();
            OveralFeedbackUI.MisplacedPieces.text = result.OveralFeedback.MisplacedPieces.ToString();

            foreach (var feedback in result.Feedbacks)
            {
                foreach (var ui in FeedbackUIs)
                {
                    if (ui.ReferencingPieces.SequenceEqual(feedback.ReferencingPieces))
                    {
                        ui.CorrectPieces.text = feedback.CorrectPieces.ToString();
                        ui.SimilarPieces.text = feedback.SimilarPieces.ToString();
                    }
                }
            }
        }
示例#3
0
        void createAndAddNewAttemptResultUI(AttemptResult result)
        {
            var attemptResultUI = Instantiate(_attemptResultUI, _transform);

            attemptResultUI.GetComponent <AttemptResultUI>().Init(result);
        }
示例#4
0
 public void AddAttemptResult(AttemptResult result, Action onCompleted)
 {
     expandScrollHieght();
     createAndAddNewAttemptResultUI(result);
     shrinkScrollHieght(onCompleted);
 }