refactor: 收口创作入口启动意图
This commit is contained in:
87
src/components/platform-entry/platformCreationLaunchModel.ts
Normal file
87
src/components/platform-entry/platformCreationLaunchModel.ts
Normal file
@@ -0,0 +1,87 @@
|
||||
import { EDUTAINMENT_HIDDEN_MESSAGE } from './platformEdutainmentVisibility';
|
||||
import type { PlatformCreationTypeId } from './platformEntryCreationTypes';
|
||||
|
||||
export type PlatformCreationLaunchTarget =
|
||||
| 'rpg'
|
||||
| 'big-fish'
|
||||
| 'match3d'
|
||||
| 'square-hole'
|
||||
| 'jump-hop'
|
||||
| 'wooden-fish'
|
||||
| 'puzzle'
|
||||
| 'bark-battle'
|
||||
| 'visual-novel'
|
||||
| 'baby-object-match';
|
||||
|
||||
export type PlatformCreationLaunchIntent =
|
||||
| {
|
||||
type: 'noop';
|
||||
shouldPrepare: false;
|
||||
reason: 'placeholder';
|
||||
}
|
||||
| {
|
||||
type: 'noop';
|
||||
shouldPrepare: true;
|
||||
reason: 'unknown';
|
||||
}
|
||||
| {
|
||||
type: 'blocked';
|
||||
shouldPrepare: true;
|
||||
message: string;
|
||||
}
|
||||
| {
|
||||
type: 'launch';
|
||||
shouldPrepare: true;
|
||||
target: PlatformCreationLaunchTarget;
|
||||
};
|
||||
|
||||
const PLATFORM_CREATION_LAUNCH_TARGETS = new Set<PlatformCreationTypeId>([
|
||||
'rpg',
|
||||
'big-fish',
|
||||
'match3d',
|
||||
'square-hole',
|
||||
'jump-hop',
|
||||
'wooden-fish',
|
||||
'puzzle',
|
||||
'bark-battle',
|
||||
'visual-novel',
|
||||
'baby-object-match',
|
||||
]);
|
||||
|
||||
export function resolvePlatformCreationLaunchIntent(params: {
|
||||
type: PlatformCreationTypeId;
|
||||
isBabyObjectMatchVisible: boolean;
|
||||
}): PlatformCreationLaunchIntent {
|
||||
if (params.type === 'airp') {
|
||||
return {
|
||||
type: 'noop',
|
||||
shouldPrepare: false,
|
||||
reason: 'placeholder',
|
||||
};
|
||||
}
|
||||
|
||||
if (
|
||||
params.type === 'baby-object-match' &&
|
||||
!params.isBabyObjectMatchVisible
|
||||
) {
|
||||
return {
|
||||
type: 'blocked',
|
||||
shouldPrepare: true,
|
||||
message: EDUTAINMENT_HIDDEN_MESSAGE,
|
||||
};
|
||||
}
|
||||
|
||||
if (!PLATFORM_CREATION_LAUNCH_TARGETS.has(params.type)) {
|
||||
return {
|
||||
type: 'noop',
|
||||
shouldPrepare: true,
|
||||
reason: 'unknown',
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'launch',
|
||||
shouldPrepare: true,
|
||||
target: params.type as PlatformCreationLaunchTarget,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user