|
@@ -1,7 +1,7 @@
|
|
package ludo
|
|
package ludo
|
|
|
|
|
|
import (
|
|
import (
|
|
- "fmt"
|
|
|
|
|
|
+ "server/console"
|
|
"server/msg"
|
|
"server/msg"
|
|
"server/user"
|
|
"server/user"
|
|
|
|
|
|
@@ -19,9 +19,9 @@ func RecvMatchLudo(args []interface{}) {
|
|
//判断玩家是否有足够金币
|
|
//判断玩家是否有足够金币
|
|
coin := ud.(*msg.UserInfo).MCoin
|
|
coin := ud.(*msg.UserInfo).MCoin
|
|
matchConfig := gameRule.getMatchByLevle(m.RoomLevel)
|
|
matchConfig := gameRule.getMatchByLevle(m.RoomLevel)
|
|
- fmt.Printf("coin = %d \n", coin)
|
|
|
|
- fmt.Printf("RoomLevel = %d \n", m.RoomLevel)
|
|
|
|
- fmt.Printf("matchConfig.enterNum = %v \n", matchConfig.enterNum)
|
|
|
|
|
|
+ console.Log("coin = ", coin)
|
|
|
|
+ console.Log("RoomLevel = ", m.RoomLevel)
|
|
|
|
+ console.Log("matchConfig.enterNum = ", matchConfig.enterNum)
|
|
if coin >= matchConfig.enterNum {
|
|
if coin >= matchConfig.enterNum {
|
|
user.DecreaseUserCoin(matchConfig.enterNum, user_id)
|
|
user.DecreaseUserCoin(matchConfig.enterNum, user_id)
|
|
go matchRoom(m, user_id, a)
|
|
go matchRoom(m, user_id, a)
|
|
@@ -33,15 +33,15 @@ func RecvMatchLudo(args []interface{}) {
|
|
//根据玩家要匹配的对局,给玩家寻找和的房间
|
|
//根据玩家要匹配的对局,给玩家寻找和的房间
|
|
|
|
|
|
func matchRoom(matchInfo *msg.MatchLudo, userId string, user_agent gate.Agent) {
|
|
func matchRoom(matchInfo *msg.MatchLudo, userId string, user_agent gate.Agent) {
|
|
- fmt.Printf("matchRoom\n")
|
|
|
|
|
|
+ console.Log("matchRoom")
|
|
roomList := GetRoomsByLevel(matchInfo, msg.RoomStatus_AWAIT)
|
|
roomList := GetRoomsByLevel(matchInfo, msg.RoomStatus_AWAIT)
|
|
- fmt.Printf("matchRoom123\n")
|
|
|
|
|
|
+ console.Log("matchRoom123")
|
|
if len(roomList) == 0 {
|
|
if len(roomList) == 0 {
|
|
// Create new room if none available
|
|
// Create new room if none available
|
|
- fmt.Printf("没找到房间匹配一个!\n")
|
|
|
|
|
|
+ console.Log("没找到房间匹配一个!")
|
|
_, err := CreateRoom(matchInfo, userId)
|
|
_, err := CreateRoom(matchInfo, userId)
|
|
if err != nil {
|
|
if err != nil {
|
|
- fmt.Printf("%s\n", err.Error())
|
|
|
|
|
|
+ console.Log(err.Error())
|
|
sendMatchErrorMsg(user_agent, 101, "not find player")
|
|
sendMatchErrorMsg(user_agent, 101, "not find player")
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
@@ -51,7 +51,7 @@ func matchRoom(matchInfo *msg.MatchLudo, userId string, user_agent gate.Agent) {
|
|
if err_info == nil {
|
|
if err_info == nil {
|
|
if isFullPlayer {
|
|
if isFullPlayer {
|
|
start_room := startGame(roomList[0])
|
|
start_room := startGame(roomList[0])
|
|
- fmt.Printf("%v:匹配成功开始游戏!", start_room)
|
|
|
|
|
|
+ console.Log(":匹配成功开始游戏!", start_room)
|
|
NotifyRoomPlayerMatch(start_room)
|
|
NotifyRoomPlayerMatch(start_room)
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|