using System; using System.Diagnostics; using System.Text; using GameMessage; using Newtonsoft.Json; namespace GameData { /// /// 桌子规则 /// public class DeskRule { /// /// 密码 /// public string pwd; /// /// 最大玩家数量 /// public int maxCnt; /// /// 最小玩家数量 /// public int minCnt; /// /// 战斗场次 /// public int warCnt; /// /// 游戏的服务器id /// public int game_serid; /// /// 是否拦截ip /// public int interceptIp; /// /// 地理位置拦截 /// public int interceptpos; /// /// 是否拦截不是微信的账号 /// public int interceptWeChat; /// /// 检查设备唯一码是否相同 /// public int interecptimei; /// /// 防外挂 /// public int fanG; /// /// 是否开启语音 /// public int yuying; /// /// 防作弊变化是否提醒 /// public int warn; /// /// 客户端拓展,只保存,服务器不处理 /// public string[] ex; /// /// 是否需要换座位 /// public bool isNeedSwapSeat; /// /// 赔率 /// public float peilv; /// /// 房间规则 /// public string roomrule; /// /// 多少数封顶,总结算的封顶(子乘倍率的,就是最后封顶输多少钱) 等于0的值就是有封顶,要不就没有封顶 /// public int Capping; /// /// 玩法备注 /// public string Remarks; /// /// 规则拓展 /// public DeskRuleEx RuleEx; [JsonIgnore] public string RuleExStr { get { if (RuleEx == null) { return string.Empty; } return JsonPack.GetJson(RuleEx); } } /// /// /// public DeskRule() { //SetCappingAndPeiLv(ex); } /// /// /// /// public DeskRule(int maxCnt) { this.maxCnt = maxCnt; //SetCappingAndPeiLv(ex); } /// /// 获取创建房间所需要的房卡 /// 一般在客户端显示的时候需要传递参数。 /// 服务器在创建房间的时候是不用填写参数,直接使用类里面的内存技术即可 /// /// 局数 /// 人数 /// 计算房卡的委托,自己计算 /// 返回所需要的房卡数量 /// [Obsolete("方法作废,客户端自己计算使用了多少房卡,服务器取规则里面的房卡数量", true)] public int GetCreateRoomCardNum(int _warCnt = 0, int _maxCnt = 0,Func clacCreateRoomCardNum=null) { if (clacCreateRoomCardNum != null) { return clacCreateRoomCardNum(_warCnt,_maxCnt); } var num = _warCnt > 0 ? _warCnt : warCnt; var renshu = _maxCnt > 0 ? _maxCnt : maxCnt; int result = 0; switch (game_serid)//游戏的服务器id { case 42: //跑得快朋友房 case 41: //上饶打炸 result = num / 4; break; case 26: //窝龙 result = num / 4; if (renshu > 4) { result = result * 2; } break; case 45: break; default: #if !Server throw new Exception("游戏未实现创建房间需要多少张房卡" + game_serid); #endif break; } return result; } /// /// /// /// public override string ToString() { StringBuilder sb = new StringBuilder(); sb.AppendLine("密码" + pwd); sb.AppendLine("最大开战人数:" + maxCnt); sb.AppendLine("最小开战人数:" + minCnt); sb.AppendLine("总局数:" + warCnt); sb.AppendLine("游戏id:" + game_serid); sb.AppendLine("是否拦截ip:" + interceptIp); sb.AppendLine("是否拦截电脑账号:" + interceptWeChat); sb.AppendLine("是否拦截定位:" + interceptpos); sb.AppendLine("是否拦截设备唯一标识:" + interecptimei); sb.AppendLine("规则:" + roomrule); return sb.ToString(); } } }