1
This commit is contained in:
parent
386daa2c38
commit
5a819e7af4
@ -25,9 +25,11 @@ func (this *App) Init() {
|
||||
playerMgr.init()
|
||||
wspListener.init()
|
||||
httpListener.init()
|
||||
roomMgr.init()
|
||||
}
|
||||
|
||||
func (this *App) UnInit() {
|
||||
roomMgr.unInit()
|
||||
httpListener.unInit()
|
||||
playerMgr.unInit()
|
||||
handlerMgr.unInit()
|
||||
|
@ -5,3 +5,4 @@ var wspListener = new(WSPListener)
|
||||
var playerMgr = new(PlayerMgr)
|
||||
var handlerMgr = new(HandlerMgr)
|
||||
var httpListener = new(HttpListener)
|
||||
var roomMgr = new(RoomMgr)
|
||||
|
@ -30,40 +30,6 @@ func (this *PlayerMgr) init() {
|
||||
})
|
||||
}
|
||||
})
|
||||
conn := q5.NewMysql(
|
||||
mt.Table.GameDb.GetById(0).GetHost(),
|
||||
mt.Table.GameDb.GetById(0).GetPort(),
|
||||
mt.Table.GameDb.GetById(0).GetUser(),
|
||||
mt.Table.GameDb.GetById(0).GetPasswd(),
|
||||
mt.Table.GameDb.GetById(0).GetDatabase(),
|
||||
)
|
||||
conn.Open()
|
||||
rows, err := conn.Query("SELECT * FROM t_user LIMIT 1")
|
||||
if err == nil {
|
||||
dataSet := f5.NewDataSet(rows)
|
||||
if dataSet.Next() {
|
||||
columns := dataSet.GetColumns()
|
||||
for i := 0; i < len(columns); i++ {
|
||||
f5.GetSysLog().Info(
|
||||
"%s:%s",
|
||||
columns[i],
|
||||
*dataSet.GetByName(columns[i]))
|
||||
}
|
||||
}
|
||||
} else {
|
||||
f5.GetSysLog().Info("mysql error:%s\n", err)
|
||||
}
|
||||
{
|
||||
f5.GetJsStyleDb().OrmSelectOne(
|
||||
GAME_DB,
|
||||
"t_user",
|
||||
[][]string{
|
||||
[]string{"account_id", "100"},
|
||||
},
|
||||
func(err error, row *f5.DataSet) {
|
||||
fmt.Println(row)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (this *PlayerMgr) unInit() {
|
||||
|
@ -116,3 +116,90 @@ message SMReconnect
|
||||
optional int32 errcode = 1; //错误码 0:成功 1:重连失败
|
||||
optional string errmsg = 2; //错误描述
|
||||
}
|
||||
|
||||
//创建房间
|
||||
message CMCreateRoom
|
||||
{
|
||||
optional string passwd = 1; //密码,空:无密码
|
||||
}
|
||||
|
||||
message SMCreateRoom
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//获取房间列表
|
||||
message CMRoomList
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
message SMRoomList
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//加入房间
|
||||
message CMJoinRoom
|
||||
{
|
||||
optional string room_id = 1; //房间号
|
||||
optional string passwd = 2; //密码,空:无密码
|
||||
}
|
||||
|
||||
message SMJoinRoom
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//解散房间
|
||||
message CMDisbandRoom
|
||||
{
|
||||
optional string room_id = 1; //房间号
|
||||
}
|
||||
|
||||
message SMDisbandRoom
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//退出房间
|
||||
message CMLeaveRoom
|
||||
{
|
||||
optional string room_id = 1; //房间号
|
||||
}
|
||||
|
||||
message SMLeaveRoom
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//修改房间
|
||||
message CMModifyRoom
|
||||
{
|
||||
optional string room_id = 1; //房间号
|
||||
}
|
||||
|
||||
message SMModifyRoom
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//开始游戏
|
||||
message CMStartGame
|
||||
{
|
||||
}
|
||||
|
||||
message SMStartGame
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//准备
|
||||
message CMSetPrepare
|
||||
{
|
||||
}
|
||||
|
||||
//踢人
|
||||
message CMKickout
|
||||
{
|
||||
}
|
||||
|
10
server/hallserver/room.go
Normal file
10
server/hallserver/room.go
Normal file
@ -0,0 +1,10 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"cs"
|
||||
)
|
||||
|
||||
type Room struct {
|
||||
cs.MsgHandlerImpl
|
||||
|
||||
}
|
17
server/hallserver/roommgr.go
Normal file
17
server/hallserver/roommgr.go
Normal file
@ -0,0 +1,17 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"cs"
|
||||
)
|
||||
|
||||
type RoomMgr struct {
|
||||
cs.MsgHandlerImpl
|
||||
idHash map[int32]*Room
|
||||
}
|
||||
|
||||
func (this *RoomMgr) init() {
|
||||
this.idHash = make(map[int32]*Room)
|
||||
}
|
||||
|
||||
func (this *RoomMgr) unInit() {
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user