init commit of traderscrolling for kaeno

This commit is contained in:
CWX 2023-08-14 03:07:14 +01:00
parent 30ce0f1538
commit bd8cceeb6e
7 changed files with 126 additions and 2 deletions

View File

@ -15,6 +15,7 @@ namespace CWX_AlarmChanger
CWX_GameObject = new GameObject("CWX_GameObject"); CWX_GameObject = new GameObject("CWX_GameObject");
DontDestroyOnLoad(CWX_GameObject); DontDestroyOnLoad(CWX_GameObject);
CWX_Component = CWX_GameObject.AddComponent<AlarmChangerScript>(); CWX_Component = CWX_GameObject.AddComponent<AlarmChangerScript>();
DontDestroyOnLoad(CWX_Component);
} }
public void Start() public void Start()

View File

@ -2,7 +2,6 @@
using System.IO; using System.IO;
using System.Threading.Tasks; using System.Threading.Tasks;
using System; using System;
using EFT.Interactive;
using UnityEngine.Networking; using UnityEngine.Networking;
using UnityEngine; using UnityEngine;
using System.Linq; using System.Linq;

View File

@ -21,7 +21,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CWX_AlarmChanger", "CWX_Ala
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "test-layout", "test-layout\test-layout.csproj", "{CBDE7880-21AE-45AC-B216-D1061FD6A8A0}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "test-layout", "test-layout\test-layout.csproj", "{CBDE7880-21AE-45AC-B216-D1061FD6A8A0}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CWX_GrassCutter", "CWX_GrassCutter\CWX_GrassCutter.csproj", "{CC095831-11F9-4429-9A5C-BF60EF451E96}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CWX_GrassCutter", "CWX_GrassCutter\CWX_GrassCutter.csproj", "{CC095831-11F9-4429-9A5C-BF60EF451E96}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TraderScrolling", "TraderScrolling\TraderScrolling.csproj", "{C9FC19BC-2155-4900-B14D-2F16D13ED2DA}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -69,6 +71,10 @@ Global
{CC095831-11F9-4429-9A5C-BF60EF451E96}.Debug|Any CPU.Build.0 = Debug|Any CPU {CC095831-11F9-4429-9A5C-BF60EF451E96}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CC095831-11F9-4429-9A5C-BF60EF451E96}.Release|Any CPU.ActiveCfg = Release|Any CPU {CC095831-11F9-4429-9A5C-BF60EF451E96}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CC095831-11F9-4429-9A5C-BF60EF451E96}.Release|Any CPU.Build.0 = Release|Any CPU {CC095831-11F9-4429-9A5C-BF60EF451E96}.Release|Any CPU.Build.0 = Release|Any CPU
{C9FC19BC-2155-4900-B14D-2F16D13ED2DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C9FC19BC-2155-4900-B14D-2F16D13ED2DA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C9FC19BC-2155-4900-B14D-2F16D13ED2DA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C9FC19BC-2155-4900-B14D-2F16D13ED2DA}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -0,0 +1,14 @@
using BepInEx;
using System;
namespace TraderScrolling
{
[BepInPlugin("com.kaeno.TraderScrolling", "Kaeno-TraderScrolling", "1.0.0")]
public class TraderScrolling : BaseUnityPlugin
{
public void awake()
{
new TraderScrollingPatch().Enable();
}
}
}

View File

@ -0,0 +1,37 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Reference Include="Aki.Reflection">
<HintPath>..\..\..\Shared\Aki.Reflection.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>..\..\..\Shared\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="BepInEx">
<HintPath>..\..\..\Shared\BepInEx.dll</HintPath>
</Reference>
<Reference Include="Comfort">
<HintPath>..\..\..\Shared\Comfort.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\..\Shared\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="UnityEngine">
<HintPath>..\..\..\Shared\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>..\..\..\Shared\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UI">
<HintPath>..\..\..\Shared\UnityEngine.UI.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UIModule">
<HintPath>..\..\..\Shared\UnityEngine.UIModule.dll</HintPath>
</Reference>
</ItemGroup>
</Project>

View File

@ -0,0 +1,55 @@
using Aki.Reflection.Patching;
using Aki.Reflection.Utils;
using EFT.UI;
using System.Linq;
using System.Reflection;
using UnityEngine;
using UnityEngine.UI;
namespace TraderScrolling
{
public class TraderScrollingPatch : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
return typeof(TraderScreensGroup).GetMethod("method_4", PatchConstants.PrivateFlags);
}
[PatchPostfix]
public static void PatchPostFix()
{
Debug.LogError("test 1");
var traderCards = GameObject.Find("TraderCards");
Debug.LogError(traderCards);
var traderCardsRect = traderCards.RectTransform();
Debug.LogError(traderCardsRect);
traderCardsRect.anchorMax = new Vector2(1f, 1f);
traderCardsRect.anchorMin = new Vector2(0.385f, 1f);
var menuUI = GameObject.Find("Menu UI");
Debug.LogError(menuUI);
var list = menuUI.GetComponentsInChildren<RectTransform>(true).ToList();
Debug.LogError(list.Count);
var container = list.FirstOrDefault(x => x.name == "Container");
Debug.LogError(container);
var containerRect = container.RectTransform();
Debug.LogError(containerRect);
containerRect.anchorMin = new Vector2(1f, 1f);
containerRect.anchorMax = new Vector2(0.01f, 0f);
var scrollrect = traderCards.AddComponent<ScrollRect>();
Debug.LogError(scrollrect);
scrollrect.content = traderCardsRect;
scrollrect.vertical = false;
scrollrect.movementType = ScrollRect.MovementType.Elastic;
scrollrect.viewport = containerRect;
}
}
}

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TraderScrolling
{
public class TraderScrollingScript
{
}
}