refactor(socket): 重构 ClientData 结构体并优化相关逻辑
- 简化 ClientData 结构体,移除不必要的方法 - 优化 Player 结构体,调整 Conn 类型 - 更新 wscodec.go 中的 Conn 结构体 - 删除未使用的 XML 相关文件和代码 - 调整 ServerEvent 和 controller 中的相关逻辑
This commit is contained in:
64
common/data/xmlres/map.go
Normal file
64
common/data/xmlres/map.go
Normal file
@@ -0,0 +1,64 @@
|
||||
package xmlres
|
||||
|
||||
import (
|
||||
"github.com/ECUST-XX/xml"
|
||||
)
|
||||
|
||||
// Maps 根节点,对应<Maps>标签
|
||||
type Maps struct {
|
||||
XMLName xml.Name `xml:"Maps"`
|
||||
Maps []Map `xml:"map"` // 包含所有地图配置
|
||||
}
|
||||
|
||||
// Map 单张地图配置,对应<map>标签
|
||||
type Map struct {
|
||||
ID int `xml:"id,attr"` // 地图ID
|
||||
Name string `xml:"name,attr"` // 地图名称
|
||||
X int `xml:"x,attr"` // 地图X坐标
|
||||
Y int `xml:"y,attr"` // 地图Y坐标
|
||||
Des string `xml:"des,attr,omitempty"` // 地图描述(可选)
|
||||
Super int `xml:"super,attr,omitempty"` // 上级地图ID(可选)
|
||||
IsFB int `xml:"isFB,attr,omitempty"` // 是否为副本(0/1,可选)
|
||||
IsLocal int `xml:"isLocal,attr,omitempty"` // 是否为本地地图(0/1,可选)
|
||||
Sound string `xml:"sound,attr,omitempty"` // 背景音乐(可选)
|
||||
ReplaceMapID int `xml:"replaceMapId,attr,omitempty"` // 替换地图ID(可选)
|
||||
FX int `xml:"fx,attr,omitempty"` // 道具地面X坐标(可选)
|
||||
FY int `xml:"fy,attr,omitempty"` // 道具地面Y坐标(可选)
|
||||
WX int `xml:"wx,attr,omitempty"` // 道具墙面X坐标(可选)
|
||||
WY int `xml:"wy,attr,omitempty"` // 道具墙面Y坐标(可选)
|
||||
HX int `xml:"hx,attr,omitempty"` // 总部主电脑X坐标(可选)
|
||||
HY int `xml:"hy,attr,omitempty"` // 总部主电脑Y坐标(可选)
|
||||
|
||||
Entries Entries `xml:"Entries,omitempty"` // 进入点配置(可选)
|
||||
ChangeMapComp ComponentList `xml:"changeMapComp,omitempty"` // 场景切换组件(可选)
|
||||
FunComp ComponentList `xml:"funComp,omitempty"` // 点击触发组件(可选)
|
||||
AutoComp ComponentList `xml:"autoComp,omitempty"` // 自动触发组件(可选)
|
||||
}
|
||||
|
||||
// Entries 进入点集合,对应<Entries>标签
|
||||
type Entries struct {
|
||||
Entries []Entry `xml:"Entry"` // 多个进入点
|
||||
}
|
||||
|
||||
// Entry 单个进入点配置,对应<Entry>标签
|
||||
type Entry struct {
|
||||
FromMap int `xml:"FromMap,attr"` // 来源地图ID
|
||||
PosX int `xml:"PosX,attr"` // 进入后X坐标
|
||||
PosY int `xml:"PosY,attr"` // 进入后Y坐标
|
||||
}
|
||||
|
||||
// ComponentList 组件集合(用于统一管理不同类型的组件列表)
|
||||
type ComponentList struct {
|
||||
Components []Component `xml:"component"` // 多个组件
|
||||
}
|
||||
|
||||
// Component 单个功能组件配置,对应<component>标签
|
||||
type Component struct {
|
||||
Name string `xml:"name,attr,omitempty"` // 组件名称(可选)
|
||||
Hit string `xml:"hit,attr,omitempty"` // 碰撞区域标识(可选)
|
||||
TargetID int `xml:"targetID,attr,omitempty"` // 目标地图ID(可选)
|
||||
Dir int `xml:"dir,attr,omitempty"` // 滚动方向(1-4,可选)
|
||||
Fun string `xml:"fun,attr,omitempty"` // 触发函数名(可选)
|
||||
Des string `xml:"des,attr,omitempty"` // 鼠标提示文本(可选)
|
||||
IsStop int `xml:"isStop,attr,omitempty"` // 鼠标悬停是否跳帧(0/1,可选)
|
||||
}
|
||||
Reference in New Issue
Block a user