minigame template

This commit is contained in:
minenice55
2024-01-18 23:39:20 -05:00
parent 49fcc959f4
commit e9bda6742e
9 changed files with 112 additions and 12 deletions

View File

@ -21,7 +21,7 @@ using System.IO;
namespace HeavenStudio
{
[UnitySourceGenerator(typeof(MinigameLoaderGenerator), OverwriteIfFileExists = false)]
[UnitySourceGenerator(typeof(MinigameLoaderGenerator), OverwriteIfFileExists = true)]
public partial class Minigames
{
public enum RecommendedControlStyle

View File

@ -110,7 +110,12 @@ namespace {context.TargetClass.Namespace}
");
// USG: return true to tell USG to write content into OutputPath. false to do nothing.
return true;
// only write if changes are made.
if (!System.IO.File.Exists(context.OutputPath))
return true;
string oldContent = System.IO.File.ReadAllText(context.OutputPath);
return sb.ToString() != oldContent;
}
#pragma warning restore IDE0051