Skip to content

Commit c95cb00

Browse files
committed
feat: 编辑宴会场信息
1 parent 582b9c0 commit c95cb00

File tree

4 files changed

+110
-1
lines changed

4 files changed

+110
-1
lines changed

MaiChartManager/Controllers/MusicController.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,27 @@ public void EditMusicArtist(int id, [FromBody] string value)
3737
}
3838
}
3939

40+
[HttpPost]
41+
public void EditMusicUtageKanji(int id, [FromBody] string value)
42+
{
43+
var music = settings.MusicList.Find(it => it.Id == id);
44+
if (music != null)
45+
{
46+
music.UtageKanji = value;
47+
}
48+
}
49+
50+
[HttpPost]
51+
// Utage 备注
52+
public void EditMusicComment(int id, [FromBody] string value)
53+
{
54+
var music = settings.MusicList.Find(it => it.Id == id);
55+
if (music != null)
56+
{
57+
music.Comment = value;
58+
}
59+
}
60+
4061
[HttpPost]
4162
public void EditMusicBpm(int id, [FromBody] int value)
4263
{

MaiChartManager/Front/src/client/apiGen.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,16 @@ export interface MusicXmlWithABJacket {
141141
/** @format int32 */
142142
addVersionId?: number;
143143
artist?: string | null;
144+
utageKanji?: string | null;
145+
comment?: string | null;
144146
/** @format int32 */
145147
version?: number;
146148
/** @format int32 */
147149
bpm?: number;
148150
disable?: boolean;
149151
charts?: Chart[] | null;
150152
assetBundleJacket?: string | null;
153+
pseudoAssetBundleJacket?: string | null;
151154
hasJacket?: boolean;
152155
isAcbAwbExist?: boolean;
153156
problems?: string[] | null;
@@ -886,6 +889,38 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
886889
...params,
887890
}),
888891

892+
/**
893+
* No description
894+
*
895+
* @tags Music
896+
* @name EditMusicUtageKanji
897+
* @request POST:/MaiChartManagerServlet/EditMusicUtageKanjiApi/{id}
898+
*/
899+
EditMusicUtageKanji: (id: number, data: string, params: RequestParams = {}) =>
900+
this.request<void, any>({
901+
path: `/MaiChartManagerServlet/EditMusicUtageKanjiApi/${id}`,
902+
method: "POST",
903+
body: data,
904+
type: ContentType.Json,
905+
...params,
906+
}),
907+
908+
/**
909+
* No description
910+
*
911+
* @tags Music
912+
* @name EditMusicComment
913+
* @request POST:/MaiChartManagerServlet/EditMusicCommentApi/{id}
914+
*/
915+
EditMusicComment: (id: number, data: string, params: RequestParams = {}) =>
916+
this.request<void, any>({
917+
path: `/MaiChartManagerServlet/EditMusicCommentApi/${id}`,
918+
method: "POST",
919+
body: data,
920+
type: ContentType.Json,
921+
...params,
922+
}),
923+
889924
/**
890925
* No description
891926
*

MaiChartManager/Front/src/components/MusicEdit/index.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ const Component = defineComponent({
3737
watch(() => info.value?.version, sync('version', api.EditMusicVersion));
3838
watch(() => info.value?.genreId, sync('genreId', api.EditMusicGenre));
3939
watch(() => info.value?.addVersionId, sync('addVersionId', api.EditMusicAddVersion));
40+
watch(() => info.value?.utageKanji, sync('utageKanji', api.EditMusicUtageKanji));
41+
watch(() => info.value?.comment, sync('comment', api.EditMusicComment));
4042
});
4143

4244
const sync = (key: keyof MusicXmlWithABJacket, method: Function) => async () => {
@@ -80,6 +82,15 @@ const Component = defineComponent({
8082
<NFormItem label="版本分类">
8183
<GenreInput options={addVersionList.value} v-model:value={info.value.addVersionId}/>
8284
</NFormItem>
85+
{info.value.genreId === 107 && // 宴会场
86+
<>
87+
<NFormItem label="宴谱种类">
88+
<NInput v-model:value={info.value.utageKanji}/>
89+
</NFormItem>
90+
<NFormItem label="宴谱备注">
91+
<NInput v-model:value={info.value.comment}/>
92+
</NFormItem>
93+
</>}
8394
<AcbAwb song={info.value}/>
8495
<NTabs type="line" animated barWidth={0} v-model:value={selectedLevel.value} class="levelTabs"
8596
style={{'--n-tab-padding': 0, '--n-pane-padding-top': 0, '--n-tab-text-color-hover': ''}}>

Sitreamai/Models/MusicXml.cs

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ public int AddVersionId
244244

245245
public string Artist
246246
{
247-
get => xmlDoc.SelectSingleNode("/MusicData/artistName/str").InnerText;
247+
get => xmlDoc.SelectSingleNode("/MusicData/artistName/str")?.InnerText;
248248
set
249249
{
250250
Modified = true;
@@ -253,6 +253,48 @@ public string Artist
253253
}
254254
}
255255

256+
private const string utageKanjiNode = "utageKanjiName";
257+
258+
public string UtageKanji
259+
{
260+
get => xmlDoc.SelectSingleNode(utageKanjiNode)?.InnerText;
261+
set
262+
{
263+
Modified = true;
264+
var node = xmlDoc.SelectSingleNode(utageKanjiNode);
265+
if (node is null)
266+
{
267+
node = xmlDoc.CreateNode(XmlNodeType.Element, utageKanjiNode, null);
268+
node.InnerText = value;
269+
xmlDoc.DocumentElement.AppendChild(node);
270+
return;
271+
}
272+
273+
xmlDoc.SelectSingleNode(utageKanjiNode).InnerText = value;
274+
}
275+
}
276+
277+
private const string commentNode = "comment";
278+
279+
public string Comment
280+
{
281+
get => xmlDoc.SelectSingleNode(commentNode)?.InnerText;
282+
set
283+
{
284+
Modified = true;
285+
var node = xmlDoc.SelectSingleNode(commentNode);
286+
if (node is null)
287+
{
288+
node = xmlDoc.CreateNode(XmlNodeType.Element, commentNode, null);
289+
node.InnerText = value;
290+
xmlDoc.DocumentElement.AppendChild(node);
291+
return;
292+
}
293+
294+
xmlDoc.SelectSingleNode(commentNode).InnerText = value;
295+
}
296+
}
297+
256298
public int Version
257299
{
258300
get => int.Parse(xmlDoc.SelectSingleNode("/MusicData/version").InnerText);

0 commit comments

Comments
 (0)