Answer the question
In order to leave comments, you need to log in
Balloon Ymaps in Angular. How to properly subscribe to events in BaloonContent?
Hello.
There is a project with the display of labels on the Yandex map.
Each label has a balloon and it has three buttons in the BaloonContent section.
I used the Ymaps package to connect.
here is an example content:
balloonContentFooter: [
'<button id="assign-btn" onclick="onClickAssign()">',
'<i class="material-icons"> time_to_leave</i></button>',
'<button mat-flat-button style="margin-left: 10px"> <i class="material-icons"> beenhere</i></button>',
'<button mat-flat-button style="margin-left: 10px" color="primary"> <i class="material-icons"> format_color_reset</i></button>'
].join('')
Answer the question
In order to leave comments, you need to log in
Often the debugger points to the next line (instruction) after the problematic one, as in this case.
In order for everything to work for you, x and y must be equal to the number 0, 1 or 2. And Console.Read reads a character, not a number. Those. by entering 0, you get the character '0', which corresponds to the number 48.
You need to process the input, cut off the wrong characters and convert the characters to numbers.
const int FieldWidth = 3;
const int FieldHeight = 3;
int[,] array = new int[FieldWidth, FieldHeight];
//Ввод нуля и последующая проверка на выигрыш.
public void Enter0()
{
int x, y;
while (!int.TryParse(Console.Read(), out x) || x < 0 || x >= FieldWidth) continue; // Здесь можно обработать неверный ввод.
while (!int.TryParse(Console.Read(), out y) || y < 0 || y >= FieldHeight) continue; // Здесь можно обработать неверный ввод.
array[x, y] = 0;
draw_array();
if (Check(x, y))
Player.Win();
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question