@startuml
'main -> g_v : init
'main -> g_static : init
'ConfigMgr
'GTimerMgr
main -> ConfigMgr : 读取配置文件
note left of ConfigMgr : config/config.ini
main -> GTimerMgr : 配置定时器
main-> DbMgr
activate DbMgr
DbMgr -> DbMgr : start\n连接启动数据库-
activate DbMgr
deactivate DbMgr
deactivate DbMgr
loop 每2小时唤醒数据库
GTimerMgr -> DbMgr : keep_alive
end
main -> GameConfig
group GameConfig
GameConfig -> GameConfig: load_config_from_db
GameConfig -> DbMgr
DbMgr -> DbMgr : 从servcer_info\n读取服务器ip
activate DbMgr
DbMgr --> GameConfig :存起来m_serverId
deactivate DbMgr
DbMgr -> DbMgr : 从fishing_sys_config\n读取税率\n新人奖励
activate DbMgr
DbMgr --> GameConfig :存起来
deactivate DbMgr
DbMgr -> DbMgr : 从fishing_room_config\n渔场id\n鱼池上限\n房间金盆上限
activate DbMgr
DbMgr --> GameConfig :存到room_config_dict
deactivate DbMgr
end
main -> DbMgr
activate DbMgr
DbMgr -> DbMgr : 清除coin_lock
activate DbMgr
deactivate DbMgr
deactivate DbMgr
main -> PlayerService : on_game_init
group 启动PlayerService
loop 每10秒更新金币
PlayerService -> PlayerService :select_coin_fresh
PlayerService -> DbMgr
DbMgr-> DbMgr : 从表coin_fresh\n获取本serverid服务器中的玩家uid
activate DbMgr
DbMgr --> PlayerService : 服务器上的玩家uid
deactivate DbMgr
loop 遍历玩家m_idPlayerDict
PlayerService -> PlayerModel : 金币更改了,则存到表coin中
PlayerService -> GameLogicThread : 通知玩家金币数\nLoginPb.RoleGoldChangePush
note right
通知玩家更新金币数
end note
PlayerService -> RoomService : player_coin_fresh
RoomService -> DeskModel : 从m_roleDeskDict中根据uid找到对应房间
loop 遍历房间中的玩家更新房间中其他人金币数
DeskModel -> GameLogicThread : 通知房间中其它玩家更新金币FightPb.SyncGoldChange
end
end
PlayerService -> DbMgr : 将表coin_fresh中本server对应的记录清空
end
loop 每分钟更新在线玩家
PlayerService -> PlayerService :update_online_num
PlayerService -> DbMgr
DbMgr -> DbMgr : update_online_num\n往表server_info中\n写入在线人数
activate DbMgr
deactivate DbMgr
DbMgr -> DbMgr : update_top_online\n往表top_online中\n插入在线人数
activate DbMgr
deactivate DbMgr
end
loop 每隔20秒推送房间到机器人
PlayerService -> PlayerService : push_room_info_to_robot
PlayerService -> PlayerService : 从m_idPlayerDict缓存中找出一个机器人
PlayerService -> RoomService
activate RoomService
RoomService --> RoomService : 从缓存m_deskDict中\n返回已经准备好的房间列表
deactivate RoomService
PlayerService -> PlayerService : FightPb.RoomInfoListToRobotPush
note right
将已经准备好的房间列表推送给机器人
就是里面已经有人的房间
end note
end
end
main -> RoomService
group 处理房间信息
RoomService -> RoomService : on_game_init
group 初始化房间
loop 遍历room.xls
RoomService -> DeskModel
activate DeskModel
DeskModel --> RoomService
deactivate DeskModel
note right
初中高级房间各建立一个桌子放到m_deskDict中
end note
RoomService -> DbMgr : 读取表fishing_room_info
loop 遍历数据库将房间配置\n写入缓存m_roomInfoDict
RoomService -> RoomModel
activate RoomModel
RoomModel --> RoomService
deactivate RoomModel
note right
建立RoomModel放到m_roomInfoDict中
end note
end
end
end
RoomService -> RoomService
loop 每分钟把空房间清理掉
RoomService -> RoomService : on_timer
loop 遍历房间m_deskDict
alt 房内没人 and 房间已经准备好
RoomService -> RoomService
note right
有玩家进来玩过了,玩家都退出了
把玩家全部退出后的空房间删了
end note
end
end
end
end
==处理游戏消息进程==
main -> GameLogicThread : 启动游戏主线程
loop 处理消息
' m_listMsg
loop 循环处理完m_listMsg列表中的消息
GameLogicThread -> GameLogicThread : process_msg
alt 重新加载游戏配置GSysMsgId.ESysConfigModify
GameLogicThread -> BackstageCmd
BackstageCmd -> BackstageCmd : sys_config_modify
BackstageCmd -> GameConfig
GameConfig -> GameConfig : reload_sys_config\n从数据库读取
GameConfig -> DbMgr : 从数据表fishing_sys_config\n加载鱼tax新人等配置
activate DbMgr
DbMgr --> GameConfig
deactivate DbMgr
else 从数据库加载房间信息GSysMsgId.ERoomConfigModify
GameLogicThread -> BackstageCmd
BackstageCmd -> BackstageCmd : room_config_modify
BackstageCmd -> GameConfig : reload_room_config
GameConfig -> GameConfig :重载房间配置信息到\nroom_config_dict
activate GameConfig
GameConfig -> DbMgr
DbMgr -> DbMgr : 从fishing_room_config\n读取房间信息
activate DbMgr
deactivate DbMgr
DbMgr --> GameConfig
deactivate GameConfig
else 关闭客户端GSysMsgId.EClientClose
GameLogicThread -> LoginCmd
LoginCmd -> LoginCmd : client_close
LoginCmd -> PlayerService
PlayerService -> PlayerService: on_line_off
loop 遍历m_idPlayerDict查找关闭玩家
PlayerService -> RoomService
RoomService -> RoomService
RoomService -> DeskModel
DeskModel -> DeskModel : player_line_off \n从m_roleDeskDict中\n关闭玩家
DeskModel -> PlayerService
activate PlayerService
PlayerService -> PlayerService : player_save_game_water
activate PlayerService
PlayerService -> PlayerModel
activate PlayerModel
PlayerModel -> PlayerModel : save_game_water
activate PlayerModel
PlayerModel -> DbMgr
activate DbMgr
DbMgr -> DbMgr : save_game_water_record\n往数据表game_water_record中插入
activate DbMgr
deactivate DbMgr
DbMgr -> DbMgr : save_daly_game_score\n往数据表daly_game_score中插入
activate DbMgr
deactivate DbMgr
deactivate DbMgr
deactivate PlayerModel
deactivate PlayerModel
deactivate PlayerService
deactivate PlayerService
DeskModel -> DeskModel : FightPb.SyncMultipleRoomPlayerOut
activate DeskModel
deactivate DeskModel
DeskModel -> DeskModel : sync_msg_to_player\n通知用户有人退出\nC2SMSGID\n.FightPb_SyncMultipleRoomPlayerOut
activate DeskModel
deactivate DeskModel
end
绘制服务器序列图
最新推荐文章于 2022-02-11 18:13:12 发布
本文详细介绍了如何绘制服务器序列图,涵盖了从理解序列图的基本概念到实际操作的步骤,包括使用各种工具进行绘制,以及在服务器通信中序列图的应用。
摘要由CSDN通过智能技术生成