-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
GameCanvas 6.5.0
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "Game", | ||
"rootNamespace": "", | ||
"references": [ | ||
"GUID:d8b63aba1907145bea998dd612889d6b", | ||
"GUID:75469ad4d38634e559750d17036d5f7c", | ||
"GUID:1b735e4770e5be346a2bafdd22e488d7" | ||
], | ||
"includePlatforms": [], | ||
"excludePlatforms": [], | ||
"allowUnsafeCode": true, | ||
"overrideReferences": false, | ||
"precompiledReferences": [], | ||
"autoReferenced": true, | ||
"defineConstraints": [], | ||
"versionDefines": [], | ||
"noEngineReferences": false | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-nullable | ||
-langversion:latest |
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.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"name": "CsprojModifier.Editor", | ||
"references": [], | ||
"includePlatforms": [ | ||
"Editor" | ||
], | ||
"excludePlatforms": [], | ||
"allowUnsafeCode": false, | ||
"overrideReferences": false, | ||
"precompiledReferences": [], | ||
"autoReferenced": true, | ||
"defineConstraints": [], | ||
"versionDefines": [ | ||
{ | ||
"name": "com.unity.ide.rider", | ||
"expression": "2.0.6", | ||
"define": "HAS_ROSLYN_ANALZYER_SUPPORT_RIDER" | ||
}, | ||
{ | ||
"name": "com.unity.ide.rider", | ||
"expression": "3.0.2", | ||
"define": "HAS_ROSLYN_ANALZYER_SUPPORT_RIDER_3_0_2_OR_NEWER" | ||
}, | ||
{ | ||
"name": "com.unity.ide.vscode", | ||
"expression": "1.2.0", | ||
"define": "HAS_ROSLYN_ANALZYER_SUPPORT_VSCODE" | ||
} | ||
], | ||
"noEngineReferences": false | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using CsprojModifier.Editor.Features; | ||
using UnityEditor; | ||
|
||
namespace CsprojModifier.Editor | ||
{ | ||
public class CsprojModifierFeatureProvider : AssetPostprocessor | ||
{ | ||
private static readonly List<ICsprojModifierFeature> _features = new List<ICsprojModifierFeature>() | ||
{ | ||
new InsertAdditionalImportFeature(), | ||
new AddAnalyzerReferenceFeature(), | ||
new RegenerateProjectFeature(), | ||
}; | ||
|
||
public static List<ICsprojModifierFeature> Features => _features; | ||
|
||
private static bool OnPreGeneratingCSProjectFiles() | ||
=> _features.OfType<ICsprojModifierGeneratedFileProcessor>().Aggregate(false, (r, x) => x.OnPreGeneratingCSProjectFiles() || r); | ||
private static string OnGeneratedCSProject(string path, string content) | ||
=> _features.OfType<ICsprojModifierGeneratedFileProcessor>().Aggregate(content, (r, x) => x.OnGeneratedCSProject(path, r)); | ||
|
||
#if UNITY_2018_1_OR_NEWER && HAS_ROSLYN_ANALZYER_SUPPORT_RIDER_3_0_2_OR_NEWER | ||
#else | ||
private static void OnGeneratedCSProjectFiles() | ||
{ | ||
foreach (var feature in _features.OfType<ICsprojModifierGeneratedFileProcessor>()) | ||
{ | ||
feature.OnGeneratedCSProjectFiles(); | ||
} | ||
} | ||
#endif | ||
|
||
private static string OnGeneratedSlnSolution(string path, string content) | ||
=> _features.OfType<ICsprojModifierGeneratedFileProcessor>().Aggregate(content, (r, x) => x.OnGeneratedSlnSolution(path, r)); | ||
|
||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using UnityEngine; | ||
|
||
namespace CsprojModifier.Editor | ||
{ | ||
public class CsprojModifierSettings : ScriptableObject | ||
{ | ||
private const string SettingsPath = "ProjectSettings/CsprojModifierSettings.json"; | ||
|
||
private static CsprojModifierSettings _instance; | ||
public static CsprojModifierSettings Instance | ||
{ | ||
get | ||
{ | ||
if (_instance != null) | ||
return _instance; | ||
|
||
_instance = LoadOrNew(); | ||
|
||
return _instance; | ||
} | ||
} | ||
|
||
#region Settings | ||
public List<ImportProjectItem> AdditionalImports; | ||
public List<string> AdditionalImportsAdditionalProjects; | ||
|
||
public bool EnableAddAnalyzerReferences; | ||
public List<string> AddAnalyzerReferencesAdditionalProjects; | ||
#endregion | ||
|
||
|
||
public CsprojModifierSettings() | ||
{ | ||
AdditionalImports = new List<ImportProjectItem>(); | ||
AdditionalImportsAdditionalProjects = new List<string>(); | ||
AddAnalyzerReferencesAdditionalProjects = new List<string>(); | ||
} | ||
|
||
private static CsprojModifierSettings LoadOrNew() | ||
{ | ||
if (File.Exists(SettingsPath)) | ||
{ | ||
var instance = CreateInstance<CsprojModifierSettings>(); | ||
JsonUtility.FromJsonOverwrite(File.ReadAllText(SettingsPath), instance); | ||
return instance; | ||
} | ||
else | ||
{ | ||
var instance = CreateInstance<CsprojModifierSettings>(); | ||
return instance; | ||
} | ||
} | ||
|
||
public void Save() | ||
{ | ||
File.WriteAllText(SettingsPath, JsonUtility.ToJson(_instance)); | ||
} | ||
} | ||
|
||
public enum ImportProjectPosition | ||
{ | ||
Append, | ||
Prepend, | ||
AppendContent, | ||
PrependContent, | ||
} | ||
|
||
[Serializable] | ||
public class ImportProjectItem | ||
{ | ||
public string Path; | ||
public ImportProjectPosition Position; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Reflection; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using UnityEditor; | ||
using UnityEngine; | ||
using UnityEngine.UIElements; | ||
|
||
namespace CsprojModifier.Editor | ||
{ | ||
public class CsprojModifierSettingsProvider : SettingsProvider | ||
{ | ||
private static class Styles | ||
{ | ||
public static readonly GUIStyle VerticalStyle; | ||
|
||
static Styles() | ||
{ | ||
VerticalStyle = new GUIStyle(EditorStyles.inspectorFullWidthMargins); | ||
VerticalStyle.margin = new RectOffset(10, 10, 10, 10); | ||
} | ||
} | ||
public CsprojModifierSettingsProvider(string path, SettingsScope scopes, IEnumerable<string> keywords = null) : base(path, scopes, keywords) | ||
{ | ||
} | ||
|
||
[SettingsProvider] | ||
public static SettingsProvider Create() | ||
=> new CsprojModifierSettingsProvider("Project/Editor/C# Project Modifier", SettingsScope.Project, new[] { "Analyzer", "C#", "csproj", "Project", "Import" } /* TODO */); | ||
|
||
public override void OnActivate(string searchContext, VisualElement rootElement) | ||
{ | ||
Initialize(); | ||
base.OnActivate(searchContext, rootElement); | ||
} | ||
|
||
public override void OnGUI(string searchContext) | ||
{ | ||
using (new EditorGUILayout.VerticalScope(Styles.VerticalStyle)) | ||
{ | ||
foreach (var feature in CsprojModifierFeatureProvider.Features) | ||
{ | ||
feature.OnGUI(); | ||
GUILayout.Space(10); | ||
} | ||
} | ||
|
||
if (GUI.changed) | ||
{ | ||
CsprojModifierSettings.Instance.Save(); | ||
} | ||
} | ||
|
||
private void Initialize() | ||
{ | ||
foreach (var feature in CsprojModifierFeatureProvider.Features) | ||
{ | ||
feature.Initialize(); | ||
} | ||
} | ||
} | ||
} |
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.