This repository has been archived on 2026-10-31. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
Ananta-ps/internal/catalogs/rail_carriage_catalog4229938.go
T

135 lines
4.4 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package catalogs
import (
"encoding/json"
"os"
"path/filepath"
"sync"
)
var _ = json.RawMessage{}
var _ = sync.Mutex{}
var _ = os.ReadFile
var _ = filepath.Join
// One row of RailCarriageConfig — a carriage prefab template.
type RailCarriage4229938 struct {
Id uint32 `json:"id"`
TemplateName string `json:"templateName"`
ViewModelName string `json:"viewModelName"`
LayoutClass string `json:"layoutClass"`
}
//
// Reads Configs/RailCarriageConfig.json. The table itself has no seat count
// (seat layout lives inside the prefab), but it tells us which carriage templates share a
// layout — which is what makes the seat-count collection job tractable.
//
//
// ★ 为什么需要它(2026-09-27):
// RailTrainConfig.CarriageIds 给出编组模板序列(1/2 号线 [10,2,2,2,3]、
// 3 号线 [11,7,7,7,8]、4 号线 [4,5,9]、9-14 号线 [12,13,13,13,14]、15 号线 [15]),
// 共 13 个模板。但按 TemplateName + ViewModelName 后缀 归并后只有 8 种布局:
// <code>
// Vehicle01/Head = 10, 11 (MGA=MoveGroundArea02,F=14 R=11)
// Vehicle01/Mid = 2, 7 (F=11.2 R=11)
// Vehicle01/Tail = 3, 8 (revert=true,F=11 R=14)
// Vehicle03/End = 4, 9 (F/R 互换,同一节车厢镜像)
// Vehicle03/Mid = 5
// VehicleCX01/Mid = 13
// VehicleCX01/End = 12, 14 (14 是 12 的 revert)
// TourBoat01/View = 15
// </code>
// ⇒ 采集量从 13 个数字降到 8 个;采一趟 1/2 号线就能覆盖 Vehicle01 的头/中/尾,
// 3、7、8、11 可直接类推(同车型不同涂装)。
// ⛔ 现有配置 metroGadgets.seatsByCarriageTemplate 里 4 → 4 座、9 → 6 座 ——
// 这俩是同一车型(Vehicle03/CarriageOnEnd,只是前后镜像),座位数不该不一样。
// 至少有一个是错的,GameRouter 的 metro 分支会把这个矛盾喊出来。
//
var (
RailCarriageCatalog4229938_cacheLock sync.RWMutex
RailCarriageCatalog4229938_cached = false
RailCarriageCatalog4229938_entries []any
)
// LoadRailCarriageCatalog4229938 loads catalog records from client config directory
func LoadRailCarriageCatalog4229938(configDir string) ([]any, error) {
RailCarriageCatalog4229938_cacheLock.RLock()
if RailCarriageCatalog4229938_cached {
defer RailCarriageCatalog4229938_cacheLock.RUnlock()
return RailCarriageCatalog4229938_entries, nil
}
RailCarriageCatalog4229938_cacheLock.RUnlock()
RailCarriageCatalog4229938_cacheLock.Lock()
defer RailCarriageCatalog4229938_cacheLock.Unlock()
if RailCarriageCatalog4229938_cached { return RailCarriageCatalog4229938_entries, nil }
filePath := filepath.Join(configDir, "RailCarriageCatalog.json.json")
data, err := os.ReadFile(filePath)
if err != nil {
return nil, err
}
var raw struct {
Records []json.RawMessage `json:"records"`
}
if err := json.Unmarshal(data, &raw); err != nil {
return nil, err
}
var result []any
for _, item := range raw.Records {
var m map[string]any
if err := json.Unmarshal(item, &m); err == nil {
result = append(result, m)
}
}
RailCarriageCatalog4229938_entries = result
RailCarriageCatalog4229938_cached = true
return result, nil
}
func RailCarriageCatalog4229938_ById(id uint32) *RailCarriage4229938 {
// Catalog helper RailCarriageCatalog4229938_ById
return nil
}
// Layout class of a template id, e.g. "Vehicle01/Head"; null when unknown.
func RailCarriageCatalog4229938_LayoutClassOf(id uint32) *string {
// Catalog helper RailCarriageCatalog4229938_LayoutClassOf
return nil
}
// Human label for logs: "10=Vehicle01/Head" / "10(tpl10)" when unknown.
func RailCarriageCatalog4229938_Describe(id uint32) string {
// Catalog helper RailCarriageCatalog4229938_Describe
return ""
}
func RailCarriageCatalog4229938_LoadPair() any {
// Catalog helper RailCarriageCatalog4229938_LoadPair
var zero any; return zero
}
//
// Vehicle01/CarriageOnEnd + View_Orange_Tail → Vehicle01/Tail。
// 车型看 TemplateName 前缀,头/中/尾看 ViewModelName 的最后一段。
//
func RailCarriageCatalog4229938_LayoutClass(templateName string, viewModelName string) string {
// Catalog helper RailCarriageCatalog4229938_LayoutClass
return ""
}
func RailCarriageCatalog4229938_U32(source any, name string) uint32 {
// Catalog helper RailCarriageCatalog4229938_U32
return 0
}
func RailCarriageCatalog4229938_Str(source any, name string) string {
// Catalog helper RailCarriageCatalog4229938_Str
return ""
}