Skip to content

Commit

Permalink
Updated to version 2.3.0
Browse files Browse the repository at this point in the history
WARNING: Code is still stupid and bad. Just added a fields list to help out some folks
-----
Added a dynamic Field list that you can add stuff to.
Set defaults in the Start Node per conversation.
Defaults will be added as nodes are viewed and will be added for the entire conversation on save.
Defaults can be overwritten per node.
  • Loading branch information
digiwombat committed Jan 11, 2023
1 parent 0118207 commit 7aebb0f
Show file tree
Hide file tree
Showing 12 changed files with 243 additions and 17 deletions.
2 changes: 1 addition & 1 deletion GraphLayout/GraphLayout/GraphLayout.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>GraphLayout</RootNamespace>
<AssemblyName>GraphLayout</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<FileUpgradeFlags>
</FileUpgradeFlags>
Expand Down
2 changes: 1 addition & 1 deletion SetupScript.iss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "TalkerMaker Deluxe"
#define MyAppVersion "2.2.2"
#define MyAppVersion "2.3.0"
#define MyAppPublisher "Barky Seal Games"
#define MyAppURL "http://randallfitzgerald.net"
#define MyAppExeName "TalkerMakerDeluxe.exe"
Expand Down
100 changes: 98 additions & 2 deletions TalkerMakerDeluxe/EditorWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -1121,6 +1121,8 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0" Margin="4,0,4,4" HorizontalAlignment="Left" VerticalAlignment="Top" FontWeight="Bold">ID</Label>
<TextBlock Grid.Row="0" Grid.Column="1" Margin="4,0,4,4" TextAlignment="Left" Text="{Binding SelectedItem.ID, ElementName=lstConversations}" Name="txtConvoID" VerticalAlignment="Top"/>
Expand Down Expand Up @@ -1155,11 +1157,57 @@

<Label Grid.Row="5" Grid.Column="0" Margin="4,0,4,4" HorizontalAlignment="Left" VerticalAlignment="Top" FontWeight="Bold">Description</Label>
<TextBox Grid.Row="5" Grid.Column="1" Margin="4,0,4,4" SpellCheck.IsEnabled="True" TextWrapping="Wrap" MinHeight="50" MaxHeight="200" VerticalScrollBarVisibility="Auto" Text="{Binding SelectedItem.description, ElementName=lstConversations}" Name="txtConvoDescription" />
<Label Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="2" FontSize="12" Margin="4,0,4,4" BorderBrush="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" VerticalAlignment="Top" FontWeight="Bold" HorizontalAlignment="Left">Default Fields
</Label>
<StackPanel Orientation="Horizontal" Grid.Row="6" Grid.Column="1" Margin="4,0,4,4" HorizontalAlignment="Right" VerticalAlignment="Center" Visibility="Hidden">
<Button Width="20" Height="20" x:Name="btnAddField" Click="btnAddField_Click" Background="#FF2A2A2A" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}">+</Button>
</StackPanel>
<DataGrid x:Name="dgFields" AutoGenerateColumns="False" Grid.Row="7" Grid.ColumnSpan="2" Grid.Column="0" DataContext="{Binding ElementName=EditorWin}" ItemsSource="{Binding selectedEntry.fields}" HorizontalContentAlignment="Stretch" MinHeight="100" VerticalContentAlignment="Stretch" SelectionMode="Single" CanUserAddRows="True" CanUserDeleteRows="True" Background="#FF2A2A2A" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}">
<DataGrid.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}" Color="#333333"/>
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}" Color="#eeeeee"/>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#555555"/>
</DataGrid.Resources>
<DataGrid.ColumnHeaderStyle>
<Style TargetType="DataGridColumnHeader">
<Setter Property="Background" Value="#FF222222"/>
<Setter Property="Foreground" Value="White"/>
</Style>
</DataGrid.ColumnHeaderStyle>

<DataGrid.Columns>
<DataGridTextColumn Width="80" Header="Name" Binding="{Binding name}"/>
<DataGridTextColumn Width="40" Header="Type" Binding="{Binding type}" />
<DataGridTextColumn Width="*" Header="Value" Binding="{Binding value}"/>
<DataGridTemplateColumn Header="Del" Width="30">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ContentControl Button.Click="btnFieldDelete_Click">
<ContentControl.Resources>
<Button x:Key="btn" Content="Del" Click="btnFieldDelete_Click" Background="#FF2A2A2A" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
</ContentControl.Resources>
<ContentControl.Style>
<Style TargetType="ContentControl">
<Setter Property="Content" Value="{StaticResource btn}" />
<Style.Triggers>
<DataTrigger Binding="{Binding DataContext, RelativeSource={RelativeSource AncestorType=DataGridRow}}" Value="{x:Static CollectionView.NewItemPlaceholder}">
<Setter Property="Visibility" Value="Hidden">
</Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</ContentControl.Style>
</ContentControl>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
</TabItem>
<TabItem x:Name="tabEntry" Header="Entry" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<Grid x:Name="gridDialogueEntry">
<Grid x:Name="gridDialogueEntry" VerticalAlignment="Top">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
Expand Down Expand Up @@ -1232,6 +1280,8 @@
</Style>
</RowDefinition.Style>
</RowDefinition>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0" FontSize="12" Margin="4,0,4,4" VerticalAlignment="Top" FontWeight="Bold" HorizontalAlignment="Left">ID</Label>
<TextBlock Grid.Row="0" Grid.Column="1" Margin="4,0,4,4" Text="{Binding ID}" TextAlignment="Left" Name="txtDialogueID"/>
Expand Down Expand Up @@ -1411,9 +1461,55 @@
</CheckBox.BorderBrush>
</CheckBox>
</StackPanel>
<Label Grid.Row="11" Grid.Column="0" Grid.ColumnSpan="2" FontSize="12" Margin="4,0,4,4" BorderBrush="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" VerticalAlignment="Top" FontWeight="Bold" HorizontalAlignment="Left">Fields</Label>
<StackPanel Orientation="Horizontal" Grid.Row="11" Grid.Column="1" Margin="4,0,4,4" HorizontalAlignment="Right" VerticalAlignment="Center" Visibility="Hidden">
<Button Width="20" Height="20" x:Name="btnAddDefaultField" Click="btnAddDefaultField_Click" Background="#FF2A2A2A" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}">+</Button>
</StackPanel>
<DataGrid x:Name="dgDefaultFields" AutoGenerateColumns="False" Grid.Row="12" Grid.ColumnSpan="2" Grid.Column="0" DataContext="{Binding ElementName=EditorWin}" ItemsSource="{Binding selectedEntry.fields}" HorizontalContentAlignment="Stretch" MinHeight="100" VerticalContentAlignment="Stretch" SelectionMode="Single" CanUserAddRows="True" CanUserDeleteRows="True" Background="#FF2A2A2A" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}">
<DataGrid.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}" Color="#333333"/>
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}" Color="#eeeeee"/>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#555555"/>
</DataGrid.Resources>
<DataGrid.ColumnHeaderStyle>
<Style TargetType="DataGridColumnHeader">
<Setter Property="Background" Value="#FF222222"/>
<Setter Property="Foreground" Value="White"/>
</Style>
</DataGrid.ColumnHeaderStyle>

<DataGrid.Columns>
<DataGridTextColumn Width="80" Header="Name" Binding="{Binding name}"/>
<DataGridTextColumn Width="40" Header="Type" Binding="{Binding type}" />
<DataGridTextColumn Width="*" Header="Value" Binding="{Binding value}"/>
<DataGridTemplateColumn Header="Del" Width="30">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ContentControl Button.Click="btnDefaultFieldDelete_Click">
<ContentControl.Resources>
<Button x:Key="btn" Content="Del" Click="btnDefaultFieldDelete_Click" Background="#FF2A2A2A" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
</ContentControl.Resources>
<ContentControl.Style>
<Style TargetType="ContentControl">
<Setter Property="Content" Value="{StaticResource btn}" />
<Style.Triggers>
<DataTrigger Binding="{Binding DataContext, RelativeSource={RelativeSource AncestorType=DataGridRow}}" Value="{x:Static CollectionView.NewItemPlaceholder}">
<Setter Property="Visibility" Value="Hidden">
</Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</ContentControl.Style>
</ContentControl>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
</ScrollViewer>
</TabItem>

</TabControl>
</Grid>
</Border>
Expand Down Expand Up @@ -1476,7 +1572,7 @@
</Button>
</StatusBarItem>
<StatusBarItem HorizontalAlignment="Right" Margin="0,0,16,0">
<TextBlock Text="v2.2.2" />
<TextBlock Text="v2.3.0" />
</StatusBarItem>
</StatusBar>
<StackPanel Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Bottom" Width="225">
Expand Down
109 changes: 105 additions & 4 deletions TalkerMakerDeluxe/EditorWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using System.Windows.Threading;
using System.Xml;
using System.Windows.Shapes;
using System.Windows.Data;

namespace TalkerMakerDeluxe
{
Expand Down Expand Up @@ -161,7 +162,7 @@ void PrepareProject()
theDatabase.Version = "1.0.0";
theDatabase.Actors.Add(new Actor() { ID = 0, name = "Player", isPlayer = true });
theDatabase.Conversations.Add(new Conversation() { ID = 0, title = "New Conversation", description = "A new conversation", actorID = 0, conversantID = 0, actor = theDatabase.Actors[0], conversant = theDatabase.Actors[0] });
theDatabase.Conversations[0].DialogEntries.Add(new DialogueEntry() { ID = 0, IsRoot = true, title = "START", actorID = 0, actor = theDatabase.Actors[0], conversantID = 0, conversant = theDatabase.Actors[0], NodeColor = "Normal" });
theDatabase.Conversations[0].DialogEntries.Add(new DialogueEntry() { ID = 0, IsRoot = true, title = "START", actorID = 0, actor = theDatabase.Actors[0], conversantID = 0, conversant = theDatabase.Actors[0], NodeColor = "Normal", fields = new List<DialogueEntry.Field>() });
theDatabase.Items.Add(new Item() { ID = 0, name = "New Item" });
theDatabase.Variables.Add(new UserVariable() { ID = 0, name = "New Variable", type = "Boolean", initialValue = "false" });
theDatabase.Locations.Add(new Location() { ID = 0, name = "New Location" });
Expand All @@ -171,6 +172,7 @@ void PrepareProject()
conditionsStack.DataContext = null;
gridScript.DataContext = null;


lstConversations.SelectionChanged -= lstConversations_SelectionChanged;

lstCharacters.SelectedItem = null;
Expand Down Expand Up @@ -217,7 +219,10 @@ void PrepareProject()
lstConversations.SelectionChanged += lstConversations_SelectionChanged;
lstConversations.SelectedIndex = 0;
//LoadConversation(0);
Console.WriteLine("Finish making new project");

SelectNode("_node_0");

Console.WriteLine("Finished making new project");
}

void PrepareProject(string project)
Expand Down Expand Up @@ -275,6 +280,8 @@ void PrepareProject(string project)
lstConversations.Items.Refresh();
lstConversations.SelectionChanged += lstConversations_SelectionChanged;
lstConversations.SelectedIndex = 0;

SelectNode("_node_0");
}

private void DoAutoSave(object sender, EventArgs e)
Expand Down Expand Up @@ -358,11 +365,21 @@ public void AddNode(string parentNode, DialogueEntry entryToAdd = null)
newDialogueEntry.conversant = theDatabase.Actors.FirstOrDefault(x => x.ID == theDatabase.Conversations[loadedConversation].conversantID);
newDialogueEntry.menuText = "";
newDialogueEntry.dialogueText = "";
newDialogueEntry.fields = new List<DialogueEntry.Field>();
}
else
{
newDialogueEntry = new DialogueEntry(entryToAdd);
newDialogueEntry.ID = theDatabase.Conversations[loadedConversation].DialogEntries.OrderByDescending(p => p.ID).First().ID + 1;
newDialogueEntry.fields = new List<DialogueEntry.Field>();
}

foreach (DialogueEntry.Field field in theDatabase.Conversations[loadedConversation].DialogEntries.Find(x => x.ID == 0).fields)
{
if (!selectedEntry.fields.Exists(y => y.name == field.name))
{
selectedEntry.fields.Add(new DialogueEntry.Field() { name = field.name, type = field.type, value = field.value });
}
}

//Add to conversation
Expand Down Expand Up @@ -538,6 +555,7 @@ public void SelectNode(string newNode)
nodeTree = tcMain.FindName(newNode.Remove(0, 1)) as TreeNode;
node = nodeTree.Content as NodeControl;
currentNode = newNode;


if (newNode == "_node_0")
{
Expand All @@ -551,10 +569,38 @@ public void SelectNode(string newNode)
editScript.IsEnabled = false;
conditionsStack.DataContext = null;
gridScript.DataContext = null;

selectedEntry = theDatabase.Conversations[loadedConversation].DialogEntries[0];
if (selectedEntry.fields == null)
{
selectedEntry.fields = new List<DialogueEntry.Field>();
}
//dgDefaultFields.DataContext = selectedEntry;
//dgDefaultFields.ItemsSource = selectedEntry.fields;
//dgDefaultFields.Items.Refresh();
}
else
{
selectedEntry = theDatabase.Conversations[loadedConversation].DialogEntries.FirstOrDefault(x => x.ID == node.dialogueEntryID);
selectedEntry = null;
selectedEntry = theDatabase.Conversations[loadedConversation].DialogEntries.Find(x => x.ID == node.dialogueEntryID);

if (selectedEntry.fields == null)
{
selectedEntry.fields = new List<DialogueEntry.Field>();
}

foreach(DialogueEntry.Field field in theDatabase.Conversations[loadedConversation].DialogEntries.Find(x => x.ID == 0).fields)
{
if(!selectedEntry.fields.Exists(y => y.name == field.name))
{
selectedEntry.fields.Add(new DialogueEntry.Field() { name = field.name, type = field.type, value = field.value});
}
}

//dgFields.DataContext = selectedEntry;
//dgFields.ItemsSource = selectedEntry.fields;
//dgFields.Items.Refresh();

node.DataContext = selectedEntry;
Console.WriteLine("UserScript: " + selectedEntry.UserScript + " | UserScript.Length: " + selectedEntry.UserScript.Length + " | IsNullOrEmpty: " + string.IsNullOrEmpty(selectedEntry.UserScript) + " | IsNullOrWhiteSpace: " + string.IsNullOrWhiteSpace(selectedEntry.UserScript));
gridDialogueEntry.DataContext = selectedEntry;
Expand All @@ -566,6 +612,17 @@ public void SelectNode(string newNode)
editConditions.IsEnabled = true;
editScript.IsEnabled = true;
}

if (selectedEntry != null)
{
Console.WriteLine($"Changing Items | Selected ID: {selectedEntry.ID}");
dgDefaultFields.DataContext = selectedEntry;
dgDefaultFields.ItemsSource = selectedEntry.fields;
dgDefaultFields.Items.Refresh();
dgFields.DataContext = selectedEntry;
dgFields.ItemsSource = selectedEntry.fields;
dgFields.Items.Refresh();
}
}

private void DrawConversationTree(DialogHolder dh)
Expand Down Expand Up @@ -681,6 +738,8 @@ private void LoadConversation(int convotoload)
//recOverview.GetBindingExpression(VisualBrush.VisualProperty).UpdateTarget();
DrawExtraConnections();
handledNodes.Clear();

SelectNode("_node_0");
}

private void Delete_Node(TreeNode mainNode)
Expand Down Expand Up @@ -1279,7 +1338,8 @@ private void btnAddConversation_Click(object sender, RoutedEventArgs e)
actorID = 0,
actor = theDatabase.Actors[0],
conversantID = 0,
conversant = theDatabase.Actors[0]
conversant = theDatabase.Actors[0],
fields = new List<DialogueEntry.Field>()
};

newConvo.DialogEntries.Add(convoStart);
Expand Down Expand Up @@ -1804,6 +1864,47 @@ private void ScaleTransform_Changed(object sender, EventArgs e)
DrawExtraConnections();
}
}

private void btnAddField_Click(object sender, RoutedEventArgs e)
{
if (selectedEntry != null)
{
if(selectedEntry.fields == null)
{
selectedEntry.fields = new List<DialogueEntry.Field>();
}
selectedEntry.fields.Add(new DialogueEntry.Field());
dgFields.DataContext = selectedEntry;
dgFields.ItemsSource = selectedEntry.fields;
dgFields.Items.Refresh();
}
}

private void btnFieldDelete_Click(object sender, RoutedEventArgs e)
{
//Console.WriteLine($"Removing Field at Index: {dgFields.SelectedIndex} | {selectedEntry.fields?.Count}");
if (selectedEntry != null && selectedEntry.fields?.Count > dgFields.SelectedIndex)
{
selectedEntry.fields.RemoveAt(dgFields.SelectedIndex);
dgFields.DataContext = selectedEntry;
dgFields.ItemsSource = selectedEntry.fields;
dgFields.Items.Refresh();
}
}

private void btnAddDefaultField_Click(object sender, RoutedEventArgs e)
{
if(selectedEntry.ID == 0)
{
Console.Write("We're good");
}
}

private void btnDefaultFieldDelete_Click(object sender, RoutedEventArgs e)
{

}

}

public static class SelectOnInternalClick
Expand Down
2 changes: 1 addition & 1 deletion TalkerMakerDeluxe/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion TalkerMakerDeluxe/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 7aebb0f

Please sign in to comment.