# WPF 앱 통합 이 문서는 Live2D 모델을 WPF 앱에 탑재하는 방식을 정의한다. ## 런타임 구조 WPF 안에 WebView2를 배치하고, WebView2 내부에서 Cubism SDK for Web 런타임을 실행한다. WPF는 JSON 메시지로 Live2D 캐릭터 반응을 지시한다. ```text WPF ViewModel / Service -> WebView2.PostWebMessageAsJson(...) -> Live2D Web Runtime -> Cubism SDK for Web -> LeeSori.model3.json -> motions / expressions / physics ``` ## 리소스 구조 ```text Assets/Live2D/LeeSori/ LeeSori.model3.json LeeSori.moc3 textures/ texture_00.png motions/ idle_breath.motion3.json idle_dance.motion3.json no.motion3.json heart.motion3.json expressions/ neutral.exp3.json smile.exp3.json love.exp3.json negative.exp3.json LeeSori.physics3.json reactions.json ``` ## WPF API 초안 ```csharp public interface IMascotService { Task InitializeAsync(); Task SetVisibleAsync(bool visible); Task SetIdleAsync(string key); Task ReactAsync(string key); Task SayAsync(string text, string expression = "exp_neutral"); } ``` ## WebView2 메시지 ```json { "type": "loadModel", "model": "Assets/Live2D/LeeSori/LeeSori.model3.json" } { "type": "setIdle", "key": "idle" } { "type": "react", "key": "success" } { "type": "react", "key": "error" } { "type": "say", "text": "환영합니다", "expression": "exp_smile" } { "type": "setVisible", "value": true } ``` ## Live2D 런타임 책임 - `.model3.json` 로드. - idle motion 유지. - `reactions.json` 로드. - motion 우선순위 처리. - expression fade 처리. - mouth driver로 `ParamMouthOpenY` 구동. - caption, sfx, TTS 이벤트 처리. ## 앱 이벤트 매핑 | 앱 이벤트 | 메시지 | |---|---| | 처리 성공 | `{ "type": "react", "key": "success" }` | | 오류/불가 | `{ "type": "react", "key": "error" }` | | 화면 진입 | `{ "type": "setIdle", "key": "idle" }` | | 안내 문구 | `{ "type": "say", "text": "...", "expression": "exp_neutral" }` | ## 확인 항목 - Live2D Cubism SDK 라이선스와 앱 배포 조건. - WebView2 배포 방식. - 앱 리소스 경로와 업데이트 방식. - TTS/말풍선 정책.