<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <AssemblyName>TravelEar</AssemblyName>
    <RootNamespace>TravelEar</RootNamespace>
    <Description>Hear and record your own Big Walk voice the way other players hear it.</Description>
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
    <!-- Il2CppInterop proxy assemblies clash with the compiler-synthesized nullable attributes. -->
    <Nullable>disable</Nullable>
    <CopyLocalLockFileAssemblies>false</CopyLocalLockFileAssemblies>
    <InteropDir>$(GameDir)\BepInEx\interop</InteropDir>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="BepInEx.Unity.IL2CPP" Version="6.0.0-be.755" />
    <PackageReference Include="BepInEx.Core" Version="6.0.0-be.755" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\TravelEar.Core\TravelEar.Core.csproj" />
  </ItemGroup>

  <!-- Game + Unity proxy assemblies generated by Il2CppInterop on first BepInEx launch. -->
  <ItemGroup>
    <Reference Include="Assembly-CSharp">
      <HintPath>$(InteropDir)\Assembly-CSharp.dll</HintPath>
      <Private>false</Private>
    </Reference>
    <Reference Include="AudioSystem">
      <HintPath>$(InteropDir)\AudioSystem.dll</HintPath>
      <Private>false</Private>
    </Reference>
    <Reference Include="DissonanceVoip">
      <HintPath>$(InteropDir)\DissonanceVoip.dll</HintPath>
      <Private>false</Private>
    </Reference>
    <Reference Include="Mirror">
      <HintPath>$(InteropDir)\Mirror.dll</HintPath>
      <Private>false</Private>
    </Reference>
    <Reference Include="UnityEngine.CoreModule">
      <HintPath>$(InteropDir)\UnityEngine.CoreModule.dll</HintPath>
      <Private>false</Private>
    </Reference>
    <Reference Include="UnityEngine.AudioModule">
      <HintPath>$(InteropDir)\UnityEngine.AudioModule.dll</HintPath>
      <Private>false</Private>
    </Reference>
    <Reference Include="UnityEngine.UI">
      <HintPath>$(InteropDir)\UnityEngine.UI.dll</HintPath>
      <Private>false</Private>
    </Reference>
    <Reference Include="Unity.TextMeshPro">
      <HintPath>$(InteropDir)\Unity.TextMeshPro.dll</HintPath>
      <Private>false</Private>
    </Reference>
    <Reference Include="Il2Cppmscorlib">
      <HintPath>$(InteropDir)\Il2Cppmscorlib.dll</HintPath>
      <Private>false</Private>
    </Reference>
  </ItemGroup>

  <!-- Copy the plugin into the game for local testing: dotnet build -p:DeployToGame=true -->
  <Target Name="DeployToGame" AfterTargets="Build" Condition="'$(DeployToGame)' == 'true'">
    <ItemGroup>
      <!-- Helper build output (self-contained win-x64), if it has been built. It lives OUTSIDE BepInEx\plugins:
           BepInEx examines every DLL under plugins as a plugin candidate (260 files, slow load). -->
      <HelperFiles Include="..\TravelEar.Helper\bin\$(Configuration)\net8.0-windows\win-x64\**\*" />
    </ItemGroup>
    <Copy SourceFiles="$(TargetPath);$(TargetDir)TravelEar.Core.dll" DestinationFolder="$(GameDir)\BepInEx\plugins\TravelEar" />
    <Copy SourceFiles="@(HelperFiles)" DestinationFiles="@(HelperFiles->'$(GameDir)\BepInEx\TravelEar.Helper\%(RecursiveDir)%(Filename)%(Extension)')" SkipUnchangedFiles="true" Condition="'@(HelperFiles)' != ''" />
  </Target>

</Project>
