Skip to content

Latest commit

 

History

History
90 lines (80 loc) · 6.41 KB

assemblies.md

File metadata and controls

90 lines (80 loc) · 6.41 KB
title アセンブリとレイヤー
status current
area client
related
client/services-and-player-data
client/scenes-and-scopes
client/screens
code
Client/AtlasUnityProject/Assets/Scripts
updated 2026-10-18

アセンブリとレイヤー

オニオンアーキテクチャ。Domain を中心に、Application → Presentation・Infrastructure → DI(構成ルート)の順に外側になり、 依存は外側から内側への一方向だけにする(asmdef の参照で強制する)。通信・保存のインターフェースは内側に置き、Infrastructure が実装する。

flowchart TD
    DI["Atlas.DI<br/>構成ルート"] --> Presentation["Atlas.Presentation<br/>View・Presenter"]
    DI --> Navigation["Atlas.Navigation<br/>シーン・エラー後の遷移"]
    DI --> Infrastructure["Atlas.Infrastructure<br/>Service・Repository の実装"]
    Presentation --> Application["Atlas.Application<br/>IXxxService"]
    Presentation --> Domain
    Presentation --> MasterData
    Navigation --> Application
    Infrastructure --> Application
    Infrastructure --> Domain
    Infrastructure --> MasterData
    Infrastructure --> Grpc["Atlas.Infrastructure.Grpc<br/>player_diff の反映"]
    Infrastructure --> Realtime["Atlas.Infrastructure.Realtime<br/>MagicOnion"]
    Infrastructure --> Api["Atlas.Api.V1<br/>生成コード"]
    Grpc --> Api
    Grpc --> Application
    Grpc --> Domain
    Realtime --> Application
    Realtime --> Domain
    Realtime --> Contracts["Atlas.BattleContracts<br/>(Shared)"]
    Realtime --> Core["Atlas.BattleCore<br/>(Shared)"]
    Contracts --> Core
    Application --> Domain["Atlas.Domain<br/>Entity・IXxxRepository"]
    Application --> MasterData["Atlas.MasterData<br/>マスターデータ"]
Loading

Atlas.DI は図の3つのほか、Atlas.BattleContracts 以外のすべての Atlas のアセンブリを参照する(矢印は省いた)。

asmdef 置くもの Atlas の参照 外部の主な参照
Atlas.Domain Entity、IXxxRepository、IBattleConnection とその型 (なし) UniTask
Atlas.MasterData マスターデータの生成物とローダー、能力の計算(PachimonStatCalculator)、技グループから技を引くクエリ(PachimonMoveLookup) (なし) MasterMemory, MessagePack
Atlas.Application IXxxService、IPlayerSession、IBattleMatchMaker/IBattleConnectionFactory、戻り値の型、BattleEntryStore、AddressDefinition(生成物) Domain, MasterData UniTask
Atlas.Api.V1 .proto・errors.toml から生成した C#(Infrastructure/Grpc/Generated/。手で編集しない) (なし) VolTech.Client, VolTech.V1
Atlas.Infrastructure.Grpc PlayerDiffApplier/XxxDiffApplier/PlayerSnapshotApplier(所持データの反映) Domain, Application, Api.V1 VolTech.Client, Google.Protobuf
Atlas.Infrastructure.Realtime RealtimeBattleConnection(MagicOnion のクライアント) Domain, Application, BattleContracts, BattleCore MagicOnion.Client, YetAnotherHttpHandler, Grpc.Net.Client
Atlas.Infrastructure Service の実装(生成したラッパー XxxApi を呼ぶ)、Repository の実装、PlayerSession、BattleMatchMaker、FileAccountStore、MasterDatabaseLoader、DI 登録の拡張メソッド Domain, Application, MasterData, Api.V1, Infrastructure.Grpc, Infrastructure.Realtime VolTech.Client, Supplement, VContainer
Atlas.Navigation TransitionAwareSceneNavigator、ErrorNavigator(通信エラーの後の画面遷移) Application USN, VolTech.Client
Atlas.Presentation View・Presenter・ViewDto(画面単位の型だけ)、ErrorDialog Domain, Application, MasterData USN, VContainer, R3, LitMotion, Supplement, VolTech.Client(ErrorDialog が基盤の IErrorDialogView を実装するため)
Atlas.DI RootLifetimeScope/HomeLifetimeScope/BattleLifetimeScope(構成ルート) BattleContracts 以外のすべて VContainer, USN, Supplement, VolTech.Client
Atlas.BattleCore ダメージ計算・ターン処理。リポジトリの Shared/ をローカルパッケージとして参照する (なし)
Atlas.BattleContracts 対戦の通信契約。同上 BattleCore MagicOnion.Abstractions, MessagePack

UniTask・ZLinq はほとんどのアセンブリが参照するので、表では Domain・Application 以外は省いた。

  • Atlas.DI だけが全レイヤーに依存してよい最上位のアセンブリ。シーン単位の LifetimeScope はすべてここに置く。 Atlas.Presentation は Atlas.Infrastructure も Atlas.DI も参照しない
  • Presenter は IXxxService(Application)越しにしか通信しないため、実装が何かを知らない

Atlas.Presentation のフォルダ

Presentation/
├── Common/        機能に属さない共通の型(PaletteColor、PachimonTypeNames、PachimonTypeBadgeView、ErrorDialog 等)
├── GlobalHeader/  アウトゲームに共通のヘッダー(GlobalHeaderView・GlobalHeaderPresenter)
├── Title/
├── Home/          HomePage・HomePresenter・HomeViewDto
│   └── Matchmaking/       Modal(1 Modal = 1フォルダ)
├── Party/         パーティ編成。ほかの機能でも使う部品(PachimonInfoView・PachimonListView 等)もここ
├── Training/      育成。TrainingPage・TrainingPresenter・TrainingStatAllocation(割り振りの調整)
│   ├── Views/     TrainingPage の部品(技・ステータスのタブ)
│   └── MoveReplace/ DiscardAdjustment/ TicketShortage/
├── Shop/
│   └── Confirm/
├── Scout/
│   └── Confirm/
└── Battle/        BattlePage・BattlePresenter
    ├── Views/     BattlePage の部品(CommandView・SelfInfoView・HpGaugeView 等)
    └── Selection/ Switch/ Forfeit/ OpponentSwitching/ Result/
  • Page は機能名の直下、Modal は機能名の下に Modal ごとのフォルダを切る(namespace は機能名のまま)。Page の部品が多ければ Views/ にまとめる
  • 他の機能と共用する部品は、最初に作った機能のフォルダに置いたまま参照する
  • prefab は Modal も含めて Assets/Addressables/Views/{機能名}/ の直下に置く(prefab は1画面1ファイル、C# は1画面4〜5ファイルになるため、C# だけフォルダを切る)。 機能をまたぐ部品(GlobalHeader 等)の prefab は Views/Parts/ に置く