# confused-qy/lingxu architecture

> Architecture diagram of the GitHub repository confused-qy/lingxu, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/confused-qy/lingxu
- Repository: https://github.com/confused-qy/lingxu

## Overview

This repository combines a Unity client project with a C# login/center-server backend. The evidenced account workflow is: a client submits registration or login through the login server; the login controller validates or rate-limits selected requests and forwards them to the center server; the center controller delegates account, server-list, game-server selection, and role operations to the model; responses return to the client session. Unity boot files and protocol definitions are visible in the tree, but their runtime wiring is not established by the sampled source. No README was provided, and game-server runtime code is absent from the tree.

Main entry points: [`Violet_Servers/02_Library/02_Library/Network/ Socket/NetServer.cs`](https://github.com/confused-qy/lingxu/blob/main/Violet_Servers/02_Library/02_Library/Network/%20Socket/NetServer.cs) (TCP Server), [`Violet_Servers/01_Servers/LoginServer/Ctrl/LoginCtrl.cs`](https://github.com/confused-qy/lingxu/blob/main/Violet_Servers/01_Servers/LoginServer/Ctrl/LoginCtrl.cs) (Login Controller), [`Violet_Servers/01_Servers/LoginServer/Program.cs`](https://github.com/confused-qy/lingxu/blob/main/Violet_Servers/01_Servers/LoginServer/Program.cs) (Login Process), [`Violet_Servers/01_Servers/CenterServer/Program.cs`](https://github.com/confused-qy/lingxu/blob/main/Violet_Servers/01_Servers/CenterServer/Program.cs) (Center Process)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Unity Client"]
  node_unityboot["Unity Boot<br/>[Load.cs]"]
end

subgraph group_login["Login Gateway"]
  node_loginprogram["Login Process<br/>[Program.cs]"]
  node_loginctrl["Login Controller<br/>[LoginCtrl.cs]"]
end

subgraph group_center["Center Services"]
  node_centerprogram["Center Process<br/>[Program.cs]"]
  node_centectrl["Center Controller"]
  node_loginmodel["Account Model<br/>[LoginModel.cs]"]
  node_dbmgr["Database Setup<br/>[DBMgr.cs]"]
  node_tables["Account Role Tables<br/>[AccountTable.cs]"]
end

subgraph group_transport["Network Transport"]
  node_netserver["TCP Server<br/>[NetServer.cs]"]
  node_netclient["TCP Client<br/>[NetClient.cs]"]
  node_session["Client Session<br/>[Session.cs]"]
  node_sessionmgr[("Session Registry<br/>[SessionMgr.cs]")]
  node_protocol["Protocol Messages<br/>[ResultEntity.cs]"]
  node_responseproto["Result Definitions<br/>[ResultEntity.proto]"]
end

node_user(("Player Client"))
node_mysql[("MySQL Database")]

node_user -->|"sends requests"| node_netserver
node_unityboot -.->|"starts client"| node_user
node_loginprogram -->|"connects upstream"| node_netclient
node_loginprogram -->|"starts listener"| node_netserver
node_loginprogram -->|"registers commands"| node_loginctrl
node_loginprogram -->|"registers handlers"| node_netclient
node_netserver -->|"accepts session"| node_session
node_session -->|"dispatches request"| node_loginctrl
node_loginctrl -->|"forwards requests"| node_netclient
node_netclient -->|"sends requests"| node_centerprogram
node_centerprogram -->|"starts listener"| node_netserver
node_centerprogram -->|"initializes database"| node_dbmgr
node_centerprogram -->|"registers commands"| node_centectrl
node_netserver -->|"dispatches request"| node_centectrl
node_centectrl -->|"invokes operations"| node_loginmodel
node_loginmodel -->|"queries and writes"| node_mysql
node_dbmgr -->|"creates schema"| node_mysql
node_dbmgr -->|"initializes tables"| node_tables
node_session -->|"registers session"| node_sessionmgr
node_loginctrl -->|"looks up session"| node_sessionmgr
node_loginctrl -->|"sends response"| node_session
node_centectrl -->|"sends response"| node_netserver
node_responseproto -->|"defines messages"| node_protocol

click node_unityboot "https://github.com/confused-qy/lingxu/blob/main/MMO_RPG/Assets/Boot/Load.cs"
click node_loginprogram "https://github.com/confused-qy/lingxu/blob/main/Violet_Servers/01_Servers/LoginServer/Program.cs"
click node_loginctrl "https://github.com/confused-qy/lingxu/blob/main/Violet_Servers/01_Servers/LoginServer/Ctrl/LoginCtrl.cs"
click node_centerprogram "https://github.com/confused-qy/lingxu/blob/main/Violet_Servers/01_Servers/CenterServer/Program.cs"
click node_centectrl "https://github.com/confused-qy/lingxu/blob/main/Violet_Servers/01_Servers/CenterServer/Ctrl/Center_LoginCtrl.cs"
click node_loginmodel "https://github.com/confused-qy/lingxu/blob/main/Violet_Servers/01_Servers/CenterServer/DB/Model/LoginModel.cs"
click node_dbmgr "https://github.com/confused-qy/lingxu/blob/main/Violet_Servers/01_Servers/CenterServer/DB/DBMgr.cs"
click node_tables "https://github.com/confused-qy/lingxu/blob/main/Violet_Servers/01_Servers/CenterServer/DB/Table/AccountTable.cs"
click node_netserver "https://github.com/confused-qy/lingxu/blob/main/Violet_Servers/02_Library/02_Library/Network/%20Socket/NetServer.cs"
click node_netclient "https://github.com/confused-qy/lingxu/blob/main/Violet_Servers/02_Library/02_Library/Network/%20Socket/NetClient.cs"
click node_session "https://github.com/confused-qy/lingxu/blob/main/Violet_Servers/02_Library/02_Library/Network/%20Socket/com/Session.cs"
click node_sessionmgr "https://github.com/confused-qy/lingxu/blob/main/Violet_Servers/02_Library/02_Library/Network/%20Socket/com/SessionMgr.cs"
click node_protocol "https://github.com/confused-qy/lingxu/blob/main/Violet_Servers/02_Library/02_Library/Network/Proto/ResultEntity.cs"
click node_responseproto "https://github.com/confused-qy/lingxu/blob/main/protoc-28.3/proto/ResultEntity.proto"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_unityboot,node_user toneBlue
class node_loginprogram,node_loginctrl,node_mysql toneAmber
class node_centerprogram,node_centectrl,node_loginmodel,node_dbmgr,node_tables toneMint
class node_netserver,node_netclient,node_session,node_sessionmgr,node_protocol,node_responseproto toneRose
```

## Components

### Unity Client

- [Unity Boot](https://github.com/confused-qy/lingxu/blob/main/MMO_RPG/Assets/Boot/Load.cs): `MMO_RPG/Assets/Boot/Load.cs`

### Login Gateway

- [Login Process](https://github.com/confused-qy/lingxu/blob/main/Violet_Servers/01_Servers/LoginServer/Program.cs): `Violet_Servers/01_Servers/LoginServer/Program.cs`
- [Login Controller](https://github.com/confused-qy/lingxu/blob/main/Violet_Servers/01_Servers/LoginServer/Ctrl/LoginCtrl.cs): `Violet_Servers/01_Servers/LoginServer/Ctrl/LoginCtrl.cs`

### Center Services

- [Center Process](https://github.com/confused-qy/lingxu/blob/main/Violet_Servers/01_Servers/CenterServer/Program.cs): `Violet_Servers/01_Servers/CenterServer/Program.cs`
- [Center Controller](https://github.com/confused-qy/lingxu/blob/main/Violet_Servers/01_Servers/CenterServer/Ctrl/Center_LoginCtrl.cs): `Violet_Servers/01_Servers/CenterServer/Ctrl/Center_LoginCtrl.cs`
- [Account Model](https://github.com/confused-qy/lingxu/blob/main/Violet_Servers/01_Servers/CenterServer/DB/Model/LoginModel.cs): `Violet_Servers/01_Servers/CenterServer/DB/Model/LoginModel.cs`
- [Database Setup](https://github.com/confused-qy/lingxu/blob/main/Violet_Servers/01_Servers/CenterServer/DB/DBMgr.cs): `Violet_Servers/01_Servers/CenterServer/DB/DBMgr.cs`
- [Account Role Tables](https://github.com/confused-qy/lingxu/blob/main/Violet_Servers/01_Servers/CenterServer/DB/Table/AccountTable.cs): `Violet_Servers/01_Servers/CenterServer/DB/Table/AccountTable.cs`

### Network Transport

- [TCP Server](https://github.com/confused-qy/lingxu/blob/main/Violet_Servers/02_Library/02_Library/Network/%20Socket/NetServer.cs): `Violet_Servers/02_Library/02_Library/Network/ Socket/NetServer.cs`
- [TCP Client](https://github.com/confused-qy/lingxu/blob/main/Violet_Servers/02_Library/02_Library/Network/%20Socket/NetClient.cs): `Violet_Servers/02_Library/02_Library/Network/ Socket/NetClient.cs`
- [Client Session](https://github.com/confused-qy/lingxu/blob/main/Violet_Servers/02_Library/02_Library/Network/%20Socket/com/Session.cs): `Violet_Servers/02_Library/02_Library/Network/ Socket/com/Session.cs`
- [Session Registry](https://github.com/confused-qy/lingxu/blob/main/Violet_Servers/02_Library/02_Library/Network/%20Socket/com/SessionMgr.cs): `Violet_Servers/02_Library/02_Library/Network/ Socket/com/SessionMgr.cs`
- [Protocol Messages](https://github.com/confused-qy/lingxu/blob/main/Violet_Servers/02_Library/02_Library/Network/Proto/ResultEntity.cs): `Violet_Servers/02_Library/02_Library/Network/Proto/ResultEntity.cs`
- [Result Definitions](https://github.com/confused-qy/lingxu/blob/main/protoc-28.3/proto/ResultEntity.proto): `protoc-28.3/proto/ResultEntity.proto`

### Other components

- **Player Client**
- **MySQL Database**

## Connections

- Player Client → TCP Server: sends requests
- Unity Boot → Player Client: starts client
- Login Process → TCP Client: connects upstream
- Login Process → TCP Server: starts listener
- Login Process → Login Controller: registers commands
- Login Process → TCP Client: registers handlers
- TCP Server → Client Session: accepts session
- Client Session → Login Controller: dispatches request
- Login Controller → TCP Client: forwards requests
- TCP Client → Center Process: sends requests
- Center Process → TCP Server: starts listener
- Center Process → Database Setup: initializes database
- Center Process → Center Controller: registers commands
- TCP Server → Center Controller: dispatches request
- Center Controller → Account Model: invokes operations
- Account Model → MySQL Database: queries and writes
- Database Setup → MySQL Database: creates schema
- Database Setup → Account Role Tables: initializes tables
- Client Session → Session Registry: registers session
- Login Controller → Session Registry: looks up session
- Login Controller → Client Session: sends response
- Center Controller → TCP Server: sends response
- Result Definitions → Protocol Messages: defines messages
