From b0eb95249412baad2f00f9f5ec36f7816cbacbac Mon Sep 17 00:00:00 2001 From: "DESKTOP-45ANQ2C\\unis" <179233648@qq.com> Date: Wed, 9 Oct 2024 14:49:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A8=83=E5=A8=83=E6=9C=BA=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E7=BB=93=E6=9E=9C=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gamesrv/clawdoll/action_clawdoll.go | 2 ++ gamesrv/clawdoll/player_clawdoll.go | 24 ++++++++++++++++++++++++ gamesrv/clawdoll/scenepolicy_clawdoll.go | 20 -------------------- 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/gamesrv/clawdoll/action_clawdoll.go b/gamesrv/clawdoll/action_clawdoll.go index 3da5a08..b1ccc03 100644 --- a/gamesrv/clawdoll/action_clawdoll.go +++ b/gamesrv/clawdoll/action_clawdoll.go @@ -119,6 +119,8 @@ func MSDollMachineoCoinResultHandler(session *netlib.Session, packetId int, data playerEx.IsWin = false } + playerEx.SendPlayerGameBilled(int32(sceneEx.RoundId)) + logger.Logger.Tracef("ClawDoll StatePlayGame OnPlayerOp Grab response, SnId= %v", msg.Snid) s.ChangeSceneState(rule.ClawDollSceneStateBilled) diff --git a/gamesrv/clawdoll/player_clawdoll.go b/gamesrv/clawdoll/player_clawdoll.go index 5cc463d..0b82f75 100644 --- a/gamesrv/clawdoll/player_clawdoll.go +++ b/gamesrv/clawdoll/player_clawdoll.go @@ -6,6 +6,9 @@ import ( "mongo.games.com/game/model" "mongo.games.com/game/srvdata" "mongo.games.com/goserver/core/logger" + + "mongo.games.com/game/proto" + "mongo.games.com/game/protocol/clawdoll" ) type PlayerEx struct { @@ -225,3 +228,24 @@ func (this *PlayerEx) GetItemCount(itemID int32) int64 { } return 0 } + +func (this *PlayerEx) SendPlayerGameBilled(RoundId int32) { + if this != nil { + + result := 0 + if this.IsWin { + result = 1 + } + pack := &clawdoll.SCCLAWDOLLRoundGameBilled{ + RoundId: proto.Int32(RoundId), + ClowResult: proto.Int32(int32(result)), + Award: proto.Int64(this.gainCoin), + Balance: proto.Int64(this.Coin), + } + + logger.Logger.Trace("Clawdoor -StateWaitPayCoin is pack: ", pack) + proto.SetDefaults(pack) + + this.SendToClient(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_GAMEBILLED), pack) + } +} diff --git a/gamesrv/clawdoll/scenepolicy_clawdoll.go b/gamesrv/clawdoll/scenepolicy_clawdoll.go index 9eaf13c..becf327 100644 --- a/gamesrv/clawdoll/scenepolicy_clawdoll.go +++ b/gamesrv/clawdoll/scenepolicy_clawdoll.go @@ -924,26 +924,6 @@ func (this *StateWaitPayCoin) OnPlayerOp(s *base.Scene, p *base.Player, opcode i func (this *StateWaitPayCoin) OnEnter(s *base.Scene) { logger.Logger.Trace("(this *StateWaitPayCoin) OnEnter, sceneid=", s.GetSceneId()) this.BaseState.OnEnter(s) - - sceneEx, ok := s.ExtraData.(*SceneEx) - if !ok { - return - } - - playerEx := sceneEx.GetPlayingEx() - if playerEx != nil { - pack := &clawdoll.SCCLAWDOLLRoundGameBilled{ - RoundId: proto.Int32(int32(sceneEx.RoundId)), - ClowResult: proto.Int32(0), - Award: proto.Int64(playerEx.gainCoin), - Balance: proto.Int64(playerEx.Coin), - } - - logger.Logger.Trace("Clawdoor -StateWaitPayCoin is pack: ", pack) - proto.SetDefaults(pack) - - playerEx.SendToClient(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_GAMEBILLED), pack) - } } func (this *StateWaitPayCoin) OnLeave(s *base.Scene) {