comp380team3 / PuzzlePathDimension

Class project for COMP 380 at California State University, Northridge
0 stars 0 forks source link

Level screen input behaves weirdly #99

Closed Jjp137 closed 11 years ago

Jjp137 commented 11 years ago

When you select Next on the Level Select screen, and you press up or down, you start skipping level entries (you can only select every other entry), and then things get worse from there. For instance, selecting Back afterwards ends up selecting a level for some reason, and you have to back out of the Level Details screen multiple times before it finally goes away.

This did not occur at commit b619139. Something went wrong with the fix to #97... Actually, there's nothing wrong with that fix; see below.

Jjp137 commented 11 years ago

Found the culprit:

    private void turnPage(bool back) {
      items.Clear();
      if (back) {
        CurrentLevel = CurrentLevel - numberOfLevelsPerPage - setOfLevels;
        LoadContent(content);
        menuTemplate.SelectedItem = 0;//currentLevel - setOfLevels;
      } else {
        LoadContent(content);
        menuTemplate.SelectedItem = 0;
      }
    }

Why :( That would mean that we're hooking up the input handlers repeatedly...

I'm...going to sleep now since I have a midterm in about 9 hours, but here's the cause!

Twisol commented 11 years ago

I can reproduce as well. It's because the input handlers are set up in LoadContent, which is only meant to be called when a screen is loaded.