ui小游戏额外奖励

This commit is contained in:
meixiongfeng 2023-10-18 11:33:13 +08:00
parent 8c3fe6c9e2
commit 30970cb7d9
5 changed files with 28 additions and 4 deletions

View File

@ -28,9 +28,9 @@ func (this *gameMgrComp) Init(service core.IService, module core.IModule, comp c
return
}
func (this *gameMgrComp) CreateRoom(session [2]comm.IUserSession) {
func (this *gameMgrComp) CreateRoom(s1 comm.IUserSession, s2 comm.IUserSession) {
room := new(Room) //初始化房间
room.InitRoom(session)
room.InitRoom(s1, s2)
this.lock.Lock()
this.rooms[room.Id] = room

View File

@ -57,3 +57,8 @@ func (this *Entertainment) Start() (err error) {
// this.xxl.DropGirde()
return
}
// 匹配完成
func (this *Entertainment) MatchingComplete(s1 comm.IUserSession, s2 comm.IUserSession) {
this.gameMgr.CreateRoom(s1, s2)
}

View File

@ -16,7 +16,7 @@ type Room struct {
chessboard *MapData
}
func (this *Room) InitRoom(session [2]comm.IUserSession) *Room {
func (this *Room) InitRoom(s1 comm.IUserSession, s2 comm.IUserSession) *Room {
this.chessboard = new(MapData)
this.chessboard.InitMap() // 初始化棋盘
return &Room{

View File

@ -25,6 +25,7 @@ func (this *apiComp) MinerKey(session comm.IUserSession, req *pb.UiGameMinerKeyR
}
var (
atno []*pb.UserAtno
res []*cfg.Gameatn
)
list, _ := this.module.modelMiner.getMinerList(session.GetUserId(), req.Hdid)
if _, ok := list.Gotarr[req.Cid]; ok { // 重复拼图
@ -39,7 +40,13 @@ func (this *apiComp) MinerKey(session comm.IUserSession, req *pb.UiGameMinerKeyR
}
}
if len(conf.Costget) > 0 {
if errdata, atno = this.module.DispenseAtno(session, conf.Costget, true); errdata != nil {
res = append(res, conf.Costget...)
}
if c, err := this.module.configure.GetMinerConf(req.Cid); err == nil {
res = append(res, c.Itemid)
}
if len(res) > 0 {
if errdata, atno = this.module.DispenseAtno(session, res, true); errdata != nil {
return
}
}

View File

@ -25,6 +25,7 @@ func (this *apiComp) PuzzleGrid(session comm.IUserSession, req *pb.UiGamePuzzleG
}
var (
atno []*pb.UserAtno
res []*cfg.Gameatn
)
list, _ := this.module.modelPuzzle.getPuzzleList(session.GetUserId(), req.Hdid)
if _, ok := list.Puzzle[req.Grid]; ok { // 重复拼图
@ -43,6 +44,17 @@ func (this *apiComp) PuzzleGrid(session comm.IUserSession, req *pb.UiGamePuzzleG
return
}
}
if len(conf.Costget) > 0 {
res = append(res, conf.Costget...)
}
if c, err := this.module.configure.GetMinerConf(req.Grid); err == nil {
res = append(res, c.Itemid)
}
if len(res) > 0 {
if errdata, atno = this.module.DispenseAtno(session, res, true); errdata != nil {
return
}
}
}
list.Puzzle[req.Grid] = 1