This commit is contained in:
CWXDEV 2024-02-06 00:14:43 +00:00
parent 0d98ee659b
commit 37cc39c0f8
6 changed files with 53 additions and 22 deletions

View File

@ -1,36 +1,42 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net472</TargetFramework> <TargetFramework>net472</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="0Harmony">
<HintPath>..\..\..\..\SPT\BepInEx\core\0Harmony.dll</HintPath>
</Reference>
<Reference Include="Aki.Reflection"> <Reference Include="Aki.Reflection">
<HintPath>..\Shared\Aki.Reflection.dll</HintPath> <HintPath>D:\SPT\EscapeFromTarkov_Data\Managed\Aki.Reflection.dll</HintPath>
</Reference> </Reference>
<Reference Include="Assembly-CSharp"> <Reference Include="Assembly-CSharp">
<HintPath>..\Shared\Assembly-CSharp.dll</HintPath> <HintPath>D:\SPT\EscapeFromTarkov_Data\Managed\Assembly-CSharp.dll</HintPath>
</Reference> </Reference>
<Reference Include="BepInEx"> <Reference Include="BepInEx">
<HintPath>..\Shared\BepInEx.dll</HintPath> <HintPath>D:\SPT\BepInEx\core\BepInEx.dll</HintPath>
</Reference> </Reference>
<Reference Include="Comfort"> <Reference Include="Comfort">
<HintPath>..\Shared\Comfort.dll</HintPath> <HintPath>D:\SPT\EscapeFromTarkov_Data\Managed\Comfort.dll</HintPath>
</Reference> </Reference>
<Reference Include="Newtonsoft.Json"> <Reference Include="Newtonsoft.Json">
<HintPath>..\Shared\Newtonsoft.Json.dll</HintPath> <HintPath>D:\SPT\EscapeFromTarkov_Data\Managed\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Sirenix.Serialization">
<HintPath>..\..\..\..\SPT\EscapeFromTarkov_Data\Managed\Sirenix.Serialization.dll</HintPath>
</Reference> </Reference>
<Reference Include="UnityEngine"> <Reference Include="UnityEngine">
<HintPath>..\Shared\UnityEngine.dll</HintPath> <HintPath>D:\SPT\EscapeFromTarkov_Data\Managed\UnityEngine.dll</HintPath>
</Reference> </Reference>
<Reference Include="UnityEngine.CoreModule"> <Reference Include="UnityEngine.CoreModule">
<HintPath>..\Shared\UnityEngine.CoreModule.dll</HintPath> <HintPath>D:\SPT\EscapeFromTarkov_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
</Reference> </Reference>
<Reference Include="UnityEngine.UI"> <Reference Include="UnityEngine.UI">
<HintPath>..\Shared\UnityEngine.UI.dll</HintPath> <HintPath>D:\SPT\EscapeFromTarkov_Data\Managed\UnityEngine.UI.dll</HintPath>
</Reference> </Reference>
<Reference Include="UnityEngine.UIModule"> <Reference Include="UnityEngine.UIModule">
<HintPath>..\Shared\UnityEngine.UIModule.dll</HintPath> <HintPath>D:\SPT\EscapeFromTarkov_Data\Managed\UnityEngine.UIModule.dll</HintPath>
</Reference> </Reference>
</ItemGroup> </ItemGroup>

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2024 Naekami
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -13,7 +13,7 @@ namespace TraderScrolling
var rightPerson = GameObject.Find("Right Person"); var rightPerson = GameObject.Find("Right Person");
var list = rightPerson.GetComponentsInChildren<RectTransform>(true).ToList(); var list = rightPerson.GetComponentsInChildren<RectTransform>(true).ToList();
var money = list.FirstOrDefault(x => x.name == "Money"); var money = list.FirstOrDefault(x => x.name == "Money");
var moneyRect = money.RectTransform(); var moneyRect = money.GetComponent<RectTransform>();
moneyRect.anchoredPosition = new Vector2(moneyRect.anchoredPosition.x + 60f, moneyRect.anchoredPosition.y); moneyRect.anchoredPosition = new Vector2(moneyRect.anchoredPosition.x + 60f, moneyRect.anchoredPosition.y);
//End of Money position Change //End of Money position Change
@ -38,7 +38,8 @@ namespace TraderScrolling
// Change Colour alpha to max for background // Change Colour alpha to max for background
var background = tile.FirstOrDefault(x => x.name == "Background"); var background = tile.FirstOrDefault(x => x.name == "Background");
background.color = new Color(0, 0, 0, 1); background.color = new Color(0, 0, 0, 1);
} }
} }
} }

View File

@ -2,13 +2,13 @@
namespace TraderScrolling namespace TraderScrolling
{ {
[BepInPlugin("com.kaeno.TraderScrolling", "Kaeno-TraderScrolling", "1.0.0")] [BepInPlugin("com.kaeno.TraderScrolling", "Kaeno-TraderScrolling", "1.0.2")]
public class TraderScrolling : BaseUnityPlugin public class TraderScrolling : BaseUnityPlugin
{ {
private void Awake() private void Awake()
{ {
new TraderScrollingPatch().Enable(); new TraderScrollingPatch().Enable();
new PlayerCardPatch().Enable(); new PlayerCardPatch().Enable();
} }
} }
} }

View File

@ -2,6 +2,7 @@
using Aki.Reflection.Patching; using Aki.Reflection.Patching;
using Aki.Reflection.Utils; using Aki.Reflection.Utils;
using EFT.UI; using EFT.UI;
using HarmonyLib;
using UnityEngine; using UnityEngine;
namespace TraderScrolling namespace TraderScrolling
@ -10,7 +11,7 @@ namespace TraderScrolling
{ {
protected override MethodBase GetTargetMethod() protected override MethodBase GetTargetMethod()
{ {
return typeof(TraderScreensGroup).GetMethod("method_4", PatchConstants.PrivateFlags); return AccessTools.Method(typeof(TraderScreensGroup), nameof(TraderScreensGroup.Show));
} }
[PatchPostfix] [PatchPostfix]
@ -18,12 +19,12 @@ namespace TraderScrolling
{ {
var gameObject = GameObject.Find("Menu UI"); var gameObject = GameObject.Find("Menu UI");
var check = gameObject.GetComponentInChildren<TraderScrollingScript>(); var check = gameObject.GetComponentInChildren<TraderScrollingScript>();
if (check != null) if (check != null)
{ {
return; return;
} }
gameObject.AddComponent<TraderScrollingScript>(); gameObject.AddComponent<TraderScrollingScript>();
} }
} }

View File

@ -1,4 +1,6 @@
using System.Linq; using Comfort.Common;
using EFT.UI;
using System.Linq;
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
@ -13,10 +15,10 @@ namespace TraderScrolling
var list = menuUI.GetComponentsInChildren<RectTransform>(true).ToList(); var list = menuUI.GetComponentsInChildren<RectTransform>(true).ToList();
var container = list.FirstOrDefault(x => x.name == "Container"); var container = list.FirstOrDefault(x => x.name == "Container");
var scrollrect = traderCards.AddComponent<ScrollRect>(); var scrollrect = traderCards.AddComponent<ScrollRect>();
var traderCardsRect = traderCards.RectTransform(); var traderCardsRect = traderCards.GetComponent<RectTransform>();
var containerRect = container.RectTransform(); var containerRect = container.GetComponent<RectTransform>();
var countCards = traderCards.transform.childCount; var countCards = traderCards.transform.childCount;
var count = countCards - 10; var count = countCards - 10;
//THIS IS DEFAULT anchorMin For anything below 11 //THIS IS DEFAULT anchorMin For anything below 11
@ -35,6 +37,6 @@ namespace TraderScrolling
scrollrect.vertical = false; scrollrect.vertical = false;
scrollrect.movementType = ScrollRect.MovementType.Elastic; scrollrect.movementType = ScrollRect.MovementType.Elastic;
scrollrect.viewport = containerRect; scrollrect.viewport = containerRect;
} }
} }
} }