/********************************
*
* 作者:吴隆健
* 创建时间: 2019/7/3 14:08:57
*
********************************/
using System;
using System.Text;
using Server.Core;
namespace GameData
{
///
///
///
public class PlayerDataChange : Reference
{
///
/// 玩家的userid;
///
public int userid;
///
/// 游戏币变化值
///
public long moneyChange;
///
/// 经验变化值
///
public int expChange;
///
/// 金币变化值
///
public int goldChange;
///
/// 房卡变化值
///
public int fangkaChange;
///
/// 奖券变化值
///
public int couponChange;
///
/// 比赛卷变化 ,用于新的大厅界面的充值钻石(钻石)
///
public int MatchRollChange;
///
/// 钱备份
///
public long MoneyBak;
///
/// 是否已更改
///
public bool IsChanged => MatchRollChange != 0 || expChange != 0 ||
moneyChange != 0 || goldChange != 0 ||
fangkaChange != 0 || couponChange != 0;
///
/// 获取相反值
///
///
public PlayerDataChange GetOppositeValue(bool fromPool)
{
PlayerDataChange pdc = null;
if (fromPool)
{
pdc = PlayerDataChange.Create(this.userid);
}
else
{
pdc = new PlayerDataChange();
pdc.userid = this.userid;
}
pdc.userid = this.userid;
pdc.expChange = -this.expChange;
pdc.moneyChange = -this.moneyChange;
pdc.goldChange = -this.goldChange;
pdc.fangkaChange = -this.fangkaChange;
pdc.couponChange = -this.couponChange;
pdc.MatchRollChange = -this.MatchRollChange;
return pdc;
}
///
///
///
///
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("userid:" + userid);
sb.AppendLine("moneyChange:" + moneyChange);
sb.AppendLine("MoneyBak:" + MoneyBak);
sb.AppendLine("goldChange:" + goldChange);
sb.AppendLine("fangkaChange:" + fangkaChange);
sb.AppendLine("couponChange:" + couponChange);
sb.AppendLine("MatchRollChange:" + MatchRollChange);
return sb.ToString();
}
///
///
///
public PlayerDataChange()
{
}
public static PlayerDataChange Create(int userid)
{
PlayerDataChange self = ReferencePool.Fetch();
self.userid = userid;
self.moneyChange = 0;
self.expChange = 0;
self.goldChange = 0;
self.fangkaChange = 0;
self.couponChange = 0;
self.MatchRollChange = 0;
self.MoneyBak = 0;
return self;
}
public override void Dispose()
{
ReferencePool.Recycle(this);
}
}
}