Skip to content
Draft
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
Binary file added frontend/public/demo/candidates/boy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/public/demo/candidates/lirael.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/public/demo/candidates/samurai.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/public/demo/candidates/skeleton.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/public/demo/samurai/idle-01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/public/demo/samurai/idle-02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/public/demo/samurai/idle-03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/public/demo/samurai/idle-04.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/public/demo/samurai/idle-05.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/public/demo/samurai/idle-06.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/public/demo/samurai/idle-07.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/public/demo/samurai/idle-08.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/public/demo/samurai/idle-09.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/public/demo/samurai/idle-10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/public/demo/samurai/idle-11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/public/demo/samurai/idle-12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/public/demo/samurai/idle-13.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/public/demo/samurai/idle-14.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/public/demo/samurai/idle-15.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/public/demo/samurai/idle-16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/public/demo/samurai/idle-17.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/public/demo/samurai/idle-18.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/public/demo/samurai/idle-19.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/public/demo/samurai/idle-20.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/public/demo/samurai/idle-21.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/public/demo/samurai/idle-22.png
Binary file added frontend/public/demo/samurai/idle-23.png
Binary file added frontend/public/demo/samurai/idle-24.png
Binary file added frontend/public/demo/samurai/idle-25.png
Binary file added frontend/public/demo/samurai/idle-26.png
Binary file added frontend/public/demo/samurai/idle-27.png
Binary file added frontend/public/demo/samurai/idle-28.png
Binary file added frontend/public/demo/samurai/idle-29.png
Binary file added frontend/public/demo/samurai/idle-30.png
Binary file added frontend/public/demo/samurai/idle-31.png
Binary file added frontend/public/demo/samurai/idle-32.png
Binary file added frontend/public/demo/samurai/idle-33.png
Binary file added frontend/public/demo/samurai/idle-34.png
Binary file added frontend/public/demo/samurai/idle-35.png
Binary file added frontend/public/demo/samurai/idle-36.png
Binary file added frontend/public/demo/samurai/jump-01.png
Binary file added frontend/public/demo/samurai/jump-02.png
Binary file added frontend/public/demo/samurai/jump-03.png
Binary file added frontend/public/demo/samurai/jump-04.png
Binary file added frontend/public/demo/samurai/jump-05.png
Binary file added frontend/public/demo/samurai/jump-06.png
Binary file added frontend/public/demo/samurai/jump-07.png
Binary file added frontend/public/demo/samurai/jump-08.png
Binary file added frontend/public/demo/samurai/jump-09.png
Binary file added frontend/public/demo/samurai/jump-10.png
Binary file added frontend/public/demo/samurai/jump-11.png
Binary file added frontend/public/demo/samurai/jump-12.png
Binary file added frontend/public/demo/samurai/jump-13.png
Binary file added frontend/public/demo/samurai/jump-14.png
Binary file added frontend/public/demo/samurai/jump-15.png
Binary file added frontend/public/demo/samurai/jump-16.png
Binary file added frontend/public/demo/samurai/jump-17.png
Binary file added frontend/public/demo/samurai/jump-18.png
Binary file added frontend/public/demo/samurai/jump-19.png
Binary file added frontend/public/demo/samurai/jump-20.png
Binary file added frontend/public/demo/samurai/jump-21.png
Binary file added frontend/public/demo/samurai/jump-22.png
Binary file added frontend/public/demo/samurai/jump-23.png
Binary file added frontend/public/demo/samurai/jump-24.png
Binary file added frontend/public/demo/samurai/jump-25.png
Binary file added frontend/public/demo/samurai/jump-26.png
Binary file added frontend/public/demo/samurai/jump-27.png
Binary file added frontend/public/demo/samurai/jump-28.png
Binary file added frontend/public/demo/samurai/jump-29.png
Binary file added frontend/public/demo/samurai/jump-30.png
Binary file added frontend/public/demo/samurai/jump-31.png
Binary file added frontend/public/demo/samurai/jump-32.png
Binary file added frontend/public/demo/samurai/jump-33.png
Binary file added frontend/public/demo/samurai/jump-34.png
Binary file added frontend/public/demo/samurai/jump-35.png
Binary file added frontend/public/demo/samurai/jump-36.png
Binary file added frontend/public/demo/samurai/walk-01.png
Binary file added frontend/public/demo/samurai/walk-02.png
Binary file added frontend/public/demo/samurai/walk-03.png
Binary file added frontend/public/demo/samurai/walk-04.png
Binary file added frontend/public/demo/samurai/walk-05.png
Binary file added frontend/public/demo/samurai/walk-06.png
Binary file added frontend/public/demo/samurai/walk-07.png
Binary file added frontend/public/demo/samurai/walk-08.png
Binary file added frontend/public/demo/samurai/walk-09.png
Binary file added frontend/public/demo/samurai/walk-10.png
Binary file added frontend/public/demo/samurai/walk-11.png
Binary file added frontend/public/demo/samurai/walk-12.png
Binary file added frontend/public/demo/samurai/walk-13.png
Binary file added frontend/public/demo/samurai/walk-14.png
Binary file added frontend/public/demo/samurai/walk-15.png
Binary file added frontend/public/demo/samurai/walk-16.png
Binary file added frontend/public/demo/samurai/walk-17.png
Binary file added frontend/public/demo/samurai/walk-18.png
Binary file added frontend/public/demo/samurai/walk-19.png
Binary file added frontend/public/demo/samurai/walk-20.png
Binary file added frontend/public/demo/samurai/walk-21.png
Binary file added frontend/public/demo/samurai/walk-22.png
Binary file added frontend/public/demo/samurai/walk-23.png
Binary file added frontend/public/demo/samurai/walk-24.png
Binary file added frontend/public/demo/samurai/walk-25.png
Binary file added frontend/public/demo/samurai/walk-26.png
Binary file added frontend/public/demo/samurai/walk-27.png
Binary file added frontend/public/demo/samurai/walk-28.png
Binary file added frontend/public/demo/samurai/walk-29.png
Binary file added frontend/public/demo/samurai/walk-30.png
Binary file added frontend/public/demo/samurai/walk-31.png
Binary file added frontend/public/demo/samurai/walk-32.png
Binary file added frontend/public/demo/samurai/walk-33.png
Binary file added frontend/public/demo/samurai/walk-34.png
Binary file added frontend/public/demo/samurai/walk-35.png
Binary file added frontend/public/demo/samurai/walk-36.png
1 change: 1 addition & 0 deletions frontend/src/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export function App() {
<Route path="/projects" element={<ProjectsPage />} />
<Route path="/projects/:projectId" element={<ProjectDetailPage />} />
<Route path="/projects/:projectId/assets" element={<AssetLibraryPage />} />
<Route path="/workflow-editor" element={<WorkflowEditorPage />} />
<Route path="/workflow-editor/:runId" element={<WorkflowEditorPage />} />
<Route path="/workflow-editor/:runId/:stage" element={<WorkflowEditorPage />} />
<Route path="/playtest/:characterId/:outfitId" element={<PlaytestPage />} />
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/app/layout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ export function AppShell({ children }: AppShellProps) {
<Link to="/projects" className="hover:text-slate-900">
项目
</Link>
<Link to="/workflow-editor" className="hover:text-slate-900">
工作流编辑器
</Link>
</div>
</nav>
<main className="mx-auto max-w-5xl px-6 py-8">{children}</main>
Expand Down
90 changes: 90 additions & 0 deletions frontend/src/features/canvas-flow/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import { describe, expect, it } from 'vitest'

import {
addCard,
autoAppend,
createGraph,
descendants,
layout,
plusOptions,
removeCard,
updateCard,
type Card,
} from './index'

/** 把图推进到「母版已确认」,后面几个用例都从这里开始。 */
function graphWithMaster() {
let graph = createGraph()
const origin = graph.cards[0]
graph = autoAppend(updateCard(graph, origin.id, { status: 'confirmed' }), origin.id, 'candidates')
const candidates = graph.cards[1]
graph = autoAppend(
updateCard(graph, candidates.id, { status: 'confirmed' }),
candidates.id,
'master',
)
const master = graph.cards[2]
return { graph: updateCard(graph, master.id, { status: 'confirmed' }), masterId: master.id }
}

describe('加号只列合法下游', () => {
it('未确认的卡片没有下游,用户无从往下走', () => {
const graph = createGraph()
expect(plusOptions(graph.cards[0])).toEqual([])
})

it('母版给出生成动作、静态资产与导出,静态资产本期禁用', () => {
const { graph, masterId } = graphWithMaster()
const options = plusOptions(graph.cards.find((card) => card.id === masterId) as Card)
expect(options.map((option) => option.id)).toEqual(['action', 'static', 'export'])
expect(options.find((option) => option.id === 'static')?.disabled).toBe(true)
})

it('首帧只有完整动画一个下游,因此界面不弹菜单', () => {
const { graph, masterId } = graphWithMaster()
const next = addCard(graph, masterId, 'preset:walk')
const firstFrame = next.cards[next.cards.length - 1]
expect(
plusOptions(updateCard(next, firstFrame.id, { status: 'confirmed' }).cards.at(-1) as Card),
).toHaveLength(1)
})
})

describe('挂动作', () => {
it('在母版上重复展开加号可以挂多条并列分支', () => {
const { graph, masterId } = graphWithMaster()
const withTwo = addCard(addCard(graph, masterId, 'preset:walk'), masterId, 'preset:idle')
const branches = withTwo.cards.filter((card) => card.kind === 'first-frame')
expect(branches).toHaveLength(2)
expect(branches.every((card) => card.parentId === masterId)).toBe(true)
})

it('自定义动作与预设动作是同一种卡片,只是定义来源不同', () => {
const { graph, masterId } = graphWithMaster()
const preset = addCard(graph, masterId, 'preset:walk').cards.at(-1) as Card
const custom = addCard(graph, masterId, 'custom').cards.at(-1) as Card
expect(preset.kind).toBe(custom.kind)
expect(preset.action?.kind).toBe('preset')
expect(custom.action?.kind).toBe('custom')
})

it('并列分支各占一行,主干留在第 0 行', () => {
const { graph, masterId } = graphWithMaster()
const withTwo = addCard(addCard(graph, masterId, 'preset:walk'), masterId, 'preset:idle')
const positions = layout(withTwo)
const [walk, idle] = withTwo.cards.filter((card) => card.kind === 'first-frame')
expect(positions[masterId].y).toBe(0)
expect(positions[walk.id].y).not.toBe(positions[idle.id].y)
})
})

describe('删除连带下游', () => {
it('删掉首帧会一并移除它下面的动画', () => {
const { graph, masterId } = graphWithMaster()
const withWalk = addCard(graph, masterId, 'preset:walk')
const firstFrame = withWalk.cards.at(-1) as Card
const withAnimation = addCard(withWalk, firstFrame.id, 'animation')
expect(descendants(withAnimation, firstFrame.id)).toHaveLength(2)
expect(removeCard(withAnimation, firstFrame.id).cards).toHaveLength(3)
})
})
Loading