diff --git a/.idea/.idea.Aetheria-Economy/.idea/indexLayout.xml b/.idea/.idea.Aetheria-Economy/.idea/indexLayout.xml index 71b8dd8fd..1667e6372 100644 --- a/.idea/.idea.Aetheria-Economy/.idea/indexLayout.xml +++ b/.idea/.idea.Aetheria-Economy/.idea/indexLayout.xml @@ -39,6 +39,7 @@ Logs Recordings Server + Temp UserSettings obj diff --git a/Aetheria-Economy.sln b/Aetheria-Economy.sln index d8c272e32..a94ca1cd6 100644 --- a/Aetheria-Economy.sln +++ b/Aetheria-Economy.sln @@ -5,10 +5,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp", "Assembly EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Economy.Shared.Unity", "Economy.Shared.Unity.csproj", "{c2362ba6-dee9-92b9-0779-f5fcf5968986}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniRx", "UniRx.csproj", "{4d885cb7-1f9e-abb3-b070-7265b432ecda}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MessagePack", "MessagePack.csproj", "{c511ef21-dc27-883d-b027-9a4b6f36bae4}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniRx", "UniRx.csproj", "{4d885cb7-1f9e-abb3-b070-7265b432ecda}" +EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp-firstpass", "Assembly-CSharp-firstpass.csproj", "{a442877d-fc0d-6756-0a98-3ca4312f9253}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Substance.EditorHelper", "Substance.EditorHelper.csproj", "{dd909206-f54e-1c12-ed74-b4e22d464f6a}" @@ -33,14 +33,14 @@ Global {c2362ba6-dee9-92b9-0779-f5fcf5968986}.Debug|Any CPU.Build.0 = Debug|Any CPU {c2362ba6-dee9-92b9-0779-f5fcf5968986}.Release|Any CPU.ActiveCfg = Release|Any CPU {c2362ba6-dee9-92b9-0779-f5fcf5968986}.Release|Any CPU.Build.0 = Release|Any CPU - {4d885cb7-1f9e-abb3-b070-7265b432ecda}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4d885cb7-1f9e-abb3-b070-7265b432ecda}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4d885cb7-1f9e-abb3-b070-7265b432ecda}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4d885cb7-1f9e-abb3-b070-7265b432ecda}.Release|Any CPU.Build.0 = Release|Any CPU {c511ef21-dc27-883d-b027-9a4b6f36bae4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {c511ef21-dc27-883d-b027-9a4b6f36bae4}.Debug|Any CPU.Build.0 = Debug|Any CPU {c511ef21-dc27-883d-b027-9a4b6f36bae4}.Release|Any CPU.ActiveCfg = Release|Any CPU {c511ef21-dc27-883d-b027-9a4b6f36bae4}.Release|Any CPU.Build.0 = Release|Any CPU + {4d885cb7-1f9e-abb3-b070-7265b432ecda}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4d885cb7-1f9e-abb3-b070-7265b432ecda}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4d885cb7-1f9e-abb3-b070-7265b432ecda}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4d885cb7-1f9e-abb3-b070-7265b432ecda}.Release|Any CPU.Build.0 = Release|Any CPU {a442877d-fc0d-6756-0a98-3ca4312f9253}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {a442877d-fc0d-6756-0a98-3ca4312f9253}.Debug|Any CPU.Build.0 = Debug|Any CPU {a442877d-fc0d-6756-0a98-3ca4312f9253}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/Assembly-CSharp-Editor-firstpass.csproj b/Assembly-CSharp-Editor-firstpass.csproj index 7ef9286aa..608e58d80 100644 --- a/Assembly-CSharp-Editor-firstpass.csproj +++ b/Assembly-CSharp-Editor-firstpass.csproj @@ -284,6 +284,9 @@ C:/Program Files/Unity/Hub/Editor/2020.2.1f1/Editor/Data/PlaybackEngines/WindowsStandaloneSupport/UnityEditor.WindowsStandalone.Extensions.dll + + E:/Projects/Aetheria-Economy/Assets/Plugins/System.Threading.Tasks.Extensions.dll + E:/Projects/Aetheria-Economy/Assets/Plugins/Remotion.Linq.dll @@ -305,15 +308,15 @@ E:/Projects/Aetheria-Economy/Assets/Plugins/System.Buffers.dll + + E:/Projects/Aetheria-Economy/Library/PackageCache/com.unity.burst@1.4.3/Unity.Burst.Unsafe.dll + E:/Projects/Aetheria-Economy/Assets/Plugins/QuickGraph.dll E:/Projects/Aetheria-Economy/Assets/Allegorithmic/Plugins/Substance.Game.dll - - E:/Projects/Aetheria-Economy/Assets/Plugins/System.Threading.Tasks.Extensions.dll - E:/Projects/Aetheria-Economy/Assets/Allegorithmic/Plugins/Substance/Substance Source/Editor/SourceUnityLib.dll @@ -323,9 +326,6 @@ E:/Projects/Aetheria-Economy/Assets/Allegorithmic/Plugins/Substance/Substance Engine/Editor/Substance.Editor.dll - - E:/Projects/Aetheria-Economy/Library/PackageCache/com.unity.burst@1.4.3/Unity.Burst.Unsafe.dll - C:/Program Files/Unity/Hub/Editor/2020.2.1f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/mscorlib.dll @@ -701,6 +701,9 @@ E:/Projects/Aetheria-Economy/Library/ScriptAssemblies/Unity.TextMeshPro.dll + + E:/Projects/Aetheria-Economy/Library/ScriptAssemblies/Unity.Burst.Editor.dll + E:/Projects/Aetheria-Economy/Library/ScriptAssemblies/Unity.2D.Sprite.Editor.dll @@ -728,6 +731,9 @@ E:/Projects/Aetheria-Economy/Library/ScriptAssemblies/Cinemachine.dll + + E:/Projects/Aetheria-Economy/Library/ScriptAssemblies/Unity.Burst.dll + E:/Projects/Aetheria-Economy/Library/ScriptAssemblies/com.unity.cinemachine.editor.dll @@ -751,12 +757,6 @@ E:/Projects/Aetheria-Economy/Library/ScriptAssemblies/Unity.Recorder.dll - - - E:/Projects/Aetheria-Economy/Library/ScriptAssemblies/Unity.Burst.Editor.dll - - - E:/Projects/Aetheria-Economy/Library/ScriptAssemblies/Unity.Burst.dll diff --git a/Assembly-CSharp-Editor.csproj b/Assembly-CSharp-Editor.csproj index aae970e12..8d487a751 100644 --- a/Assembly-CSharp-Editor.csproj +++ b/Assembly-CSharp-Editor.csproj @@ -348,6 +348,9 @@ C:/Program Files/Unity/Hub/Editor/2020.2.1f1/Editor/Data/PlaybackEngines/WindowsStandaloneSupport/UnityEditor.WindowsStandalone.Extensions.dll + + E:/Projects/Aetheria-Economy/Assets/Plugins/System.Threading.Tasks.Extensions.dll + E:/Projects/Aetheria-Economy/Assets/Plugins/Remotion.Linq.dll @@ -369,15 +372,15 @@ E:/Projects/Aetheria-Economy/Assets/Plugins/System.Buffers.dll + + E:/Projects/Aetheria-Economy/Library/PackageCache/com.unity.burst@1.4.3/Unity.Burst.Unsafe.dll + E:/Projects/Aetheria-Economy/Assets/Plugins/QuickGraph.dll E:/Projects/Aetheria-Economy/Assets/Allegorithmic/Plugins/Substance.Game.dll - - E:/Projects/Aetheria-Economy/Assets/Plugins/System.Threading.Tasks.Extensions.dll - E:/Projects/Aetheria-Economy/Assets/Allegorithmic/Plugins/Substance/Substance Source/Editor/SourceUnityLib.dll @@ -387,9 +390,6 @@ E:/Projects/Aetheria-Economy/Assets/Allegorithmic/Plugins/Substance/Substance Engine/Editor/Substance.Editor.dll - - E:/Projects/Aetheria-Economy/Library/PackageCache/com.unity.burst@1.4.3/Unity.Burst.Unsafe.dll - C:/Program Files/Unity/Hub/Editor/2020.2.1f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/mscorlib.dll @@ -765,6 +765,9 @@ E:/Projects/Aetheria-Economy/Library/ScriptAssemblies/Unity.TextMeshPro.dll + + E:/Projects/Aetheria-Economy/Library/ScriptAssemblies/Unity.Burst.Editor.dll + E:/Projects/Aetheria-Economy/Library/ScriptAssemblies/Unity.2D.Sprite.Editor.dll @@ -792,6 +795,9 @@ E:/Projects/Aetheria-Economy/Library/ScriptAssemblies/Cinemachine.dll + + E:/Projects/Aetheria-Economy/Library/ScriptAssemblies/Unity.Burst.dll + E:/Projects/Aetheria-Economy/Library/ScriptAssemblies/com.unity.cinemachine.editor.dll @@ -815,12 +821,6 @@ E:/Projects/Aetheria-Economy/Library/ScriptAssemblies/Unity.Recorder.dll - - - E:/Projects/Aetheria-Economy/Library/ScriptAssemblies/Unity.Burst.Editor.dll - - - E:/Projects/Aetheria-Economy/Library/ScriptAssemblies/Unity.Burst.dll diff --git a/Assembly-CSharp-firstpass.csproj b/Assembly-CSharp-firstpass.csproj index b8554d973..7e59b454f 100644 --- a/Assembly-CSharp-firstpass.csproj +++ b/Assembly-CSharp-firstpass.csproj @@ -351,6 +351,9 @@ C:/Program Files/Unity/Hub/Editor/2020.2.1f1/Editor/Data/Managed/UnityEngine/UnityEditor.UnityConnectModule.dll + + E:/Projects/Aetheria-Economy/Assets/Plugins/System.Threading.Tasks.Extensions.dll + E:/Projects/Aetheria-Economy/Assets/Plugins/Remotion.Linq.dll @@ -372,21 +375,18 @@ E:/Projects/Aetheria-Economy/Assets/Plugins/System.Buffers.dll + + E:/Projects/Aetheria-Economy/Library/PackageCache/com.unity.burst@1.4.3/Unity.Burst.Unsafe.dll + E:/Projects/Aetheria-Economy/Assets/Plugins/QuickGraph.dll E:/Projects/Aetheria-Economy/Assets/Allegorithmic/Plugins/Substance.Game.dll - - E:/Projects/Aetheria-Economy/Assets/Plugins/System.Threading.Tasks.Extensions.dll - E:/Projects/Aetheria-Economy/Assets/Plugins/System.Runtime.CompilerServices.Unsafe.dll - - E:/Projects/Aetheria-Economy/Library/PackageCache/com.unity.burst@1.4.3/Unity.Burst.Unsafe.dll - C:/Program Files/Unity/Hub/Editor/2020.2.1f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/mscorlib.dll @@ -756,6 +756,9 @@ E:/Projects/Aetheria-Economy/Library/ScriptAssemblies/Unity.TextMeshPro.dll + + E:/Projects/Aetheria-Economy/Library/ScriptAssemblies/Unity.Burst.Editor.dll + E:/Projects/Aetheria-Economy/Library/ScriptAssemblies/Unity.2D.Sprite.Editor.dll @@ -783,6 +786,9 @@ E:/Projects/Aetheria-Economy/Library/ScriptAssemblies/Cinemachine.dll + + E:/Projects/Aetheria-Economy/Library/ScriptAssemblies/Unity.Burst.dll + E:/Projects/Aetheria-Economy/Library/ScriptAssemblies/com.unity.cinemachine.editor.dll @@ -806,12 +812,6 @@ E:/Projects/Aetheria-Economy/Library/ScriptAssemblies/Unity.Recorder.dll - - - E:/Projects/Aetheria-Economy/Library/ScriptAssemblies/Unity.Burst.Editor.dll - - - E:/Projects/Aetheria-Economy/Library/ScriptAssemblies/Unity.Burst.dll diff --git a/Assembly-CSharp.csproj b/Assembly-CSharp.csproj index 867a5fe49..5bc773f3f 100644 --- a/Assembly-CSharp.csproj +++ b/Assembly-CSharp.csproj @@ -253,9 +253,9 @@ - + @@ -1012,6 +1012,9 @@ C:/Program Files/Unity/Hub/Editor/2020.2.1f1/Editor/Data/Managed/UnityEngine/UnityEditor.UnityConnectModule.dll + + E:/Projects/Aetheria-Economy/Assets/Plugins/System.Threading.Tasks.Extensions.dll + E:/Projects/Aetheria-Economy/Assets/Plugins/Remotion.Linq.dll @@ -1033,21 +1036,18 @@ E:/Projects/Aetheria-Economy/Assets/Plugins/System.Buffers.dll + + E:/Projects/Aetheria-Economy/Library/PackageCache/com.unity.burst@1.4.3/Unity.Burst.Unsafe.dll + E:/Projects/Aetheria-Economy/Assets/Plugins/QuickGraph.dll E:/Projects/Aetheria-Economy/Assets/Allegorithmic/Plugins/Substance.Game.dll - - E:/Projects/Aetheria-Economy/Assets/Plugins/System.Threading.Tasks.Extensions.dll - E:/Projects/Aetheria-Economy/Assets/Plugins/System.Runtime.CompilerServices.Unsafe.dll - - E:/Projects/Aetheria-Economy/Library/PackageCache/com.unity.burst@1.4.3/Unity.Burst.Unsafe.dll - C:/Program Files/Unity/Hub/Editor/2020.2.1f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/mscorlib.dll @@ -1417,6 +1417,9 @@ E:/Projects/Aetheria-Economy/Library/ScriptAssemblies/Unity.TextMeshPro.dll + + E:/Projects/Aetheria-Economy/Library/ScriptAssemblies/Unity.Burst.Editor.dll + E:/Projects/Aetheria-Economy/Library/ScriptAssemblies/Unity.2D.Sprite.Editor.dll @@ -1444,6 +1447,9 @@ E:/Projects/Aetheria-Economy/Library/ScriptAssemblies/Cinemachine.dll + + E:/Projects/Aetheria-Economy/Library/ScriptAssemblies/Unity.Burst.dll + E:/Projects/Aetheria-Economy/Library/ScriptAssemblies/com.unity.cinemachine.editor.dll @@ -1467,12 +1473,6 @@ E:/Projects/Aetheria-Economy/Library/ScriptAssemblies/Unity.Recorder.dll - - - E:/Projects/Aetheria-Economy/Library/ScriptAssemblies/Unity.Burst.Editor.dll - - - E:/Projects/Aetheria-Economy/Library/ScriptAssemblies/Unity.Burst.dll diff --git a/Assets/Scenes/ARPG.unity b/Assets/Scenes/ARPG.unity index 2f5ceee50..cdcd49498 100644 --- a/Assets/Scenes/ARPG.unity +++ b/Assets/Scenes/ARPG.unity @@ -17271,7 +17271,7 @@ PrefabInstance: - target: {fileID: 878382121558056004, guid: 2758dfa2744d7ad4d8877545189d116e, type: 3} propertyPath: m_AnchoredPosition.x - value: 55.675 + value: 0 objectReference: {fileID: 0} - target: {fileID: 878382121558056004, guid: 2758dfa2744d7ad4d8877545189d116e, type: 3} @@ -18127,7 +18127,7 @@ PrefabInstance: - target: {fileID: 878382121558056004, guid: 2758dfa2744d7ad4d8877545189d116e, type: 3} propertyPath: m_AnchoredPosition.x - value: 60.98 + value: 0 objectReference: {fileID: 0} - target: {fileID: 878382121558056004, guid: 2758dfa2744d7ad4d8877545189d116e, type: 3} diff --git a/Assets/Scripts/ActionGameManager.cs b/Assets/Scripts/ActionGameManager.cs index 6893230da..365f08a0d 100644 --- a/Assets/Scripts/ActionGameManager.cs +++ b/Assets/Scripts/ActionGameManager.cs @@ -45,17 +45,20 @@ public class ActionGameManager : MonoBehaviour // private CinemachineFramingTransposer _transposer; // private CinemachineComposer _composer; + private DirectoryInfo _filePath; + private DirectoryInfo _presetPath; private bool _editMode; private float _time; private AetheriaInput _input; private int _zoomLevelIndex; + public List Presets { get; set; } = new List(); // private ShipInput _shipInput; private float2 _shipYawPitch; private float3 _viewDirection; - private (HardpointData[] hardpoints, Transform[] barrels, PlaceUIElementWorldspace crosshair)[] ArticulationGroups; - private (TargetLock targetLock, PlaceUIElementWorldspace indicator, Rotate spin)[] LockingIndicators; + private (HardpointData[] hardpoints, Transform[] barrels, PlaceUIElementWorldspace crosshair)[] _articulationGroups; + private (TargetLock targetLock, PlaceUIElementWorldspace indicator, Rotate spin)[] _lockingIndicators; public List PlayerShips { get; } = new List(); public EquippedDockingBay DockingBay { get; private set; } @@ -71,6 +74,11 @@ public class ActionGameManager : MonoBehaviour (float2(0, -1), "Rear") }; + public void SavePreset(EntityPack pack) + { + File.WriteAllBytes(Path.Combine(_presetPath.FullName, $"{pack.Name}.preset"), MessagePackSerializer.Serialize(pack)); + } + void Start() { // _transposer = DockCamera.GetCinemachineComponent(); @@ -79,10 +87,14 @@ public class ActionGameManager : MonoBehaviour ConsoleController.MessageReceiver = this; _filePath = new DirectoryInfo(Application.dataPath).Parent.CreateSubdirectory("GameData"); + _presetPath = _filePath.CreateSubdirectory("Presets"); ItemData = new DatabaseCache(); ItemData.Load(_filePath.FullName); ItemManager = new ItemManager(ItemData, Settings.GameplaySettings, Debug.Log); + Presets.AddRange(_presetPath.EnumerateFiles("*.preset") + .Select(fi => MessagePackSerializer.Deserialize(File.ReadAllBytes(fi.FullName)))); + var zoneFile = Path.Combine(_filePath.FullName, "Home.zone"); // If the game has already been run, there will be a Home file containing a ZonePack; if not, generate one @@ -535,7 +547,7 @@ public class ActionGameManager : MonoBehaviour Cursor.lockState = CursorLockMode.None; _input.Player.Disable(); GameplayUI.SetActive(false); - if(LockingIndicators!=null) foreach(var (_, indicator, _) in LockingIndicators) + if(_lockingIndicators!=null) foreach(var (_, indicator, _) in _lockingIndicators) indicator.GetComponent().ReturnToPool(); } } @@ -573,7 +585,7 @@ public class ActionGameManager : MonoBehaviour FollowCamera.enabled = true; FollowCamera.LookAt = SectorRenderer.EntityInstances[CurrentShip].LookAtPoint; FollowCamera.Follow = SectorRenderer.EntityInstances[CurrentShip].Transform; - ArticulationGroups = CurrentShip.Equipment + _articulationGroups = CurrentShip.Equipment .Where(item => item.Behaviors.Any(x => x.Data is WeaponData && !(x.Data is LauncherData))) .GroupBy(item => SectorRenderer.EntityInstances[CurrentShip] .GetBarrel(CurrentShip.Hardpoints[item.Position.x, item.Position.y]) @@ -588,10 +600,10 @@ public class ActionGameManager : MonoBehaviour foreach (var crosshair in Crosshairs) crosshair.gameObject.SetActive(false); - foreach (var group in ArticulationGroups) + foreach (var group in _articulationGroups) group.crosshair.gameObject.SetActive(true); - LockingIndicators = CurrentShip.GetBehaviors().Select(x => + _lockingIndicators = CurrentShip.GetBehaviors().Select(x => { var i = LockIndicator.Instantiate(); return (x, i, i.GetComponent()); @@ -677,7 +689,7 @@ public class ActionGameManager : MonoBehaviour if (CurrentShip.Target.Value != null) TargetIndicator.Target = CurrentShip.Target.Value.Position; var distance = length((float3)ViewDot.Target - CurrentShip.Position); - foreach (var (_, barrels, crosshair) in ArticulationGroups) + foreach (var (_, barrels, crosshair) in _articulationGroups) { var averagePosition = Vector3.zero; foreach (var barrel in barrels) @@ -685,7 +697,7 @@ public class ActionGameManager : MonoBehaviour averagePosition /= barrels.Length; crosshair.Target = averagePosition; } - foreach (var (targetLock, indicator, spin) in LockingIndicators) + foreach (var (targetLock, indicator, spin) in _lockingIndicators) { var showLockingIndicator = targetLock.Lock > .01f && CurrentShip.Target.Value != null; indicator.gameObject.SetActive(showLockingIndicator); diff --git a/Assets/Scripts/ServerShared/EntitySerializer.cs b/Assets/Scripts/ServerShared/EntitySerializer.cs index cd5c21aa1..8095f7160 100644 --- a/Assets/Scripts/ServerShared/EntitySerializer.cs +++ b/Assets/Scripts/ServerShared/EntitySerializer.cs @@ -10,25 +10,48 @@ using Unity.Mathematics; public class EntityPack { [Key(0)] - public EquippableItem Hull; + public string Name; [Key(1)] + public EquippableItem Hull; + + [Key(2)] public (int2 position, EquippableItem item)[] Equipment; + + [Key(3)] public (int2 position, EquippableItem item)[] CargoBays; + + [Key(4)] public (int2 position, EquippableItem item)[] DockingBays; + [Key(5)] public Dictionary PersistedBehaviors; + [Key(6)] public float[,] Temperature; + + [Key(7)] public float[,] Armor; + + [Key(8)] + public bool2[,] Conductivity; + + [Key(9)] public Dictionary HardpointArmor; + + [Key(10)] public int[] DockingBayAssignments; + + [Key(11)] public (int2 position, ItemInstance item)[][] CargoContents; + + [Key(12)] public (int2 position, ItemInstance item)[][] DockingBayContents; + [Key(13)] public EntityPack[] Children; - public static EntityPack Serialize(Entity entity) + public static EntityPack Pack(Entity entity) { var pack = new EntityPack(); @@ -41,7 +64,9 @@ public class EntityPack .Where(b=>b is IPersistentBehavior) .Cast()}) .ToDictionary(x=> x.equippable.Position, x=>x.behaviors.Select(b => b.Store()).ToArray()); - + + pack.Hull = entity.Hull; + pack.Name = entity.Name; pack.Equipment = entity.Equipment.Select(e => (e.Position, e.EquippableItem)).ToArray(); pack.CargoBays = entity.CargoBays.Select(e => (e.Position, e.EquippableItem)).ToArray(); pack.DockingBays = entity.DockingBays.Select(e => (e.Position, e.EquippableItem)).ToArray(); @@ -50,20 +75,21 @@ public class EntityPack pack.DockingBayContents = entity.DockingBays.Select(b => b.Cargo.Select(i => (i.Value, i.Key)).ToArray()).ToArray(); pack.Armor = entity.Armor; pack.Temperature = entity.Temperature; + pack.Conductivity = entity.HullConductivity; var hullData = entity.ItemManager.GetData(entity.Hull) as HullData; pack.HardpointArmor = entity.HardpointArmor.ToDictionary(x => hullData.Hardpoints.IndexOf(x.Key), x => x.Value); - pack.Children = entity.Children.Select(Serialize).ToArray(); + pack.Children = entity.Children.Select(Pack).ToArray(); return pack; } - public static Ship Deserialize(ItemManager itemManager, Zone zone, EntityPack pack) + public static Ship Unpack(ItemManager itemManager, Zone zone, EntityPack pack) { var entity = new Ship(itemManager, zone, pack.Hull); Restore(itemManager, zone, pack, entity); return entity; } - public static OrbitalEntity Deserialize(ItemManager itemManager, Zone zone, EntityPack pack, Guid orbit) + public static OrbitalEntity Unpack(ItemManager itemManager, Zone zone, EntityPack pack, Guid orbit) { var entity = new OrbitalEntity(itemManager, zone, pack.Hull, orbit); Restore(itemManager, zone, pack, entity); @@ -72,9 +98,10 @@ public class EntityPack public static void Restore(ItemManager itemManager, Zone zone, EntityPack pack, Entity entity) { + entity.Name = pack.Name; entity.Children = pack.Children.Select(c => { - var child = Deserialize(itemManager, zone, c); + var child = Unpack(itemManager, zone, c); child.Parent = entity; return (Entity) child; }).ToList(); @@ -109,6 +136,7 @@ public class EntityPack entity.Temperature = pack.Temperature; entity.Armor = pack.Armor; var hullData = entity.ItemManager.GetData(entity.Hull) as HullData; + entity.HullConductivity = pack.Conductivity; entity.HardpointArmor = pack.HardpointArmor.ToDictionary(x => hullData.Hardpoints[x.Key], x => x.Value); } } diff --git a/Assets/Scripts/ServerShared/MathFormatters.cs b/Assets/Scripts/ServerShared/MathFormatters.cs index 098ffab88..5a906895b 100644 --- a/Assets/Scripts/ServerShared/MathFormatters.cs +++ b/Assets/Scripts/ServerShared/MathFormatters.cs @@ -87,6 +87,47 @@ public class Int2Formatter : MessagePack.Formatters.IMessagePackFormatter } } +public class Bool2Formatter : MessagePack.Formatters.IMessagePackFormatter +{ + public void Serialize(ref MessagePackWriter writer, bool2 value, MessagePackSerializerOptions options) + { + writer.WriteArrayHeader(2); + writer.Write(value.x); + writer.Write(value.y); + } + + public bool2 Deserialize(ref MessagePackReader reader, MessagePackSerializerOptions options) + { + if (reader.IsNil) + { + throw new InvalidOperationException("typecode is null, struct not supported"); + } + + var length = reader.ReadArrayHeader(); + var x = default(bool); + var y = default(bool); + for (int i = 0; i < length; i++) + { + var key = i; + switch (key) + { + case 0: + x = reader.ReadBoolean(); + break; + case 1: + y = reader.ReadBoolean(); + break; + default: + reader.Skip(); + break; + } + } + + var result = bool2(x, y); + return result; + } +} + public class Float3Formatter : MessagePack.Formatters.IMessagePackFormatter { public void Serialize(ref MessagePackWriter writer, float3 value, MessagePackSerializerOptions options) diff --git a/Assets/Scripts/ServerShared/MathResolver.cs b/Assets/Scripts/ServerShared/MathResolver.cs index cb823bfb5..bc0574d26 100644 --- a/Assets/Scripts/ServerShared/MathResolver.cs +++ b/Assets/Scripts/ServerShared/MathResolver.cs @@ -38,6 +38,7 @@ internal static class MathResolverResolverGetFormatterHelper // standard { typeof(float2), new Float2Formatter() }, { typeof(int2), new Int2Formatter() }, + { typeof(bool2), new Bool2Formatter() }, { typeof(float3), new Float3Formatter() }, { typeof(float4), new Float4Formatter() }, { typeof(float2?), new StaticNullableFormatter(new Float2Formatter()) }, diff --git a/Assets/Scripts/UI/InventoryPanel.cs b/Assets/Scripts/UI/InventoryPanel.cs index f2168ab83..15b3d370a 100644 --- a/Assets/Scripts/UI/InventoryPanel.cs +++ b/Assets/Scripts/UI/InventoryPanel.cs @@ -124,6 +124,12 @@ public class InventoryPanel : MonoBehaviour if(GameManager.DockingBay!=null && _displayedCargo!=GameManager.DockingBay) ContextMenu.AddOption(GameManager.DockingBay.Name, () => Display(GameManager.DockingBay)); + + ContextMenu.AddOption("Create Preset", + () => + { + GameManager.SavePreset(EntityPack.Pack(_displayedEntity)); + }); ContextMenu.Show(); }); diff --git a/Economy.Shared.Unity.csproj b/Economy.Shared.Unity.csproj index a244e809a..005611bc0 100644 --- a/Economy.Shared.Unity.csproj +++ b/Economy.Shared.Unity.csproj @@ -58,8 +58,8 @@ - + @@ -521,6 +521,9 @@ + + E:/Projects/Aetheria-Economy/Assets/Plugins/System.Threading.Tasks.Extensions.dll + E:/Projects/Aetheria-Economy/Assets/Plugins/Remotion.Linq.dll @@ -542,15 +545,15 @@ E:/Projects/Aetheria-Economy/Assets/Plugins/System.Buffers.dll + + E:/Projects/Aetheria-Economy/Library/PackageCache/com.unity.burst@1.4.3/Unity.Burst.Unsafe.dll + E:/Projects/Aetheria-Economy/Assets/Plugins/QuickGraph.dll E:/Projects/Aetheria-Economy/Assets/Allegorithmic/Plugins/Substance.Game.dll - - E:/Projects/Aetheria-Economy/Assets/Plugins/System.Threading.Tasks.Extensions.dll - E:/Projects/Aetheria-Economy/Assets/Allegorithmic/Plugins/Substance/Substance Source/Editor/SourceUnityLib.dll @@ -560,9 +563,6 @@ E:/Projects/Aetheria-Economy/Assets/Allegorithmic/Plugins/Substance/Substance Engine/Editor/Substance.Editor.dll - - E:/Projects/Aetheria-Economy/Library/PackageCache/com.unity.burst@1.4.3/Unity.Burst.Unsafe.dll - C:/Program Files/Unity/Hub/Editor/2020.2.1f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/mscorlib.dll diff --git a/GameData/Presets/Djinni.preset b/GameData/Presets/Djinni.preset new file mode 100644 index 000000000..678cb12ac Binary files /dev/null and b/GameData/Presets/Djinni.preset differ diff --git a/MessagePack.csproj b/MessagePack.csproj index 04cadb7db..45c521bbf 100644 --- a/MessagePack.csproj +++ b/MessagePack.csproj @@ -378,6 +378,9 @@ C:/Program Files/Unity/Hub/Editor/2020.2.1f1/Editor/Data/PlaybackEngines/WindowsStandaloneSupport/UnityEditor.WindowsStandalone.Extensions.dll + + E:/Projects/Aetheria-Economy/Assets/Plugins/System.Threading.Tasks.Extensions.dll + E:/Projects/Aetheria-Economy/Assets/Plugins/Remotion.Linq.dll @@ -399,15 +402,15 @@ E:/Projects/Aetheria-Economy/Assets/Plugins/System.Buffers.dll + + E:/Projects/Aetheria-Economy/Library/PackageCache/com.unity.burst@1.4.3/Unity.Burst.Unsafe.dll + E:/Projects/Aetheria-Economy/Assets/Plugins/QuickGraph.dll E:/Projects/Aetheria-Economy/Assets/Allegorithmic/Plugins/Substance.Game.dll - - E:/Projects/Aetheria-Economy/Assets/Plugins/System.Threading.Tasks.Extensions.dll - E:/Projects/Aetheria-Economy/Assets/Allegorithmic/Plugins/Substance/Substance Source/Editor/SourceUnityLib.dll @@ -417,9 +420,6 @@ E:/Projects/Aetheria-Economy/Assets/Allegorithmic/Plugins/Substance/Substance Engine/Editor/Substance.Editor.dll - - E:/Projects/Aetheria-Economy/Library/PackageCache/com.unity.burst@1.4.3/Unity.Burst.Unsafe.dll - C:/Program Files/Unity/Hub/Editor/2020.2.1f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/mscorlib.dll diff --git a/Substance.EditorHelper.csproj b/Substance.EditorHelper.csproj index 2333b536b..1ac9366ce 100644 --- a/Substance.EditorHelper.csproj +++ b/Substance.EditorHelper.csproj @@ -282,6 +282,9 @@ C:/Program Files/Unity/Hub/Editor/2020.2.1f1/Editor/Data/PlaybackEngines/WindowsStandaloneSupport/UnityEditor.WindowsStandalone.Extensions.dll + + E:/Projects/Aetheria-Economy/Assets/Plugins/System.Threading.Tasks.Extensions.dll + E:/Projects/Aetheria-Economy/Assets/Plugins/Remotion.Linq.dll @@ -303,15 +306,15 @@ E:/Projects/Aetheria-Economy/Assets/Plugins/System.Buffers.dll + + E:/Projects/Aetheria-Economy/Library/PackageCache/com.unity.burst@1.4.3/Unity.Burst.Unsafe.dll + E:/Projects/Aetheria-Economy/Assets/Plugins/QuickGraph.dll E:/Projects/Aetheria-Economy/Assets/Allegorithmic/Plugins/Substance.Game.dll - - E:/Projects/Aetheria-Economy/Assets/Plugins/System.Threading.Tasks.Extensions.dll - E:/Projects/Aetheria-Economy/Assets/Allegorithmic/Plugins/Substance/Substance Source/Editor/SourceUnityLib.dll @@ -321,9 +324,6 @@ E:/Projects/Aetheria-Economy/Assets/Allegorithmic/Plugins/Substance/Substance Engine/Editor/Substance.Editor.dll - - E:/Projects/Aetheria-Economy/Library/PackageCache/com.unity.burst@1.4.3/Unity.Burst.Unsafe.dll - C:/Program Files/Unity/Hub/Editor/2020.2.1f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/mscorlib.dll diff --git a/Substance.Platform.csproj b/Substance.Platform.csproj index 058a04302..5f7d24857 100644 --- a/Substance.Platform.csproj +++ b/Substance.Platform.csproj @@ -282,6 +282,9 @@ C:/Program Files/Unity/Hub/Editor/2020.2.1f1/Editor/Data/PlaybackEngines/WindowsStandaloneSupport/UnityEditor.WindowsStandalone.Extensions.dll + + E:/Projects/Aetheria-Economy/Assets/Plugins/System.Threading.Tasks.Extensions.dll + E:/Projects/Aetheria-Economy/Assets/Plugins/Remotion.Linq.dll @@ -303,15 +306,15 @@ E:/Projects/Aetheria-Economy/Assets/Plugins/System.Buffers.dll + + E:/Projects/Aetheria-Economy/Library/PackageCache/com.unity.burst@1.4.3/Unity.Burst.Unsafe.dll + E:/Projects/Aetheria-Economy/Assets/Plugins/QuickGraph.dll E:/Projects/Aetheria-Economy/Assets/Allegorithmic/Plugins/Substance.Game.dll - - E:/Projects/Aetheria-Economy/Assets/Plugins/System.Threading.Tasks.Extensions.dll - E:/Projects/Aetheria-Economy/Assets/Allegorithmic/Plugins/Substance/Substance Source/Editor/SourceUnityLib.dll @@ -321,9 +324,6 @@ E:/Projects/Aetheria-Economy/Assets/Allegorithmic/Plugins/Substance/Substance Engine/Editor/Substance.Editor.dll - - E:/Projects/Aetheria-Economy/Library/PackageCache/com.unity.burst@1.4.3/Unity.Burst.Unsafe.dll - C:/Program Files/Unity/Hub/Editor/2020.2.1f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/mscorlib.dll diff --git a/UniRx.csproj b/UniRx.csproj index 46ef4e74f..3b8786f5b 100644 --- a/UniRx.csproj +++ b/UniRx.csproj @@ -521,6 +521,9 @@ C:/Program Files/Unity/Hub/Editor/2020.2.1f1/Editor/Data/PlaybackEngines/WindowsStandaloneSupport/UnityEditor.WindowsStandalone.Extensions.dll + + E:/Projects/Aetheria-Economy/Assets/Plugins/System.Threading.Tasks.Extensions.dll + E:/Projects/Aetheria-Economy/Assets/Plugins/Remotion.Linq.dll @@ -542,15 +545,15 @@ E:/Projects/Aetheria-Economy/Assets/Plugins/System.Buffers.dll + + E:/Projects/Aetheria-Economy/Library/PackageCache/com.unity.burst@1.4.3/Unity.Burst.Unsafe.dll + E:/Projects/Aetheria-Economy/Assets/Plugins/QuickGraph.dll E:/Projects/Aetheria-Economy/Assets/Allegorithmic/Plugins/Substance.Game.dll - - E:/Projects/Aetheria-Economy/Assets/Plugins/System.Threading.Tasks.Extensions.dll - E:/Projects/Aetheria-Economy/Assets/Allegorithmic/Plugins/Substance/Substance Source/Editor/SourceUnityLib.dll @@ -560,9 +563,6 @@ E:/Projects/Aetheria-Economy/Assets/Allegorithmic/Plugins/Substance/Substance Engine/Editor/Substance.Editor.dll - - E:/Projects/Aetheria-Economy/Library/PackageCache/com.unity.burst@1.4.3/Unity.Burst.Unsafe.dll - C:/Program Files/Unity/Hub/Editor/2020.2.1f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/mscorlib.dll