feat(map): 实现地图加载和玩家进入地图功能
- 在 Player 结构中添加 MapId 字段,用于记录当前所在地图 ID - 新增地图配置解析功能,支持从 XML 文件中读取地图信息 - 实现玩家进入地图的逻辑,包括设置玩家位置和广播通知 - 更新登录逻辑,在玩家登录时自动进入默认地图 - 重构地图相关的数据结构和接口,为后续地图功能扩展做准备
This commit is contained in:
@@ -48,25 +48,14 @@ var s = `
|
||||
</superMaps>`
|
||||
|
||||
func Test_main(t *testing.T) {
|
||||
tt := &SuperMaps{}
|
||||
xml.Unmarshal([]byte(s), tt)
|
||||
|
||||
// tt.Maps = append(tt.Maps, Maps{
|
||||
// ID: "1",
|
||||
// Name: "传送舱",
|
||||
// // Galaxy: "1",
|
||||
// X: "358",
|
||||
// Y: "46",
|
||||
// })
|
||||
// tt.Maps = append(tt.Maps, Maps{
|
||||
// ID: "4",
|
||||
// Name: "船长室",
|
||||
// // Galaxy: "1",
|
||||
// X: "358",
|
||||
// Y: "46",
|
||||
// })
|
||||
tf, _ := xml.MarshalIndentShortForm(tt, " ", " ")
|
||||
fmt.Println(string(tf))
|
||||
// 解析XML到结构体
|
||||
var maps Maps
|
||||
t1, _ := getxml()
|
||||
xml.Unmarshal(t1, &maps)
|
||||
|
||||
//tf, _ := xml.MarshalIndentShortForm(tt, " ", " ")
|
||||
fmt.Println(maps)
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user