Skip to content

Commit

Permalink
Installer v3 (menu item added)
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-bures committed Oct 27, 2023
1 parent 2a39dbb commit cbccc07
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 30 deletions.
11 changes: 8 additions & 3 deletions Assets/Thunderkit Installer - KSP2.meta

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

47 changes: 26 additions & 21 deletions Assets/Thunderkit Installer - KSP2/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,22 @@ public class Startup
{
public static List<string> Packages { get; set; } = new List<string>() {
#if UNITY_2020_3_33
"com.unity.ui",
"com.unity.ui.builder",
"com.unity.ui",
"com.unity.ui.builder",
#endif
"com.unity.burst",
"com.unity.inputsystem"
"com.unity.inputsystem"
};

static Startup()
{
EditorApplication.update += ExecuteCoroutine;
// StartCoroutine(InstallPackages());
}

[MenuItem("Tools/Reinstall Thunderkit")]
static void ReinstallThunderKit()
{
StartCoroutine(InstallPackages());
}

Expand All @@ -29,7 +35,7 @@ private static IEnumerator StartCoroutine(IEnumerator newCorou)
return newCorou;
}

private static List<IEnumerator> CoroutineInProgress = new();
private static readonly List<IEnumerator> CoroutineInProgress = new();

static int currentExecute = 0;
private static void ExecuteCoroutine()
Expand All @@ -47,18 +53,18 @@ private static void ExecuteCoroutine()

private static IEnumerator InstallPackages()
{
if(!EditorUtility.DisplayDialog($"Install Thunderkit?",
"Do you want to run this installer?",
"Install", "Skip"))
{

if (EditorUtility.DisplayDialog($"Remove Installer?",
"Do you want to remove this installer package?", "Delete", "Skip") &&
AssetDatabase.DeleteAsset("Assets/Thunderkit Installer"))
Debug.Log($"Installer Removed.");

yield break;
}
// if(!EditorUtility.DisplayDialog($"Install Thunderkit?",
// "Do you want to run this installer?",
// "Install", "Skip"))
// {
//
// if (EditorUtility.DisplayDialog($"Remove Installer?",
// "Do you want to remove this installer package?", "Delete", "Skip") &&
// AssetDatabase.DeleteAsset("Assets/Thunderkit Installer"))
// Debug.Log($"Installer Removed.");
//
// yield break;
// }

var listRequest = Client.List(true, false);
while(!listRequest.IsCompleted)
Expand All @@ -70,7 +76,6 @@ private static IEnumerator InstallPackages()
{
var collection = listRequest.Result;


if(!collection.Any(x => x.packageId.StartsWith("com.passivepicasso.thunderkit")))
{
var result = Client.Add("https://github.com/PassivePicasso/ThunderKit.git");
Expand Down Expand Up @@ -113,10 +118,10 @@ private static IEnumerator InstallPackages()
Debug.Log($"{package} found.");
}
}

if(EditorUtility.DisplayDialog($"Remove Installer?", "Do you want to remove this installer package now that it has completed its work?", "Delete", "Skip") && AssetDatabase.DeleteAsset("Assets/Thunderkit Installer - KSP2"))
Debug.Log($"Installer Removed.");

EditorUtility.DisplayDialog("Reinstallation Complete", "The reinstallation of thunderkit has succeeded",
"ok");
Debug.Log($"Installation Complete.");
yield break;
}
Expand Down
14 changes: 11 additions & 3 deletions Assets/Thunderkit Installer - KSP2/Startup.cs.meta

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

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

3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ This repository contains a Unity package that automatically installs the latest
3. Wait for the installation to finish.

## Changelog
### v3
- Added Tools -> Reinstall ThunderKit menu item
- No longer automatically installs itself
### v2
- Added support for Unity 2022.3.5
- Updated ThunderKit source from 8.0.3 to master branch
Expand Down

0 comments on commit cbccc07

Please sign in to comment.