Example #1
0
        public void OnClickMapPlace(int id, ShipmentNodeType type)
        {
            ShipmentsAnswerCell cell = GetCurrentAnswerCell();

            if (cell.Type == AnswerCellType.Numeric)
            {
                SoundController.GetController().PlayDropSound();
            }
            else
            {
                SoundController.GetController().PlayTypingSound();
                cell.Value = id;
                cell.GetComponent <Image>().sprite = GetCellSprite(id, type);
                List <ShipmentsAnswerCell> cells = GetAnswerCells();
                if (type == ShipmentNodeType.Other && _currentFocus + 2 < cells.Count && _currentFocus % 3 == 1)
                {
                    ShipmentsAnswerCell cell2 = cells[_currentFocus + 2];
                    cell2.Value = id;
                    cell2.GetComponent <Image>().sprite = GetCellSprite(id, type);
                }
                else if (type == ShipmentNodeType.Other && _currentFocus - 2 > 0 && _currentFocus % 3 == 0)
                {
                    ShipmentsAnswerCell cell2 = cells[_currentFocus - 2];
                    cell2.Value = id;
                    cell2.GetComponent <Image>().sprite = GetCellSprite(id, type);
                }
                FocusNextEmptyCell();
            }
        }
Example #2
0
        public void OnClickNumberBtn(int number)
        {
            ShipmentsAnswerCell cell = GetCurrentAnswerCell();

            if (cell.Type == AnswerCellType.Numeric)
            {
                Text uiText = cell.GetComponentInChildren <Text>();
                if (uiText.text.Length > 2)
                {
                    SoundController.GetController().PlayDropSound();
                }
                else
                {
                    if (cell.Value == -1)
                    {
                        uiText.text = "";
                    }
                    SoundController.GetController().PlayTypingSound();
                    uiText.text += number;
                    cell.Value   = int.Parse(uiText.text);
                }
            }
            UpdateTotalKm();
        }