添加项目文件。
This commit is contained in:
parent
d6f081d3cb
commit
e7cdc18907
54
SkinHide.cs
Normal file
54
SkinHide.cs
Normal file
@ -0,0 +1,54 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using EFT.Visual;
|
||||
using EFT.Interactive;
|
||||
|
||||
namespace SkinHide
|
||||
{
|
||||
public class SkinHide : MonoBehaviour
|
||||
{
|
||||
public SkinDress[] skindress;
|
||||
public Dress[] dress;
|
||||
public bool skinhide = true;
|
||||
public GameObject Player;
|
||||
|
||||
void Update()
|
||||
{
|
||||
//Destroy LootItem
|
||||
if (GetComponent<ObservedLootItem>() == null)
|
||||
{
|
||||
Debug.LogError("not find ObservedLootItem");
|
||||
}
|
||||
else if (GetComponent<ObservedLootItem>().enabled == true)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
if (transform.GetComponentInParent<Animator>() == null)
|
||||
{
|
||||
Debug.LogError("not find Animator");
|
||||
}
|
||||
else if (skinhide)
|
||||
{
|
||||
//Get Player GameObject
|
||||
Player = transform.GetComponentInParent<Animator>().gameObject;
|
||||
|
||||
//Find Skin
|
||||
skindress = Player.GetComponentsInChildren<SkinDress>();
|
||||
dress = Player.GetComponentsInChildren<Dress>();
|
||||
|
||||
//False Skin GameObject
|
||||
foreach (SkinDress skindress in skindress)
|
||||
{
|
||||
skindress.gameObject.SetActive(false);
|
||||
}
|
||||
foreach (Dress dress in dress)
|
||||
{
|
||||
dress.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
25
SkinHide.sln
Normal file
25
SkinHide.sln
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.1.32407.343
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SkinHide", "SkinHide\SkinHide.csproj", "{E5DD6484-115E-4104-AADF-E5610EE4F397}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{E5DD6484-115E-4104-AADF-E5610EE4F397}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E5DD6484-115E-4104-AADF-E5610EE4F397}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E5DD6484-115E-4104-AADF-E5610EE4F397}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E5DD6484-115E-4104-AADF-E5610EE4F397}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {DEF8B0A7-400E-448C-8C06-2ACDC08A868C}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
22
SkinHide/Patches/BotOwnerPatch.cs
Normal file
22
SkinHide/Patches/BotOwnerPatch.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using Aki.Reflection.Patching;
|
||||
using Aki.Reflection.Utils;
|
||||
using System.Reflection;
|
||||
using EFT;
|
||||
|
||||
namespace SkinHide.Patches
|
||||
{
|
||||
public class BotOwnerPatch : ModulePatch
|
||||
{
|
||||
|
||||
protected override MethodBase GetTargetMethod()
|
||||
{
|
||||
return typeof(BotOwner).GetMethod("method_4", PatchConstants.PrivateFlags);
|
||||
}
|
||||
|
||||
[PatchPostfix]
|
||||
private static void PatchPostfix(BotOwner __instance)
|
||||
{
|
||||
SkinHidePlugin.Bot.Add(__instance.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
22
SkinHide/Patches/GamePlayerOwnerPatch.cs
Normal file
22
SkinHide/Patches/GamePlayerOwnerPatch.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using Aki.Reflection.Patching;
|
||||
using Aki.Reflection.Utils;
|
||||
using System.Reflection;
|
||||
using EFT;
|
||||
|
||||
namespace SkinHide.Patches
|
||||
{
|
||||
public class GamePlayerOwnerPatch : ModulePatch
|
||||
{
|
||||
|
||||
protected override MethodBase GetTargetMethod()
|
||||
{
|
||||
return typeof(GamePlayerOwner).GetMethod("method_6", PatchConstants.PrivateFlags);
|
||||
}
|
||||
|
||||
[PatchPostfix]
|
||||
private static void PatchPostfix(GamePlayerOwner __instance)
|
||||
{
|
||||
SkinHidePlugin.Player = __instance.gameObject;
|
||||
}
|
||||
}
|
||||
}
|
25
SkinHide/Patches/PlayerModelViewPatch.cs
Normal file
25
SkinHide/Patches/PlayerModelViewPatch.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using Aki.Reflection.Patching;
|
||||
using Aki.Reflection.Utils;
|
||||
using System.Reflection;
|
||||
using EFT.UI;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SkinHide.Patches
|
||||
{
|
||||
public class PlayerModelViewPatch : ModulePatch
|
||||
{
|
||||
|
||||
protected override MethodBase GetTargetMethod()
|
||||
{
|
||||
return typeof(PlayerModelView).GetMethod("method_0", PatchConstants.PrivateFlags);
|
||||
}
|
||||
|
||||
[PatchPostfix]
|
||||
private static async void PatchPostfix(Task __result, PlayerModelView __instance)
|
||||
{
|
||||
await __result;
|
||||
|
||||
SkinHidePlugin.PlayerModelView = __instance.gameObject;
|
||||
}
|
||||
}
|
||||
}
|
36
SkinHide/Properties/AssemblyInfo.cs
Normal file
36
SkinHide/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 有关程序集的一般信息由以下
|
||||
// 控制。更改这些特性值可修改
|
||||
// 与程序集关联的信息。
|
||||
[assembly: AssemblyTitle("kmyuhkyuk-SkinHide")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("SkinHide")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2022")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 将 ComVisible 设置为 false 会使此程序集中的类型
|
||||
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
|
||||
//请将此类型的 ComVisible 特性设置为 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||
[assembly: Guid("e5dd6484-115e-4104-aadf-e5610ee4f397")]
|
||||
|
||||
// 程序集的版本信息由下列四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
|
||||
//通过使用 "*",如下所示:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
84
SkinHide/SkinHide.csproj
Normal file
84
SkinHide/SkinHide.csproj
Normal file
@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{E5DD6484-115E-4104-AADF-E5610EE4F397}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>SkinHide</RootNamespace>
|
||||
<AssemblyName>SkinHide</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<AssemblyOriginatorKeyFile>kmyuhkyuk.pfx</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Aki.Reflection">
|
||||
<HintPath>R:\Battlestate Games\Client.0.12.12.15.17349\EscapeFromTarkov_Data\Managed\Aki.Reflection.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Assembly-CSharp, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>R:\Battlestate Games\Client.0.12.12.15.17349\EscapeFromTarkov_Data\Managed\Assembly-CSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="BepInEx">
|
||||
<HintPath>R:\Battlestate Games\Client.0.12.12.15.17349\BepInEx\core\BepInEx.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Sirenix.Serialization, Version=3.0.4.0, Culture=neutral, PublicKeyToken=null" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="UnityEngine, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>R:\Battlestate Games\Client.0.12.12.15.17349\EscapeFromTarkov_Data\Managed\UnityEngine.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.AnimationModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>R:\Battlestate Games\Client.0.12.12.15.17349\EscapeFromTarkov_Data\Managed\UnityEngine.AnimationModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>R:\Battlestate Games\Client.0.12.12.15.17349\EscapeFromTarkov_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Patches\BotOwnerPatch.cs" />
|
||||
<Compile Include="Patches\GamePlayerOwnerPatch.cs" />
|
||||
<Compile Include="Patches\PlayerModelViewPatch.cs" />
|
||||
<Compile Include="SkinHidePlugin.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="kmyuhkyuk.pfx" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
142
SkinHide/SkinHidePlugin.cs
Normal file
142
SkinHide/SkinHidePlugin.cs
Normal file
@ -0,0 +1,142 @@
|
||||
using BepInEx;
|
||||
using BepInEx.Configuration;
|
||||
using UnityEngine;
|
||||
using SkinHide.Patches;
|
||||
using EFT.Visual;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SkinHide
|
||||
{
|
||||
[BepInPlugin("com.kmyuhkyuk.SkinHide", "kmyuhkyuk-SkinHide", "1.0.0")]
|
||||
public class SkinHidePlugin : BaseUnityPlugin
|
||||
{
|
||||
public static GameObject Player;
|
||||
|
||||
public static GameObject PlayerModelView;
|
||||
|
||||
public SkinDress[] PlayerMVSkinDress;
|
||||
|
||||
public Dress[] PlayerMVDress;
|
||||
|
||||
public SkinDress[] PlayerSkinDress;
|
||||
|
||||
public Dress[] PlayerDress;
|
||||
|
||||
public HashSet<GameObject> PlayerSkinGameObject = new HashSet<GameObject>();
|
||||
|
||||
public static List <GameObject> Bot = new List<GameObject>();
|
||||
|
||||
public HashSet<GameObject> BotSkinGameObject = new HashSet<GameObject>();
|
||||
|
||||
public SkinDress[] BotSkinDress;
|
||||
|
||||
public Dress[] BotDress;
|
||||
|
||||
public static ConfigEntry<bool> KeyPlayerSkinHide { get; set; }
|
||||
public static ConfigEntry<bool> KeyBotSkinHide { get; set; }
|
||||
|
||||
private void Start()
|
||||
{
|
||||
Logger.LogInfo("Loaded: kmyuhkyuk-SkinHide");
|
||||
KeyPlayerSkinHide = Config.Bind<bool>("玩家服装隐藏 Player Skin Hide", "开关 Swithc", false);
|
||||
KeyBotSkinHide = Config.Bind<bool>("Bot服装隐藏 Bot Skin Hide", "开关 Swithc", false);
|
||||
|
||||
new PlayerModelViewPatch().Enable();
|
||||
new GamePlayerOwnerPatch().Enable();
|
||||
new BotOwnerPatch().Enable();
|
||||
}
|
||||
void Update()
|
||||
{
|
||||
if (PlayerModelView != null && KeyPlayerSkinHide.Value)
|
||||
{
|
||||
PlayerMVSkinDress = PlayerModelView.GetComponentsInChildren<SkinDress>();
|
||||
PlayerMVDress = PlayerModelView.GetComponentsInChildren<Dress>();
|
||||
|
||||
if (PlayerMVSkinDress != null)
|
||||
{
|
||||
foreach (SkinDress skindress in PlayerMVSkinDress)
|
||||
{
|
||||
skindress.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
if (PlayerMVDress != null)
|
||||
{
|
||||
foreach (Dress dress in PlayerMVDress)
|
||||
{
|
||||
dress.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Player != null)
|
||||
{
|
||||
PlayerSkinDress = Player.GetComponentsInChildren<SkinDress>();
|
||||
PlayerDress = Player.GetComponentsInChildren<Dress>();
|
||||
|
||||
if (PlayerSkinDress != null)
|
||||
{
|
||||
foreach (SkinDress skindress in PlayerSkinDress)
|
||||
{
|
||||
PlayerSkinGameObject.Add(skindress.gameObject);
|
||||
}
|
||||
}
|
||||
if (PlayerDress != null)
|
||||
{
|
||||
foreach (Dress dress in PlayerDress)
|
||||
{
|
||||
PlayerSkinGameObject.Add(dress.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
if (PlayerSkinGameObject != null)
|
||||
{
|
||||
foreach (GameObject skin in PlayerSkinGameObject)
|
||||
{
|
||||
skin.SetActive(!KeyPlayerSkinHide.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerSkinGameObject.Clear();
|
||||
}
|
||||
|
||||
Bot.RemoveAll(x => x == null);
|
||||
if (Bot.Count > 0)
|
||||
{
|
||||
foreach (GameObject bot in Bot)
|
||||
{
|
||||
BotSkinDress = bot.GetComponentsInChildren<SkinDress>();
|
||||
BotDress = bot.GetComponentsInChildren<Dress>();
|
||||
}
|
||||
|
||||
if (BotSkinDress != null)
|
||||
{
|
||||
foreach (SkinDress botskindess in BotSkinDress)
|
||||
{
|
||||
BotSkinGameObject.Add(botskindess.gameObject);
|
||||
}
|
||||
}
|
||||
if (BotDress != null)
|
||||
{
|
||||
foreach (Dress botdess in BotDress)
|
||||
{
|
||||
BotSkinGameObject.Add(botdess.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
if (BotSkinGameObject != null)
|
||||
{
|
||||
foreach (GameObject botskin in BotSkinGameObject)
|
||||
{
|
||||
botskin.SetActive(!KeyBotSkinHide.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
BotSkinGameObject.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user