Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/aquamai.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jobs:
cd Output
mkdir Upload
move AquaMai.dll Upload
move AquaMai.BepInEx.dll Upload
move AquaMai.*.toml Upload

- uses: actions/upload-artifact@v4
Expand All @@ -53,6 +54,7 @@ jobs:
- name: Upload CI release
if: github.event_name != 'pull_request_target' && github.ref == 'refs/heads/main'
shell: cmd
# For MaiChartManager, upload MelonLoader version only.
run: build-assets\Releaser\AquaMaiReleaser.exe "Output\Upload\AquaMai.dll" "${{ env.GIT_DESCRIBE }}"

- name: Send to Telegram
Expand All @@ -62,11 +64,13 @@ jobs:
$Form = @{
chat_id = "-1002231087502"
media = @(
@{ type = "document"; media = "attach://aquamai_main"; caption = "${{ env.GIT_DESCRIBE }}`n${{ github.event.commits[0].message }}" },
@{ type = "document"; media = "attach://aquamai_melonloader"; caption = "${{ env.GIT_DESCRIBE }}`n${{ github.event.commits[0].message }}" },
@{ type = "document"; media = "attach://aquamai_bepinex" },
@{ type = "document"; media = "attach://aquamai_zh" }
@{ type = "document"; media = "attach://aquamai_en" }
) | ConvertTo-Json
aquamai_main = Get-Item Output\Upload\AquaMai.dll
aquamai_melonloader = Get-Item Output\Upload\AquaMai.dll
aquamai_bepinex = Get-Item Output\Upload\AquaMai.BepInEx.dll
aquamai_zh = Get-Item Output\Upload\AquaMai.zh.toml
aquamai_en = Get-Item Output\Upload\AquaMai.en.toml
}
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -372,5 +372,5 @@ MigrationBackup/

Output
tools
AquaMai/BuildInfo.g.cs
AquaMai.Common/BuildInfo.g.cs
.idea
60 changes: 60 additions & 0 deletions AquaMai.BepInEx/AquaMai.BepInEx.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<OutputType>Library</OutputType>
<RootNamespace>AquaMai.BepInEx</RootNamespace>
<AssemblyName>AquaMai.BepInEx</AssemblyName>
<TargetFramework>net48</TargetFramework>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<LangVersion>12</LangVersion>
<NoWarn>414</NoWarn>
<AssemblySearchPaths>$(ProjectDir)../Libs/;$(AssemblySearchPaths)</AssemblySearchPaths>
<OutputPath>$(ProjectDir)../Output/</OutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<EnableDefaultEmbeddedResourceItems>false</EnableDefaultEmbeddedResourceItems>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>false</DebugSymbols>
<DebugType>None</DebugType>
<Optimize>true</Optimize>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DefineConstants>DEBUG</DefineConstants>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="../AquaMai.Config.Interfaces/AquaMai.Config.Interfaces.csproj" />
<ProjectReference Include="../AquaMai.Config/AquaMai.Config.csproj" />
<ProjectReference Include="../AquaMai.Core/AquaMai.Core.csproj" />
<ProjectReference Include="../AquaMai.Mods/AquaMai.Mods.csproj" />
<ProjectReference Include="../AquaMai.Common/AquaMai.Common.csproj" />
</ItemGroup>

<ItemGroup>
<Reference Include="mscorlib" />
<Reference Include="0Harmony" />
<Reference Include="BepInEx" />
<Reference Include="UnityEngine" />
<Reference Include="UnityEngine.CoreModule" />
<Reference Include="Assembly-CSharp" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Fody" Version="6.9.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="ILMerge.Fody" Version="1.24.0" PrivateAssets="all" />
</ItemGroup>

</Project>
6 changes: 6 additions & 0 deletions AquaMai.BepInEx/FodyWeavers.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ILMerge>
<IncludeAssemblies>AquaMai.Common</IncludeAssemblies>
</ILMerge>
</Weavers>
111 changes: 111 additions & 0 deletions AquaMai.BepInEx/FodyWeavers.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="ILMerge" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:all>
<xs:element name="IncludeAssemblies" type="xs:string" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>A regular expression matching the assembly names to include in merging.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="ExcludeAssemblies" type="xs:string" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>A regular expression matching the assembly names to exclude from merging.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="IncludeResources" type="xs:string" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>A regular expression matching the resource names to include in merging.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="ExcludeResources" type="xs:string" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>A regular expression matching the resource names to exclude from merging.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="HideImportedTypes" type="xs:boolean" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>A switch to control whether the imported types are hidden (made private) or keep their visibility unchanged. Default is 'true'</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="NamespacePrefix" type="xs:string" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>A string that is used as prefix for the namespace of the imported types.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="FullImport" type="xs:boolean" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>A switch to control whether to import the full assemblies or only the referenced types. Default is 'false'</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="CompactMode" type="xs:boolean" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>A switch to enable compacting of the target assembly by skipping properties, events and unused methods. Default is 'false'</xs:documentation>
</xs:annotation>
</xs:element>
</xs:all>
<xs:attribute name="IncludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A regular expression matching the assembly names to include in merging.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ExcludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A regular expression matching the assembly names to exclude from merging.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IncludeResources" type="xs:string">
<xs:annotation>
<xs:documentation>A regular expression matching the resource names to include in merging.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ExcludeResources" type="xs:string">
<xs:annotation>
<xs:documentation>A regular expression matching the resource names to exclude from merging.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="HideImportedTypes" type="xs:boolean">
<xs:annotation>
<xs:documentation>A switch to control whether the imported types are hidden (made private) or keep their visibility unchanged. Default is 'true'</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="NamespacePrefix" type="xs:string">
<xs:annotation>
<xs:documentation>A string that is used as prefix for the namespace of the imported types.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="FullImport" type="xs:boolean">
<xs:annotation>
<xs:documentation>A switch to control whether to import the full assemblies or only the referenced types. Default is 'false'</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="CompactMode" type="xs:boolean">
<xs:annotation>
<xs:documentation>A switch to enable compacting of the target assembly by skipping properties, events and unused methods. Default is 'false'</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>
41 changes: 41 additions & 0 deletions AquaMai.BepInEx/Plugin.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using System.Reflection;
using AquaMai.Common;
using BepInEx;
using BepInEx.Logging;

namespace AquaMai.BepInEx;

[BepInPlugin(PluginName, BuildInfo.Name, BuildInfo.Version)]
public class Plugin : BaseUnityPlugin
{
public const string PluginName = "net.aquadx.aquamai";

public readonly static ManualLogSource LogSource = global::BepInEx.Logging.Logger.CreateLogSource(BuildInfo.Name);

private static bool _isInitialized = false;

public void Awake()
{
if (_isInitialized) return;
_isInitialized = true;

var harmony = new HarmonyLib.Harmony(PluginName);

Common.AquaMai.Bootstrap(new BootstrapOptions
{
CurrentAssembly = Assembly.GetExecutingAssembly(),
Harmony = harmony,
MsgStringAction = LogSource.LogMessage,
MsgObjectAction = LogSource.LogMessage,
ErrorStringAction = LogSource.LogError,
ErrorObjectAction = LogSource.LogError,
WarningStringAction = LogSource.LogWarning,
WarningObjectAction = LogSource.LogWarning,
});
}

public void OnGUI()
{
Common.AquaMai.OnGUI();
}
}
11 changes: 11 additions & 0 deletions AquaMai.BepInEx/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System.Reflection;
using AquaMai.Common;

[assembly: AssemblyTitle(BuildInfo.Description)]
[assembly: AssemblyDescription(BuildInfo.Description)]
[assembly: AssemblyCompany(BuildInfo.Company)]
[assembly: AssemblyProduct(BuildInfo.Name)]
[assembly: AssemblyCopyright("Created by " + BuildInfo.Author)]
[assembly: AssemblyTrademark(BuildInfo.Company)]
[assembly: AssemblyVersion(BuildInfo.Version)]
[assembly: AssemblyFileVersion(BuildInfo.GitVersion)]
15 changes: 11 additions & 4 deletions AquaMai/AquaMai.csproj → AquaMai.Common/AquaMai.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<OutputType>Library</OutputType>
<RootNamespace>AquaMai</RootNamespace>
<AssemblyName>AquaMai</AssemblyName>
<TargetFramework>net472</TargetFramework>
<RootNamespace>AquaMai.Common</RootNamespace>
<AssemblyName>AquaMai.Common</AssemblyName>
<TargetFramework>net48</TargetFramework>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<LangVersion>12</LangVersion>
Expand All @@ -33,6 +33,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="dotnetCampus.LatestCSharpFeatures" Version="12.0.1" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="../MelonLoader.TinyJSON/MelonLoader.TinyJSON.csproj" />
<ProjectReference Include="../AquaMai.Config.Interfaces/AquaMai.Config.Interfaces.csproj" />
<ProjectReference Include="../AquaMai.Config/AquaMai.Config.csproj" />
<ProjectReference Include="../AquaMai.Core/AquaMai.Core.csproj" />
Expand All @@ -42,7 +47,6 @@
<ItemGroup>
<Reference Include="mscorlib" />
<Reference Include="0Harmony" />
<Reference Include="MelonLoader" />
</ItemGroup>

<UsingTask TaskName="PostBuildPatch" AssemblyFile="$(OutputPath)AquaMai.Build.dll" />
Expand All @@ -56,6 +60,9 @@
</Target>

<ItemGroup>
<EmbeddedResource Include="$(OutputPath)MelonLoader.TinyJSON.dll">
<LogicalName>MelonLoader.TinyJSON.dll</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="$(OutputPath)AquaMai.Config.Interfaces.dll">
<LogicalName>AquaMai.Config.Interfaces.dll</LogicalName>
</EmbeddedResource>
Expand Down
Loading