-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
312 additions
and
229 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Media; | ||
|
||
using TriviaMurderPartyModder.Data; | ||
using TriviaMurderPartyModder.Dialogs; | ||
using TriviaMurderPartyModder.Files; | ||
using TriviaMurderPartyModder.Properties; | ||
|
||
namespace TriviaMurderPartyModder { | ||
public partial class MainWindow { | ||
void SelectFinalQuestion(FinalRounder question) { | ||
selectedTopic = question; | ||
topicId.Text = question.ID.ToString(); | ||
topic.Text = question.Text; | ||
} | ||
|
||
void DeselectChoice() { | ||
selectedChoice = null; | ||
choiceCorrect.IsChecked = false; | ||
choiceAnswer.Text = string.Empty; | ||
} | ||
|
||
void FinalRoundSelection(object sender, RoutedPropertyChangedEventArgs<object> e) { | ||
TreeViewItem selected = (TreeViewItem)((TreeView)sender).SelectedItem; | ||
if (selected is FinalRounder topic) { | ||
DeselectChoice(); | ||
SelectFinalQuestion(topic); | ||
} else if (selected != null) { | ||
selectedChoice = (FinalRounderChoice)selected; | ||
choiceCorrect.IsChecked = selectedChoice.Correct; | ||
choiceAnswer.Text = selectedChoice.Text; | ||
SelectFinalQuestion((FinalRounder)selected.Parent); | ||
} | ||
} | ||
|
||
void AddTopic(object _, RoutedEventArgs e) { | ||
FinalRounder newTopic = new FinalRounder(0, "New topic"); | ||
finalRoundList.Add(newTopic); | ||
newTopic.IsSelected = true; | ||
topic.SelectAll(); | ||
topic.Focus(); | ||
} | ||
|
||
void AddTopicChoice(object _, RoutedEventArgs e) { | ||
if (selectedTopic != null) { | ||
FinalRounderChoice choice = new FinalRounderChoice(false, "New choice"); | ||
selectedTopic.Items.Add(choice); | ||
selectedTopic.IsExpanded = true; | ||
choice.IsSelected = true; | ||
choiceAnswer.SelectAll(); | ||
choiceAnswer.Focus(); | ||
finalRoundList.Unsaved = true; | ||
} | ||
} | ||
|
||
void AddTopicChoices(object _, RoutedEventArgs e) { | ||
if (selectedTopic != null) { | ||
BulkOption form = new BulkOption(); | ||
bool? result = form.ShowDialog(); | ||
if (result.HasValue && result.Value) { | ||
selectedTopic.IsExpanded = true; | ||
finalRoundList.Unsaved = true; | ||
string[] correct = form.CorrectValues, incorrect = form.IncorrectValues; | ||
for (int i = 0; i < correct.Length; ++i) { | ||
FinalRounderChoice choice = new FinalRounderChoice(true, correct[i]); | ||
selectedTopic.Items.Add(choice); | ||
} | ||
for (int i = 0; i < incorrect.Length; ++i) { | ||
FinalRounderChoice choice = new FinalRounderChoice(false, incorrect[i]); | ||
selectedTopic.Items.Add(choice); | ||
} | ||
} | ||
} | ||
} | ||
|
||
void AddTopicAudio(object _, RoutedEventArgs e) => | ||
selectedTopic.ImportTopicAudio(finalRoundList.DataFolderPath, LoadAudio(questions, questionList)); | ||
|
||
void TopicIDChange(object sender, TextChangedEventArgs e) { | ||
TextBox box = (TextBox)sender; | ||
if (!int.TryParse(box.Text, out int id)) { | ||
box.Background = new SolidColorBrush(Color.FromRgb(255, 0, 0)); | ||
return; | ||
} | ||
box.Background = new SolidColorBrush(Color.FromRgb(255, 255, 255)); | ||
if (selectedTopic != null) { | ||
selectedTopic.ID = id; | ||
finalRoundList.Unsaved = true; | ||
} | ||
} | ||
|
||
void TopicChange(object sender, TextChangedEventArgs e) { | ||
if (selectedTopic != null) { | ||
selectedTopic.Text = ((TextBox)sender).Text; | ||
finalRoundList.Unsaved = true; | ||
} | ||
} | ||
|
||
void RemoveTopic(object _, RoutedEventArgs e) { | ||
if (selectedTopic != null) { | ||
DeselectChoice(); | ||
finalRoundList.Remove(selectedTopic); | ||
} | ||
} | ||
|
||
void ChoiceCorrect(object sender, RoutedEventArgs e) { | ||
if (selectedChoice != null) { | ||
selectedChoice.Correct = ((CheckBox)sender).IsChecked.Value; | ||
finalRoundList.Unsaved = true; | ||
} | ||
} | ||
|
||
void ChoiceText(object sender, TextChangedEventArgs e) { | ||
if (selectedChoice != null) { | ||
selectedChoice.Text = ((TextBox)sender).Text; | ||
finalRoundList.Unsaved = true; | ||
} | ||
} | ||
|
||
void RemoveChoice(object _, RoutedEventArgs e) { | ||
if (selectedChoice != null) { | ||
selectedTopic.Items.Remove(selectedChoice); | ||
DeselectChoice(); | ||
finalRoundList.Unsaved = true; | ||
} | ||
} | ||
|
||
void FinalRoundImport(object _, RoutedEventArgs e) => finalRoundList.Import(true); | ||
void FinalRoundImportLastSave(object _, RoutedEventArgs e) => | ||
finalRoundList.ImportFrom(Settings.Default.lastFinalRound); | ||
void FinalRoundMerge(object _, RoutedEventArgs e) => finalRoundList.Import(false); | ||
void FinalRoundSave(object _, RoutedEventArgs e) => finalRoundList.Save(); | ||
void FinalRoundSaveAs(object _, RoutedEventArgs e) => finalRoundList.SaveAs(); | ||
|
||
void FinalRoundReleaseCheck(object _, RoutedEventArgs e) { | ||
string finalRoundFileDir = null; | ||
if (finalRoundList.FileName != null) | ||
finalRoundFileDir = finalRoundList.DataFolderPath; | ||
for (int i = 0, end = finalRoundList.Count; i < end; ++i) { | ||
for (int j = i + 1; j < end; ++j) { | ||
if (finalRoundList[i].ID == finalRoundList[j].ID) { | ||
FinalRounders.FinalRoundIssue(string.Format(Properties.Resources.multipleIDs, finalRoundList[i].ID)); | ||
return; | ||
} | ||
} | ||
if (finalRoundList[i].Items.Count < 3) { | ||
FinalRounders.FinalRoundIssue(string.Format("{0} has less than 3 choices.", finalRoundList[i].Text)); | ||
return; | ||
} | ||
if (finalRoundList.FileName != null && !Parsing.CheckAudio(finalRoundFileDir, finalRoundList[i].ID)) { | ||
FinalRounders.FinalRoundIssue(string.Format(Properties.Resources.missingAudio, finalRoundList[i].ID)); | ||
return; | ||
} | ||
} | ||
MessageBox.Show(Properties.Resources.checkSuccess, Properties.Resources.checkResult); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
|
||
using TriviaMurderPartyModder.Data; | ||
using TriviaMurderPartyModder.Properties; | ||
|
||
namespace TriviaMurderPartyModder { | ||
public partial class MainWindow { | ||
void ImportQuestionAudio(AudioType type) { | ||
if (!(questions.SelectedItem is Question question)) { | ||
return; | ||
} | ||
question.ImportAudio(questionList.DataFolderPath, type, LoadAudio(questions, questionList)); | ||
hasIntro.IsChecked = question.GetIntroAudio(questionList.DataFolderPath); | ||
} | ||
|
||
void RemoveQuestionAudio(AudioType type) { | ||
if (!(questions.SelectedItem is Question question)) { | ||
return; | ||
} | ||
question.RemoveAudio(questionList.DataFolderPath, type); | ||
hasIntro.IsChecked = question.GetIntroAudio(questionList.DataFolderPath); | ||
} | ||
|
||
void QuestionSelected(object _, SelectionChangedEventArgs e) { | ||
if (!(questions.SelectedItem is Question question)) { | ||
return; | ||
} | ||
hasIntro.IsChecked = question.GetIntroAudio(questionList.DataFolderPath); | ||
} | ||
|
||
void Questions_CellEditEnding(object _, DataGridCellEditEndingEventArgs e) => questionList.Unsaved = true; | ||
void QuestionImport(object _, RoutedEventArgs e) => questionList.Import(true); | ||
void QuestionImportLastSave(object _, RoutedEventArgs e) => questionList.ImportFrom(Settings.Default.lastQuestion); | ||
void QuestionMerge(object _, RoutedEventArgs e) => questionList.Import(false); | ||
void QuestionSave(object _, RoutedEventArgs e) => questionList.Save(); | ||
void QuestionSaveAs(object _, RoutedEventArgs e) => questionList.SaveAs(); | ||
void QuestionReleaseCheck(object _, RoutedEventArgs e) => ReleaseCheck(questionList); | ||
void QuestionEqualize(object _, RoutedEventArgs e) => questionList.Equalize(); | ||
void QuestionAudio(object _, RoutedEventArgs e) => ImportQuestionAudio(AudioType.Q); | ||
void QuestionIntroAudio(object _, RoutedEventArgs e) => ImportQuestionAudio(AudioType.Intro); | ||
void RemoveIntroAudio(object _, RoutedEventArgs e) => RemoveQuestionAudio(AudioType.Intro); | ||
void QuestionRemove(object _, RoutedEventArgs e) => RemoveElement(questions, questionList); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
|
||
using TriviaMurderPartyModder.Data; | ||
using TriviaMurderPartyModder.Properties; | ||
|
||
namespace TriviaMurderPartyModder { | ||
public partial class MainWindow { | ||
void WorstDrawings_CellEditEnding(object _, DataGridCellEditEndingEventArgs e) => worstDrawingList.Unsaved = true; | ||
void WorstDrawingImport(object _, RoutedEventArgs e) => worstDrawingList.Import(true); | ||
void WorstDrawingImportLastSave(object _, RoutedEventArgs e) => | ||
worstDrawingList.ImportFrom(Settings.Default.lastWorstDrawing); | ||
void WorstDrawingMerge(object _, RoutedEventArgs e) => worstDrawingList.Import(false); | ||
void WorstDrawingSave(object _, RoutedEventArgs e) => worstDrawingList.Save(); | ||
void WorstDrawingSaveAs(object _, RoutedEventArgs e) => worstDrawingList.SaveAs(); | ||
void WorstDrawingReleaseCheck(object _, RoutedEventArgs e) => ReleaseCheck(worstDrawingList); | ||
void WorstDrawingAudio(object _, RoutedEventArgs e) => | ||
((WorstDrawing)worstDrawings.SelectedItem).ImportAudio(worstDrawingList.DataFolderPath, | ||
LoadAudio(questions, questionList)); | ||
void WorstDrawingRemove(object _, RoutedEventArgs e) => RemoveElement(worstDrawings, worstDrawingList); | ||
} | ||
} |
Oops, something went wrong.