/// <summary>
/// Initializes all the menu panels and links them togther. Call this in the Game's
/// create cycle. Lots of hard coding here! - we'll have to adjust it if the game's
/// viewport size changes.
/// </summary>
public static void init()
{
if (initialized)
return;
//initialize static variables
components = new List<Sprite>();
panelStack = new Stack<Panel>();
activePanel = menuBody;
menuOpen = false;
initialized = true;
// places list
placesScreen = new PlacesPanel(200, 480, 440, 380);
placesScreen.setPopLocations(200, 480, 200, 100);
placesScreen.setScrolling(7, 1);
placesScreen.loadEntriesFromFile(Directories.TEXTDATA + "PlacesJournalInfo.txt");
components.Add(placesScreen);
// people list
peopleScreen = new PeoplePanel(200, 480, 440, 380);
peopleScreen.setPopLocations(200, 480, 200, 100);
peopleScreen.setScrolling(7, 1);
peopleScreen.loadEntriesFromFile(Directories.TEXTDATA + "PeopleJournalInfo.txt");
components.Add(peopleScreen);
// quest list
questScreen = new QuestPanel(200, 480, 440, 380);
questScreen.setPopLocations(200, 480, 200, 100);
questScreen.setScrolling(7, 1);
questScreen.loadEntriesFromFile(Directories.TEXTDATA + "QuestJournalInfo.txt");
components.Add(questScreen);
// journal prompt
DialogPanel journalPrompt = new DialogPanel(200, -100, 440, 100);
journalPrompt.setMessage("What type of info do you need?");
journalPrompt.setRefreshMessage(journalPrompt.getMessage());
ScreenSpecifierEntry questEntry = new ScreenSpecifierEntry("Quests", journalPrompt, questScreen);
questEntry.setNewMessage("Looking up past and current quests...");
questEntry.setOtherPanels(peopleScreen, placesScreen);
ScreenSpecifierEntry peopleEntry = new ScreenSpecifierEntry("People", journalPrompt, peopleScreen);
peopleEntry.setNewMessage("Looking up intel on individuals...");
peopleEntry.setOtherPanels(questScreen, placesScreen);
ScreenSpecifierEntry placesEntry = new ScreenSpecifierEntry("Places", journalPrompt, placesScreen);
placesEntry.setNewMessage("Looking up intel on locations...");
placesEntry.setOtherPanels(questScreen, peopleScreen);
journalPrompt.loadEntries(questEntry, peopleEntry, placesEntry);
journalPrompt.setPopLocations(200, -100, 200, 0);
journalPrompt.setYMargin(20);
journalPrompt.setYDivider(journalPrompt.getHeight() - 30);
components.Add(journalPrompt);
// clues info screen
TextPanel cluesInfoScreen = new TextPanel(400, -200, 240, 200);
cluesInfoScreen.setMessage("Info about the clue here.");
cluesInfoScreen.setPopLocations(400, -200, 400, 0);
components.Add(cluesInfoScreen);
// clues list
ListPanel cluesScreen = new CluePanel(200, 480, 200, 480, cluesInfoScreen);
cluesScreen.setPopLocations(200, 480, 200, 0);
components.Add(cluesScreen);
// inventory item info screen
TextPanel inventoryInfoScreen = new TextPanel(200, 480, 440, 150);
inventoryInfoScreen.setMessage("This is where information about the item will appear.");
inventoryInfoScreen.setPopLocations(200, 480, 200, 330);
components.Add(inventoryInfoScreen);
// inventory screen
inventoryScreen = new InventoryPanel(200, -330, 440, 330);
inventoryScreen.setMessagePanel(inventoryInfoScreen);
inventoryScreen.loadEntriesFromFile(Directories.TEXTDATA + "ItemInfo.txt");
inventoryScreen.setScrolling(5, 2);
inventoryScreen.setPopLocations(200, -330, 200, 0);
components.Add(inventoryScreen);
// reputation screen
ReputationPanel reputationScreen = new ReputationPanel(200, 480, 440, 480);
reputationScreen.setPopLocations(200, 480, 200, 0);
components.Add(reputationScreen);
// sound config screen
SoundConfigPanel soundConfigScreen = new SoundConfigPanel(200, 480, 440, 380);
soundConfigScreen.setPopLocations(200, 480, 200, 100);
components.Add(soundConfigScreen);
// key config screen
KeyConfigPanel keyConfigScreen = new KeyConfigPanel(200, 480, 440, 380);
KeyModifierEntry keyAction = new KeyModifierEntry("Talk/Action/Confirm", keyConfigScreen, KeyInputType.Action);
KeyModifierEntry keyCancel = new KeyModifierEntry("Go Back/Cancel", keyConfigScreen, KeyInputType.Cancel);
KeyModifierEntry keyShoot = new KeyModifierEntry("Shoot", keyConfigScreen, KeyInputType.Shoot);
KeyModifierEntry keyPickpocket = new KeyModifierEntry("Pickpocket", keyConfigScreen, KeyInputType.Pickpocket);
KeyModifierEntry keyUp = new KeyModifierEntry("Move Up", keyConfigScreen, KeyInputType.MoveNorth);
KeyModifierEntry keyDown = new KeyModifierEntry("Move Down", keyConfigScreen, KeyInputType.MoveSouth);
KeyModifierEntry keyLeft = new KeyModifierEntry("Move Left", keyConfigScreen, KeyInputType.MoveWest);
KeyModifierEntry keyRight = new KeyModifierEntry("Move Right", keyConfigScreen, KeyInputType.MoveEast);
KeyModifierEntry keyToggleMenu = new KeyModifierEntry("Toggle Menu", keyConfigScreen, KeyInputType.MenuToggle);
keyConfigScreen.loadEntries(keyAction, keyCancel, keyShoot, keyPickpocket, keyUp, keyDown, keyLeft, keyRight, keyToggleMenu);
keyConfigScreen.alignEntriesVertical();
keyConfigScreen.setPopLocations(200, 480, 200, 100);
components.Add(keyConfigScreen);
// config prompt
DialogPanel configPrompt = new DialogPanel(200, -100, 440, 100);
keyConfigScreen.setPreviousPanel(configPrompt);
configPrompt.setMessage("What would you like to configure?");
configPrompt.setRefreshMessage(configPrompt.getMessage());
ScreenSpecifierEntry keyEntry = new ScreenSpecifierEntry("Key Controls", configPrompt, keyConfigScreen);
keyEntry.setNewMessage("Configuring key controls... Press [" +
Enum.GetName(typeof(Keys), KeyboardManager.getKeyControl(KeyInputType.Action)) +
"] to modify the key.");
keyEntry.setOtherPanels(soundConfigScreen);
ScreenSpecifierEntry soundEntry = new ScreenSpecifierEntry("Sound", configPrompt, soundConfigScreen);
soundEntry.setNewMessage("Configuring sound settings...");
soundEntry.setOtherPanels(keyConfigScreen);
configPrompt.loadEntries(keyEntry, soundEntry);
configPrompt.setPopLocations(200, -100, 200, 0);
configPrompt.setYMargin(20);
configPrompt.setYDivider(configPrompt.getHeight() - 30);
components.Add(configPrompt);
// save file data screen
SaveDataPanel saveScreen = new SaveDataPanel(200, 480, 440, 380);
saveScreen.setScrolling(5, 1);
saveScreen.loadSaveData();
saveScreen.setPopLocations(200, 480, 200, 100);
components.Add(saveScreen);
// save/load prompt
DialogPanel savePrompt = new DialogPanel(200, -100, 440, 100);
saveScreen.setPreviousPanel(savePrompt);
savePrompt.setMessage("Would you like to save the current game or load an older game?");
savePrompt.setRefreshMessage(savePrompt.getMessage());
SaveTypeSpecifierEntry saveEntry = new SaveTypeSpecifierEntry("Save", savePrompt, saveScreen);
saveEntry.setSaveType(true);
saveEntry.setNewMessage("Saving current progress...select a file to overwrite.");
SaveTypeSpecifierEntry loadEntry = new SaveTypeSpecifierEntry("Load", savePrompt, saveScreen);
loadEntry.setSaveType(false);
loadEntry.setNewMessage("Loading another save file...select a file to load.");
savePrompt.loadEntries(saveEntry, loadEntry);
//savePrompt.alignEntriesHorizontal();
savePrompt.setPopLocations(200, -100, 200, 0);
savePrompt.setYMargin(20);
savePrompt.setYDivider(savePrompt.getHeight() - 30);
components.Add(savePrompt);
// exit game prompt
DialogPanel exitPrompt = new DialogPanel(200, 480, 350, 200);
exitPrompt.setMessage("Are you sure you want to exit the game? All unsaved progress will be lost.");
ExitEntry cancelEntry = new ExitEntry("Cancel", false);
ExitEntry exitEntry = new ExitEntry("Quit Game", true);
exitPrompt.loadEntries(cancelEntry, exitEntry);
exitPrompt.setPopLocations(200, 480, 200, 280);
components.Add(exitPrompt);
// main menu
menuBody = new ListPanel(-200, 0, 200, 480);
SubMenuFocusEntry menuBodyJournal = new SubMenuFocusEntry("Journal", journalPrompt);
SubMenuFocusEntry menuBodyClues = new SubMenuFocusEntry("Clues", cluesScreen);
SubMenuFocusEntry menuBodyInventory = new SubMenuFocusEntry("Inventory", inventoryScreen);
//SubMenuFocusEntry menuBodyEquip = new SubMenuFocusEntry("Equip", null);
SubMenuFocusEntry menuBodyReputation = new SubMenuFocusEntry("Reputation", reputationScreen);
SubMenuFocusEntry menuBodyConfig = new SubMenuFocusEntry("Config", configPrompt);
SubMenuFocusEntry menuBodySave = new SubMenuFocusEntry("Save/Load", savePrompt);
SubMenuFocusEntry menuBodyExit = new SubMenuFocusEntry("Exit Game", exitPrompt);
menuBody.loadEntries(menuBodyJournal, menuBodyClues, menuBodyInventory, /*menuBodyEquip,*/
menuBodyReputation, menuBodyConfig, menuBodySave, menuBodyExit);
menuBody.alignEntriesVertical();
menuBody.setPopLocations(-200, 0, 0, 0);
components.Add(menuBody);
// menu cursor
menuArrow = new CursorArrow(-175, 67);
menuArrow.setPopLocations(menuBody.getHideX() + 25, menuBody.getHideY() + 67,
menuBody.getAppearX() + 25, menuBody.getAppearY() + 67);
components.Add(menuArrow);
// journal entry info screen
// this panel "covers" the menu cursor, so it goes last
components.Add(JournalInfoPanel.instance);
//group panels that pop in and out together
PanelGroup pg0 = new PanelGroup(menuBody);
PanelGroup pg1 = new PanelGroup(journalPrompt, questScreen, peopleScreen, placesScreen);
PanelGroup pg1a = new PanelGroup(JournalInfoPanel.instance);
PanelGroup pg2 = new PanelGroup(cluesScreen, cluesInfoScreen);
PanelGroup pg3 = new PanelGroup(inventoryScreen, inventoryInfoScreen);
PanelGroup pg4 = new PanelGroup(reputationScreen);
PanelGroup pg5 = new PanelGroup(configPrompt, keyConfigScreen, soundConfigScreen);
PanelGroup pg6 = new PanelGroup(saveScreen, savePrompt);
PanelGroup pg7 = new PanelGroup(exitPrompt);
PanelGroupSorter.addPanelGroups(pg0, pg1, pg1a, pg2, pg3, pg4, pg5, pg6, pg7);
}