/// <summary>Indica o planeta anterior</summary> private Planet getPrevious(int idx) { Planet toReturn = null; while (idx > 0) { toReturn = Player.Planets[idx - 1]; SubSectionMenu.IsAvailable available = (SubSectionMenu.IsAvailable)SubSectionMenu.Available[Section]; if (available == null) { throw new Exception("Don't know how to handke '" + Section + "'"); } if (!available(toReturn)) { toReturn = null; --idx; continue; } return(toReturn); } return(toReturn); }
/// <summary>Indica o planeta próximo</summary> private Planet getNext(int idx) { Planet toReturn = null; while (idx < Player.Planets.Length - 1) { toReturn = Player.Planets[idx + 1]; SubSectionMenu.IsAvailable available = (SubSectionMenu.IsAvailable)SubSectionMenu.Available[Section]; if (available == null) { throw new Exception("Don't know how to handke '" + Section + "'"); } if (!available(toReturn)) { toReturn = null; ++idx; continue; } return(toReturn); } return(toReturn); }