예제 #1
0
        public void RebuildItems()
        {
            List <SaveState> saveStates = new List <SaveState>();

            string[] files = Directory.GetFiles(SaveManager.SaveFilePath, "*.svf", SearchOption.TopDirectoryOnly);
            foreach (string file in files)
            {
                FileStream      fs = new FileStream(file, FileMode.Open);
                BinaryFormatter bf = new BinaryFormatter();
                saveStates.Add((SaveState)bf.Deserialize(fs));
                fs.Close();
            }
            slot1 = saveStates.Count == 0 || String.IsNullOrEmpty(saveStates[0].PlayerName) ? "---" : saveStates[0].PlayerName;
            slot2 = saveStates.Count <= 1 || String.IsNullOrEmpty(saveStates[1].PlayerName) ? "---" : saveStates[1].PlayerName;
            slot3 = saveStates.Count <= 2 || String.IsNullOrEmpty(saveStates[2].PlayerName) ? "---" : saveStates[2].PlayerName;

            menuItems.Clear();
            menuItems.Add(new MenuItem(slot1, fontName, true));
            menuItems.Add(new MenuItem(slot2, fontName));
            menuItems.Add(new MenuItem(slot3, fontName));
            menuItems.Add(new MenuItem(back, fontName));

            SetPositions();

            menuItems[3].ItemPosition += itemOffset;

            menuLabels.Clear();
            menuLabels.Add(new MenuLabel(select, fontName));
            menuLabels[0].Position = ShortcutProvider.ScreenCenter - ShortcutProvider.GetFontCenter(fontName, select) - 3 * itemOffset;
        }
예제 #2
0
 protected void SetPositions()
 {
     for (int i = 0; i < menuItems.Count; ++i)
     {
         menuItems[i].ItemPosition = ShortcutProvider.ScreenCenter - ShortcutProvider.GetFontCenter(fontName, menuItems[i].ItemName) + (i - 2) * itemOffset;
     }
 }
예제 #3
0
        public NewGameMenu()
        {
            menuLabels.Add(new MenuLabel(name, fontName));
            menuItems.Add(new MenuItem(ok, fontName, false));
            menuItems.Add(new MenuItem(back, fontName, true));

            menuLabels[0].Position    = ShortcutProvider.ScreenCenter - ShortcutProvider.GetFontCenter(fontName, menuItems[0].ItemName) + new Vector2(-200, 0);
            menuItems[0].ItemPosition = ShortcutProvider.ScreenCenter - ShortcutProvider.GetFontCenter(fontName, menuItems[1].ItemName) + 2 * itemOffset;
            menuItems[1].ItemPosition = ShortcutProvider.ScreenCenter - ShortcutProvider.GetFontCenter(fontName, menuItems[1].ItemName) + 3 * itemOffset;

            EventInput.EventInput.Initialize(VariableProvider.Game.Window);
            EventInput.EventInput.CharEntered += new EventInput.CharEnteredHandler(CharacterEntered);
            TextBuffer = "";

            confirmDialog = new ConfirmOverlay(this);
        }
예제 #4
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            base.Draw(spriteBatch);

            spriteBatch.DrawString(
                FontProvider.GetFont(fontName),
                confirmText + GameVariableProvider.SaveState.PlayerName + "?",
                ShortcutProvider.Vector2Point(menuItems[0].ItemPosition - itemOffset - new Vector2(ShortcutProvider.GetFontCenter(fontName, confirmText + GameVariableProvider.SaveState.PlayerName + "?").X, 0)),
                Color.White,
                0,
                Vector2.Zero,
                1,
                SpriteEffects.None,
                .2f);
        }