graph-di5 / sky-shoot

Automatically exported from code.google.com/p/sky-shoot
0 stars 0 forks source link

Проблема с индексом игр в ScreenManager #63

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Если в списке игр нет созданных, то при 
нажатии на Joingame все отваливается с ошибкой:
ScreenManager.AddScreen(new WaitScreen(
                _tempGameList[_gameList.SelectedItems[0]].UsedTileSet + "",
                _tempGameList[_gameList.SelectedItems[0]].GameType + "",
                _tempGameList[_gameList.SelectedItems[0]].MaximumPlayersAllowed + "",
                _tempGameList[_gameList.SelectedItems[0]].GameId));

IndexOutOfRangeException
Index was outside the bounds of the array.

Original issue reported on code.google.com by Sidorenk...@gmail.com on 30 Nov 2011 at 4:06

GoogleCodeExporter commented 9 years ago

Original comment by graph....@gmail.com on 30 Nov 2011 at 4:12

GoogleCodeExporter commented 9 years ago
Index was outside the bounds of the array.

попрежнему кидается исключение

Original comment by graph....@gmail.com on 2 Dec 2011 at 8:35

GoogleCodeExporter commented 9 years ago

Original comment by krasnovd...@gmail.com on 3 Dec 2011 at 11:01

GoogleCodeExporter commented 9 years ago
ошибка попрежнему проявляется

главное исправлние, которое надо сделать:
            if (_tempGameList == null)
                return;

добавить следующее
 || _tempGameList.Length == null

Original comment by graph....@gmail.com on 3 Dec 2011 at 11:53

GoogleCodeExporter commented 9 years ago
и

            //todo setActive
            ExitScreen();

можно делать __только__ в успешном случае

            if(!GameController.Instance.JoinGame(_tempGameList[_gameList.SelectedItems[0]]))
            {
                //todo popup
                Trace.WriteLine("Join game failed");
return;// !!
            }
ExitScreen()

Original comment by graph....@gmail.com on 3 Dec 2011 at 11:58

GoogleCodeExporter commented 9 years ago

Original comment by graph....@gmail.com on 3 Dec 2011 at 12:50