Skip to content

Commit 0194ca9

Browse files
committed
feat: 安装 AquaMai 时选择版本
1 parent 2d75910 commit 0194ca9

File tree

6 files changed

+57
-19
lines changed

6 files changed

+57
-19
lines changed

MaiChartManager/Controllers/ModController.cs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,18 @@ public void InstallMelonLoader()
8282
}
8383
}
8484

85-
[HttpPost]
86-
public void InstallAquaMai()
85+
public enum GameEdition
8786
{
88-
var version = "145";
89-
if (settings.gameVersion < 45)
90-
{
91-
version = "140";
92-
}
87+
SDGA,
88+
SDEZ
89+
}
9390

94-
var src = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "AquaMai", version, "AquaMai.dll");
91+
public record InstallAquaMaiRequest(GameEdition Version);
92+
93+
[HttpPost]
94+
public void InstallAquaMai(InstallAquaMaiRequest request)
95+
{
96+
var src = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "AquaMai", request.Version.ToString(), "AquaMai.dll");
9597
var dest = Path.Combine(StaticSettings.GamePath, @"Mods\AquaMai.dll");
9698
Directory.CreateDirectory(Path.GetDirectoryName(dest));
9799
System.IO.File.Copy(src, dest, true);

MaiChartManager/Front/src/client/apiGen.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,21 @@ export interface Config {
5353
cheat?: CheatConfig;
5454
performance?: PerformanceConfig;
5555
fix?: FixConfig;
56+
utils?: UtilsConfig;
5657
}
5758

5859
export interface FixConfig {
5960
skipVersionCheck?: boolean;
6061
removeEncryption?: boolean;
6162
forceAsServer?: boolean;
6263
forceFreePlay?: boolean;
64+
/** @format int32 */
65+
extendNotesPool?: number;
66+
}
67+
68+
export enum GameEdition {
69+
SDGA = "SDGA",
70+
SDEZ = "SDEZ",
6371
}
6472

6573
export interface GameModInfo {
@@ -133,6 +141,10 @@ export interface ImportChartResult {
133141
fatal?: boolean;
134142
}
135143

144+
export interface InstallAquaMaiRequest {
145+
version?: GameEdition;
146+
}
147+
136148
export enum MessageLevel {
137149
Info = "Info",
138150
Warning = "Warning",
@@ -229,6 +241,10 @@ export interface UploadAssetDirResult {
229241
dirName?: string | null;
230242
}
231243

244+
export interface UtilsConfig {
245+
logUserId?: boolean;
246+
}
247+
232248
export interface VersionXml {
233249
assetDir?: string | null;
234250
/** @format int32 */
@@ -1118,10 +1134,12 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
11181134
* @name InstallAquaMai
11191135
* @request POST:/MaiChartManagerServlet/InstallAquaMaiApi
11201136
*/
1121-
InstallAquaMai: (params: RequestParams = {}) =>
1137+
InstallAquaMai: (data: InstallAquaMaiRequest, params: RequestParams = {}) =>
11221138
this.request<void, any>({
11231139
path: `/MaiChartManagerServlet/InstallAquaMaiApi`,
11241140
method: "POST",
1141+
body: data,
1142+
type: ContentType.Json,
11251143
...params,
11261144
}),
11271145

MaiChartManager/Front/src/components/ModManager/ConfigEditor.tsx

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { computed, defineComponent, onMounted, PropType, ref, watch } from "vue";
22
import { NButton, NCheckbox, NDivider, NFlex, NFormItem, NInput, NModal, NScrollbar, NSwitch, useDialog } from "naive-ui";
3-
import { Config, GameModInfo } from "@/client/apiGen";
3+
import { Config, GameEdition, GameModInfo } from "@/client/apiGen";
44
import comments from './modComments.yaml';
55
import api from "@/client/api";
66
import { capitalCase } from "change-case";
@@ -30,6 +30,7 @@ export default defineComponent({
3030
const installingMelonLoader = ref(false)
3131
const installingAquaMai = ref(false)
3232
const showAquaMaiInstallDone = ref(false)
33+
const showVersionSelect = ref(false);
3334

3435
onMounted(async () => {
3536
config.value = (await api.GetAquaMaiConfig()).data;
@@ -47,12 +48,17 @@ export default defineComponent({
4748
}
4849
}
4950

50-
const installAquaMai = async () => {
51+
const installAquaMai = async (version?: GameEdition) => {
52+
showVersionSelect.value = false
5153
if (showAquaMaiInstallDone.value) return
54+
if (!version) {
55+
showVersionSelect.value = true
56+
return
57+
}
5258
try {
5359
// 但是你根本看不到这个加载图标,因为太快了
5460
installingAquaMai.value = true
55-
await api.InstallAquaMai()
61+
await api.InstallAquaMai({version})
5662
await props.refresh()
5763
showAquaMaiInstallDone.value = true
5864
setTimeout(() => showAquaMaiInstallDone.value = false, 3000);
@@ -85,7 +91,7 @@ export default defineComponent({
8591
{props.info.aquaMaiInstalled ?
8692
props.info.aquaMaiVersion === props.info.bundledAquaMaiVersion ? <span class="c-green-6">已安装</span> : <span class="c-orange">可更新</span> :
8793
<span class="c-red-6">未安装</span>}
88-
<NButton secondary loading={installingAquaMai.value} onClick={installAquaMai}
94+
<NButton secondary loading={installingAquaMai.value} onClick={() => installAquaMai()}
8995
type={showAquaMaiInstallDone.value ? 'success' : 'default'}>
9096
{showAquaMaiInstallDone.value ? <span class="i-material-symbols-done"/> : props.info.aquaMaiInstalled ? '重新安装 / 更新' : '安装'}
9197
</NButton>
@@ -110,6 +116,17 @@ export default defineComponent({
110116
</>)}
111117
</NScrollbar>}
112118
</NFlex>
119+
<NModal
120+
preset="card"
121+
class="w-[min(50vw,50em)]"
122+
title="请选择你的游戏类型"
123+
v-model:show={showVersionSelect.value}
124+
>
125+
<NFlex vertical>
126+
<NButton secondary onClick={() => installAquaMai(GameEdition.SDGA)}>SDGA</NButton>
127+
<NButton secondary onClick={() => installAquaMai(GameEdition.SDEZ)}>SDEZ</NButton>
128+
</NFlex>
129+
</NModal>
113130
</NModal>;
114131
}
115132
})

MaiChartManager/MaiChartManager.csproj

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@
8989
<None Update="AquaMai\MelonLoader.x64.zip">
9090
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
9191
</None>
92+
<None Update="AquaMai\SDEZ\AquaMai.dll">
93+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
94+
</None>
95+
<None Update="AquaMai\SDGA\AquaMai.dll">
96+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
97+
</None>
9298
</ItemGroup>
9399

94100
<ItemGroup>
@@ -98,7 +104,7 @@
98104

99105
<ItemGroup>
100106
<Reference Include="AquaMai">
101-
<HintPath>AquaMai\145\AquaMai.dll</HintPath>
107+
<HintPath>AquaMai\SDGA\AquaMai.dll</HintPath>
102108
</Reference>
103109
<Reference Include="AssetStudio">
104110
<HintPath>Libs\AssetStudio.dll</HintPath>
@@ -114,11 +120,6 @@
114120
</Reference>
115121
</ItemGroup>
116122

117-
<ItemGroup>
118-
<Folder Include="AquaMai\140\" />
119-
<Folder Include="AquaMai\145\" />
120-
</ItemGroup>
121-
122123
<ItemGroup>
123124
<EmbeddedResource Update="Properties\Resources.resx">
124125
<Generator>ResXFileCodeGenerator</Generator>

0 commit comments

Comments
 (0)