-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add assembly references to storages * auto gen code
- Loading branch information
1 parent
0877781
commit ed28f07
Showing
416 changed files
with
1,115 additions
and
845 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
client/Packages/com.beamable.server/Editor/UI2/Configs/BeamableStorageSettings.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
using Beamable.Common; | ||
using Beamable.Editor.BeamCli.Commands; | ||
using Beamable.Server.Editor.Usam; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using UnityEditor; | ||
using UnityEditorInternal; | ||
using UnityEngine; | ||
|
||
namespace Beamable.Editor.Microservice.UI2.Configs | ||
{ | ||
public class BeamableStorageSettings : ScriptableObject | ||
{ | ||
public List<AssemblyDefinitionAsset> assemblyReferences; | ||
private List<AssemblyDefinitionAsset> originalAssemblyReferences = new List<AssemblyDefinitionAsset>(); | ||
|
||
public BeamManifestStorageEntry storage; | ||
public string storageName => storage.beamoId; | ||
|
||
|
||
public static SerializedObject GetSerializedSettings(BeamManifestStorageEntry storage) | ||
{ | ||
var instance = CreateInstance<BeamableStorageSettings>(); | ||
instance.storage = storage; | ||
|
||
{ // update the assembly references | ||
instance.assemblyReferences = new List<AssemblyDefinitionAsset>(); | ||
foreach (var name in storage.unityReferences) | ||
{ | ||
var guids = AssetDatabase.FindAssets($"{name.AssemblyName} t:{nameof(AssemblyDefinitionAsset)}"); | ||
AssemblyDefinitionAsset asset = null; | ||
foreach (var id in guids) | ||
{ | ||
var assetPath = AssetDatabase.GUIDToAssetPath(id); | ||
var nameQuery = $"{Path.DirectorySeparatorChar}{name.AssemblyName}.asmdef"; | ||
if (!assetPath.Contains(nameQuery)) | ||
{ | ||
continue; | ||
} | ||
|
||
asset = AssetDatabase.LoadAssetAtPath<AssemblyDefinitionAsset>(assetPath); | ||
} | ||
|
||
instance.assemblyReferences.Add(asset); | ||
} | ||
} | ||
instance.UpdateOriginalData(); | ||
|
||
return new SerializedObject(instance); | ||
} | ||
|
||
public Promise SaveChanges(UsamService usam) | ||
{ | ||
UpdateOriginalData(); | ||
return usam.SetStorageChanges(storageName, assemblyReferences); | ||
} | ||
|
||
public bool HasChanges() | ||
{ | ||
if (originalAssemblyReferences == null || assemblyReferences == null) | ||
{ | ||
return false; | ||
} | ||
|
||
var nonEmptyAssemblies = assemblyReferences; | ||
nonEmptyAssemblies.RemoveAll(x => x==null); | ||
|
||
if (!BeamableMicroservicesSettings.ScrambledEquals(originalAssemblyReferences, nonEmptyAssemblies)) | ||
return true; | ||
|
||
return false; | ||
} | ||
|
||
private void UpdateOriginalData() | ||
{ | ||
originalAssemblyReferences.Clear(); | ||
|
||
assemblyReferences.ForEach(asmdef => originalAssemblyReferences.Add(asmdef)); | ||
|
||
originalAssemblyReferences.RemoveAll(x => x == null); | ||
} | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
client/Packages/com.beamable.server/Editor/UI2/Configs/BeamableStorageSettings.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.