private void FightButton_Click(object sender, RoutedEventArgs e) { RollInitiativeWindow window = new RollInitiativeWindow(); window.DataContext = GlobalContext.Context.FightContext.FightersList; window.ShowCentered(); if (window.Cancelled == false) { GlobalContext.Context.FightContext.FightersList.SetTurnOrders(); console.Reset(); MainFightWindow fightWindow = new MainFightWindow(); fightWindow.DataContext = GlobalContext.Context; fightWindow.ShowCentered(); // Clean up after a Fight fightWindow.UnregisterAllChildren(); foreach (Character character in GlobalContext.Context.FightContext.FightersList.Elements.OfType <Character>()) { character.GetOutOfFight(); } GlobalContext.Context.FightContext.Reset(); GenericList <Character> .SaveAll <Character>(GlobalContext.Context.CharacterList); //Global.Context.CharacterList.SaveAll(); } }
private void AddToFightButton_Click(object sender, RoutedEventArgs e) { PlayableEntity currently_playing = GlobalContext.Context.FightContext.CurrentlyPlaying; AddToFightWindow window = new AddToFightWindow(); window.ShowCentered(); RollInitiativeWindow rollInitiativeWindow = new RollInitiativeWindow(); rollInitiativeWindow.DataContext = GlobalContext.Context.FightContext.FightersList; rollInitiativeWindow.ShowCentered(); GlobalContext.Context.FightContext.FightersList.SetTurnOrdersMiddleFight(); for (int i = 0; i != GlobalContext.Context.FightContext.FightersList.Elements.Count; i++) { if (GlobalContext.Context.FightContext.FightersList.Elements[i] == currently_playing) { GlobalContext.Context.FightContext.TurnIndex = i; } } }