using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; using Server.Core; namespace ObjectModel.Game { /// /// 玩家对战对象 /// public class UserWarDataModel : Reference { /// /// userid /// public int UserId; /// /// 游戏ID /// public int GameId; /// /// 赢的盘数 /// public int WinCount; /// /// 输的盘数 /// public int LoseCount; /// /// 对战总盘数 /// public int GameTotal; /// /// 对战改变的数量 /// public int TotalChange = 0; /// /// 赢的变化的数量 /// public int WinChange = 0; /// /// 输变化的数量 /// public int LoseChange = 0; /// /// 异常托管局数,不存数据库 /// public int ExcepCount = 0; /// /// 胜率0.12 ,没有乘以100的,不是百分之多少 /// public float VictoryRate { get { if (GameTotal == 0) return 0; return WinCount * 1.0f / GameTotal; } } public UserWarDataModel() { } public static UserWarDataModel Create(int userid, int gameId) { UserWarDataModel self = ReferencePool.Fetch(); self.UserId = userid; self.GameId = gameId; self.ExcepCount = 0; self.LoseCount = 0; self.GameTotal = 0; self.TotalChange = 0; self.WinChange = 0; self.LoseChange = 0; self.WinCount = 1; self.LoseCount = 1; self.GameTotal = 2; return self; } /// /// 是否有改变 /// /// public bool IsChange() { return TotalChange > 0; } public override void Dispose() { ReferencePool.Recycle(this); } } }