娃娃机调转方向
This commit is contained in:
parent
c0941e43e7
commit
a314c42d6c
|
|
@ -67,7 +67,7 @@ func processConnMessageQueue(queue *ConnMessageQueue) {
|
|||
}
|
||||
}
|
||||
|
||||
// 移动
|
||||
// 移动 1-前 2-后 3-左 4-右 5-投币
|
||||
func SMDollMachinePerateHandler(session *netlib.Session, packetId int, data interface{}) error {
|
||||
fmt.Println("SMDollMachinePerateHandler %v", data)
|
||||
msg, ok := data.(*machine.SMDollMachineoPerate)
|
||||
|
|
@ -86,15 +86,6 @@ func SMDollMachinePerateHandler(session *netlib.Session, packetId int, data inte
|
|||
|
||||
switch msg.Perate {
|
||||
case 1:
|
||||
//向前移动
|
||||
f1 := []func(){
|
||||
func() { machinedoll.Backward(conn) },
|
||||
}
|
||||
f2 := []func(){
|
||||
func() { machinedoll.BackwardStop(conn) },
|
||||
}
|
||||
Process(conn, f1, f2)
|
||||
case 2:
|
||||
//向后移动
|
||||
f1 := []func(){
|
||||
func() { machinedoll.Forward(conn) },
|
||||
|
|
@ -103,16 +94,16 @@ func SMDollMachinePerateHandler(session *netlib.Session, packetId int, data inte
|
|||
func() { machinedoll.ForwardStop(conn) },
|
||||
}
|
||||
Process(conn, f1, f2)
|
||||
case 3:
|
||||
//向左移动
|
||||
case 2:
|
||||
//向前移动
|
||||
f1 := []func(){
|
||||
func() { machinedoll.Left(conn) },
|
||||
func() { machinedoll.Backward(conn) },
|
||||
}
|
||||
f2 := []func(){
|
||||
func() { machinedoll.LeftStop(conn) },
|
||||
func() { machinedoll.BackwardStop(conn) },
|
||||
}
|
||||
Process(conn, f1, f2)
|
||||
case 4:
|
||||
case 3:
|
||||
//向右移动
|
||||
f1 := []func(){
|
||||
func() { machinedoll.Right(conn) },
|
||||
|
|
@ -121,6 +112,16 @@ func SMDollMachinePerateHandler(session *netlib.Session, packetId int, data inte
|
|||
func() { machinedoll.RightStop(conn) },
|
||||
}
|
||||
Process(conn, f1, f2)
|
||||
case 4:
|
||||
//向左移动
|
||||
f1 := []func(){
|
||||
func() { machinedoll.Left(conn) },
|
||||
}
|
||||
f2 := []func(){
|
||||
func() { machinedoll.LeftStop(conn) },
|
||||
}
|
||||
Process(conn, f1, f2)
|
||||
|
||||
case 5:
|
||||
//投币
|
||||
conn := machinedoll.MachineMgr.CreateConn(int(msg.GetId()))
|
||||
|
|
@ -284,6 +285,7 @@ func SMGameLinkSucceedHandler(session *netlib.Session, packetId int, data interf
|
|||
msg.Data = append(msg.Data, info)
|
||||
}
|
||||
session.Send(int(machine.DollMachinePacketID_PACKET_MSDollMachineList), msg)
|
||||
machinedoll.MachineMgr.BeatStatus = true
|
||||
fmt.Println("向游戏服务器发送娃娃机连接信息:%v", msg)
|
||||
return nil
|
||||
}
|
||||
|
|
@ -333,6 +335,10 @@ func SMGameLinkSucceedHandler(session *netlib.Session, packetId int, data interf
|
|||
*/
|
||||
func SMDollMachineHeartBeatHandler(session *netlib.Session, packetId int, data interface{}) error {
|
||||
//fmt.Println("收到返回的心跳包")
|
||||
machinedoll.MachineMgr.BeatCount--
|
||||
if machinedoll.MachineMgr.BeatCount < 0 {
|
||||
machinedoll.MachineMgr.BeatCount = 0
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func init() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue