Fix multiselect refreshing to parent context
This commit is contained in:
@@ -162,7 +162,10 @@ public class MultiSelect
|
|||||||
if (oldItemContext != null)
|
if (oldItemContext != null)
|
||||||
{
|
{
|
||||||
MultiSelectItemContext newContext = oldItemContext.Refresh();
|
MultiSelectItemContext newContext = oldItemContext.Refresh();
|
||||||
SelectedItems.Add(newContext, SelectedItems[oldItemContext]);
|
if (newContext != null)
|
||||||
|
{
|
||||||
|
SelectedItems.Add(newContext, SelectedItems[oldItemContext]);
|
||||||
|
}
|
||||||
|
|
||||||
SelectedItems.Remove(oldItemContext);
|
SelectedItems.Remove(oldItemContext);
|
||||||
oldItemContext.Dispose();
|
oldItemContext.Dispose();
|
||||||
@@ -463,7 +466,12 @@ public class MultiSelectItemContext : DragItemContext
|
|||||||
|
|
||||||
public MultiSelectItemContext Refresh()
|
public MultiSelectItemContext Refresh()
|
||||||
{
|
{
|
||||||
return new MultiSelectItemContext(ItemContextAbstractClass, ItemRotation);
|
if (Item == ItemContextAbstractClass.Item)
|
||||||
|
{
|
||||||
|
return new MultiSelectItemContext(ItemContextAbstractClass, ItemRotation);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateDragContext(DragItemContext itemContext)
|
public void UpdateDragContext(DragItemContext itemContext)
|
||||||
|
@@ -66,9 +66,7 @@ public class MultiSelectDebug : MonoBehaviour
|
|||||||
}
|
}
|
||||||
|
|
||||||
ItemAddress address = itemContext is DragItemContext dragItemContext ? dragItemContext.ItemAddress : itemContext.Item.CurrentAddress;
|
ItemAddress address = itemContext is DragItemContext dragItemContext ? dragItemContext.ItemAddress : itemContext.Item.CurrentAddress;
|
||||||
LocationInGrid location = address is GridItemAddress gridAddress ?
|
LocationInGrid location = address is GridItemAddress gridAddress ? gridAddress.LocationInGrid : null;
|
||||||
itemContext is MultiSelectItemContext ? MultiGrid.GetGridLocation(gridAddress) : gridAddress.LocationInGrid :
|
|
||||||
null;
|
|
||||||
string locationString = location != null ? $"({location.x}, {location.y})" : "(slot)";
|
string locationString = location != null ? $"({location.x}, {location.y})" : "(slot)";
|
||||||
|
|
||||||
return $"x{itemContext.Item.StackObjectsCount} {address.Container.ID} {locationString} {itemContext.Item.Name.Localized()}";
|
return $"x{itemContext.Item.StackObjectsCount} {address.Container.ID} {locationString} {itemContext.Item.Name.Localized()}";
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
<TargetFramework>net471</TargetFramework>
|
<TargetFramework>net471</TargetFramework>
|
||||||
<AssemblyName>Tyfon.UIFixes</AssemblyName>
|
<AssemblyName>Tyfon.UIFixes</AssemblyName>
|
||||||
<Description>SPT UI Fixes</Description>
|
<Description>SPT UI Fixes</Description>
|
||||||
<Version>2.2.0</Version>
|
<Version>2.2.1</Version>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<Configurations>Debug;Release</Configurations>
|
<Configurations>Debug;Release</Configurations>
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "uifixes",
|
"name": "uifixes",
|
||||||
"version": "2.2.0",
|
"version": "2.2.1",
|
||||||
"main": "src/mod.js",
|
"main": "src/mod.js",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"author": "Tyfon",
|
"author": "Tyfon",
|
||||||
|
Reference in New Issue
Block a user