整理代码、调用LUA修改场景天气

This commit is contained in:
unkown committed 2023-09-29 08:09:25 +08:00
1 parent a08d28a895
commit 282c16f7fe
7 files changed
+198 -104

No files matched your search

+1 -1
View File
@@ -74,7 +74,7 @@ type GameDataConfig struct {
OpenStateDataMap map[int32]*OpenStateData // 开放状态
WeatherDataMap map[int32]*WeatherData // 天气
WeatherTemplateMap map[string]map[int32]*WeatherTemplate // 天气模版
SceneWeatherAreaMap map[int32][]*SceneWeatherArea // 天气区域
SceneWeatherAreaMap map[int32]map[int32]*SceneWeatherArea // 天气区域
}
func InitGameDataConfig() {
+10 -6
View File
@@ -20,7 +20,7 @@ type AreaPoint struct {
}
func (g *GameDataConfig) loadSceneWeatherArea() {
g.SceneWeatherAreaMap = make(map[int32][]*SceneWeatherArea)
g.SceneWeatherAreaMap = make(map[int32]map[int32]*SceneWeatherArea)
sceneLuaPrefix := g.luaPrefix + "scene/"
count := 0
for _, sceneData := range g.SceneDataMap {
@@ -43,19 +43,23 @@ func (g *GameDataConfig) loadSceneWeatherArea() {
for _, area := range sceneWeatherAreaList {
_, exist := g.SceneWeatherAreaMap[sceneId]
if !exist {
g.SceneWeatherAreaMap[sceneId] = make([]*SceneWeatherArea, 0)
g.SceneWeatherAreaMap[sceneId] = make(map[int32]*SceneWeatherArea, len(area.Points))
}
g.SceneWeatherAreaMap[sceneId] = append(g.SceneWeatherAreaMap[sceneId], area)
g.SceneWeatherAreaMap[sceneId][area.AreaId] = area
count++
}
}
logger.Info("SceneWeatherArea count: %v", count)
}
func GetSceneWeatherAreaListBySceneId(sceneId int32) []*SceneWeatherArea {
return CONF.SceneWeatherAreaMap[sceneId]
func GetSceneWeatherAreaMapBySceneIdAndWeatherAreaId(sceneId int32, WeatherAreaId int32) *SceneWeatherArea {
value, exist := CONF.SceneWeatherAreaMap[sceneId]
if !exist {
return nil
}
return value[WeatherAreaId]
}
func GetSceneWeatherAreaMap() map[int32][]*SceneWeatherArea {
func GetSceneWeatherAreaMap() map[int32]map[int32]*SceneWeatherArea {
return CONF.SceneWeatherAreaMap
}