6 major server modules (PdkFriendServer/GlobalSever/ServerCore/GameModule/GameNetModule) + game logic (GameFix/GameDAL/ServerData) + network layer (NetWorkMessage) + data layer (ObjectModel) + utilities (MrWu/Core/Config/CloudAPI/dll) + adapters (zyxAdapter/base) .NET 8.0 C# solution, 16 projects, 958 source files
111 lines
2.6 KiB
C#
111 lines
2.6 KiB
C#
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
|
||
{
|
||
/// <summary>
|
||
/// 玩家对战对象
|
||
/// </summary>
|
||
public class UserWarDataModel : Reference
|
||
{
|
||
/// <summary>
|
||
/// userid
|
||
/// </summary>
|
||
public int UserId;
|
||
|
||
/// <summary>
|
||
/// 游戏ID
|
||
/// </summary>
|
||
public int GameId;
|
||
|
||
/// <summary>
|
||
/// 赢的盘数
|
||
/// </summary>
|
||
public int WinCount;
|
||
|
||
/// <summary>
|
||
/// 输的盘数
|
||
/// </summary>
|
||
public int LoseCount;
|
||
|
||
/// <summary>
|
||
/// 对战总盘数
|
||
/// </summary>
|
||
public int GameTotal;
|
||
|
||
/// <summary>
|
||
/// 对战改变的数量
|
||
/// </summary>
|
||
public int TotalChange = 0;
|
||
|
||
/// <summary>
|
||
/// 赢的变化的数量
|
||
/// </summary>
|
||
public int WinChange = 0;
|
||
|
||
/// <summary>
|
||
/// 输变化的数量
|
||
/// </summary>
|
||
public int LoseChange = 0;
|
||
|
||
/// <summary>
|
||
/// 异常托管局数,不存数据库
|
||
/// </summary>
|
||
public int ExcepCount = 0;
|
||
|
||
/// <summary>
|
||
/// 胜率0.12 ,没有乘以100的,不是百分之多少
|
||
/// </summary>
|
||
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<UserWarDataModel>();
|
||
|
||
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;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 是否有改变
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public bool IsChange()
|
||
{
|
||
return TotalChange > 0;
|
||
}
|
||
|
||
public override void Dispose()
|
||
{
|
||
ReferencePool.Recycle(this);
|
||
}
|
||
}
|
||
} |