Commit b5a72131 authored by nanahira's avatar nanahira

fix

parent 3ac2c111
Pipeline #43271 passed with stages
in 2 minutes and 45 seconds
...@@ -220,7 +220,7 @@ export class CloudReplayService { ...@@ -220,7 +220,7 @@ export class CloudReplayService {
for (const replay of page.entries) { for (const replay of page.entries) {
menu.push({ menu.push({
title: `R#${replay.id}`, title: this.formatDate(replay.endTime),
callback: async (currentClient) => { callback: async (currentClient) => {
currentClient.cloudReplaySelectedReplayId = replay.id; currentClient.cloudReplaySelectedReplayId = replay.id;
await this.renderReplayDetailMenu(currentClient, replay.id); await this.renderReplayDetailMenu(currentClient, replay.id);
...@@ -238,15 +238,6 @@ export class CloudReplayService { ...@@ -238,15 +238,6 @@ export class CloudReplayService {
}); });
} }
while (menu.length <= 2) {
menu.push({
title: '',
callback: async (currentClient) => {
await this.renderReplayListMenu(currentClient);
},
});
}
await this.menuManager.launchMenu(client, menu); await this.menuManager.launchMenu(client, menu);
} }
...@@ -441,12 +432,22 @@ export class CloudReplayService { ...@@ -441,12 +432,22 @@ export class CloudReplayService {
private createJoinGamePacket(replay: DuelRecordEntity) { private createJoinGamePacket(replay: DuelRecordEntity) {
return new YGOProStocJoinGame().fromPartial({ return new YGOProStocJoinGame().fromPartial({
info: { info: this.normalizeHostInfoForClient(replay.hostInfo),
...replay.hostInfo,
},
}); });
} }
private normalizeHostInfoForClient(hostInfo: HostInfo) {
return {
...hostInfo,
mode:
hostInfo.mode > 2
? this.isTagMode(hostInfo)
? 2
: 1
: hostInfo.mode,
};
}
private createReplayPacket(replay: DuelRecordEntity) { private createReplayPacket(replay: DuelRecordEntity) {
const duelRecord = this.restoreDuelRecord(replay); const duelRecord = this.restoreDuelRecord(replay);
return new YGOProStocReplay().fromPartial({ return new YGOProStocReplay().fromPartial({
......
...@@ -80,7 +80,9 @@ export class MenuManager { ...@@ -80,7 +80,9 @@ export class MenuManager {
} }
async launchMenu(client: Client, menu: MenuEntry[]) { async launchMenu(client: Client, menu: MenuEntry[]) {
client.currentMenu = menu; client.currentMenu = menu.filter(
(entry): entry is MenuEntry => !!entry,
);
if (client.menuOffset == null) { if (client.menuOffset == null) {
client.menuOffset = 0; client.menuOffset = 0;
} }
...@@ -93,7 +95,9 @@ export class MenuManager { ...@@ -93,7 +95,9 @@ export class MenuManager {
} }
private buildMenuView(client: Client): MenuView { private buildMenuView(client: Client): MenuView {
const menu = client.currentMenu || []; const menu = (client.currentMenu || []).filter(
(entry): entry is MenuEntry => !!entry,
);
if (menu.length <= 2) { if (menu.length <= 2) {
return { return {
actions: menu.map((entry) => ({ type: 'entry', entry })), actions: menu.map((entry) => ({ type: 'entry', entry })),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment