-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add compatibility for Afterlife Overhaul
Requires to edit ModAgent within Afterlife!
- Loading branch information
Showing
15 changed files
with
244 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
|
||
call 10-CompileVanilla.bat %* | ||
call 11-CompileSmxCompat.bat %* | ||
call 12-CompileAlCompat.bat %* |
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 |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
|
||
call 20-PackageVanilla.bat %* | ||
call 21-PackageSmxCompat.bat %* | ||
call 22-PackageAlCompat.bat %* |
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,13 @@ | ||
@echo off | ||
|
||
call MC7D2D AlCompat\InventoryMouseWheel.dll ^ | ||
/reference:"%PATH_7D2D_MANAGED%\NGUI.dll" ^ | ||
/reference:"%PATH_7D2D_MANAGED%\Assembly-CSharp.dll" ^ | ||
/reference:"%PATH_7D2D_MANAGED%\Afterlife.dll" ^ | ||
/reference:"%PATH_7D2D_MANAGED%\Quartz.dll" ^ | ||
Harmony\*.cs AlCompat\*.cs && ^ | ||
echo Successfully compiled AlCompat\InventoryMouseWheel.dll | ||
|
||
SET RV=%ERRORLEVEL% | ||
if "%CI%"=="" pause | ||
exit /B %RV% |
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,40 @@ | ||
@echo off | ||
|
||
SET NAME=OcbInventoryMouseWheelAL | ||
|
||
if not exist build\ ( | ||
mkdir build | ||
) | ||
|
||
if exist build\%NAME%\ ( | ||
echo remove existing directory | ||
rmdir build\%NAME% /S /Q | ||
) | ||
|
||
mkdir build\%NAME% | ||
|
||
SET VERSION=snapshot | ||
|
||
if not "%1"=="" ( | ||
SET VERSION=%1 | ||
) | ||
|
||
echo create %VERSION% | ||
|
||
xcopy *.xml build\%NAME%\ | ||
xcopy *.md build\%NAME%\ | ||
xcopy AlCompat\*.dll build\%NAME%\ | ||
xcopy Config build\%NAME%\Config\ /S | ||
xcopy Resources build\%NAME%\Resources\ /S | ||
xcopy UIAtlases build\%NAME%\UIAtlases\ /S | ||
|
||
powershell -Command "(gc -encoding UTF8 build\%NAME%\ModInfo.xml) -replace '\"OcbInventoryMouseWheel\"', '\"OcbInventoryMouseWheelAL\"' | Out-File -encoding UTF8 build\%NAME%\ModInfo.xml" | ||
|
||
cd build | ||
echo Packaging %NAME%-%VERSION%.zip | ||
powershell Compress-Archive %NAME% %NAME%-%VERSION%.zip -Force | ||
cd .. | ||
|
||
SET RV=%ERRORLEVEL% | ||
if "%CI%"=="" pause | ||
exit /B %RV% |
Binary file not shown.
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,84 @@ | ||
using Audio; | ||
using System; | ||
using UnityEngine; | ||
|
||
public class XUiC_AL_WheelItemStack : AL.UI.XUiC_AL_ItemStack | ||
{ | ||
|
||
protected bool IsOver = false; | ||
|
||
public override void Init() | ||
{ | ||
base.Init(); | ||
} | ||
|
||
private ItemStack DnDStack => xui.dragAndDrop.CurrentStack; | ||
|
||
private void SetSlot(ItemStack stack) => ItemStack = stack; | ||
|
||
private void SetDnD(ItemStack stack) => xui.dragAndDrop.CurrentStack = stack; | ||
|
||
static bool IsShiftPressed => Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift); | ||
|
||
protected virtual int TransferItems(int amount, | ||
ItemStack src, Action<ItemStack> setSrc, | ||
ItemStack dst, Action<ItemStack> setDst) | ||
{ | ||
if (IsShiftPressed) amount *= 10; | ||
if (WheelItemStack.TransferItems(amount, src, setSrc, dst, setDst) > 0) | ||
{ | ||
// Copied from vanilla | ||
ForceRefreshItemStack(); | ||
IsDirty = true; | ||
Selected = false; | ||
HandleClickComplete(); | ||
xui.calloutWindow.UpdateCalloutsForItemStack( | ||
ViewComponent.UiTransform.gameObject, | ||
ItemStack, IsOver); | ||
if (placeSound != null) Manager. | ||
PlayXUiSound(placeSound, 0.1f); | ||
} | ||
// Return how much was transfered | ||
return amount; | ||
} | ||
|
||
public override void OnHovered(bool _isOver) | ||
{ | ||
IsOver = _isOver; | ||
base.OnHovered(_isOver); | ||
} | ||
|
||
public override void OnScrolled(float _delta) | ||
{ | ||
// Process the item transfer | ||
if (IsLocked || StackLock) | ||
{ | ||
base.OnScrolled(_delta); | ||
} | ||
// Do nothing if the cursor is currently locked | ||
// Happens when cursors stay over toolbar when backpack is closed | ||
else if (Cursor.lockState != CursorLockMode.None) | ||
{ | ||
base.OnScrolled(_delta); | ||
} | ||
else if (_delta > 0.0) | ||
{ | ||
TransferItems( | ||
(int)(_delta * 10), | ||
DnDStack, SetDnD, | ||
itemStack, SetSlot); | ||
} | ||
else if (_delta < 0.0) | ||
{ | ||
TransferItems( | ||
(int)(_delta * -10), | ||
itemStack, SetSlot, | ||
DnDStack, SetDnD); | ||
} | ||
else | ||
{ | ||
base.OnScrolled(_delta); | ||
} | ||
} | ||
|
||
} |
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,78 @@ | ||
using Audio; | ||
using System; | ||
using UnityEngine; | ||
|
||
public class XUiC_AL_WheelRequiredItemStack : AL.UI.XUiC_AL_RequiredItemStack | ||
{ | ||
|
||
protected bool IsOver = false; | ||
|
||
private ItemStack DnDStack => xui.dragAndDrop.CurrentStack; | ||
|
||
private void SetSlot(ItemStack stack) => ItemStack = stack; | ||
|
||
private void SetDnD(ItemStack stack) => xui.dragAndDrop.CurrentStack = stack; | ||
|
||
static bool IsShiftPressed => Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift); | ||
|
||
protected virtual int TransferItems(int amount, | ||
ItemStack src, Action<ItemStack> setSrc, | ||
ItemStack dst, Action<ItemStack> setDst) | ||
{ | ||
if (IsShiftPressed) amount *= 10; | ||
if (WheelItemStack.TransferItems(amount, src, setSrc, dst, setDst) > 0) | ||
{ | ||
// Copied from vanilla | ||
ForceRefreshItemStack(); | ||
IsDirty = true; | ||
Selected = false; | ||
HandleClickComplete(); | ||
xui.calloutWindow.UpdateCalloutsForItemStack( | ||
ViewComponent.UiTransform.gameObject, | ||
ItemStack, IsOver); | ||
if (placeSound != null) Manager. | ||
PlayXUiSound(placeSound, 0.1f); | ||
} | ||
// Return how much was transfered | ||
return amount; | ||
} | ||
|
||
public override void OnHovered(bool _isOver) | ||
{ | ||
IsOver = _isOver; | ||
base.OnHovered(_isOver); | ||
} | ||
|
||
public override void OnScrolled(float _delta) | ||
{ | ||
// Process the item transfer | ||
if (IsLocked || StackLock) | ||
{ | ||
base.OnScrolled(_delta); | ||
} | ||
// Do nothing if the cursor is currently locked | ||
// Happens when cursors stay over toolbar when backpack is closed | ||
else if (Cursor.lockState != CursorLockMode.None) | ||
{ | ||
base.OnScrolled(_delta); | ||
} | ||
else if (_delta > 0.0 && !TakeOnly && CanSwap(DnDStack)) | ||
{ | ||
TransferItems( | ||
(int)(_delta * 10), | ||
DnDStack, SetDnD, | ||
itemStack, SetSlot); | ||
} | ||
else if (_delta < 0.0 && (DnDStack.IsEmpty() || CanSwap(DnDStack))) | ||
{ | ||
TransferItems( | ||
(int)(_delta * -10), | ||
itemStack, SetSlot, | ||
DnDStack, SetDnD); | ||
} | ||
else | ||
{ | ||
base.OnScrolled(_delta); | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
<configs patcher-version="7"> | ||
<modif condition="xpath:/windows//item_stack[@controller='RequiredItemStack']"> | ||
<modif condition="xpath:/windows//*[@controller='AL.UI.AL_RequiredItemStack\,Afterlife']"> | ||
<echo log="OcbInventoryMouseWheel: Patching Afterlife required item stack"/> | ||
<setattribute xpath="/windows//*[@controller='AL.UI.AL_RequiredItemStack,Afterlife']" name="on_scroll">true</setattribute> | ||
<setattribute xpath="/windows//*[@controller='AL.UI.AL_RequiredItemStack,Afterlife']" name="controller">AL_WheelRequiredItemStack, InventoryMouseWheel</setattribute> | ||
</modif> | ||
<modif condition="xpath:/windows//*[@controller='RequiredItemStack']"> | ||
<echo log="OcbInventoryMouseWheel: Patching Vanilla required item stack"/> | ||
<setattribute xpath="/windows//item_stack[@controller='RequiredItemStack']" name="on_scroll">true</setattribute> | ||
<setattribute xpath="/windows//item_stack[@controller='RequiredItemStack']" name="controller">WheelRequiredItemStack, InventoryMouseWheel</setattribute> | ||
<setattribute xpath="/windows//*[@controller='RequiredItemStack']" name="on_scroll">true</setattribute> | ||
<setattribute xpath="/windows//*[@controller='RequiredItemStack']" name="controller">WheelRequiredItemStack, InventoryMouseWheel</setattribute> | ||
</modif> | ||
</configs> |
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
Binary file not shown.
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
Binary file not shown.