Compare commits

...

2 Commits

2 changed files with 38 additions and 42 deletions

View File

@ -119,8 +119,8 @@ func SMDollMachinePerateHandler(session *netlib.Session, packetId int, data inte
Process(conn, f1, f2) Process(conn, f1, f2)
case 5: case 5:
//投币 //投币
fmt.Println("===========玩家投币===========") fmt.Println("===========玩家投币===========", conn)
go DollMachineGrabResult(session, conn, msg.Snid, msg.GetId()) go DollMachineGrabResult(conn, msg.Snid, msg.GetId())
machinedoll.Coin(conn) machinedoll.Coin(conn)
} }
@ -162,7 +162,7 @@ func SMDollMachineGrabHandler(session *netlib.Session, packetId int, data interf
} }
// 监听抓取结果返回 // 监听抓取结果返回
func DollMachineGrabResult(session *netlib.Session, conn *machinedoll.Conn, snid, id int32) { func DollMachineGrabResult(conn *machinedoll.Conn, snid, id int32) {
num := int64(1) num := int64(1)
for { for {
// 读取数据 // 读取数据

View File

@ -10,11 +10,9 @@ import (
"syscall" "syscall"
"time" "time"
"mongo.games.com/goserver/core/basic"
"mongo.games.com/goserver/core/logger" "mongo.games.com/goserver/core/logger"
"mongo.games.com/goserver/core/module" "mongo.games.com/goserver/core/module"
"mongo.games.com/goserver/core/netlib" "mongo.games.com/goserver/core/netlib"
"mongo.games.com/goserver/core/task"
"mongo.games.com/goserver/srvlib" "mongo.games.com/goserver/srvlib"
"mongo.games.com/game/protocol/machine" "mongo.games.com/game/protocol/machine"
@ -90,14 +88,14 @@ func (this *MachineManager) Init() {
} }
func (this *MachineManager) Update() { func (this *MachineManager) Update() {
var delConn []*Conn /* var delConn []*Conn
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
for _, v := range this.ConnMap { for _, v := range this.ConnMap {
_, err := v.Write([]byte("heartbeat")) _, err := v.Write([]byte("heartbeat"))
if err != nil { if err != nil {
delConn = append(delConn, v) delConn = append(delConn, v)
v.Close() v.Close()
logger.Logger.Tracef("断开连接:%v", v.Addr) fmt.Println("断开连接:%v", v.Addr)
this.UpdateToGameServer(v, 0) this.UpdateToGameServer(v, 0)
} }
} }
@ -116,7 +114,7 @@ func (this *MachineManager) Update() {
if err != nil { if err != nil {
continue continue
} }
logger.Logger.Tracef("娃娃机重连成功addr = %v", addr) fmt.Println("娃娃机重连成功addr = %v", addr)
delIds = append(delIds, &Conn{ delIds = append(delIds, &Conn{
Id: id, Id: id,
Conn: conn, Conn: conn,
@ -131,7 +129,7 @@ func (this *MachineManager) Update() {
this.UpdateToGameServer(v, 1) this.UpdateToGameServer(v, 1)
} }
})).StartByFixExecutor(this.ModuleName()) })).StartByFixExecutor(this.ModuleName())
})).StartByFixExecutor(this.ModuleName()) })).StartByFixExecutor(this.ModuleName())*/
} }
func (this *MachineManager) Shutdown() { func (this *MachineManager) Shutdown() {
@ -204,8 +202,6 @@ func listenKeyboardEvents(conn net.Conn) {
case "j": case "j":
Grab(conn) Grab(conn)
case "J": case "J":
SetPower(conn)
time.Sleep(200 * time.Millisecond)
Grab(conn) Grab(conn)
case "k": case "k":