Keep inventory previews display-only
This commit is contained in:
parent
781e612c23
commit
039c979e72
4 changed files with 51 additions and 6 deletions
|
|
@ -1,14 +1,14 @@
|
|||
{
|
||||
"name": "org.gamecult.eve.unity-scene",
|
||||
"displayName": "Eve Unity Scene Lowering",
|
||||
"version": "0.3.120",
|
||||
"version": "0.3.121",
|
||||
"unity": "6000.0",
|
||||
"description": "Provider-agnostic Unity scene shell for gamecult.eve.surface.v1 interactive world surfaces.",
|
||||
"dependencies": {
|
||||
"org.gamecult.cultlib": "1.0.56",
|
||||
"org.gamecult.eve.plugin-fields": "0.2.3",
|
||||
"org.gamecult.eve.surface": "0.3.3",
|
||||
"org.gamecult.eve.unity-uitoolkit": "0.1.6",
|
||||
"org.gamecult.eve.unity-uitoolkit": "0.1.7",
|
||||
"com.unity.mathematics": "1.3.2",
|
||||
"com.unity.render-pipelines.universal": "17.4.0",
|
||||
"com.unity.modules.particlesystem": "1.0.0"
|
||||
|
|
|
|||
|
|
@ -414,9 +414,6 @@ namespace GameCult.Eve.UnityUIToolkit
|
|||
Math.Max(0f, ParseNumber(target.GetProp("cellGap"), 4f)));
|
||||
var x = Math.Max(0, (int)Math.Floor(local.x / pitch));
|
||||
var y = Math.Max(0, (int)Math.Floor(local.y / pitch));
|
||||
if (!EveInventoryInteraction.TryCreatePlacementPreview(source, target, x, y, out var preview) ||
|
||||
preview == null || !preview.IsValid)
|
||||
return false;
|
||||
if (!EveInventoryInteraction.TryCreateDropRequest(
|
||||
document, source, target, x, y, "unity-uitoolkit", out var request) || request == null)
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -368,6 +368,54 @@ namespace GameCult.Eve.UnityUIToolkit.Tests
|
|||
Assert.That(outside.Reason, Is.EqualTo("outside-grid"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void InvalidLocalPreviewStillEmitsProviderOwnedDrop()
|
||||
{
|
||||
EveSurfaceCommandRequest? emitted = null;
|
||||
var source = Component("moving", EveInventoryInteraction.ItemKind, new Dictionary<string, string>
|
||||
{
|
||||
["sourceKind"] = "equipment",
|
||||
["sourceIndex"] = "0",
|
||||
["itemKey"] = "reactor",
|
||||
["shapeCells"] = "0,0"
|
||||
});
|
||||
var occupied = Component("stored", EveInventoryInteraction.ItemKind, new Dictionary<string, string>
|
||||
{
|
||||
["x"] = "0",
|
||||
["y"] = "0",
|
||||
["shapeCells"] = "0,0"
|
||||
});
|
||||
var target = new EveSurfaceComponent(
|
||||
"hangar.inventory",
|
||||
EveInventoryInteraction.GridKind,
|
||||
new Dictionary<string, string>
|
||||
{
|
||||
["columns"] = "8",
|
||||
["rows"] = "2",
|
||||
["targetKind"] = "hangar",
|
||||
["dropCommand.equipment"] = "aetheria.hangar.remove_item"
|
||||
},
|
||||
new[] { occupied });
|
||||
var method = typeof(EveUiToolkitSurfaceLowerer).GetMethod(
|
||||
"TryEmitInventoryDrop",
|
||||
System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);
|
||||
|
||||
Assert.That(method, Is.Not.Null);
|
||||
var emittedDrop = (bool)method!.Invoke(null, new object[]
|
||||
{
|
||||
Document(target),
|
||||
source,
|
||||
target,
|
||||
new VisualElement(),
|
||||
UnityEngine.Vector2.zero,
|
||||
new Action<EveSurfaceCommandRequest>(request => emitted = request)
|
||||
})!;
|
||||
|
||||
Assert.That(emittedDrop, Is.True);
|
||||
Assert.That(emitted, Is.Not.Null);
|
||||
Assert.That(emitted!.Command, Is.EqualTo("aetheria.hangar.remove_item"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void InventoryGridAndItemsLowerToNativeSpatialElements()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "org.gamecult.eve.unity-uitoolkit",
|
||||
"displayName": "Eve UI Toolkit Lowering",
|
||||
"version": "0.1.6",
|
||||
"version": "0.1.7",
|
||||
"unity": "2021.3",
|
||||
"description": "Unity UI Toolkit lowering for gamecult.eve.surface.v1 documents.",
|
||||
"dependencies": {
|
||||
|
|
|
|||
Reference in a new issue