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
This commit is contained in:
50
ObjectModel/Club/ClubBureauScore.cs
Normal file
50
ObjectModel/Club/ClubBureauScore.cs
Normal file
@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ObjectModel.Club
|
||||
{
|
||||
public class ClubBureauScore
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public ClubBureauScore() { }
|
||||
|
||||
public BureauScorePlayer[] Players;
|
||||
|
||||
public int ClubId;
|
||||
|
||||
public string weiyima;
|
||||
|
||||
public string wayId;
|
||||
|
||||
public int game_serid;
|
||||
|
||||
public int ModuleId;
|
||||
|
||||
//SendFightRecordToClub
|
||||
}
|
||||
|
||||
public class BureauScorePlayer
|
||||
{
|
||||
/// <summary>
|
||||
/// 玩家Id
|
||||
/// </summary>
|
||||
public int UserId;
|
||||
|
||||
/// <summary>
|
||||
/// 玩家到现在的总分
|
||||
/// </summary>
|
||||
public decimal Score;
|
||||
public string NickName;
|
||||
|
||||
/// <summary>
|
||||
/// 参加比赛的俱乐部ID
|
||||
/// </summary>
|
||||
public int ClubId;
|
||||
public BureauScorePlayer() { }
|
||||
}
|
||||
}
|
||||
39
ObjectModel/Club/ClubInnerData.cs
Normal file
39
ObjectModel/Club/ClubInnerData.cs
Normal file
@ -0,0 +1,39 @@
|
||||
// -----------------------------------------------------------------------
|
||||
// <summary>
|
||||
// 服务器内部传输数据
|
||||
// </summary>
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
|
||||
using System;
|
||||
|
||||
namespace GameData.Club
|
||||
{
|
||||
/// <summary>
|
||||
/// 房卡变更
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class ClubInnerRoomCardChange
|
||||
{
|
||||
/// <summary>
|
||||
/// 俱乐部ID
|
||||
/// </summary>
|
||||
public int ClubId;
|
||||
/// <summary>
|
||||
/// 房卡操作数量
|
||||
/// </summary>
|
||||
public int CardCnt;
|
||||
/// <summary>
|
||||
/// 操作用户
|
||||
/// </summary>
|
||||
public int UserId;
|
||||
/// <summary>
|
||||
/// 描述
|
||||
/// </summary>
|
||||
public string Des;
|
||||
/// <summary>
|
||||
/// 是否开启赠送折扣
|
||||
/// </summary>
|
||||
public bool IsOpenGive;
|
||||
}
|
||||
}
|
||||
271
ObjectModel/Club/ClubLeagueMatch.cs
Normal file
271
ObjectModel/Club/ClubLeagueMatch.cs
Normal file
@ -0,0 +1,271 @@
|
||||
#if !WebManagement
|
||||
using GameData.Club;
|
||||
#endif
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using GameData;
|
||||
|
||||
namespace ObjectModel.Club
|
||||
{
|
||||
/// <summary>
|
||||
/// 玩家联赛权限
|
||||
/// </summary>
|
||||
public class ClubLeaguePower
|
||||
{
|
||||
/// <summary>
|
||||
/// 自增Id 主键
|
||||
/// </summary>
|
||||
public int ClubLeaguePowerId;
|
||||
/// <summary>
|
||||
/// 俱乐部Id --索引
|
||||
/// </summary>
|
||||
public int ClubId;
|
||||
/// <summary>
|
||||
/// 是否有创建联赛权限 Ture有权限 false 没有
|
||||
/// </summary>
|
||||
public bool IsCanCreate;
|
||||
/// <summary>
|
||||
/// 是否有加入联赛权限 Ture有权限 false 没有
|
||||
/// </summary>
|
||||
public bool IsCanJoin;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加入到联赛的俱乐部集合
|
||||
/// </summary>
|
||||
public class JoinInClubLeagueMatch
|
||||
{
|
||||
/// <summary>
|
||||
/// 比赛Id--索引
|
||||
/// </summary>
|
||||
public int ClubMatchId;
|
||||
|
||||
/// <summary>
|
||||
/// 存数据库 Json 数据
|
||||
/// </summary>
|
||||
public string JoinInLeagueMatchClubs;
|
||||
|
||||
/// <summary>
|
||||
/// 加入联赛的俱乐部Id集合,保存前到联赛内存里面拿数据。中途对该对象不做操作
|
||||
/// </summary>
|
||||
public List<int> ClubIds;
|
||||
|
||||
/// <summary>
|
||||
/// 返回存数据库的JSon 字符串,存数据库前调用
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string GetJoinInLeagueMatchClubsToString()
|
||||
{
|
||||
return JsonPack.GetJson(ClubIds);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从Json字符串获取加入的俱乐部Id集合对象 ,从数据库取出后调用
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<int> GetClubIdsByJSON()
|
||||
{
|
||||
return string.IsNullOrWhiteSpace(JoinInLeagueMatchClubs) ? null : JsonPack.GetData<List<int>>(JoinInLeagueMatchClubs);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 联赛禁桌对象。
|
||||
/// </summary>
|
||||
public class LeagueMatchBanDesk
|
||||
{
|
||||
/// <summary>
|
||||
/// 自增Id 主键
|
||||
/// </summary>
|
||||
public int LeagueMatchBanDeskId;
|
||||
|
||||
/// <summary>
|
||||
/// 玩法ID
|
||||
/// </summary>
|
||||
public string WayId;
|
||||
|
||||
/// <summary>
|
||||
/// 存数据库 Json 数据
|
||||
/// </summary>
|
||||
public string JSONString;
|
||||
|
||||
/// <summary>
|
||||
/// 被禁桌的俱乐部集合
|
||||
/// </summary>
|
||||
public List<int> ClubIds;
|
||||
|
||||
/// <summary>
|
||||
/// 返回存数据库的JSon 字符串,存数据库前调用
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string GetClubsToString()
|
||||
{
|
||||
return JsonPack.GetJson(ClubIds);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从Json字符串获取加入的俱乐部Id集合对象 ,从数据库取出后调用
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<int> GetClubIdsByJSON()
|
||||
{
|
||||
return string.IsNullOrWhiteSpace(JSONString) ? null : JsonPack.GetData<List<int>>(JSONString);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 联赛俱乐部积分统计
|
||||
/// </summary>
|
||||
public class LeagueMatchClubScore : ClubLeagueBaseScoreInfo,ICloneable
|
||||
{
|
||||
/// <summary>
|
||||
/// 联赛俱乐部ID
|
||||
/// </summary>
|
||||
public int LeagueClubId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 联盟比赛的Id
|
||||
/// </summary>
|
||||
public int MatchId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 自增Id 主键 (Old)
|
||||
/// </summary>
|
||||
public int LeagueMatchClubScoreId;
|
||||
|
||||
/// <summary>
|
||||
/// 数据更新时间
|
||||
/// </summary>
|
||||
public DateTime UpdateTime { get; set; }
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
return this.MemberwiseClone();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 俱乐部退赛数据
|
||||
/// </summary>
|
||||
public class LeagueMatchClubExitScore : LeagueMatchClubScore
|
||||
{
|
||||
/// <summary>
|
||||
/// 俱乐部解禁Id (时间戳 秒级)
|
||||
/// </summary>
|
||||
public long ReliefId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 颁奖Id
|
||||
/// </summary>
|
||||
public long AwardId { get; set;}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 颁奖记录
|
||||
/// </summary>
|
||||
public class AwardRecord : ClubLeagueBaseScoreInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 比赛Id--索引
|
||||
/// </summary>
|
||||
public int ClubMatchId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 自增Id 主键
|
||||
/// </summary>
|
||||
//public int AwardRecordId;
|
||||
|
||||
/// <summary>
|
||||
/// 颁奖的时间chuo
|
||||
/// </summary>
|
||||
public long RecordId { get; set;}
|
||||
|
||||
/// <summary>
|
||||
/// 序号 --排序使用
|
||||
/// </summary>
|
||||
public int Index { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 时间
|
||||
/// </summary>
|
||||
public DateTime CreateTime { get; set; }
|
||||
}
|
||||
|
||||
public class ClubLeagueBaseScoreInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 俱乐部名字
|
||||
/// </summary>
|
||||
public string ClubName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 俱乐部Id
|
||||
/// </summary>
|
||||
public int ClubId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 有效耗卡
|
||||
/// </summary>
|
||||
public decimal CardScore { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 活跃积分-群主赚的房费
|
||||
/// </summary>
|
||||
public decimal DeskScore { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 成员总积分
|
||||
/// </summary>
|
||||
public decimal ClubUserSumScore { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参与房间数量
|
||||
/// </summary>
|
||||
public int JoinRoom { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 联盟的活跃积分
|
||||
/// </summary>
|
||||
public decimal LeagueScore { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 俱乐部生存任务
|
||||
/// </summary>
|
||||
public class LeagueClubLiveTask
|
||||
{
|
||||
/// <summary>
|
||||
/// 自增Id 主键
|
||||
/// </summary>
|
||||
public int LeagueClubLiveTaskId;
|
||||
|
||||
/// <summary>
|
||||
/// 俱乐部Id
|
||||
/// </summary>
|
||||
public int ClubId;
|
||||
|
||||
/// <summary>
|
||||
/// 任务的分值 0是不限制
|
||||
/// </summary>
|
||||
public int TaskScore;
|
||||
|
||||
/// <summary>
|
||||
/// 是否是激活状态 false没有生效
|
||||
/// </summary>
|
||||
public bool IsActive
|
||||
{
|
||||
get
|
||||
{
|
||||
return TaskScore != 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 默认生存积分 0是没有默认积分
|
||||
/// </summary>
|
||||
public int DefaultScore;
|
||||
}
|
||||
}
|
||||
1187
ObjectModel/Club/ClubMatch.cs
Normal file
1187
ObjectModel/Club/ClubMatch.cs
Normal file
@ -0,0 +1,1187 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
using GameData;
|
||||
using GameMessage;
|
||||
using MrWu.Time;
|
||||
using Server;
|
||||
using Debug = MrWu.Debug.Debug;
|
||||
using GameData.Club;
|
||||
|
||||
namespace ObjectModel.Club
|
||||
{
|
||||
/// <summary>
|
||||
/// 俱乐部比赛 表实体
|
||||
/// </summary>
|
||||
public class ClubMatch
|
||||
{
|
||||
/// <summary>
|
||||
/// 联赛的俱乐部比赛数据
|
||||
/// </summary>
|
||||
public ClubMatch LeagueClubMatch;
|
||||
|
||||
/// <summary>
|
||||
/// 开启中
|
||||
/// </summary>
|
||||
public bool IsOpening;
|
||||
|
||||
/// <summary>
|
||||
/// 自增ID 主键 0是新增 其他是修改
|
||||
/// </summary>
|
||||
public int ClubMatchId;
|
||||
|
||||
/// <summary>
|
||||
/// 俱乐部Id 索引
|
||||
/// </summary>
|
||||
public int ClubId;
|
||||
|
||||
/// <summary>
|
||||
/// 比赛名称
|
||||
/// </summary>
|
||||
public string ClubMatchName;
|
||||
|
||||
private DateTime _MatchStartTime;
|
||||
|
||||
/// <summary>
|
||||
/// 比赛开始时间
|
||||
/// </summary>
|
||||
public DateTime MatchStartTime
|
||||
{
|
||||
get
|
||||
{
|
||||
if (LeagueClubMatch != null)
|
||||
{
|
||||
return LeagueClubMatch.MatchStartTime;
|
||||
}
|
||||
return _MatchStartTime;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (LeagueClubMatch != null)
|
||||
{
|
||||
Debug.Error("MatchStartTime 当前比赛数据属于联赛,不能修改!");
|
||||
}
|
||||
|
||||
_MatchStartTime = value;
|
||||
}
|
||||
}
|
||||
|
||||
private DateTime _MatchEndTime;
|
||||
|
||||
/// <summary>
|
||||
/// 比赛结束时间
|
||||
/// </summary>
|
||||
public DateTime MatchEndTime
|
||||
{
|
||||
get
|
||||
{
|
||||
if (LeagueClubMatch != null)
|
||||
{
|
||||
return LeagueClubMatch.MatchEndTime;
|
||||
}
|
||||
|
||||
return _MatchEndTime;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (LeagueClubMatch != null)
|
||||
{
|
||||
Debug.Error("MatchEndTime 当前比赛数据属于联赛,不能修改!");
|
||||
}
|
||||
|
||||
_MatchEndTime = value;
|
||||
}
|
||||
}
|
||||
|
||||
private int _DieOutNum;
|
||||
|
||||
/// <summary>
|
||||
/// 比赛淘汰分值
|
||||
/// </summary>
|
||||
public int DieOutNum
|
||||
{
|
||||
get
|
||||
{
|
||||
if (LeagueClubMatch != null)
|
||||
{
|
||||
return LeagueClubMatch.DieOutNum;
|
||||
}
|
||||
|
||||
return _DieOutNum;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (LeagueClubMatch != null)
|
||||
{
|
||||
Debug.Error("DieOutNum 当前比赛的数据属于联赛,不能修改!");
|
||||
}
|
||||
|
||||
_DieOutNum = value;
|
||||
}
|
||||
}
|
||||
|
||||
private DateTime _CreateTime;
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime CreateTime {
|
||||
get
|
||||
{
|
||||
if (LeagueClubMatch != null)
|
||||
{
|
||||
return LeagueClubMatch.CreateTime;
|
||||
}
|
||||
|
||||
return _CreateTime;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (LeagueClubMatch != null)
|
||||
{
|
||||
Debug.Error("CreateTime 当前比赛的数据属于联赛,不能修改!");
|
||||
}
|
||||
_CreateTime = value;
|
||||
}
|
||||
}
|
||||
|
||||
private int _StatusFlag;
|
||||
|
||||
/// <summary>
|
||||
/// 比赛状态 1比赛中 2结束
|
||||
/// </summary>
|
||||
public int StatusFlag
|
||||
{
|
||||
get
|
||||
{
|
||||
if (LeagueClubMatch != null)
|
||||
{
|
||||
return LeagueClubMatch.StatusFlag;
|
||||
}
|
||||
return _StatusFlag;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (LeagueClubMatch != null)
|
||||
{
|
||||
Debug.Error("StatusFlag 当前比赛数据属于联赛,不能修改!");
|
||||
}
|
||||
|
||||
_StatusFlag = value;
|
||||
}
|
||||
}
|
||||
|
||||
private bool _AutoOpen;
|
||||
|
||||
/// <summary>
|
||||
/// 是否自动开启下一场比赛
|
||||
/// </summary>
|
||||
public bool AutoOpen
|
||||
{
|
||||
get
|
||||
{
|
||||
if (LeagueClubMatch != null)
|
||||
{
|
||||
return LeagueClubMatch.AutoOpen;
|
||||
}
|
||||
|
||||
return _AutoOpen;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (LeagueClubMatch != null)
|
||||
{
|
||||
Debug.Error("AutoOpen 当前比赛数据属于联赛,不能修改!");
|
||||
}
|
||||
|
||||
_AutoOpen = value;
|
||||
}
|
||||
}
|
||||
|
||||
private int _HowTopUser;
|
||||
|
||||
/// <summary>
|
||||
/// --前多少名正数玩家自动进入下一轮比赛
|
||||
/// 该值表示是否是联赛,小于0是联赛,该值存储了联赛的ClubId
|
||||
/// </summary>
|
||||
public int HowTopUser
|
||||
{
|
||||
get
|
||||
{
|
||||
if (LeagueClubMatch != null)
|
||||
{
|
||||
return LeagueClubMatch.HowTopUser;
|
||||
}
|
||||
|
||||
return _HowTopUser;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (LeagueClubMatch != null)
|
||||
{
|
||||
Debug.Error("HowTopUser 当前比赛数据属于联赛,不能修改!");
|
||||
}
|
||||
|
||||
_HowTopUser = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 第几场比赛
|
||||
/// </summary>
|
||||
public int Round;
|
||||
|
||||
private int _MatchRate;
|
||||
|
||||
/// <summary>
|
||||
/// 比赛频率 单位为天
|
||||
/// </summary>
|
||||
public int MatchRate
|
||||
{
|
||||
get
|
||||
{
|
||||
if (LeagueClubMatch != null)
|
||||
{
|
||||
return LeagueClubMatch.MatchRate;
|
||||
}
|
||||
|
||||
return _MatchRate;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (LeagueClubMatch != null)
|
||||
{
|
||||
Debug.Error("MatchRate 当前比赛数据属于联赛,不能修改!");
|
||||
}
|
||||
|
||||
_MatchRate = value;
|
||||
}
|
||||
}
|
||||
|
||||
private int _VisibleDesk;
|
||||
|
||||
/// <summary>
|
||||
/// 普通成员显示的桌子数量
|
||||
/// </summary>
|
||||
public int VisibleDesk
|
||||
{
|
||||
get
|
||||
{
|
||||
if (LeagueClubMatch != null)
|
||||
{
|
||||
return LeagueClubMatch._VisibleDesk;
|
||||
}
|
||||
|
||||
return _VisibleDesk;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (LeagueClubMatch != null)
|
||||
{
|
||||
Debug.Error("VisibleDesk 当前比赛数据属于联赛,不能修改!");
|
||||
}
|
||||
|
||||
_VisibleDesk = value;
|
||||
}
|
||||
}
|
||||
|
||||
private byte _isOnlyVisibleMyClub;
|
||||
|
||||
/// <summary>
|
||||
/// 是否只显示自己俱乐部的桌子--只有联赛才会能体现出这个设置
|
||||
/// 1不是 0是显示自己俱乐部的桌子
|
||||
/// </summary>
|
||||
public byte isOnlyVisibleMyClub
|
||||
{
|
||||
get
|
||||
{
|
||||
if (LeagueClubMatch != null)
|
||||
{
|
||||
return LeagueClubMatch._isOnlyVisibleMyClub;
|
||||
}
|
||||
|
||||
return _isOnlyVisibleMyClub;
|
||||
}
|
||||
set
|
||||
{
|
||||
_isOnlyVisibleMyClub = value;
|
||||
}
|
||||
}
|
||||
|
||||
private byte _isVisibleScoreBak;
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示淘汰分 1显示 0不显示(默认)
|
||||
/// </summary>
|
||||
public byte isVisibleScoreBak
|
||||
{
|
||||
get
|
||||
{
|
||||
if (LeagueClubMatch != null)
|
||||
{
|
||||
return LeagueClubMatch._isVisibleScoreBak;
|
||||
}
|
||||
return _isVisibleScoreBak;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (LeagueClubMatch != null)
|
||||
{
|
||||
Debug.Error("isVisibleScoreBak 当前比赛数据属于联赛,不能修改!");
|
||||
}
|
||||
_isVisibleScoreBak = value;
|
||||
}
|
||||
}
|
||||
|
||||
private byte _isScoreReset;
|
||||
|
||||
/// <summary>
|
||||
/// 每轮比赛开始积分是否清零 1清零 0不清零(默认)
|
||||
/// </summary>
|
||||
public byte isScoreReset
|
||||
{
|
||||
get
|
||||
{
|
||||
if (LeagueClubMatch != null)
|
||||
{
|
||||
return LeagueClubMatch._isScoreReset;
|
||||
}
|
||||
return _isScoreReset;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (LeagueClubMatch != null)
|
||||
{
|
||||
Debug.Error("isScoreReset 当前比赛数据属于联赛,不能修改!");
|
||||
}
|
||||
_isScoreReset = value;
|
||||
}
|
||||
}
|
||||
|
||||
private List<MatchPlayWay> _MatchPlayWays = new List<MatchPlayWay>();
|
||||
|
||||
/// <summary>
|
||||
/// 比赛关联的玩法 数据库这个字段用string存储 MatchPlayWayId,用逗号分隔。
|
||||
/// </summary>
|
||||
public List<MatchPlayWay> MatchPlayWays
|
||||
{
|
||||
get
|
||||
{
|
||||
if (LeagueClubMatch != null)
|
||||
{
|
||||
return LeagueClubMatch.MatchPlayWays;
|
||||
}
|
||||
return _MatchPlayWays;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (LeagueClubMatch != null)
|
||||
{
|
||||
Debug.Error("MatchPlayWays 当前比赛数据属于联赛,不能修改!");
|
||||
}
|
||||
_MatchPlayWays = value;
|
||||
}
|
||||
}
|
||||
|
||||
public List<MatchPlayWay> _BakMatchPlayWays = new List<MatchPlayWay>();
|
||||
|
||||
/// <summary>
|
||||
/// 备份的玩法,目的是用户删除玩法然后有的玩法该玩法已经开战了,用户开战玩家计算分。
|
||||
/// 不存数据库,只在内存中。
|
||||
/// </summary>
|
||||
public List<MatchPlayWay> BakMatchPlayWays
|
||||
{
|
||||
get
|
||||
{
|
||||
if (LeagueClubMatch != null)
|
||||
{
|
||||
return LeagueClubMatch._BakMatchPlayWays;
|
||||
}
|
||||
return _BakMatchPlayWays;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (LeagueClubMatch != null)
|
||||
{
|
||||
Debug.Error("BakMatchPlayWays 当前比赛数据属于联赛,不能修改!");
|
||||
}
|
||||
_BakMatchPlayWays = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 存储比赛其他设置的Json数据
|
||||
/// </summary>
|
||||
public string JsonData;
|
||||
|
||||
/// <summary>
|
||||
/// 比赛账号转换联赛账号的基数
|
||||
/// </summary>
|
||||
const int ConstNum = 10000;
|
||||
|
||||
private MatchOtherSetting _matchOtherSetting = new MatchOtherSetting();
|
||||
|
||||
/// <summary>
|
||||
/// 比赛其他设置
|
||||
/// </summary>
|
||||
public MatchOtherSetting matchOtherSetting
|
||||
{
|
||||
get
|
||||
{
|
||||
if (LeagueClubMatch != null)
|
||||
{
|
||||
return LeagueClubMatch._matchOtherSetting;
|
||||
}
|
||||
return _matchOtherSetting;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (LeagueClubMatch != null)
|
||||
{
|
||||
Debug.Error("matchOtherSetting 当前比赛数据属于联赛,不能修改!");
|
||||
}
|
||||
_matchOtherSetting = value;
|
||||
}
|
||||
}
|
||||
|
||||
public void InitOtherSetting()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(JsonData))
|
||||
{
|
||||
matchOtherSetting = JsonPack.GetData<MatchOtherSetting>(JsonData);
|
||||
}
|
||||
}
|
||||
|
||||
public MatchOtherSetting CopyMatchOtherSetting()
|
||||
{
|
||||
string jsondata = GetJsonData();
|
||||
return JsonPack.GetData<MatchOtherSetting>(jsondata);
|
||||
}
|
||||
|
||||
public string GetJsonData()
|
||||
{
|
||||
if (matchOtherSetting == null)
|
||||
{
|
||||
matchOtherSetting = new MatchOtherSetting();
|
||||
}
|
||||
return JsonPack.GetJsonNoIgnore(matchOtherSetting);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取联赛账号 5位数数字
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static int GetLeagueUserName(int clubMatchId)
|
||||
{
|
||||
return clubMatchId + ConstNum;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据联赛账号返回比赛ID
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static int GetClubMatchId(int leagueUserNameNumber)
|
||||
{
|
||||
return leagueUserNameNumber - ConstNum;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回对象
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static ClubMatch GetInstance(CreateClubMatchPack request, ClubMatch oldClubMatch, bool IsLeague = false)
|
||||
{
|
||||
DateTime endTime = DateTime.Now.Date.AddDays(request.MatchRate).AddHours(request.MatchStartTime.Hour).AddMinutes(request.MatchStartTime.Minute);
|
||||
return new ClubMatch()
|
||||
{
|
||||
ClubMatchId = 0,
|
||||
ClubId = request.ClubId,
|
||||
ClubMatchName = request.ClubMatchName ?? $"{(IsLeague ? "竞技联赛" : "竞技赛")}第{GetFromRound(oldClubMatch == null ? 1 : oldClubMatch.Round + 1)}轮",
|
||||
MatchStartTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, request.MatchStartTime.Hour, request.MatchStartTime.Minute, 0),
|
||||
MatchEndTime = endTime,
|
||||
DieOutNum = request.DieOutNum,
|
||||
CreateTime = DateTime.Now,
|
||||
StatusFlag = 1,
|
||||
AutoOpen = request.AutoOpen,
|
||||
HowTopUser = request.HowTopUser,
|
||||
Round = oldClubMatch == null ? 1 : oldClubMatch.Round + 1,
|
||||
MatchRate = request.MatchRate,
|
||||
MatchPlayWays = MatchPlayWay.GetInstances(request),
|
||||
VisibleDesk = request.VisibleDesk,
|
||||
isOnlyVisibleMyClub = request.isOnlyVisibleMyClub,
|
||||
isScoreReset = request.isScoreReset,
|
||||
isVisibleScoreBak = request.isVisibleScoreBak
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取界面上显示的比赛轮次
|
||||
/// </summary>
|
||||
/// <param name="round"></param>
|
||||
/// <returns></returns>
|
||||
public static int GetFromRound(int round)
|
||||
{
|
||||
return (round % 5) + 1;
|
||||
}
|
||||
|
||||
private static string GetClubMatchName(bool isLeague,int round)
|
||||
{
|
||||
return $"{(isLeague ? "竞技联赛" : "竞技赛")}第{GetFromRound(round + 1)}轮";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回下一轮新比赛的对象
|
||||
/// </summary>
|
||||
/// <param name="oldClubMatch"></param>
|
||||
/// <returns></returns>
|
||||
public static ClubMatch GetNexMatchObject(ClubMatch oldClubMatch, bool isLeague = false)
|
||||
{
|
||||
if (oldClubMatch == null) return null;
|
||||
DateTime endTime = DateTime.Now.Date.AddDays(oldClubMatch.MatchRate).AddHours(oldClubMatch.MatchEndTime.Hour).AddMinutes(oldClubMatch.MatchEndTime.Minute);
|
||||
var result = new ClubMatch();
|
||||
result.ClubMatchId = 0;
|
||||
result.ClubId = oldClubMatch.ClubId;
|
||||
result.ClubMatchName = GetClubMatchName(isLeague, oldClubMatch.Round);
|
||||
result.MatchStartTime = DateTime.Now;
|
||||
result.MatchEndTime = endTime;
|
||||
result.DieOutNum = oldClubMatch.DieOutNum;
|
||||
result.CreateTime = DateTime.Now;
|
||||
result.StatusFlag = 1;
|
||||
result.AutoOpen = oldClubMatch.AutoOpen;
|
||||
result.HowTopUser = oldClubMatch.HowTopUser;
|
||||
result.Round = oldClubMatch.Round + 1;
|
||||
result.MatchRate = oldClubMatch.MatchRate;
|
||||
result.MatchPlayWays = oldClubMatch.MatchPlayWays;
|
||||
result.VisibleDesk = oldClubMatch.VisibleDesk;
|
||||
result.isOnlyVisibleMyClub = oldClubMatch.isOnlyVisibleMyClub;
|
||||
result.isVisibleScoreBak = oldClubMatch.isVisibleScoreBak;
|
||||
result.isScoreReset = oldClubMatch.isScoreReset;
|
||||
result.matchOtherSetting = oldClubMatch.CopyMatchOtherSetting();
|
||||
if (result.MatchPlayWays != null)
|
||||
{
|
||||
foreach (var item in result.MatchPlayWays)
|
||||
{
|
||||
item.ClubMatchId = 0;
|
||||
item.MatchPlayWayId = 0;
|
||||
if (item.MaxWinnerScoreRanges != null)
|
||||
{
|
||||
foreach (var itemChid in item.MaxWinnerScoreRanges)
|
||||
{
|
||||
itemChid.MatchPlayWayId = 0;
|
||||
itemChid.MaxWinnerScoreRangeId = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据联赛返回 比赛对象
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static ClubMatch GetClubMatchByLeagueMatch(ClubMatch leagueMatch,ClubMatch originMatch,int clubId, int round)
|
||||
{
|
||||
if (leagueMatch == null) return null;
|
||||
var result = new ClubMatch();
|
||||
result.ClubMatchName = leagueMatch.ClubMatchName; //比赛名称不能乱改,必须与联赛一致,使用了名字做逻辑
|
||||
result.LeagueClubMatch = leagueMatch;
|
||||
result.ClubMatchId = 0;
|
||||
result.ClubId = clubId;
|
||||
result.Round = round + 1;
|
||||
return result;
|
||||
}
|
||||
|
||||
public static ClubMatchInfoResponse GetClubMatchInfoResponse(ClubMatch clubMatch)
|
||||
{
|
||||
ClubMatchInfoResponse response = new ClubMatchInfoResponse();
|
||||
|
||||
response.ClubId = clubMatch.ClubId;
|
||||
response.MatchStartTime = DateTimeHelper.DateTime2TimeStamp(clubMatch.MatchStartTime);
|
||||
response.MatchInfoName = clubMatch.ClubMatchName;
|
||||
response.MatchEndTime = DateTimeHelper.DateTime2TimeStamp(clubMatch.MatchEndTime);
|
||||
response.MatchRate = clubMatch.MatchRate;
|
||||
response.DieOutNum = clubMatch.DieOutNum;
|
||||
response.AutoOpen = clubMatch.AutoOpen;
|
||||
response.LeagueClubId = clubMatch.HowTopUser;
|
||||
response.VisibleDesk = clubMatch.VisibleDesk;
|
||||
response.IsOnlyVisibleMyClub = clubMatch.isOnlyVisibleMyClub;
|
||||
response.IsScoreReset = clubMatch.isScoreReset;
|
||||
response.IsVisibleScoreBak = clubMatch.isVisibleScoreBak;
|
||||
response.LeagueUserNameNumber = ClubMatch.GetLeagueUserName(clubMatch.ClubMatchId);
|
||||
response.MatchPlayWayInfos = MatchPlayWay.GetMatchPlayWayInfos(clubMatch.MatchPlayWays);
|
||||
return response;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回输出对象
|
||||
/// </summary>
|
||||
/// <param name="oldClubMatch"></param>
|
||||
/// <returns></returns>
|
||||
public static CreateClubMatchPack GetCreateClubMatchResponse(ClubMatch oldClubMatch)
|
||||
{
|
||||
return new CreateClubMatchPack
|
||||
{
|
||||
ClubId = oldClubMatch.ClubId,
|
||||
MatchStartTime = oldClubMatch.MatchStartTime,
|
||||
ClubMatchName = oldClubMatch.ClubMatchName,
|
||||
MatchEndTime = oldClubMatch.MatchEndTime,
|
||||
MatchRate = oldClubMatch.MatchRate,
|
||||
DieOutNum = oldClubMatch.DieOutNum,
|
||||
AutoOpen = oldClubMatch.AutoOpen,
|
||||
HowTopUser = oldClubMatch.HowTopUser,
|
||||
VisibleDesk = oldClubMatch.VisibleDesk,
|
||||
isOnlyVisibleMyClub = oldClubMatch.isOnlyVisibleMyClub,
|
||||
isScoreReset = oldClubMatch.isScoreReset,
|
||||
isVisibleScoreBak = oldClubMatch.isVisibleScoreBak,
|
||||
LeagueUserNameNumber = ClubMatch.GetLeagueUserName(oldClubMatch.ClubMatchId),
|
||||
MatchPlayWays = MatchPlayWay.GetMatchPlayWayPacks(oldClubMatch.MatchPlayWays)
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回对象
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
/// <returns></returns>
|
||||
public static ClubMatchInfo GetMatchInfoInstance(ClubMatch obj)
|
||||
{
|
||||
return new ClubMatchInfo
|
||||
{
|
||||
ClubMatchId = obj.ClubMatchId,
|
||||
ClubMatchName = obj.ClubMatchName,
|
||||
ClubId = obj.ClubId,
|
||||
StatusFlag = obj.StatusFlag,
|
||||
MatchStartTime = obj.MatchStartTime,
|
||||
MatchEndTime = obj.MatchEndTime
|
||||
};
|
||||
}
|
||||
|
||||
public static ClubMatchData GetMatchDataInstance(ClubMatch obj)
|
||||
{
|
||||
ClubMatchData data = new ClubMatchData();
|
||||
data.ClubMatchId = obj.ClubMatchId;
|
||||
data.ClubId = obj.ClubId;
|
||||
data.ClubMatchName = obj.ClubMatchName;
|
||||
data.MatchStartTime = DateTimeHelper.DateTime2TimeStamp(obj.MatchStartTime);
|
||||
data.MatchEndTime = DateTimeHelper.DateTime2TimeStamp(obj.MatchEndTime);
|
||||
data.StatusFlag = obj.StatusFlag;
|
||||
return data;
|
||||
}
|
||||
|
||||
public void Copy2LeagueMatch()
|
||||
{
|
||||
ClubMatch leagueClubMatch = this.LeagueClubMatch;
|
||||
this.LeagueClubMatch = null;
|
||||
this._MatchStartTime = leagueClubMatch._MatchStartTime;
|
||||
this._MatchEndTime = leagueClubMatch._MatchEndTime;
|
||||
this._DieOutNum = leagueClubMatch._DieOutNum;
|
||||
this._CreateTime = leagueClubMatch._CreateTime;
|
||||
this._StatusFlag = leagueClubMatch._StatusFlag;
|
||||
this._AutoOpen = leagueClubMatch._AutoOpen;
|
||||
this._HowTopUser = leagueClubMatch._HowTopUser;
|
||||
this._MatchRate = leagueClubMatch._MatchRate;
|
||||
this._VisibleDesk = leagueClubMatch._VisibleDesk;
|
||||
this._isOnlyVisibleMyClub = leagueClubMatch._isOnlyVisibleMyClub;
|
||||
this._isVisibleScoreBak = leagueClubMatch._isVisibleScoreBak;
|
||||
this._isScoreReset = leagueClubMatch._isScoreReset;
|
||||
this._MatchPlayWays = leagueClubMatch._MatchPlayWays;
|
||||
this._BakMatchPlayWays = leagueClubMatch._BakMatchPlayWays;
|
||||
this._matchOtherSetting = leagueClubMatch._matchOtherSetting;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 比赛其他设置
|
||||
/// </summary>
|
||||
public class MatchOtherSetting
|
||||
{
|
||||
/// <summary>
|
||||
/// 重赛限制 --重赛审核中的用户无法在本联赛任何俱乐部参与比赛 false不限制 true限制 默认不限制
|
||||
/// </summary>
|
||||
public bool ReplayRestrictions;
|
||||
/// <summary>
|
||||
/// 生存任务限制 --下一轮比赛开始时生存任务调整为默认值
|
||||
/// </summary>
|
||||
public bool LiveTaskRestrictions;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 比赛玩法 表实体对象
|
||||
/// </summary>
|
||||
public class MatchPlayWay
|
||||
{
|
||||
/// <summary>
|
||||
/// 自增Id 主键
|
||||
/// </summary>
|
||||
public int MatchPlayWayId;
|
||||
|
||||
/// <summary>
|
||||
/// 所属竞技比赛 组合索引I_MatchPlayWay_ClubIdClubMatchId 1
|
||||
/// </summary>
|
||||
public int ClubId;
|
||||
|
||||
/// <summary>
|
||||
/// 比赛Id 外键 组合索引I_MatchPlayWay_ClubIdClubMatchId 2
|
||||
/// </summary>
|
||||
public int ClubMatchId;
|
||||
|
||||
/// <summary>
|
||||
/// 玩法的唯一码
|
||||
/// </summary>
|
||||
public string weiyima;
|
||||
|
||||
/// <summary>
|
||||
/// 最低分数限制,玩家低于此分不能进入桌子
|
||||
/// </summary>
|
||||
public int MinScore;
|
||||
|
||||
/// <summary>
|
||||
/// 桌费数值 AA
|
||||
/// </summary>
|
||||
public int DeskCost;
|
||||
|
||||
/// <summary>
|
||||
/// 消耗方式 1AA 2大赢家
|
||||
/// </summary>
|
||||
public int TypeMode;
|
||||
|
||||
/// <summary>
|
||||
/// 最低分值免收桌费 AA
|
||||
/// </summary>
|
||||
public int MinFreeDeskCostNum;
|
||||
|
||||
/// <summary>
|
||||
/// 是否第一局结束前解散不计房费 true是不计 false 否计算
|
||||
/// </summary>
|
||||
public bool IsFirstCalcDeskCost;
|
||||
|
||||
/// <summary>
|
||||
/// 小局低于多少分解散桌子
|
||||
/// </summary>
|
||||
public int BuresMinScore;
|
||||
|
||||
/// <summary>
|
||||
/// 是否开启小局低于多少分解散房间
|
||||
/// </summary>
|
||||
public bool IsBuresMin;
|
||||
|
||||
/// <summary>
|
||||
/// 是否开启 解散房间按实际局数计算比赛消耗
|
||||
/// </summary>
|
||||
public bool IsRealCalcScore;
|
||||
|
||||
/// <summary>
|
||||
/// 大赢家消耗规则
|
||||
/// </summary>
|
||||
public List<MaxWinnerScoreRange> MaxWinnerScoreRanges;
|
||||
|
||||
/// <summary>
|
||||
/// 每次比赛联赛活跃积分
|
||||
/// </summary>
|
||||
public decimal LeagueDeskScore;
|
||||
|
||||
/// <summary>
|
||||
/// 深复制对象
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="obj"></param>
|
||||
/// <returns></returns>
|
||||
public static T DeepCopy<T>(T obj)
|
||||
{
|
||||
object retval;
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
{
|
||||
XmlSerializer xml = new XmlSerializer(typeof(T));
|
||||
xml.Serialize(ms, obj);
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
retval = xml.Deserialize(ms);
|
||||
ms.Close();
|
||||
}
|
||||
return (T)retval;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
public static List<MatchPlayWay> GetInstances(CreateClubMatchPack request)
|
||||
{
|
||||
var result = new List<MatchPlayWay>();
|
||||
if (request.MatchPlayWays == null || request.MatchPlayWays.Count < 1)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
foreach (var item in request.MatchPlayWays)
|
||||
{
|
||||
result.Add(new MatchPlayWay
|
||||
{
|
||||
MatchPlayWayId = 0,
|
||||
ClubId = request.ClubId,
|
||||
ClubMatchId = 0,//新增的时候要赋值
|
||||
weiyima = item.weiyima,
|
||||
MinScore = item.MinScore,
|
||||
DeskCost = item.DeskCost,
|
||||
TypeMode = item.TypeMode,
|
||||
MinFreeDeskCostNum = item.MinFreeDeskCostNum,
|
||||
IsBuresMin = item.IsBuresMin,
|
||||
IsFirstCalcDeskCost = item.IsFirstCalcDeskCost,
|
||||
IsRealCalcScore = item.IsRealCalcScore,
|
||||
BuresMinScore = item.BuresMinScore,
|
||||
MaxWinnerScoreRanges = item.MaxWinnerScoreRanges,
|
||||
LeagueDeskScore = item.LeagueDeskScore
|
||||
});
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 生成一个默认的玩法
|
||||
/// </summary>
|
||||
/// <param name="playWay"></param>
|
||||
/// <param name="clubMatch"></param>
|
||||
/// <returns></returns>
|
||||
public static MatchPlayWay GetInstanceByPlayWay(PlayWay playWay, ClubMatch clubMatch)
|
||||
{
|
||||
return new MatchPlayWay()
|
||||
{
|
||||
MatchPlayWayId = 0,
|
||||
ClubId = playWay.Clubid,
|
||||
ClubMatchId = clubMatch.ClubMatchId,
|
||||
weiyima = playWay.weiyima,
|
||||
MinScore = clubMatch.DieOutNum,
|
||||
DeskCost = 5,
|
||||
TypeMode = 2,
|
||||
MinFreeDeskCostNum = 10,
|
||||
IsBuresMin = true,
|
||||
IsFirstCalcDeskCost = true,
|
||||
IsRealCalcScore = true,
|
||||
BuresMinScore = clubMatch.DieOutNum,
|
||||
MaxWinnerScoreRanges = new List<MaxWinnerScoreRange>() {
|
||||
new MaxWinnerScoreRange{ MatchPlayWayId=0, MaxWinnerScoreRangeId=0, DeskScore=5,
|
||||
MaxWinnerMinScore=0}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取玩法
|
||||
/// </summary>
|
||||
/// <param name="matchPlayWays"></param>
|
||||
/// <returns></returns>
|
||||
public static List<MatchPlayWayInfo> GetMatchPlayWayInfos(List<MatchPlayWay> matchPlayWays)
|
||||
{
|
||||
List<MatchPlayWayInfo> result = new List<MatchPlayWayInfo>();
|
||||
if (matchPlayWays == null || matchPlayWays.Count < 1)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
foreach (var item in matchPlayWays)
|
||||
{
|
||||
result.Add(new MatchPlayWayInfo
|
||||
{
|
||||
WeiYiMa = item.weiyima,
|
||||
MinScore = item.MinScore,
|
||||
DeskCost = item.DeskCost,
|
||||
TypeMode = item.TypeMode,
|
||||
MinFreeDeskCostNum = item.MinFreeDeskCostNum,
|
||||
IsBuresMin = item.IsBuresMin,
|
||||
IsFirstCalcDeskCost = item.IsFirstCalcDeskCost,
|
||||
IsRealCalcScore = item.IsRealCalcScore,
|
||||
BuresMinScore = item.BuresMinScore,
|
||||
MaxWinnerScoreRanges = Convert2MatchMaxWinnerScoreRanges(item.MaxWinnerScoreRanges),
|
||||
LeagueDeskScore = (double)item.LeagueDeskScore
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static List<MatchMaxWinnerScoreRange> Convert2MatchMaxWinnerScoreRanges(List<MaxWinnerScoreRange> maxWinnerScoreRanges)
|
||||
{
|
||||
List<MatchMaxWinnerScoreRange> result = new List<MatchMaxWinnerScoreRange>();
|
||||
foreach (var item in maxWinnerScoreRanges)
|
||||
{
|
||||
result.Add(MaxWinnerScoreRange2MatchMaxWinnerScoreRange(item));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//todo 优化使用引用池
|
||||
private static MatchMaxWinnerScoreRange MaxWinnerScoreRange2MatchMaxWinnerScoreRange(MaxWinnerScoreRange maxWinnerScoreRange)
|
||||
{
|
||||
MatchMaxWinnerScoreRange range = new MatchMaxWinnerScoreRange();
|
||||
range.DeskScore = maxWinnerScoreRange.DeskScore;
|
||||
range.MaxWinnerMinScore = maxWinnerScoreRange.MaxWinnerMinScore;
|
||||
return range;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取玩法
|
||||
/// </summary>
|
||||
/// <param name="matchPlayWays"></param>
|
||||
/// <returns></returns>
|
||||
public static List<MatchPlayWayPack> GetMatchPlayWayPacks(List<MatchPlayWay> matchPlayWays)
|
||||
{
|
||||
var result = new List<MatchPlayWayPack>();
|
||||
if (matchPlayWays == null || matchPlayWays.Count < 1)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
foreach (var item in matchPlayWays)
|
||||
{
|
||||
result.Add(new MatchPlayWayPack
|
||||
{
|
||||
weiyima = item.weiyima,
|
||||
MinScore = item.MinScore,
|
||||
DeskCost = item.DeskCost,
|
||||
TypeMode = item.TypeMode,
|
||||
MinFreeDeskCostNum = item.MinFreeDeskCostNum,
|
||||
IsBuresMin = item.IsBuresMin,
|
||||
IsFirstCalcDeskCost = item.IsFirstCalcDeskCost,
|
||||
IsRealCalcScore = item.IsRealCalcScore,
|
||||
BuresMinScore = item.BuresMinScore,
|
||||
MaxWinnerScoreRanges = item.MaxWinnerScoreRanges,
|
||||
LeagueDeskScore = item.LeagueDeskScore
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 积分记录
|
||||
/// </summary>
|
||||
public class ClubMatchScoreNotes
|
||||
{
|
||||
/// <summary>
|
||||
/// 自增Id 主键
|
||||
/// </summary>
|
||||
public int ScoreNotesId;
|
||||
/// <summary>
|
||||
/// 俱乐部ID 组合索引I_ScoreNotes_ClubIdClubMatchId 1
|
||||
/// </summary>
|
||||
public int ClubId;
|
||||
/// <summary>
|
||||
/// 比赛ID 组合索引I_ScoreNotes_ClubIdClubMatchId 2
|
||||
/// </summary>
|
||||
public int ClubMatchId;
|
||||
|
||||
/// <summary>
|
||||
/// 玩家Id 组合索引I_ScoreNotes_ClubIdClubMatchIdUserId 3
|
||||
/// </summary>
|
||||
public int UserId;
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime CreateTime;
|
||||
/// <summary>
|
||||
/// 类型 1游戏结算 2群主调整比赛积分 3比赛重置 4比赛结束 5调整淘汰分
|
||||
/// </summary>
|
||||
public int TypeId;
|
||||
/// <summary>
|
||||
/// 操作的分值
|
||||
/// </summary>
|
||||
public double Score;
|
||||
|
||||
/// <summary>
|
||||
/// 这把玩家扣除的桌费--这个字段只有群主自己展示
|
||||
/// </summary>
|
||||
public double DeskScore;
|
||||
|
||||
/// <summary>
|
||||
/// 操作以后的分值
|
||||
/// </summary>
|
||||
public double NewScore;
|
||||
|
||||
/// <summary>
|
||||
/// 获取输出对象
|
||||
/// </summary>
|
||||
/// <param name="lists"></param>
|
||||
/// <returns></returns>
|
||||
public static List<UserScoreLog> GetUserScoreLogs(List<ClubMatchScoreNotes> lists)
|
||||
{
|
||||
var result = new List<UserScoreLog>();
|
||||
if (lists == null || lists.Count < 1)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
for (int i = lists.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var item = lists[i];
|
||||
result.Add(new UserScoreLog
|
||||
{
|
||||
CreateTime = item.CreateTime,
|
||||
TypeId = item.TypeId,
|
||||
Score = item.Score,
|
||||
DeskScore = item.DeskScore,
|
||||
ScoreUI = item.TypeId == 1 ? item.Score - item.DeskScore : item.NewScore
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 俱乐部退赛对象
|
||||
/// </summary>
|
||||
public class ExitMatchObj
|
||||
{
|
||||
public int ClubId;
|
||||
|
||||
public List<ClubMatchUserScore> Datas;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 比赛玩家积分表
|
||||
/// </summary>
|
||||
public class ClubMatchUserScore
|
||||
{
|
||||
/// <summary>
|
||||
/// 自增Id 主键
|
||||
/// </summary>
|
||||
public int UserScoreId;
|
||||
/// <summary>
|
||||
/// 俱乐部ID 组合索引I_UserScore_ClubIdClubMatchId
|
||||
/// </summary>
|
||||
public int ClubId;
|
||||
/// <summary>
|
||||
/// 比赛ID 组合索引I_UserScore_ClubIdClubMatchId
|
||||
/// </summary>
|
||||
public int ClubMatchId;
|
||||
|
||||
/// <summary>
|
||||
/// 玩家Id
|
||||
/// </summary>
|
||||
public int UserId;
|
||||
|
||||
/// <summary>
|
||||
/// 比赛分
|
||||
/// </summary>
|
||||
public decimal Score;
|
||||
|
||||
/// <summary>
|
||||
/// 玩家提供的桌费 竞技赛活跃积分 房费/人数
|
||||
/// </summary>
|
||||
public decimal DeskScore;
|
||||
|
||||
/// <summary>
|
||||
/// 如果显示淘汰分那么就是淘汰分,如果不显示就是积分备注
|
||||
/// </summary>
|
||||
public decimal ScoreBak;
|
||||
|
||||
/// <summary>
|
||||
/// 数据更新时间
|
||||
/// </summary>
|
||||
public DateTime UpdateTime;
|
||||
|
||||
/// <summary>
|
||||
/// 获取玩家总积分
|
||||
/// </summary>
|
||||
/// <param name="isHaveScoreBak">是否显示淘汰分</param>
|
||||
/// <returns></returns>
|
||||
public decimal GetPlayScore(bool isHaveScoreBak)
|
||||
{
|
||||
if (isHaveScoreBak)
|
||||
{
|
||||
return this.Score + this.ScoreBak;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.Score;
|
||||
}
|
||||
}
|
||||
|
||||
public ClubMatchUserScore Clone()
|
||||
{
|
||||
return new ClubMatchUserScore
|
||||
{
|
||||
UserScoreId = this.UserScoreId,
|
||||
ClubId = this.ClubId,
|
||||
ClubMatchId = this.ClubMatchId,
|
||||
UserId = this.UserId,
|
||||
Score = this.Score,
|
||||
DeskScore = this.DeskScore,
|
||||
ScoreBak = this.ScoreBak
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 比赛记录
|
||||
/// </summary>
|
||||
public class ClubMatchNotes
|
||||
{
|
||||
/// <summary>
|
||||
/// 自增Id 主键
|
||||
/// </summary>
|
||||
public long ClubMatchNotesId;
|
||||
|
||||
/// <summary>
|
||||
/// 日志类型
|
||||
/// </summary>
|
||||
public MatchNotesEnum TypeId;
|
||||
|
||||
/// <summary>
|
||||
/// 俱乐部ID 组合索引I_ClubMatchNotes_ClubIdClubMatchId
|
||||
/// </summary>
|
||||
public int ClubId;
|
||||
/// <summary>
|
||||
/// 比赛ID 组合索引I_ClubMatchNotes_ClubIdClubMatchId
|
||||
/// </summary>
|
||||
public int ClubMatchId;
|
||||
|
||||
/// <summary>
|
||||
/// 产生时间
|
||||
/// </summary>
|
||||
public DateTime CreateTime;
|
||||
|
||||
/// <summary>
|
||||
/// 内容
|
||||
/// </summary>
|
||||
public string Content;
|
||||
|
||||
/// <summary>
|
||||
/// 获取输出对象
|
||||
/// </summary>
|
||||
/// <param name="lists"></param>
|
||||
/// <returns></returns>
|
||||
public static List<ClubMatchNotesLog> GetClubMatchNotes(List<ClubMatchNotes> lists)
|
||||
{
|
||||
var result = new List<ClubMatchNotesLog>();
|
||||
if (lists == null || lists.Count < 1)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
for (int i=lists.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var item = lists[i];
|
||||
result.Add(new ClubMatchNotesLog
|
||||
{
|
||||
TypeId = item.TypeId,
|
||||
CreateTime = item.CreateTime,
|
||||
Content = item.Content
|
||||
});
|
||||
//Debug.Info($"发给客户端的日志:{item.Content}");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
27
ObjectModel/Club/ClubPayCardDBEntity.cs
Normal file
27
ObjectModel/Club/ClubPayCardDBEntity.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using GameMessage;
|
||||
|
||||
namespace ObjectModel.Club
|
||||
{
|
||||
/// <summary>
|
||||
/// 俱乐部房卡转入记录
|
||||
/// </summary>
|
||||
public class ClubPayCardDBEntity
|
||||
{
|
||||
public int id {get; set;}
|
||||
|
||||
public int clubId {get; set;} // 俱乐部ID
|
||||
|
||||
public int userId {get; set;} // 用户ID
|
||||
|
||||
public int cardCount {get; set;} // 房卡数量
|
||||
|
||||
public string nickName {get; set;} // 用户昵称
|
||||
|
||||
public DateTime datetime {get; set;}
|
||||
|
||||
public int sex {get; set;} // 性别
|
||||
|
||||
public ClubPayCardOrigin origin {get; set;}
|
||||
}
|
||||
}
|
||||
76
ObjectModel/Club/ClubPlayerSettleDetail.cs
Normal file
76
ObjectModel/Club/ClubPlayerSettleDetail.cs
Normal file
@ -0,0 +1,76 @@
|
||||
using System.Collections.Generic;
|
||||
using Server.Core;
|
||||
|
||||
namespace ObjectModel.Club
|
||||
{
|
||||
/// <summary>
|
||||
/// 俱乐部玩家结算详情
|
||||
/// </summary>
|
||||
public class ClubPlayerSettleDetail : Reference
|
||||
{
|
||||
/// <summary>
|
||||
/// 大赢家列表
|
||||
/// </summary>
|
||||
public List<int> BigWinIndexs;
|
||||
|
||||
/// <summary>
|
||||
/// 大赢家用户列表
|
||||
/// </summary>
|
||||
public List<int> BigWinUserIds;
|
||||
|
||||
/// <summary>
|
||||
/// 牌局最大分数
|
||||
/// </summary>
|
||||
public decimal MaxScore;
|
||||
|
||||
/// <summary>
|
||||
/// 房主用户Id
|
||||
/// </summary>
|
||||
public int RoomOwnerUserId;
|
||||
|
||||
/// <summary>
|
||||
/// 房卡数量
|
||||
/// </summary>
|
||||
public int CardNum;
|
||||
|
||||
public static ClubPlayerSettleDetail Create()
|
||||
{
|
||||
var entity = ReferencePool.Fetch<ClubPlayerSettleDetail>();
|
||||
entity.BigWinIndexs = new List<int>();
|
||||
entity.BigWinUserIds = new List<int>();
|
||||
entity.MaxScore = -1;
|
||||
entity.RoomOwnerUserId = -1;
|
||||
entity.CardNum = 0;
|
||||
return entity;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否大赢家
|
||||
/// </summary>
|
||||
public bool IsBigWinByIndex(int index)
|
||||
{
|
||||
return BigWinIndexs.Contains(index);
|
||||
}
|
||||
|
||||
public bool IsBigWinByUserId(int userId)
|
||||
{
|
||||
return BigWinUserIds.Contains(userId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否房主
|
||||
/// </summary>
|
||||
public bool IsRoomOwner(int userId)
|
||||
{
|
||||
return RoomOwnerUserId == userId;
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
BigWinIndexs.Clear();
|
||||
BigWinUserIds.Clear();
|
||||
|
||||
ReferencePool.Recycle(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
10
ObjectModel/Club/ClubUserScoreLog.cs
Normal file
10
ObjectModel/Club/ClubUserScoreLog.cs
Normal file
@ -0,0 +1,10 @@
|
||||
using System;
|
||||
|
||||
namespace ObjectModel.Club
|
||||
{
|
||||
[Serializable]
|
||||
public class ClubUserScoreLog : ClubMatchUserScore
|
||||
{
|
||||
public FieldChangeLog ChangeLog;
|
||||
}
|
||||
}
|
||||
37
ObjectModel/Club/FieldChangeLog.cs
Normal file
37
ObjectModel/Club/FieldChangeLog.cs
Normal file
@ -0,0 +1,37 @@
|
||||
using System;
|
||||
|
||||
namespace ObjectModel.Club
|
||||
{
|
||||
public static class FieldChangeType
|
||||
{
|
||||
public const int None = 0; // 没有执行任何操作
|
||||
public const int AddOrSub = 1; // 更新
|
||||
public const int Set = 2; // 设置
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class FieldChangeLog
|
||||
{
|
||||
/// <summary>
|
||||
/// 变更类型
|
||||
/// </summary>
|
||||
public int ChangeType;
|
||||
|
||||
/// <summary>
|
||||
/// 字段名称
|
||||
/// </summary>
|
||||
public string FieldName;
|
||||
|
||||
/// <summary>
|
||||
/// 变更值
|
||||
/// </summary>
|
||||
public string Value;
|
||||
|
||||
public FieldChangeLog(int changeType, string fieldName, string value)
|
||||
{
|
||||
ChangeType = changeType;
|
||||
FieldName = fieldName;
|
||||
Value = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
10
ObjectModel/Club/LeagueClubScoreLog.cs
Normal file
10
ObjectModel/Club/LeagueClubScoreLog.cs
Normal file
@ -0,0 +1,10 @@
|
||||
using System;
|
||||
|
||||
namespace ObjectModel.Club
|
||||
{
|
||||
[Serializable]
|
||||
public class LeagueClubScoreLog : LeagueMatchClubScore
|
||||
{
|
||||
public FieldChangeLog ChangeLog;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user