public MusicMenu(MusicChoice choice) { this.choice = choice; files = PathMod.GetModFiles(GraphicsManager.MUSIC_PATH); List <MenuChoice> flatChoices = new List <MenuChoice>(); flatChoices.Add(new MenuTextChoice("---", () => { choose(""); })); foreach (string song in files) { if (!DataManager.IsNonTrivialFile(song)) { continue; } flatChoices.Add(new MenuTextChoice(Path.GetFileNameWithoutExtension(song), () => { choose(Path.GetFileName(song)); })); } List <MenuChoice[]> choices = SortIntoPages(flatChoices, SLOTS_PER_PAGE); summaryMenu = new SongSummary(Rect.FromPoints(new Loc(8, GraphicsManager.ScreenHeight - 8 - 5 * VERT_SPACE - GraphicsManager.MenuBG.TileHeight * 2), new Loc(GraphicsManager.ScreenWidth - 8, GraphicsManager.ScreenHeight - 8))); Initialize(new Loc(8, 16), 304, Text.FormatKey("MENU_MUSIC_TITLE"), choices.ToArray(), 0, 0, SLOTS_PER_PAGE); }
public static void BuildTileIndex(string cachePattern) { TileGuide fullGuide = new TileGuide(); string search = Path.GetDirectoryName(String.Format(cachePattern, '*')); string pattern = Path.GetFileName(String.Format(cachePattern, '*')); try { foreach (string dir in PathMod.GetModFiles(search, pattern)) { string file = Path.GetFileNameWithoutExtension(dir); using (FileStream stream = File.OpenRead(dir)) { using (BinaryReader reader = new BinaryReader(stream)) { TileIndexNode guide = TileIndexNode.Load(reader); fullGuide.Nodes[file] = guide; } } } using (FileStream stream = new FileStream(PathMod.HardMod(search + "/index.idx"), FileMode.Create, FileAccess.Write)) { using (BinaryWriter writer = new BinaryWriter(stream)) fullGuide.Save(writer); } } catch (Exception ex) { DiagManager.Instance.LogError(new Exception("Error importing index at " + search + "\n", ex)); } }
public RecordsMenu() { List <MenuTextChoice> choices = new List <MenuTextChoice>(); if (DataManager.Instance.FoundRecords(PathMod.ModSavePath(DataManager.REPLAY_PATH))) { choices.Add(new MenuTextChoice(Text.FormatKey("MENU_REPLAYS_TITLE"), () => { MenuManager.Instance.AddMenu(new ReplaysMenu(), false); })); } Dictionary <int, List <RecordHeaderData> > scores = RecordHeaderData.LoadHighScores(); if (scores.Count > 0) { int minDungeon = DataManager.Instance.DataIndices[DataManager.DataType.Zone].Count; foreach (int key in scores.Keys) { if (key < minDungeon) { minDungeon = key; } } choices.Add(new MenuTextChoice(Text.FormatKey("MENU_SCORES_TITLE"), () => { MenuManager.Instance.AddMenu(new ScoreMenu(scores, minDungeon, null), false); })); } if (DataManager.Instance.Save != null) { choices.Add(new MenuTextChoice(Text.FormatKey("MENU_DEX_TITLE"), () => { MenuManager.Instance.AddMenu(new DexMenu(), false); })); choices.Add(new MenuTextChoice(Text.FormatKey("MENU_DELETE_SAVE_TITLE"), DeleteAction)); } Initialize(new Loc(16, 16), CalculateChoiceLength(choices, 72), choices.ToArray(), 0); }
public static void IndexNamedData(string dataPath) { try { EntryDataIndex fullGuide = new EntryDataIndex(); foreach (string dir in PathMod.GetModFiles(dataPath, "*" + DataManager.DATA_EXT)) { string file = Path.GetFileNameWithoutExtension(dir); int num = Convert.ToInt32(file); IEntryData data = (IEntryData)DataManager.LoadData(dir); while (fullGuide.Entries.Count <= num) { fullGuide.Entries.Add(new EntrySummary()); } fullGuide.Entries[num] = data.GenerateEntrySummary(); } using (Stream stream = new FileStream(PathMod.ModPath(dataPath + "index.idx"), FileMode.Create, FileAccess.Write, FileShare.None)) { using (BinaryWriter writer = new BinaryWriter(stream)) { IFormatter formatter = new BinaryFormatter(); formatter.Serialize(stream, fullGuide); } } } catch (Exception ex) { DiagManager.Instance.LogError(new Exception("Error importing index at " + dataPath + "\n", ex)); } }
private void awaitRescue() { //check for an AOK file from file rescue string aokPath = DataManager.FindRescueMail(PathMod.NoMod(DataManager.RESCUE_IN_PATH + DataManager.AOK_FOLDER), DataManager.Instance.Save.Rescue.SOS, DataManager.AOK_EXTENSION); if (aokPath != null) { AOKMail aok = (AOKMail)DataManager.LoadRescueMail(aokPath); SetAOK(aok); //an AOK mail has been found! MenuManager.Instance.AddMenu(MenuManager.Instance.CreateDialogue(() => loadAOK(aokPath, aok), Text.FormatKey("DLG_AWAIT_RESCUE_AOK_FOUND")), true); } else { //if there's no AOK, generate the SOS mail from the save data if (!File.Exists(PathMod.NoMod(DataManager.RESCUE_OUT_PATH + DataManager.SOS_FOLDER + DataManager.Instance.Save.UUID + DataManager.SOS_EXTENSION))) { DataManager.SaveRescueMail(PathMod.NoMod(DataManager.RESCUE_OUT_PATH + DataManager.SOS_FOLDER), DataManager.Instance.Save.Rescue.SOS, true); } List <DialogueChoice> choices = new List <DialogueChoice>(); choices.Add(new DialogueChoice(Text.FormatKey("MENU_RESCUE_GET_HELP"), contactForHelp)); choices.Add(new DialogueChoice(Text.FormatKey("MENU_RESCUE_CONFIGURE_SERVER"), configureServer)); choices.Add(new DialogueChoice(Text.FormatKey("MENU_RESCUE_OFFER_REWARD"), offerReward)); choices.Add(new DialogueChoice(Text.FormatKey("MENU_REST_QUIT"), giveUp)); choices.Add(new DialogueChoice(Text.FormatKey("MENU_CANCEL"), () => { MenuManager.Instance.RemoveMenu(); })); MenuManager.Instance.AddMenu(MenuManager.Instance.CreateMultiQuestion(Text.FormatKey("DLG_AWAIT_RESCUE_ASK"), false, choices, 0, choices.Count - 1), true); } }
public TopMenu() { bool inMod = PathMod.Mod != ""; List <MenuTextChoice> choices = new List <MenuTextChoice>(); if (DataManager.Instance.Save != null) { if (DataManager.Instance.Save.Rescue != null) { if (DataManager.Instance.Save.Rescue.SOS.RescuingTeam == null) { choices.Add(new MenuTextChoice(Text.FormatKey("MENU_TOP_RESCUE_AWAIT"), () => { MenuManager.Instance.AddMenu(new RescueMenu(), false); })); } else { choices.Add(new MenuTextChoice(Text.FormatKey("MENU_TOP_CONTINUE"), () => { Continue(DataManager.Instance.Save.Rescue.SOS); })); } } else { choices.Add(new MenuTextChoice(Text.FormatKey("MENU_TOP_CONTINUE"), () => { Continue(null); })); } if (DataManager.Instance.Save.ActiveTeam.Name != "" && !inMod) { choices.Add(new MenuTextChoice(Text.FormatKey("MENU_TOP_ROGUE"), () => { MenuManager.Instance.AddMenu(new RogueMenu(), false); })); } } else { choices.Add(new MenuTextChoice(Text.FormatKey("MENU_TOP_NEW"), () => { MainStartingMenu.StartFlow(new MonsterID(-1, -1, -1, Gender.Unknown), null, -1); })); } if (DataManager.Instance.FoundRecords(PathMod.ModSavePath(DataManager.REPLAY_PATH)) || DataManager.Instance.Save != null || RecordHeaderData.LoadHighScores().Count > 0) { choices.Add(new MenuTextChoice(Text.FormatKey("MENU_TOP_RECORD"), () => { MenuManager.Instance.AddMenu(new RecordsMenu(), false); })); } choices.Add(new MenuTextChoice(Text.FormatKey("MENU_OPTIONS_TITLE"), () => { MenuManager.Instance.AddMenu(new OptionsMenu(), false); })); if (!inMod) { string[] modsPath = Directory.GetDirectories(PathMod.MODS_PATH); if (DataManager.Instance.Save != null && modsPath.Length > 0) { choices.Add(new MenuTextChoice(Text.FormatKey("MENU_MODS_TITLE"), () => { MenuManager.Instance.AddMenu(new ModsMenu(), false); })); } } else { choices.Add(new MenuTextChoice(Text.FormatKey("MENU_MODS_EXIT"), exitMod)); } choices.Add(new MenuTextChoice(Text.FormatKey("MENU_QUIT_GAME"), exitGame)); Initialize(new Loc(16, 16), CalculateChoiceLength(choices, 72), choices.ToArray(), 0); titleMenu = new SummaryMenu(Rect.FromPoints(new Loc(Bounds.End.X + 16, 16), new Loc(GraphicsManager.ScreenWidth - 16, 16 + LINE_SPACE + GraphicsManager.MenuBG.TileHeight * 2))); MenuText title = new MenuText(Path.GetFileName(PathMod.Mod), new Loc((titleMenu.Bounds.X + titleMenu.Bounds.End.X) / 2, titleMenu.Bounds.Y + GraphicsManager.MenuBG.TileHeight), DirH.None); titleMenu.Elements.Add(title); }
public override void LoadWindowControls(StackPanel control, string parent, string name, Type type, object[] attributes, String member) { LoadLabelControl(control, name); AnimAttribute animAtt = ReflectionExt.FindAttribute <AnimAttribute>(attributes); ComboBox cbValue = new ComboBox(); cbValue.VirtualizationMode = ItemVirtualizationMode.Simple; string choice = member; List <string> items = new List <string>(); items.Add("---"); int chosenIndex = 0; string[] dirs = PathMod.GetModFiles(GraphicsManager.CONTENT_PATH + animAtt.FolderPath); for (int ii = 0; ii < dirs.Length; ii++) { string filename = Path.GetFileNameWithoutExtension(dirs[ii]); if (filename == choice) { chosenIndex = items.Count; } items.Add(filename); } var subject = new Subject <List <string> >(); cbValue.Bind(ComboBox.ItemsProperty, subject); subject.OnNext(items); cbValue.SelectedIndex = chosenIndex; control.Children.Add(cbValue); }
public bool HasAOKMail() { string parentPath = PathMod.NoMod(DataManager.RESCUE_OUT_PATH + DataManager.AOK_FOLDER); string[] files = System.IO.Directory.GetFiles(parentPath, "*" + DataManager.AOK_EXTENSION); return(files.Length > 0); }
private void completeAOK() { //if the mail worked, mark the save file as complete //and then return to the top menu //notify if it is found and working //notify if it failed to work //delete the mail either way GameState state = DataManager.Instance.LoadMainGameState(); state.Save.Rescue.SOS.RescuedBy = testingMail.RescuingTeam; state.Save.Rescue.SOS.RescuingNames = testingMail.RescuingNames; state.Save.Rescue.SOS.RescuingTeam = testingMail.RescuingProfile; state.Save.Rescue.SOS.RescuingPersonalities = testingMail.RescuingPersonalities; state.Save.Rescue.SOS.FinalStatement = testingMail.FinalStatement; DataManager.Instance.SaveGameState(state); //delete the SOS and AOK files if applicable if (File.Exists(testingPath)) { File.Delete(testingPath); } if (File.Exists(PathMod.NoMod(DataManager.RESCUE_OUT_PATH + DataManager.SOS_FOLDER + state.Save.UUID + DataManager.SOS_EXTENSION))) { File.Delete(PathMod.NoMod(DataManager.RESCUE_OUT_PATH + DataManager.SOS_FOLDER + state.Save.UUID + DataManager.SOS_EXTENSION)); } MenuManager.Instance.AddMenu(MenuManager.Instance.CreateDialogue(MenuManager.Instance.ClearMenus, Text.FormatKey("DLG_AWAIT_RESCUE_RESUME")), true); }
public static void ReserializeData(string dataPath, string ext) { foreach (string dir in PathMod.GetModFiles(dataPath, "*" + ext)) { IEntryData data = (IEntryData)DataManager.LoadData(dir, DiagManager.Instance.UpgradeBinder); DataManager.SaveData(dir, data); } }
public override void ContentChanged(int idx) { string dataPath = DataManager.DATA_PATH + DataManager.DataType.Monster.ToString() + "/"; string dir = PathMod.ModPath(dataPath + idx + DataManager.DATA_EXT); MonsterData data = DataManager.LoadData <MonsterData>(dir); Dictionary <int, FormFeatureSummary> formSummaries = computeSummary(dataPath, idx, data); FeatureData[idx] = formSummaries; }
public static void DemoData(string dataPath, string ext) { foreach (string dir in PathMod.GetModFiles(dataPath, "*" + ext)) { IEntryData data = (IEntryData)DataManager.LoadData(dir); if (!data.Released) { data = (IEntryData)ReflectionExt.CreateMinimalInstance(data.GetType()); } DataManager.SaveData(dir, data); } }
public override IEnumerator <YieldInstruction> BeginGame(int zoneID, ulong seed, DungeonStakes stakes, bool recorded, bool noRestrict) { MidAdventure = true; Stakes = stakes; if (recorded) { DataManager.Instance.BeginPlay(PathMod.NoMod(DataManager.ROGUE_PATH + DataManager.Instance.Save.StartDate + DataManager.QUICKSAVE_EXTENSION), zoneID, true, Seeded); } yield break; }
public static void RunExtraIndexing(DataManager.DataType conversionFlags) { //index extra based on triggers foreach (BaseData baseData in DataManager.Instance.UniversalData) { if ((baseData.TriggerType & conversionFlags) != DataManager.DataType.None) { baseData.ReIndex(); DataManager.SaveData(PathMod.ModPath(DataManager.MISC_PATH + baseData.FileName + DataManager.DATA_EXT), baseData); } } }
public RogueMenu() { List <MenuTextChoice> choices = new List <MenuTextChoice>(); choices.Add(new MenuTextChoice(Text.FormatKey("MENU_TOP_NEW"), () => { MenuManager.Instance.AddMenu(new RogueDestMenu(), false); })); if (Data.DataManager.Instance.FoundRecords(PathMod.NoMod(Data.DataManager.ROGUE_PATH))) { choices.Add(new MenuTextChoice(Text.FormatKey("MENU_TOP_LOAD"), () => { MenuManager.Instance.AddMenu(new QuicksaveMenu(), false); })); } choices.Add(new MenuTextChoice(Text.FormatKey("MENU_INFO"), () => { MenuManager.Instance.AddMenu(new RogueInfoMenu(), false); })); Initialize(new Loc(16, 16), CalculateChoiceLength(choices, 72), choices.ToArray(), 0); }
public void AddAOKRemark(int remarkIndex) { AOKMail aok = null; if (DataManager.Instance.Save.GeneratedAOK != null) { aok = DataManager.LoadRescueMail(PathMod.NoMod(DataManager.RESCUE_OUT_PATH + DataManager.AOK_FOLDER + DataManager.Instance.Save.GeneratedAOK)) as AOKMail; } if (aok != null) { aok.FinalStatement = remarkIndex; DataManager.SaveRescueMail(DataManager.Instance.Save.GeneratedAOK, aok); } }
public override void ReIndex() { FeatureData.Clear(); string dataPath = DataManager.DATA_PATH + DataManager.DataType.Monster.ToString() + "/"; foreach (string dir in PathMod.GetModFiles(dataPath, "*" + DataManager.DATA_EXT)) { string file = Path.GetFileNameWithoutExtension(dir); int num = Convert.ToInt32(file); MonsterData data = DataManager.LoadData <MonsterData>(dir); Dictionary <int, FormFeatureSummary> formSummaries = computeSummary(dataPath, num, data); FeatureData[num] = formSummaries; } }
public ReplaysMenu() { List <RecordHeaderData> records = DataManager.Instance.GetRecordHeaders(PathMod.ModSavePath(DataManager.REPLAY_PATH), DataManager.REPLAY_EXTENSION); List <MenuChoice> flatChoices = new List <MenuChoice>(); foreach (RecordHeaderData record in records) { string fileName = Path.GetFileNameWithoutExtension(record.Path); if (record.Name != "") { string rogueSign = ""; if (record.Result == GameProgress.ResultType.Escaped || record.Result == GameProgress.ResultType.Cleared) { rogueSign += "\uE10A"; } else { rogueSign += "\uE10B"; } if (record.IsRogue) { if (record.IsSeeded) { rogueSign += "\uE10D"; } else { rogueSign += "\uE10C"; } } //also include an indicator of the floors traversed, if possible flatChoices.Add(new MenuTextChoice(rogueSign + record.Name + ": " + record.LocationString, () => { choose(record.Path); })); } else { flatChoices.Add(new MenuTextChoice(fileName, () => { choose(record.Path); })); } } List <MenuChoice[]> choices = SortIntoPages(flatChoices, SLOTS_PER_PAGE); //for the summary menu, include team, date, filename, location (string), seed, indication of rogue and seeded runs //if it can't be read, just include the filename Initialize(new Loc(0, 0), 240, Text.FormatKey("MENU_REPLAYS_TITLE"), choices.ToArray(), 0, 0, SLOTS_PER_PAGE); }
public override void ReIndex() { RarityMap.Clear(); string dataPath = DataManager.DATA_PATH + DataManager.DataType.Item.ToString() + "/"; foreach (string dir in PathMod.GetModFiles(dataPath, "*" + DataManager.DATA_EXT)) { string file = Path.GetFileNameWithoutExtension(dir); int num = Convert.ToInt32(file); ItemData data = DataManager.LoadData <ItemData>(dir); if (data.Released) { computeSummary(num, data); } } }
static void Main() { if (OperatingSystem.IsWindows()) { enlargeConsole(); } string[] args = Environment.GetCommandLineArgs(); PathMod.InitExePath(args[0]); DiagManager.InitInstance(); for (int ii = 1; ii < args.Length; ii++) { if (args[ii] == "-asset") { PathMod.ASSET_PATH = System.IO.Path.GetFullPath(PathMod.ExePath + args[ii + 1]); ii++; } else if (args[ii] == "-raw") { PathMod.DEV_PATH = System.IO.Path.GetFullPath(PathMod.ExePath + args[ii + 1]); ii++; } } GraphicsManager.InitParams(); Text.Init(); Text.SetCultureCode("en"); LuaEngine.InitInstance(); DataManager.InitInstance(); DataManager.Instance.InitData(); #if DEBUG GenContextDebug.OnInit += ExampleDebug.Init; GenContextDebug.OnStep += ExampleDebug.OnStep; GenContextDebug.OnStepIn += ExampleDebug.StepIn; GenContextDebug.OnStepOut += ExampleDebug.StepOut; #endif Example.Run(); Console.Clear(); Console.WriteLine("Bye."); Console.ReadKey(); }
private void DeleteAction() { if (File.Exists(recordDir)) { File.Delete(recordDir); } MenuManager.Instance.RemoveMenu(); if (DataManager.Instance.FoundRecords(PathMod.NoMod(DataManager.ROGUE_PATH))) { MenuManager.Instance.ReplaceMenu(new QuicksaveMenu()); } else { MenuManager.Instance.RemoveMenu(); MenuManager.Instance.ReplaceMenu(new TopMenu()); } }
private void DeleteAction() { if (File.Exists(recordDir)) { File.Delete(recordDir); } MenuManager.Instance.RemoveMenu(); if (DataManager.Instance.FoundRecords(PathMod.ModSavePath(DataManager.REPLAY_PATH))) { MenuManager.Instance.ReplaceMenu(new ReplaysMenu()); } else { MenuManager.Instance.RemoveMenu(); MenuManager.Instance.ReplaceMenu(new TopMenu()); } }
private void DeleteAction(string fileName) { File.Delete(fileName); MenuManager.Instance.RemoveMenu(); string parentPath = sosMode ? PathMod.NoMod(DataManager.RESCUE_IN_PATH + DataManager.SOS_FOLDER) : PathMod.NoMod(DataManager.RESCUE_OUT_PATH + DataManager.AOK_FOLDER); files = Directory.GetFiles(parentPath, "*" + (sosMode ? DataManager.SOS_EXTENSION : DataManager.AOK_EXTENSION)); if (files.Length > 0) { MenuManager.Instance.ReplaceMenu(new MailMenu(sosMode, action)); } else { MenuManager.Instance.RemoveMenu(); } }
public static Bitmap GetTile(TileFrame tileTex) { long tilePos = GraphicsManager.TileIndex.GetPosition(tileTex.Sheet, tileTex.TexLoc); TileAddr addr = new TileAddr(tilePos, tileTex.Sheet); Bitmap sheet; if (tileCache.TryGetValue(addr, out sheet)) { return(sheet); } if (tilePos > 0) { try { using (FileStream stream = new FileStream(PathMod.ModPath(String.Format(GraphicsManager.TILE_PATTERN, tileTex.Sheet)), FileMode.Open, FileAccess.Read, FileShare.Read)) { // Seek to the location of the tile stream.Seek(tilePos, SeekOrigin.Begin); using (BinaryReader reader = new BinaryReader(stream)) { //usually handled by basesheet, cheat a little here long length = reader.ReadInt64(); byte[] tileBytes = reader.ReadBytes((int)length); using (MemoryStream tileStream = new MemoryStream(tileBytes)) sheet = new Bitmap(tileStream); } } tileCache.Add(addr, sheet); return(sheet); } catch (Exception ex) { DiagManager.Instance.LogError(new Exception("Error retrieving tile " + tileTex.TexLoc.X + ", " + tileTex.TexLoc.Y + " from Tileset #" + tileTex.Sheet + "\n", ex)); } } return(null); }
public override IEnumerator <YieldInstruction> BeginGame(int zoneID, ulong seed, DungeonStakes stakes, bool recorded, bool noRestrict) { ZoneData zone = DataManager.Instance.GetZone(zoneID); //restrict team size/bag size/etc if (!noRestrict) { yield return(CoroutineManager.Instance.StartCoroutine(RestrictTeam(zone, false))); } MidAdventure = true; Stakes = stakes; //create a copy (from save and load) of the current state and mark it with loss DataManager.Instance.SaveMainGameState(); GameState state = DataManager.Instance.LoadMainGameState(); if (state != null) { if (Stakes == DungeonStakes.Risk) { LossPenalty(state.Save); } DataManager.Instance.SaveGameState(state); } //set everyone's levels and mark them for backreferral if (!noRestrict) { yield return(CoroutineManager.Instance.StartCoroutine(RestrictLevel(zone, false))); } RestartLogs(seed); RescuesLeft = zone.Rescues; if (recorded) { DataManager.Instance.BeginPlay(PathMod.ModSavePath(DataManager.SAVE_PATH, DataManager.QUICKSAVE_FILE_PATH), zoneID, false, false); } }
public override void ContentChanged(int idx) { //remove the index from its previous locations foreach (Dictionary <int, List <int> > rarityTable in RarityMap.Values) { foreach (List <int> items in rarityTable.Values) { if (items.Remove(idx)) { break; } } } //Add it to its new locations string dataPath = DataManager.DATA_PATH + DataManager.DataType.Item.ToString() + "/"; string dir = PathMod.ModPath(dataPath + idx + DataManager.DATA_EXT); ItemData data = DataManager.LoadData <ItemData>(dir); computeSummary(idx, data); }
public static void ReserializeBase() { { string dir = PathMod.ModPath(DataManager.DATA_PATH + "Universal.bin"); object data = DataManager.LoadData(dir, DiagManager.Instance.UpgradeBinder); DataManager.SaveData(dir, data); } string editPath = Path.Combine(PathMod.RESOURCE_PATH, "Extensions"); foreach (string dir in Directory.GetFiles(editPath, "*.op")) { object data = DataManager.LoadData(dir, DiagManager.Instance.UpgradeBinder); DataManager.SaveData(dir, data); } foreach (string dir in PathMod.GetModFiles(DataManager.FX_PATH, "*.fx")) { object data = DataManager.LoadData(dir, DiagManager.Instance.UpgradeBinder); DataManager.SaveData(dir, data); } }
public static void Continue(SOSMail rescueMail) { //check for presence of a main save-quicksave ReplayData replay = null; string recordDir = PathMod.ModSavePath(DataManager.SAVE_PATH, DataManager.QUICKSAVE_FILE_PATH); if (File.Exists(recordDir)) { replay = DataManager.Instance.LoadReplay(recordDir, true); if (replay == null) { cannotRead(recordDir); return; } } if (replay != null) { MenuManager.Instance.ClearMenus(); GameManager.Instance.SceneOutcome = continueReplay(replay, rescueMail); return; } //then, we should load a main save instead GameState state = DataManager.Instance.LoadMainGameState(); if (state == null) { cannotRead(DataManager.SAVE_PATH + DataManager.SAVE_FILE_PATH); return; } if (state.Save.Rescue != null) { state.Save.Rescue = null; DataManager.Instance.SaveGameState(state); } MenuManager.Instance.ClearMenus(); GameManager.Instance.SceneOutcome = continueMain(state); }
public GroundTabDecorationsViewModel() { Layers = new AnimLayerBoxViewModel(DiagManager.Instance.DevEditor.GroundEditor.Edits); Layers.SelectedLayerChanged += Layers_SelectedLayerChanged; SelectedEntity = new GroundAnim(); Directions = new ObservableCollection <string>(); foreach (Dir8 dir in DirExt.VALID_DIR8) { Directions.Add(dir.ToLocal()); } ObjectAnims = new ObservableCollection <string>(); string[] dirs = PathMod.GetModFiles(GraphicsManager.CONTENT_PATH + "Object/"); for (int ii = 0; ii < dirs.Length; ii++) { string filename = Path.GetFileNameWithoutExtension(dirs[ii]); ObjectAnims.Add(filename); } ChosenObjectAnim = 0; FrameLength = 1; }
public QuicksaveMenu() { List <RecordHeaderData> records = DataManager.Instance.GetRecordHeaders(PathMod.NoMod(DataManager.ROGUE_PATH), DataManager.QUICKSAVE_EXTENSION); List <MenuChoice> flatChoices = new List <MenuChoice>(); foreach (RecordHeaderData record in records) { string fileName = Path.GetFileNameWithoutExtension(record.Path); if (record.Name != "") { LocalText zoneName = DataManager.Instance.DataIndices[DataManager.DataType.Zone].Entries[record.Zone].Name; string rogueSign = ""; if (record.IsRogue) { if (record.IsSeeded) { rogueSign = "\uE10D"; } else { rogueSign = "\uE10C"; } } //also include an indicator of the floors traversed, if possible flatChoices.Add(new MenuTextChoice(rogueSign + record.Name + ": " + zoneName.ToLocal(), () => { choose(record.Path); })); } else { flatChoices.Add(new MenuTextChoice(fileName, () => { choose(record.Path); })); } } List <MenuChoice[]> choices = SortIntoPages(flatChoices, SLOTS_PER_PAGE); Initialize(new Loc(0, 0), 240, Text.FormatKey("MENU_SAVE_TITLE"), choices.ToArray(), 0, 0, SLOTS_PER_PAGE); }