/*************************************************************************************
* 描 述: 游戏统计数据
*************************************************************************************/
using System;
using System.Collections.Generic;
using ObjectModel.Club;
using Server.Core;
namespace ObjectModel.Game
{
///
/// 俱乐部对战数据统计
///
public class ClubStatisticsSummaryData : Reference, IGameMapField
{
///
/// 俱乐部Id
///
public int ClubId { get; set;}
///
/// 所属联盟Id (没有就是0)
///
public int LeagueId { get; set; }
///
/// 比赛Id(没有就是0)
///
public int MatchId { get; set; }
///
/// 有效耗卡
///
public decimal CardScore { get; set; }
///
/// 活跃积分-群主赚的房费
///
public decimal DeskScore { get; set;}
///
/// 联盟的活跃积分-联盟赚的房费
///
public decimal LeagueScore { get; set;}
///
/// 玩家总输赢积分
///
public decimal UserSumScore { get; set;}
///
/// 游玩次数 (总的开桌次数)
///
public int PlayGameCount { get; set;}
///
/// 游玩次数 (俱乐部中一个人参与一次游戏就算一次)
///
public int PlayerJoinGameCount { get; set; }
///
/// 创建时间
///
public DateTime CreateTime { get; set; }
public static ClubStatisticsSummaryData Create(
int clubId = 0, int leagueId = 0,
int matchId = 0, decimal cardScore = 0,
decimal deskScore = 0, decimal leagueScore = 0,
decimal userSumScore = 0, int playGameCount = 0,
int playerJoinGameCount = 0, DateTime createTime = default)
{
ClubStatisticsSummaryData data = ReferencePool.Fetch();
data.ClubId = clubId;
data.LeagueId = leagueId;
data.MatchId = matchId;
data.CardScore = cardScore;
data.DeskScore = deskScore;
data.LeagueScore = leagueScore;
data.UserSumScore = userSumScore;
data.PlayGameCount = playGameCount;
data.PlayerJoinGameCount = playerJoinGameCount;
data.CreateTime = createTime;
return data;
}
public override void Dispose()
{
ReferencePool.Recycle(this);
}
public List ToFields()
{
return new List
{
new GameMapFieldData { Name = "ClubId", GetInt = ()=> ClubId , SetInt = (x)=> ClubId = x},
new GameMapFieldData { Name = "LeagueId", GetInt = ()=> LeagueId , SetInt = (x)=> LeagueId = x},
new GameMapFieldData { Name = "MatchId", GetInt = ()=> MatchId , SetInt = (x)=> MatchId = x},
new GameMapFieldData { Name = "CreateTime", GetString = ()=> CreateTime.ToString("yyyy-MM-dd HH:mm:ss"), SetString = (x)=> CreateTime = DateTime.ParseExact(x, "yyyy-MM-dd HH:mm:ss", null) },
new GameMapFieldData { Name = "CardScore", GetDecimal = ()=> CardScore, SetDecimal = (x)=> CardScore = x, IsSummary = true},
new GameMapFieldData { Name = "DeskScore", GetDecimal = ()=> DeskScore , SetDecimal = (x)=> DeskScore = x, IsSummary = true},
new GameMapFieldData { Name = "LeagueScore", GetDecimal = ()=> LeagueScore , SetDecimal = (x)=> LeagueScore = x, IsSummary = true},
new GameMapFieldData { Name = "UserSumScore", GetDecimal = ()=> UserSumScore , SetDecimal = (x)=> UserSumScore = x, IsSummary = true},
new GameMapFieldData { Name = "PlayGameCount", GetInt = ()=> PlayGameCount , SetInt = (x)=> PlayGameCount = x, IsSummary = true},
new GameMapFieldData { Name = "PlayerJoinGameCount", GetInt = ()=> PlayerJoinGameCount , SetInt = (x)=> PlayerJoinGameCount = x, IsSummary = true},
};
}
}
///
/// 玩家对战数据统计
///
public class PlayerPlayStatisticsSummaryData : Reference, IGameMapField
{
///
/// 玩家Id
///
public int UserId { get; set;}
///
/// 所属合伙人的UserId
///
public int PartnerId { get; set;}
///
/// 得分
///
public decimal Score { get; set; }
///
/// 全场最佳(大赢家)
///
public int BestCount { get; set; }
///
/// 房主次数
///
public int RoomOwnerCount { get; set; }
///
/// 玩过的场次
///
public int PlayGameCount { get; set; }
///
/// 玩过的模式
///
public PlayerStatisticsPlayGameMode PlayGameMode { get; set; }
///
/// 创建时间
///
public DateTime CreateTime { get; set; }
#region 俱乐部相关 (后面如果是金币场或者朋友房的统计就没有下面数据)
///
/// 所属俱乐部Id
///
public int ClubId { get; set;}
///
/// 所属联盟Id (没有就是0)
///
public int LeagueId { get; set; }
///
/// 比赛Id(没有就是0)
///
public int MatchId { get; set; }
///
/// 俱乐部提供的桌费
///
public decimal ClubDeskScore { get; set; }
///
/// 联盟的活跃积分
///
public decimal ClubLeagueScore { get; set; }
///
/// 有效耗卡
///
public decimal ClubCardScore { get; set;}
#endregion
public static PlayerPlayStatisticsSummaryData Create()
{
PlayerPlayStatisticsSummaryData data = ReferencePool.Fetch();
data.UserId = 0;
data.PartnerId = 0;
data.CreateTime = default;
data.Score = 0;
data.BestCount = 0;
data.RoomOwnerCount = 0;
data.PlayGameCount = 0;
data.PlayGameMode = PlayerStatisticsPlayGameMode.Unknown;
data.ClubId = 0;
data.LeagueId = 0;
data.MatchId = 0;
data.ClubDeskScore = 0;
data.ClubLeagueScore = 0;
data.ClubCardScore = 0;
return data;
}
public override void Dispose()
{
ReferencePool.Recycle(this);
}
public List ToFields()
{
return new List
{
new GameMapFieldData { Name = "UserId", GetInt = ()=> UserId , SetInt = (x)=> UserId = x},
new GameMapFieldData { Name = "PartnerId", GetInt = ()=> PartnerId , SetInt = (x)=> PartnerId = x},
new GameMapFieldData { Name = "CreateTime", GetString = ()=> CreateTime.ToString("yyyy-MM-dd HH:mm:ss"), SetString = (x)=> CreateTime = DateTime.ParseExact(x, "yyyy-MM-dd HH:mm:ss", null) },
new GameMapFieldData { Name = "PlayGameMode", GetInt = ()=> (int)PlayGameMode , SetInt = (x)=> PlayGameMode = (PlayerStatisticsPlayGameMode)x},
new GameMapFieldData { Name = "ClubId", GetInt = ()=> ClubId , SetInt = (x)=> ClubId = x},
new GameMapFieldData { Name = "LeagueId", GetInt = ()=> LeagueId , SetInt = (x)=> LeagueId = x},
new GameMapFieldData { Name = "MatchId", GetInt = ()=> MatchId , SetInt = (x)=> MatchId = x},
new GameMapFieldData { Name = "Score", GetDecimal = ()=> Score, SetDecimal = (x)=> Score = x, IsSummary = true},
new GameMapFieldData { Name = "BestCount", GetInt = ()=> BestCount , SetInt = (x)=> BestCount = x, IsSummary = true},
new GameMapFieldData { Name = "RoomOwnerCount", GetInt = ()=> RoomOwnerCount , SetInt = (x)=> RoomOwnerCount = x, IsSummary = true},
new GameMapFieldData { Name = "PlayGameCount", GetInt = ()=> PlayGameCount , SetInt = (x)=> PlayGameCount = x, IsSummary = true},
new GameMapFieldData { Name = "ClubDeskScore", GetDecimal = ()=> ClubDeskScore , SetDecimal = (x)=> ClubDeskScore = x, IsSummary = true},
new GameMapFieldData { Name = "ClubLeagueScore", GetDecimal = ()=> ClubLeagueScore , SetDecimal = (x)=> ClubLeagueScore = x, IsSummary = true},
new GameMapFieldData { Name = "ClubCardScore", GetDecimal = ()=> ClubCardScore , SetDecimal = (x)=> ClubCardScore = x, IsSummary = true},
};
}
}
///
/// 游玩类型
///
public enum PlayerStatisticsPlayGameMode
{
Unknown = 0,
GOLD = 1, // 金币场
FRIEND = 2, // 朋友房
CLUB = 3, // 俱乐部
}
}