game_sync/gamesrv/pushcoin/scene.go

75 lines
1.7 KiB
Go

package thirteen
import (
"mongo.games.com/game/common"
rule "mongo.games.com/game/gamerule/pushcoin"
"mongo.games.com/game/gamesrv/base"
"mongo.games.com/game/protocol/pushcoin"
"mongo.games.com/game/srvdata"
)
type SceneEx struct {
*base.Scene //场景
}
func NewPushCoinSceneData(s *base.Scene) *SceneEx {
sceneEx := &SceneEx{
Scene: s,
}
return sceneEx
}
func (this *SceneEx) CreateRoomInfoPacket(s *base.Scene, p *base.Player) *pushcoin.SCPushCoinRoomInfo {
playerEx, ok := p.ExtraData.(*PlayerEx)
if !ok {
return nil
}
roomInfo := &pushcoin.SCPushCoinRoomInfo{
RoomId: int32(s.GetSceneId()),
GameId: s.GameId,
RoomMode: int32(s.GetSceneMode()),
Params: common.CopySliceInt64ToInt32(s.GetParams()),
State: int32(s.GetSceneState().GetState()),
TimeOut: int32(s.GetSceneState().GetTimeout(s)),
BetList: s.GetDBGameFree().GetOtherIntParams(),
}
player := pushcoin.PushCoinPlayerData{
Name: p.Name,
SnId: p.SnId,
Head: p.Head,
Sex: p.Sex,
Coin: p.Coin,
Flag: int32(p.Flags),
VIP: p.VIP,
RoleId: p.Roles.ModId,
Level: p.Level,
Exp: p.Exp,
ShakeTimes: playerEx.Shake,
BaseCoin: playerEx.Base,
PowerLine: playerEx.Power,
PowerLineMax: rule.PowerMax,
RefreshTimes: playerEx.Refresh,
}
if p.Roles != nil {
player.RoleId = p.Roles.ModId
}
if p.Skin != nil {
player.SkinId = p.Skin.ModId
}
roomInfo.Players = append(roomInfo.Players, &player)
for _, v := range srvdata.PBDB_PropExchangeMgr.Datas.Arr {
if v.GetGroup() == 2 {
roomInfo.ExchangeList = append(roomInfo.ExchangeList, &pushcoin.ExchangeInfo{
Id: v.GetId(),
})
}
}
return roomInfo
}