Skip to content

Commit d73e914

Browse files
committed
new project: Fix create new project platform argument if pressed enter to create., When new project is added as first item add modified date and platform also.,
1 parent a061ef8 commit d73e914

File tree

4 files changed

+15
-13
lines changed

4 files changed

+15
-13
lines changed

UnityLauncherPro/MainWindow.xaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -555,9 +555,9 @@
555555
</DataGridTextColumn.CellStyle>
556556
</DataGridTextColumn>
557557
<!--<DataGridTextColumn CellStyle="{StaticResource NoFocusCellStyle}" Binding="{Binding Modified, StringFormat=\{0:dd/MM/yyyy HH:mm:ss\}}" ClipboardContentBinding="{x:Null}" Header="Modified" IsReadOnly="True" Width="120"/>-->
558-
<DataGridTextColumn CellStyle="{StaticResource NoFocusCellStyle}" Binding="{Binding Modified, Converter={StaticResource lastModifiedConverter}}" ClipboardContentBinding="{x:Null}" Header="Modified" IsReadOnly="True" Width="120"/>
559-
<DataGridTextColumn CellStyle="{StaticResource NoFocusCellStyle}" Binding="{Binding Arguments}" ClipboardContentBinding="{x:Null}" Header="Arguments" IsReadOnly="False" Width="100"/>
560-
<DataGridTextColumn CellStyle="{StaticResource NoFocusCellStyle}" Binding="{Binding GITBranch}" ClipboardContentBinding="{x:Null}" Header="Branch" IsReadOnly="True" Width="60"/>
558+
<DataGridTextColumn Binding="{Binding Modified, Converter={StaticResource lastModifiedConverter}}" CellStyle="{StaticResource NoFocusCellStyle}" ClipboardContentBinding="{x:Null}" Header="Modified" IsReadOnly="True" Width="120"/>
559+
<DataGridTextColumn Binding="{Binding Arguments}" CellStyle="{StaticResource NoFocusCellStyle}" ClipboardContentBinding="{x:Null}" Header="Arguments" IsReadOnly="False" Width="100"/>
560+
<DataGridTextColumn Binding="{Binding GITBranch}" CellStyle="{StaticResource NoFocusCellStyle}" ClipboardContentBinding="{x:Null}" Header="Branch" IsReadOnly="True" Width="60"/>
561561
<!--TODO platform as dropdown?-->
562562
<!--<DataGridTextColumn CellStyle="{StaticResource NoFocusCellStyle}" Binding="{Binding TargetPlatform}" ClipboardContentBinding="{x:Null}" Header="Platform" IsReadOnly="True" Width="100"/>-->
563563
<!--<DataGridComboBoxColumn x:Name="cmbPlatform" CellStyle="{StaticResource NoFocusCellStyle}" SelectedItemBinding="{Binding TargetPlatform, NotifyOnSourceUpdated=True, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" ClipboardContentBinding="{x:Null}" Header="Platform" IsReadOnly="True" Width="100"/>-->
@@ -567,7 +567,7 @@
567567
<DataGridTemplateColumn Header="Platform" Width="90">
568568
<DataGridTemplateColumn.CellTemplate >
569569
<DataTemplate >
570-
<ComboBox x:Name="cmbPlatformSelection" OverridesDefaultStyle="True" VerticalAlignment="Center" HorizontalAlignment="Stretch" VerticalContentAlignment="Center" HorizontalContentAlignment="Stretch" IsEnabled="{Binding ElementName=chkEnablePlatformSelection, Path=IsChecked}" ItemsSource="{Binding TargetPlatforms}" SelectedValue="{Binding TargetPlatform}" Height="18" Foreground="{DynamicResource ThemeButtonForeground}" DropDownClosed="CmbPlatformSelection_DropDownClosed" MinWidth="80"/>
570+
<ComboBox ItemsSource="{Binding TargetPlatforms}" SelectedValue="{Binding TargetPlatform}" x:Name="cmbPlatformSelection" OverridesDefaultStyle="True" VerticalAlignment="Center" HorizontalAlignment="Stretch" VerticalContentAlignment="Center" HorizontalContentAlignment="Stretch" IsEnabled="{Binding ElementName=chkEnablePlatformSelection, Path=IsChecked}" Height="18" Foreground="{DynamicResource ThemeButtonForeground}" DropDownClosed="CmbPlatformSelection_DropDownClosed" MinWidth="80"/>
571571
</DataTemplate>
572572
</DataGridTemplateColumn.CellTemplate>
573573
</DataGridTemplateColumn>

UnityLauncherPro/MainWindow.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1630,7 +1630,7 @@ void CreateNewEmptyProject()
16301630
Console.WriteLine("Create project " + NewProject.newVersion + " : " + projectPath);
16311631
if (string.IsNullOrEmpty(projectPath)) return;
16321632

1633-
var p = Tools.FastCreateProject(NewProject.newVersion, projectPath, NewProject.newProjectName, NewProject.templateZipPath, NewProject.selectedPlatform);
1633+
var p = Tools.FastCreateProject(NewProject.newVersion, projectPath, NewProject.newProjectName, NewProject.templateZipPath, NewProject.platformsForThisUnity, NewProject.selectedPlatform);
16341634

16351635
// add to list (just in case new project fails to start, then folder is already generated..)
16361636
if (p != null) AddNewProjectToList(p);

UnityLauncherPro/NewProject.xaml.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public partial class NewProject : Window
1313
public static string newName = null;
1414
public static string templateZipPath = null;
1515
public static string selectedPlatform = null;
16+
public static string[] platformsForThisUnity = null;
1617

1718
bool isInitializing = true; // to keep OnChangeEvent from firing too early
1819
int previousSelectedTemplateIndex = -1;
@@ -77,17 +78,17 @@ void UpdateTemplatesDropDown(string unityPath)
7778

7879
void UpdateModulesDropdown(string version)
7980
{
80-
// get modules and stick into combobox
81-
var platformsForThisUnity = Tools.GetPlatformsForUnityVersion(version);
81+
// get modules and stick into combobox, NOTE we already have this info from GetProjects.Scan, so could access it
82+
platformsForThisUnity = Tools.GetPlatformsForUnityVersion(version);
8283
cmbNewProjectPlatform.ItemsSource = platformsForThisUnity;
8384
//System.Console.WriteLine(Tools.GetPlatformsForUnityVersion(version).Length);
8485

8586
var lastUsedPlatform = Properties.Settings.Default.newProjectPlatform;
8687

8788
for (int i = 0; i < platformsForThisUnity.Length; i++)
8889
{
89-
// set default platform (now win64) if never used this before
90-
if (platformsForThisUnity[i].ToLower() == "win64" || platformsForThisUnity[i] == lastUsedPlatform)
90+
// set default platform (win64) if never used this setting before
91+
if ((lastUsedPlatform == null && platformsForThisUnity[i].ToLower() == "win64") || platformsForThisUnity[i] == lastUsedPlatform)
9192
{
9293
cmbNewProjectPlatform.SelectedIndex = i;
9394
break;
@@ -143,9 +144,8 @@ private void Window_PreviewKeyDown(object sender, KeyEventArgs e)
143144
cmbNewProjectTemplate.SelectedIndex = ++cmbNewProjectTemplate.SelectedIndex % cmbNewProjectTemplate.Items.Count;
144145
e.Handled = true; // override writing to textbox
145146
break;
146-
case Key.Enter: // enter accept
147-
UpdateSelectedVersion();
148-
DialogResult = true;
147+
case Key.Enter: // enter, create proj
148+
BtnCreateNewProject_Click(null, null);
149149
e.Handled = true;
150150
break;
151151
case Key.Escape: // esc cancel

UnityLauncherPro/Tools.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,7 @@ public static string BrowseForOutputFolder(string title)
10161016
return null;
10171017
}
10181018

1019-
public static Project FastCreateProject(string version, string baseFolder, string projectName = null, string templateZipPath = null, string platform = null)
1019+
public static Project FastCreateProject(string version, string baseFolder, string projectName = null, string templateZipPath = null, string[] platformsForThisUnity = null, string platform = null)
10201020
{
10211021
// check for base folders in settings tab
10221022
if (string.IsNullOrEmpty(baseFolder) == true)
@@ -1065,7 +1065,9 @@ public static Project FastCreateProject(string version, string baseFolder, strin
10651065
proj.Title = projectName;
10661066
proj.Path = Path.Combine(baseFolder, newPath);
10671067
proj.Version = version;
1068+
proj.TargetPlatforms = platformsForThisUnity;
10681069
proj.TargetPlatform = platform;
1070+
proj.Modified = DateTime.Now;
10691071
var proc = LaunchProject(proj);
10701072
ProcessHandler.Add(proj, proc);
10711073
return proj;

0 commit comments

Comments
 (0)