游戏中玩家余额变化

This commit is contained in:
sk 2024-09-13 16:57:37 +08:00
parent 31db186564
commit cfa2c003c2
4 changed files with 20 additions and 1 deletions

View File

@ -848,3 +848,9 @@ type NotifyType int // 通知类型
const (
NotifyPrivateRoomList NotifyType = 1 // 私人房间列表
)
// SCPlayerCoinChange 中数值类型
const (
PlayerChangeTypeCoin = 0 // 金币
PlayerChangeTypeNum = 1 // 积分
)

View File

@ -493,6 +493,7 @@ func (this *Player) AddCoin(num int64, gainWay int32, syncFlag int, oper, remark
SnId: proto.Int32(this.SnId),
AddCoin: proto.Int64(num),
RestCoin: proto.Int64(this.Coin),
Tp: common.PlayerChangeTypeCoin,
}
proto.SetDefaults(pack)
if (syncFlag & SyncFlag_Broadcast) != 0 {
@ -519,6 +520,7 @@ func (this *Player) AddCoinNoLog(num int64, syncFlag int) {
SnId: proto.Int32(this.SnId),
AddCoin: proto.Int64(num),
RestCoin: proto.Int64(this.Coin),
Tp: common.PlayerChangeTypeNum,
}
proto.SetDefaults(pack)
if (syncFlag & SyncFlag_Broadcast) != 0 {
@ -568,6 +570,7 @@ func (this *Player) AddCoinAsync(num int64, gainWay int32, notifyC, broadcast bo
SnId: proto.Int32(this.SnId),
AddCoin: proto.Int64(num),
RestCoin: proto.Int64(this.Coin),
Tp: common.PlayerChangeTypeCoin,
}
proto.SetDefaults(pack)
if broadcast {

View File

@ -3741,6 +3741,7 @@ type SCPlayerCoinChange struct {
SnId int32 `protobuf:"varint,1,opt,name=SnId,proto3" json:"SnId,omitempty"`
AddCoin int64 `protobuf:"varint,2,opt,name=AddCoin,proto3" json:"AddCoin,omitempty"`
RestCoin int64 `protobuf:"varint,3,opt,name=RestCoin,proto3" json:"RestCoin,omitempty"`
Tp int32 `protobuf:"varint,4,opt,name=Tp,proto3" json:"Tp,omitempty"` // 0 金币 1积分
}
func (x *SCPlayerCoinChange) Reset() {
@ -3796,6 +3797,13 @@ func (x *SCPlayerCoinChange) GetRestCoin() int64 {
return 0
}
func (x *SCPlayerCoinChange) GetTp() int32 {
if x != nil {
return x.Tp
}
return 0
}
//PACKET_SC_PLAYERRECHARGEANSWER
type SCPlayerRechargeAnswer struct {
state protoimpl.MessageState
@ -11484,12 +11492,13 @@ var file_player_proto_rawDesc = []byte{
0x12, 0x1a, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01,
0x28, 0x05, 0x52, 0x08, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04,
0x46, 0x6c, 0x61, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x46, 0x6c, 0x61, 0x67,
0x22, 0x5e, 0x0a, 0x12, 0x53, 0x43, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x43, 0x6f, 0x69, 0x6e,
0x22, 0x6e, 0x0a, 0x12, 0x53, 0x43, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x43, 0x6f, 0x69, 0x6e,
0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x6e, 0x49, 0x64, 0x18, 0x01,
0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x53, 0x6e, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x41, 0x64,
0x64, 0x43, 0x6f, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x41, 0x64, 0x64,
0x43, 0x6f, 0x69, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x74, 0x43, 0x6f, 0x69, 0x6e,
0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x52, 0x65, 0x73, 0x74, 0x43, 0x6f, 0x69, 0x6e,
0x12, 0x0e, 0x0a, 0x02, 0x54, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x54, 0x70,
0x22, 0x82, 0x01, 0x0a, 0x16, 0x53, 0x43, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x52, 0x65, 0x63,
0x68, 0x61, 0x72, 0x67, 0x65, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x4f,
0x70, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x4f, 0x70,

View File

@ -578,6 +578,7 @@ message SCPlayerCoinChange {
int32 SnId = 1;
int64 AddCoin = 2;
int64 RestCoin = 3;
int32 Tp = 4; // 0 1
}
//PACKET_SC_PLAYERRECHARGEANSWER
message SCPlayerRechargeAnswer {