Files
hjha-server/ObjectModel/Game/UserWarDataModel.cs
xiaoou e9616125ce feat: initial commit - HJHA game server full source
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
2026-07-07 12:02:15 +08:00

111 lines
2.6 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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);
}
}
}