Skip to content

Commit 0aaf7c0

Browse files
committed
new project: fix project creation from context menu, make new project window bigger, fix project name for context menu projects (keep it locked), window: double click top bar to restore window (if accidentall maximized with drag to top),
1 parent 36173fb commit 0aaf7c0

File tree

4 files changed

+22
-7
lines changed

4 files changed

+22
-7
lines changed

UnityLauncherPro/MainWindow.xaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,13 @@
510510

511511
<!-- menubar -->
512512
<Grid Grid.Row="0" UseLayoutRounding="False">
513-
<Rectangle Fill="{DynamicResource ThemeDarkMenuBar}" MouseDown="OnRectangleMouseDown" />
513+
<Button PreviewMouseDoubleClick="Button_PreviewMouseDoubleClick">
514+
<Button.Template>
515+
<ControlTemplate>
516+
<Rectangle Fill="{DynamicResource ThemeDarkMenuBar}" MouseDown="OnRectangleMouseDown"/>
517+
</ControlTemplate>
518+
</Button.Template>
519+
</Button>
514520
<Image Source="Images/icon.png" RenderOptions.BitmapScalingMode="NearestNeighbor" HorizontalAlignment="Left" Width="16" Height="16" Margin="4,0,0,0" SnapsToDevicePixels="True" UseLayoutRounding="True" />
515521
<Label Content="UnityLauncherPro" IsHitTestVisible="False" Margin="19,0,0,-5" Foreground="{DynamicResource ThemeMainTitle}" FontSize="12" HorizontalAlignment="Left" />
516522
<!-- minimize -->
@@ -1149,7 +1155,7 @@
11491155
<Button Style="{StaticResource CustomButton}" ToolTip="Explore Scripts folder" x:Name="btnExploreScriptsFolder" Content="..." Height="22" Width="22" HorizontalAlignment="Right" VerticalAlignment="Top" FontSize="16" Padding="1,-2,1,1" BorderBrush="{x:Null}" Click="btnExploreScriptsFolder_Click" Margin="5,0,0,0"/>
11501156
</StackPanel>
11511157

1152-
<Button x:Name="btnPatchHubConfig" ToolTip="Modifies json file to set 'manual:true' values into 'false', so that can add modules using Hub. NOTE: This cannot be reversed (not keeping track which values was already 'false')" Style="{StaticResource CustomButton}" BorderBrush="{x:Null}" HorizontalAlignment="Left" VerticalAlignment="Top" Click="btnPatchHubConfig_Click">
1158+
<Button x:Name="btnPatchHubConfig" ToolTip="Modifies json file to set 'manual:true' values into 'false', so that can add modules using Hub. NOTE: This cannot be reversed (not keeping track which values were already 'false')" Style="{StaticResource CustomButton}" BorderBrush="{x:Null}" HorizontalAlignment="Left" VerticalAlignment="Top" Click="btnPatchHubConfig_Click">
11531159
<Label Content="Patch Hub editors.json" Foreground="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Control}}}" />
11541160
</Button>
11551161

UnityLauncherPro/MainWindow.xaml.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3000,6 +3000,14 @@ private void txtWebglPort_LostFocus(object sender, RoutedEventArgs e)
30003000
ValidateIntRange((TextBox)sender, 50000, 65534);
30013001
}
30023002

3003+
private void Button_PreviewMouseDoubleClick(object sender, MouseButtonEventArgs e)
3004+
{
3005+
// only can do restore here, we dont want accidental maximize (max window not really needed)
3006+
if (this.WindowState == WindowState.Maximized) this.WindowState = WindowState.Normal;
3007+
// NOTE workaround for grid not focused when coming back from minimized window
3008+
Tools.SetFocusToGrid(gridRecent, GetSelectedProjectIndex());
3009+
}
3010+
30033011
//private void BtnBrowseTemplateUnityPackagesFolder_Click(object sender, RoutedEventArgs e)
30043012
//{
30053013
// var folder = Tools.BrowseForOutputFolder("Select unitypackage Templates folder");

UnityLauncherPro/NewProject.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
66
xmlns:local="clr-namespace:UnityLauncherPro"
77
mc:Ignorable="d"
8-
Title="Create New Project" Height="310" Width="450" Background="{DynamicResource ThemeDarkestBackground}" PreviewKeyDown="Window_PreviewKeyDown" ResizeMode="NoResize" WindowStartupLocation="CenterOwner">
8+
Title="Create New Project" Height="460" Width="450" Background="{DynamicResource ThemeDarkestBackground}" PreviewKeyDown="Window_PreviewKeyDown" ResizeMode="NoResize" WindowStartupLocation="CenterOwner">
99
<Window.Resources>
1010
<!-- custom buttons -->
1111
<Style x:Key="CustomButton" TargetType="{x:Type Button}">
@@ -187,7 +187,7 @@
187187
<Grid>
188188
<StackPanel Margin="10,3">
189189
<Label Content="Unity Version" Foreground="{DynamicResource ThemeButtonForeground}" Margin="0,0,0,3" Padding="5,5,5,3" />
190-
<DataGrid x:Name="gridAvailableVersions" KeyboardNavigation.TabNavigation = "None" SelectionMode="Single" Height="120" Margin="0" VerticalAlignment="Top" HeadersVisibility="None" AutoGenerateColumns="False" IsSynchronizedWithCurrentItem="True" Foreground="{DynamicResource ThemeButtonForeground}" Background="{DynamicResource ThemeMainBackgroundColor}" SelectionChanged="GridAvailableVersions_SelectionChanged" IsTabStop="True" TabIndex="1" Loaded="GridAvailableVersions_Loaded" EnableRowVirtualization="False" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled">
190+
<DataGrid x:Name="gridAvailableVersions" KeyboardNavigation.TabNavigation = "None" SelectionMode="Single" Height="270" Margin="0" VerticalAlignment="Top" HeadersVisibility="None" AutoGenerateColumns="False" IsSynchronizedWithCurrentItem="True" Foreground="{DynamicResource ThemeButtonForeground}" Background="{DynamicResource ThemeMainBackgroundColor}" SelectionChanged="GridAvailableVersions_SelectionChanged" IsTabStop="True" TabIndex="1" Loaded="GridAvailableVersions_Loaded" EnableRowVirtualization="False" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled">
191191
<DataGrid.Columns>
192192
<DataGridTextColumn Header="Version" Binding="{Binding Version}" IsReadOnly="True" CanUserResize="False" MinWidth="80" />
193193
<DataGridTextColumn Header="Platforms" Binding="{Binding PlatformsCombined}" IsReadOnly="True" CanUserResize="False" MinWidth="370" />

UnityLauncherPro/NewProject.xaml.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,9 @@ void UpdateModulesDropdown(string version)
107107

108108
private void BtnCreateNewProject_Click(object sender, RoutedEventArgs e)
109109
{
110-
// check if projectname already exists
110+
// check if projectname already exists (only if should be automatically created name)
111111
var targetPath = Path.Combine(targetFolder, txtNewProjectName.Text);
112-
if (Directory.Exists(targetPath) == true)
112+
if (txtNewProjectName.IsEnabled == true && Directory.Exists(targetPath) == true)
113113
{
114114
System.Console.WriteLine("Project already exists");
115115
return;
@@ -246,7 +246,8 @@ private void GridAvailableVersions_SelectionChanged(object sender, SelectionChan
246246
// new row selected, generate new project name for this version
247247
var k = gridAvailableVersions.SelectedItem as UnityInstallation;
248248
newVersion = k.Version;
249-
GenerateNewName();
249+
// no new name, if field is locked (because its folder name then)
250+
if (txtNewProjectName.IsEnabled == true) GenerateNewName();
250251

251252
// update templates list for selected unity version
252253
UpdateTemplatesDropDown(k.Path);

0 commit comments

Comments
 (0)