CMD_GAME_21201 = new cc.Class({ //window. ctor: function () { ////////////////////////////////////////////////////////////////////////// //公共宏定义 //测试模式 this.TMP_TEST = false; this.KIND_ID = 21201; //游戏 I D this.GAME_PLAYER = 4; //游戏人数 this.MYSELF_VIEW_ID = 2; this.MAX_WEAVE = 5; //最大组合 this.MAX_INDEX = 42; //最大索引 this.MAX_COUNT = 17; //最大数目 this.CARD_COUNT = 16; this.MAX_REPERTORY = 144; //最大库存 this.HEAP_FULL_COUNT = 34; //堆立全牌 this.MAX_RIGHT_COUNT = 1; //最大权位DWORD个数 this.GAME_SCENE_FREE = 0; //等待开始 this.GAME_SCENE_PLAY = 100; //游戏进行 this.GAME_SCENE_DOUBLE = this.GAME_SCENE_PLAY + 1; //加倍状态 this.cbLianZhuangCount = 0; SERVER_RULES_GENERAL = 0X00000010; //普通激情 this.dwChiHuRightAdd = 0; ////////////////////////////////////////////////////////////////////////// //逻辑掩码 this.MASK_COLOR = 0xF0; //花色掩码 this.MASK_VALUE = 0x0F; //数值掩码 ////////////////////////////////////////////////////////////////////////// //人数 this.GAME_RULE_RENSHU_2 = 0x00040000; //2人 18 this.GAME_RULE_RENSHU_0 = 0x00020000; //3人 17 this.GAME_RULE_RENSHU_1 = 0x00010000; //4人 16 //局数 this.GAME_RULE_JUSHU_2 = 0x00080000; //局数8 this.GAME_RULE_JUSHU_3 = 0x00100000; //局数12 this.GAME_RULE_JUSHU_4 = 0x00200000; //局数16 ////////////////////////////////////////////////////////////////////////// // 游戏规则 this.GAME_RULE_TUOGUAN_15 = 0x00000001; //60秒 0 this.GAME_RULE_TUOGUAN_30 = 0x00000002; //90秒 1 this.GAME_RULE_TUOGUAN_60 = 0x00000004; //120秒 2 this.GAME_RULE_TUOGUAN_NONE = 0x00000008; //无托管 3 this.GAME_RULE_RENSHU_LIMIT = 0x00000010; //不可少人开局 4 // this.GAME_RULE_JUSHU_1 =0x00000020; //局数4 5 // this.GAME_RULE_JUSHU_2 =0x00000040; //局数8 6 // this.GAME_RULE_JUSHU_3 =0x00000080; //局数12 7 // this.GAME_RULE_JUSHU_4 =0x00000100; //局数16 8 this.GAME_RULE_SP_6 = 0x00000200; //庄家无台 9 this.GAME_RULE_SP_7 = 0x00000400; //红中玩法 10 // this.GAME_RULE_RENSHU_0 =0x00000800; //3人 11 // this.GAME_RULE_RENSHU_1 =0x00001000; //4人 12 // this.GAME_RULE_RENSHU_2 =0x00002000; //2人 13 this.GAME_RULE_SP_1 = 0x00004000; //点炮胡 14 this.GAME_RULE_SP_2 = 0x00008000; //自摸胡 15 this.GAME_RULE_SP_3 = 0x00010000; //飘123 16 this.GAME_RULE_SP_4 = 0x00020000; //不下嘴 17 this.GAME_RULE_SP_5 = 0x00040000; //飘135 18 this.GAME_RULE_SP_8 = 0x00080000; //飘2 19 this.GAME_RULE_SP_9 = 0x00100000; //飘3 20 this.GAME_RULE_SP_10 = 0x00200000; //飘5 21 this.GAME_RULE_SP_11 = 0x00400000; //飘8 22 this.GAME_RULE_SP_12 = 0x00800000; //无红中加倍 23 this.GAME_RULE_SP_13 = 0x01000000; //起手四红中可胡 24 this.GAME_RULE_SP_14 = 0x02000000; //中途四红中可胡 25 this.GAME_RULE_SP_15 = 0x04000000; //台湾北部麻将 26 this.GAME_RULE_SP_16 = 0x08000000; //台湾南部麻将 27 this.GAME_RULE_SP_17 = 0x10000000; //呖咕呖咕 28 this.GAME_RULE_SP_18 = 0x20000000; //飞鸟 29 this.GAME_RULE_SP_19 = 0x40000000; //不抓鸟 30 this.GAME_RULE_SP_20 = 0x00000001; //服务器规则:AA付费 this.m_dwGameRule = 0; //创建规则 this.m_dwGameRuleArr = new Array(5); //创建规则 this.g_GameLogic = null; this.g_GameEngine = null; this.m_cbMagicData = 0;//混牌值 this.m_AllCardItem = new Array(); ////////////////////////////////////////////////////////////////////////// //动作定义 //动作标志 this.WIK_NULL = 0x0000; //没有类型 this.WIK_LEFT = 0x0001; //左吃类型 this.WIK_CENTER = 0x0002; //中吃类型 this.WIK_RIGHT = 0x0004; //右吃类型 this.WIK_PENG = 0x0008; //碰牌类型 this.WIK_GANG = 0x0010; //杠牌类型 this.WIK_LISTEN = 0x0020; //吃牌类型 this.WIK_CHI_HU = 0x0040; //吃胡类型 this.WIK_FANG_PAO = 0x0080; //放炮类型 this.WIK_GANG_FENG = 0x0100; //旋风杠 this.WIK_CAI_ZFB = 0x0200; //旋风杠(中发白吃杠) this.WIK_ADD_ZFB = 0x0400; //旋风杠补杠 this.WIK_DNJ = 0x0800; //东南鸡 this.WIK_ADD_DNJ = 0x1000; //东南鸡补 this.WIK_ADD_FENG = 0x2000; //旋风杠补杠 this.WIK_GANG_BU = 0x4000; //杠补 //胡牌定义 this.CHR_NULL = 0x00000000; //空权位 this.CHR_MENQiNG = 0x00000001; //门清 this.CHR_PENG_PENG = 0x00000002; //碰碰胡 this.CHR_QI_DUI = 0x00000004; //八对 this.CHR_BAXIANGUOHAI = 0x00000008; //八仙过海 this.CHR_GANG_KAI = 0x00000010; //杠上开花 this.CHR_KUN_SI_SE = 0x00000020; //混一色 this.CHR_QING_YI_SE = 0x00000040; //清一色 this.CHR_QUAN_QIU_PAO = 0x00000080; //全求 this.CHR_DI_TING = 0x00000100; //地听 this.CHR_TIAN_TING = 0x00000200; //天听 this.CHR_SHAN_YUAN = 0x00000400; //三元 this.CHR_SHAN_YUAN_XIAO = 0x00000800; //小三元 this.CHR_XIAO_SI_XI = 0x00001000; //小四喜 this.CHR_HAI_DI = 0x00002000; //海底捞 this.CHR_GANG_PAO = 0x00004000; //杠后炮 this.CHR_QI_QIANG_YI = 0x00008000; //七抢1 this.CHR_QIANG_GANG = 0x00010000; //抢杠 this.CHR_DUN_TING = 0x00020000; //独听 this.CHR_ZI_SI_SE = 0x00040000; //字一色 this.CHR_SHAN_KAN = 0x00080000; //三暗刻 this.CHR_SI_KAN = 0x00100000 //四暗刻 this.CHR_WU_KAN = 0x00200000 //五暗刻 this.CHR_HUA_GANG = 0x00400000 //花杠 this.CHR_PING_HU = 0x00800000 //平胡 this.CHR_WU_KAN_NO = 0x01000000 //无刻 this.CHR_BANKER = 0x02000000; //庄家 this.CHR_CHI_HU = 0x04000000; //放炮 this.CHR_ZI_MO = 0x08000000; //自摸 this.CHR_MEN_FENG = 0x10000000; //门风 this.CHR_HUA_PAI = 0x20000000; //hua pai this.CHR_LIAN_ZHUANG = 0x40000000; //lian zhuang this.CHR_FENG_QUAN = 0x80000000; //风圈 this.CHR_DA_SI_XI = 0x00000001; //大四喜ADD //Y 排列方式 this.enYTop = 0; //上对齐 this.enYCenter = 1; //中对齐 this.enYBottom = 2; //下对齐 //方向枚举 this.Direction_North = 0; //北向 this.Direction_West = 1; //西向 this.Direction_South = 2; //南向 this.Direction_East = 3; //东向 this.HAND_TOP = 0; this.HAND_LEFT = 1; this.HAND_BOTTOM = 2; this.HAND_RIGHT = 3; //牌状态 this.HAND_STATE_STAND = 0;//立牌 this.HAND_STATE_SHOW = 1;//显示牌 this.HAND_STATE_SHOW_BACK = 2;//显示牌背 //普通杠牌,1张牌摞起来,全部显示 this.GANG_THREE_SHOW = 0; //普通杠牌,1张牌摞起来,暗杠全部不显示 this.GAME_THREE_BACK = 1; //普通杠牌,1张牌摞起来,暗杠自己能看到第三张牌 this.GAME_THREE_BACK_SELF = 2; this.CARD_WIGTH = 86; this.CARD_HEIGHT = 122; //游戏定时器 this.IDI_START_GAME = 200; //开始定时器 this.IDI_OPERATE_CARD = 201; //操作定时器 //游戏定时器 this.TIME_START_GAME = 30; //开始定时器 this.TIME_OPERATE_CARD = 30; //操作定时器 this.TIME_OPERATE_CARD_15 = 15; //操作定时器 this.TIME_OPERATE_CARD_30 = 30; //操作定时器 this.TIME_OPERATE_CARD_60 = 60; //操作定时器 this.ITEM_PROVIDE_DIR = 0; this.ITEM_PROVIDE_COLOR = 1; ////////////////////////////////////////////////////////////////////////// //服务器命令结构 this.SUB_S_GAME_START = 100; //游戏开始 this.SUB_S_OUT_CARD = 101; //出牌命令 this.SUB_S_SEND_CARD = 102; //发送扑克 this.SUB_S_OPERATE_NOTIFY = 104; //操作提示 this.SUB_S_OPERATE_RESULT = 105; //操作命令 this.SUB_S_GAME_END = 106; //游戏结束 this.SUB_S_TRUSTEE = 107; //用户托管 this.SUB_S_NEXT_READY = 108; //下局准备 this.SUB_S_LEAVE = 109; this.SUB_S_USER_DOUBLE = 111; //用户加倍 this.SUB_S_GAME_DOUBLE = 112; //开始选刚 this.SUB_S_TING = 113; //听牌 this.SUB_S_BANKER_CAN_OUT = 114; //庄可以出牌 this.SUB_S_REPLACE_CARD = 117; //用户补牌 this.SUB_S_OPERATE_TIMER = 120; //别人有提示显示时间 //刷新数据 this.SUB_S_UPDATE_CARD = 200; //刷新操作牌 ////////////////////////////////////////////////////////////////////////// //客户端命令结构 this.SUB_C_OUT_CARD = 1; //出牌命令 this.SUB_C_OPERATE_CARD = 3; //操作扑克 this.SUB_C_TRUSTEE = 4; //用户托管 this.SUB_C_NEXT_READY = 5; this.SUB_C_LEAVE = 7; this.SUB_C_USER_DOUBLE = 8; //用户加倍 this.SUB_C_REPLACE_CARD = 9; //用户补牌 }, setRule: function (dwServerRules, dwRuleArr) { this.m_dwGameRuleArr = dwRuleArr; this.m_dwServerRules = dwServerRules; console.log("游戏规则", this.m_dwGameRuleArr) // this.GAME_PLAYER = this.GetPlayerCount(); }, IsJiPai: function (cbCardData) { return false; }, getGameFieldName: function () { if (this.m_dwGameRuleArr[3] == 1000) { return "新手場"; } else if (this.m_dwGameRuleArr[3] == 2000) { return "初級場"; } else if (this.m_dwGameRuleArr[3] == 10000) { return "中級場"; } else if (this.m_dwGameRuleArr[3] == 15000) { return "高级场"; } else if (this.m_dwGameRuleArr[3] == 30000) { return "大師場"; } }, GetPlayerCount: function (dwRule) { if (dwRule) { if (dwRule & this.GAME_RULE_RENSHU_2) return 2; if (dwRule & this.GAME_RULE_RENSHU_0) return 3; else if (dwRule & this.GAME_RULE_RENSHU_1) return 4; else return 4; } else { if (this.m_dwServerRules & this.GAME_RULE_RENSHU_2) return 2; if (this.m_dwServerRules & this.GAME_RULE_RENSHU_0) return 3; else if (this.m_dwServerRules & this.GAME_RULE_RENSHU_1) return 4; else return 4; } }, //类型子项 tagKindItem: function () { var Obj = new Object(); Obj.wWeaveKind = 0; //组合类型 Obj.cbCenterCard = 0; //中心扑克 Obj.cbValidIndex = new Array(3); //实际扑克索引 return Obj; }, //组合子项 tagWeaveItem: function () { var Obj = new Object(); Obj.wWeaveKind = 0; //组合类型 Obj.cbCenterCard = 0; //中心扑克 Obj.cbPublicCard = 0; //公开标志 Obj.wProvideUser = 0; //供应用户 Obj.cbCardCount = 0; //麻将数量 Obj.cbCardData = new Array(4); //实际扑克 Obj.cbExtraCount = new Array(4); //中发白数量 Obj.cbIndex = -1; //补杠的下标 return Obj; }, //杠牌结果 tagGangCardResult: function () { var Obj = new Object(); Obj.cbCardCount = 0; //扑克数目 Obj.cbCardData = new Array(this.MAX_WEAVE); //扑克数据r return Obj; }, //分析子项 tagAnalyseItem: function () { var Obj = new Object(); Obj.cbCardEye = 0; //牌眼扑克 Obj.wWeaveKind = new Array(this.MAX_WEAVE); //组合类型 Obj.cbCenterCard = new Array(this.MAX_WEAVE); //中心扑克 Obj.cbCardData = new Array(this.MAX_WEAVE); //实际扑克 for (var i = 0; i < this.MAX_WEAVE; ++i) { Obj.cbCardData[i] = new Array(4); } return Obj; }, //选择扑克信息 tagSelectCardInfo: function () { var Obj = new Object(); Obj.wActionMask = 0; //操作码 Obj.cbCardCount = 0; //选择数目 Obj.cbCardData = new Array(4); //选择牌 for (var i = 0; i < 4; ++i) { Obj.cbCardData[i] = 0; } return Obj; }, //积分信息 tagScoreInfo: function () { var Obj = new Object(); Obj.cbCardCount = new Array(); Obj.cbCardData = new Array(); Obj.szUserName = new Array(); for (var i = 0; i < this.GAME_PLAYER; ++i) { Obj.cbCardData[i] = new Array(); Obj.szUserName[i] = new Array(); } Obj.wBankerUser = INVALID_CHAIR; Obj.wProvideUser = INVALID_CHAIR; Obj.cbProvideCard = 0; Obj.lGameScore = new Array(); Obj.lGangScore = new Array(); Obj.dwChiHuKind = new Array(); Obj.dwChiHuRight = new Array(); Obj.wLeftUser = INVALID_CHAIR; Obj.cbLZCount = new Array(); Obj.cbHPCount = new Array(); Obj.cbDPCount = new Array(); Obj.cbZMCount = new Array(); for (var i = 0; i < this.GAME_PLAYER; ++i) { Obj.cbLZCount[i] = new Array(); Obj.cbHPCount[i] = new Array(); Obj.cbDPCount[i] = new Array(); Obj.cbZMCount[i] = new Array(); } return Obj; }, tagWeaveInfo: function () { var Obj = new Object(); Obj.cbWeaveCount = 0; //组合数目 Obj.cbCardCount = new Array(); //扑克数目 Obj.cbPublicWeave = new Array(); //公共组合 Obj.cbCardData = new Array(); //组合扑克 Obj.wWeaveKind = new Array(); for (var i = 0; i < this.MAX_WEAVE; ++i) { Obj.cbCardData[i] = new Array(); } return Obj; }, CMD_S_HandCardData: function () { var Obj = new Object(); Obj.wChairID = 0; Obj.wCardCount = 0; Obj.wCurrentUser = 0; Obj.cbSendCardData = 0; Obj.cbCardData = new Array(this.MAX_COUNT); Obj.WeaveItem = new Array(this.MAX_WEAVE); for (var j = 0; j < this.MAX_WEAVE; j++) { Obj.WeaveItem[j] = this.CMD_WeaveItem(); } Obj.dwWeaveCount = 0; Obj.cbCantOutCard = new Array(2); return Obj; }, //组合子项 CMD_WeaveItem: function () { var Obj = new Object(); Obj.wWeaveKind = 0;//组合类型 Obj.cbCenterCard = 0; //中心扑克 Obj.cbPublicCard = 0; //公开标志 Obj.wProvideUser = 0; //供应用户 Obj.cbCardCount = 0; //麻将数量 Obj.cbCardData = new Array(4);//组合数据 Obj.cbExtraCount = new Array(4); //中发白数量 Obj.cbIndex = -1; //补杠的下标 return Obj; }, //空闲状态 CMD_S_StatusFree: function () { var Obj = new Object(); Obj.lCellScore = 0; Obj.wBankerUser = INVALID_CHAIR; //庄家 Obj.bTrustee = new Array(4); //是否托管 Obj.bLeave = new Array(4); //是否离开 Obj.cbDouble = new Array(4); //是否加倍(自由钢) Obj.dwOperateTime = 0; //操作时间 Obj.wHuangZhuangCount = 0; //黄庄次数 Obj.lSumGameScore = new Array(4); return Obj; }, //刚 CMD_S_Double: function () { var Obj = new Object(); Obj.wCallUser = 0; //加倍用户 Obj.bStart = 0; //开始游戏 Obj.cbDouble = 0; //是否加倍 return Obj; }, //开始加倍 CMD_S_Game_Double: function () { var Obj = new Object(); Obj.wBankerUser = INVALID_CHAIR; //庄家用户 return Obj; }, //游戏开始 CMD_S_GameStart: function () { var Obj = new Object(); Obj.wBankerUser = INVALID_CHAIR; //庄家用户 Obj.wCurrentUser = INVALID_CHAIR; //当前用户 Obj.wUserAction = 0; //用户动作 Obj.cbCardData = new Array(this.MAX_COUNT); //扑克列表 Obj.cbMakeMagicIndex = 0; //定会牌索引值 Obj.cbDouble = new Array(this.GAME_PLAYER); Obj.cbLastCardCount = 0; //剩余牌数 Obj.bTrustee = new Array(4); //是否托管 Obj.wHuangZhuangCount = 0; //黄庄次数 Obj.cbFlowerCount = new Array(this.GAME_PLAYER); Obj.cbCardDataFlower = new Array(this.GAME_PLAYER); for (var i = 0; i < this.GAME_PLAYER; i++) { Obj.cbCardDataFlower[i] = new Array(8); } Obj.cbSick = new Array(3); Obj.cbUserDNXB = new Array(4); Obj.cbQuan = 0; Obj.cbFeng = 0; return Obj; }, //发送扑克 CMD_S_OutCard: function () { var Obj = new Object(); Obj.wOutCardUser = INVALID_CHAIR; //出牌用户 Obj.cbOutCardData = 0; //出牌扑克 return Obj; }, //补牌 CMD_S_ReplaceCard: function () { var t = new Object(); t.wReplaceUser = INVALID_CHAIR; t.cbReplaceCard = new Array(8); t.cbReplaceCount = 0; t.cbGameStart = 0; t.cbFlowerCount = new Array(this.GAME_PLAYER); t.cbCardDataFlower = new Array(this.GAME_PLAYER); for (var i = 0; i < this.GAME_PLAYER; i++) { t.cbCardDataFlower[i] = new Array(8); } return t; }, //出牌命令 CMD_S_SendCard: function () { var Obj = new Object(); Obj.cbCardData = 0; //扑克数据 Obj.wActionMask = 0; //动作掩码 Obj.wCurrentUser = INVALID_CHAIR; //当前用户 Obj.wSendCardUser = INVALID_CHAIR; //发牌用户 Obj.cbLeftCardCount = 0; //剩余数目 Obj.bFirstCard = false; //庄家第一张牌 Obj.bCanOut = false; //是否可打牌 return Obj; }, CMD_TingTip: function () { var Obj = new Object(); Obj.cbOutCardData = 0; //出牌数据 Obj.cbHuCardData = 0; //胡牌数据 Obj.cbDouble = 0; //翻数 Obj.cbHaveCardCount = 0;//剩余数量 return Obj; }, //操作提示 CMD_S_OperateNotify: function () { var Obj = new Object(); Obj.wResumeUser = INVALID_CHAIR; //还原用户 Obj.wActionMask = 0; //动作掩码 Obj.cbActionCard = 0; //动作扑克 Obj.wCount = 0; //数量 return Obj; }, CMD_OperateItem: function () { var Obj = new Object(); Obj.wActionMask = 0; //操作类型 Obj.cbCoreCardData = 0; //核心扑克 Obj.cbCardCount = 0; Obj.cbCardData = new Array(4); //操作扑克 return Obj; }, //操作命令 CMD_S_OperateResult: function () { var Obj = new Object(); Obj.wOperateUser = INVALID_CHAIR; //操作用户 Obj.wProvideUser = INVALID_CHAIR; //供应用户 Obj.cbCenterCard = 0; //中心扑克 Obj.wOperateCode = 0; //操作代码 Obj.cbOperateCard = new Array(4); //操作扑克 Obj.bBeiQiangGang = false; //被抢杠状态 Obj.bQiangGang = false; //抢杠状态 Obj.dwGangScore = 0; //杠分 return Obj; }, //游戏结束 CMD_S_GameEnd: function () { var Obj = new Object(); Obj.dwUserID = new Array(this.GAME_PLAYER); //胡牌类型 Obj.lGameTax = 0; //游戏税收 Obj.wProvideUser = INVALID_CHAIR; //供应用户 Obj.cbProvideCard = 0; //供应扑克 Obj.dwChiHuKind = new Array(this.GAME_PLAYER); //胡牌类型 Obj.dwChiHuRight = new Array(this.GAME_PLAYER); //胡牌类型 Obj.dwChiHuRightAdd = 0; Obj.cbWeaveCount = new Array(this.GAME_PLAYER); Obj.weaveItem = new Array(this.GAME_PLAYER); for (var i = 0; i < this.GAME_PLAYER; i++) { Obj.weaveItem[i] = new Array(this.MAX_WEAVE) for (var j = 0; j < this.MAX_WEAVE; j++) { Obj.weaveItem[i][j] = this.CMD_WeaveItem(); } } Obj.lGameScore = new Array(this.GAME_PLAYER); //游戏积分 Obj.lGangScore = new Array(this.GAME_PLAYER); //杠牌得分 Obj.cbCardCount = new Array(this.GAME_PLAYER); //扑克数目 Obj.cbCardData = new Array(this.GAME_PLAYER); //扑克数据 for (var i = 0; i < this.GAME_PLAYER; ++i) { Obj.cbCardData[i] = new Array(this.MAX_COUNT); } Obj.wLeftUser = INVALID_CHAIR; //玩家逃跑 Obj.lSumGameScore = new Array(this.GAME_PLAYER); Obj.wYear = 0; Obj.cbTime = new Array(this.GAME_PLAYER); Obj.wCostTime = 0; Obj.cbWinCount = new Array(this.GAME_PLAYER); Obj.cbLZCount = new Array(this.GAME_PLAYER); Obj.cbHPCount = new Array(this.GAME_PLAYER); Obj.cbDPCount = new Array(this.GAME_PLAYER); Obj.cbZMCount = new Array(this.GAME_PLAYER); Obj.cbDouble = new Array(this.GAME_PLAYER); Obj.cbMagicIndex = 0; //会牌索引 Obj.cbLastCardData = new Array(this.GAME_PLAYER); //分张 Obj.cbMingGangCount = new Array(this.GAME_PLAYER); //明杠 Obj.cbAnGangCount = new Array(this.GAME_PLAYER); //暗杠 Obj.bListen = new Array(this.GAME_PLAYER); //天听 Obj.bWinner = new Array(this.GAME_PLAYER); //赢家 Obj.cbBirdCard = new Array(6); //鸟牌 Obj.cbBirdCardCount = 0; //抓鸟数 Obj.wBirdCount = 0; //中鸟数 Obj.cbWinner = INVALID_CHAIR; //赢家 Obj.cbFlowerCount = new Array(this.GAME_PLAYER); Obj.cbCardDataFlower = new Array(this.GAME_PLAYER); for (var i = 0; i < this.GAME_PLAYER; i++) { Obj.cbCardDataFlower[i] = new Array(8); } Obj.cbSick = new Array(3); Obj.cbUserDNXB = new Array(4); Obj.cbQuan = 0; Obj.cbFeng = 0; Obj.cbLianZhuangCount = 0; return Obj; }, //大结算 CMD_S_GameCustomInfo: function () { var Obj = new Object(); Obj._name = "CMD_S_GameCustomInfo" Obj.dwUserID = new Array(this.GAME_PLAYER); Obj.cbZiMoCount = new Array(this.GAME_PLAYER); //地主次数 Obj.cbHuCount = new Array(this.GAME_PLAYER); //胡牌次数 Obj.cbDianPaoCount = new Array(this.GAME_PLAYER); //点炮次数 Obj.cbMGangCount = new Array(this.GAME_PLAYER); //明杠次数 Obj.cbAGangCount = new Array(this.GAME_PLAYER); //暗杠次数 Obj.lTotalScore = new Array(this.GAME_PLAYER); //游戏总分 return Obj; }, //游戏状态 CMD_S_StatusPlay: function () { var Obj = new Object(); Obj.lCellScore = 0; //单元积分 Obj.wBankerUser = INVALID_CHAIR; //庄家 Obj.wCurrentUser = INVALID_CHAIR; //当前玩家 Obj.cbActionCard = 0; //动作扑克 Obj.wActionMask = 0; //动作掩码 Obj.cbLeftCardCount = 0; //剩余牌数 Obj.bTrustee = new Array(this.GAME_PLAYER);//是否托管 Obj.wOutCardUser = INVALID_CHAIR; //出牌用户 Obj.cbOutCardData = 0; //出牌扑克 Obj.cbDiscardCount = new Array(this.GAME_PLAYER);//丢弃数目 Obj.cbDiscardCard = new Array(this.GAME_PLAYER); for (var i = 0; i < this.GAME_PLAYER; i++) { Obj.cbDiscardCard[i] = new Array(60); } Obj.cbCardCount = 0; //扑克数目 Obj.cbCardData = new Array(this.MAX_COUNT); //扑克列表 Obj.cbSendCardData = 0; //发送扑克 Obj.cbWeaveCount = new Array(this.GAME_PLAYER); Obj.weaveItem = new Array(this.GAME_PLAYER); for (var i = 0; i < this.GAME_PLAYER; i++) { Obj.weaveItem[i] = new Array(this.MAX_WEAVE) for (var j = 0; j < this.MAX_WEAVE; j++) { Obj.weaveItem[i][j] = this.CMD_WeaveItem(); } } Obj.bLeave = new Array(this.GAME_PLAYER); //是否离开 Obj.cbMakeMagicIndex = 0; //定会牌索引值 Obj.cbDouble = new Array(this.GAME_PLAYER); //是否加倍(自由钢) Obj.bListen = new Array(this.GAME_PLAYER); //听牌 Obj.cbCantOutCard = new Array(2); //不能吃付打付 Obj.dwOperateTime = 0; //操作时间 Obj.wHuangZhuangCount = 0; //黄庄次数 Obj.bCanOutCard = false; //是否可出牌 Obj.lGangScore = new Array(this.GAME_PLAYER); //杠分 Obj.cbFlowerCount = new Array(this.GAME_PLAYER); Obj.cbCardDataFlower = new Array(this.GAME_PLAYER); for (var i = 0; i < this.GAME_PLAYER; i++) { Obj.cbCardDataFlower[i] = new Array(8); } Obj.cbSick = new Array(3); Obj.cbUserDNXB = new Array(4); Obj.cbQuan = 0; Obj.cbFeng = 0; Obj.lSumGameScore = new Array(4); return Obj; }, //用户托管 CMD_S_Trustee: function () { var Obj = new Object(); Obj.bTrustee = false; //是否托管 Obj.wChairID = INVALID_CHAIR; //托管用户 return Obj; }, //用户离开 CMD_S_Leave: function () { var Obj = new Object(); Obj.bLeave = new Array(this.GAME_PLAYER); //是否离开 for (var i = 0; i < this.GAME_PLAYER; ++i) Obj.bLeave[i] = false; return Obj; }, //下局准备 CMD_S_NextReady: function () { var Obj = new Object(); Obj.cbNextReadyStatus = new Array(this.GAME_PLAYER); //准备状态 Obj.bNextReadyStatus = new Array(this.GAME_PLAYER); return Obj; }, //用户离开 //补牌 CMD_C_ReplaceCard: function () { var Obj = new Object(); Obj.isGameStart = 0; Obj.cbCardCount = 0; Obj.cbCardData = new Array(8); return Obj; }, CMD_C_ReplaceCard4: function () { var Obj = new Object(); Obj.cbCardData = new Array(8); Obj.cbGameStart = 0; Obj.cbCardCount = 0; return Obj; }, //出牌命令 CMD_C_OutCard: function () { var Obj = new Object(); Obj.cbCardData = 0; //扑克数据 Obj.bAddGang = false; //是否是补扭 return Obj; }, //操作命令 CMD_C_OperateCard: function () { var Obj = new Object(); Obj.wOperateCode = 0; //操作代码 Obj.cbOperateCount = 0; //操作代码 Obj.cbOperateCard = new Array(4); //操作扑克 Obj.cbIndex = -1; //补杠的下标 return Obj; }, //用户托管 CMD_C_Trustee: function () { var Obj = new Object(); Obj.bTrustee = 0; //扑克数据 return Obj; }, //用户离开 CMD_C_Leave: function () { var Obj = new Object(); this.bLeave = false; //是否离开 return Obj; }, //加倍命令 CMD_C_Double: function () { var Obj = new Object(); Obj.cbDouble = 0; //255不加,1加1, 2加2 return Obj; }, GetProgress: function (wProgress, rules) { var cnt = this.GetGameCount(rules); value = '第' + wProgress + '/' + cnt + '圈'; return value; }, GameMaxPlayerCount: function (rules) { return this.GAME_PLAYER; }, GetGameCount: function (rules) { //if (rules & this.GAME_RULE_JUSHU_1 ) return 4; if (rules & this.GAME_RULE_JUSHU_2) return 1; if (rules & this.GAME_RULE_JUSHU_3) return 2; if (rules & this.GAME_RULE_JUSHU_4) return 3; return 8; }, //是否是局数 IsPlayJu: function (rules) { return true; }, GetRulesStr: function (dwServerRules, dwRulesArr) { console.log("dwServerRules:", dwServerRules); console.log("dwRulesArr:", dwRulesArr); var cstr = ""; if (dwServerRules & this.GAME_RULE_SP_20) { cstr += " AA付費 "; } else { cstr += " 房主付費 "; } if (dwRulesArr[0] & this.GAME_RULE_SP_15) cstr += "台灣北部麻將"; if (dwRulesArr[0] & this.GAME_RULE_SP_16) cstr += "台灣南部麻將"; if (dwRulesArr[0] & this.GAME_RULE_SP_6) cstr += " 莊家無台"; if (dwRulesArr[0] & this.GAME_RULE_SP_17) cstr += " 嚦咕嚦咕"; cstr += " " + this.GetGameCount(dwServerRules) + "圈"; if (dwServerRules & this.GAME_RULE_RENSHU_2) cstr += " 2人"; if (dwServerRules & this.GAME_RULE_RENSHU_0) cstr += " 3人"; if (dwServerRules & this.GAME_RULE_RENSHU_1) cstr += " 4人"; if (dwRulesArr[0] & this.GAME_RULE_TUOGUAN_15) cstr += " 15秒"; if (dwRulesArr[0] & this.GAME_RULE_TUOGUAN_30) cstr += " 30秒"; if (dwRulesArr[0] & this.GAME_RULE_TUOGUAN_60) cstr += " 60秒"; if (dwRulesArr[0] & this.GAME_RULE_TUOGUAN_NONE) cstr += " 無託管"; if (dwRulesArr[1]) { cstr += ` 底分${dwRulesArr[1]}`; } if (dwRulesArr[2]) { cstr += ` 台数${dwRulesArr[2]}`; } // if (dwRulesArr[0] & this.GAME_RULE_RENSHU_LIMIT) cstr += " 不可少人"; // if (dwRulesArr[0] & this.GAME_RULE_SP_3) cstr += " 飘123"; // if (dwRulesArr[0] & this.GAME_RULE_SP_4) cstr += " 不飘"; // if (dwRulesArr[0] & this.GAME_RULE_SP_5) cstr += " 飘135"; // if (dwRulesArr[0] & this.GAME_RULE_SP_8) cstr += " 飘2"; // if (dwRulesArr[0] & this.GAME_RULE_SP_9) cstr += " 飘3"; // if (dwRulesArr[0] & this.GAME_RULE_SP_10) cstr += " 飘5"; // if (dwRulesArr[0] & this.GAME_RULE_SP_11) cstr += " 飘8"; // if (dwRulesArr[0] & this.GAME_RULE_SP_1) cstr += " 点炮胡"; // if (dwRulesArr[0] & this.GAME_RULE_SP_2) cstr += " 自摸胡"; // if (dwRulesArr[0] & this.GAME_RULE_SP_6) cstr += " 大胡"; // if (dwRulesArr[0] & this.GAME_RULE_SP_7) cstr += " 红中玩法"; // if (dwRulesArr[0] & this.GAME_RULE_SP_12) cstr += " 红中加倍"; // if (dwRulesArr[0] & this.GAME_RULE_SP_13) cstr += " 起手四红中可胡"; // if (dwRulesArr[0] & this.GAME_RULE_SP_14) cstr += " 中途四红中可胡"; // if (dwRulesArr[0] & this.GAME_RULE_SP_15) cstr += " 抓2鸟"; // if (dwRulesArr[0] & this.GAME_RULE_SP_16) cstr += " 抓4鸟"; // if (dwRulesArr[0] & this.GAME_RULE_SP_17) cstr += " 抓6鸟"; // if (dwRulesArr[0] & this.GAME_RULE_SP_18) cstr += " 飞鸟"; // if (dwRulesArr[0] & this.GAME_RULE_SP_19) cstr += " 不抓鸟"; return cstr; }, GetTrusteeString: function (rules) { var str = ''; if (rules & this.GAME_RULE_TUOGUAN_15) str += ' 15秒' if (rules & this.GAME_RULE_TUOGUAN_30) str += ' 30秒' if (rules & this.GAME_RULE_TUOGUAN_60) str += ' 60秒' if (rules & this.GAME_RULE_TUOGUAN_NONE) str += ' 無' //if (rules & this.GAME_RULE_MAGIC ) str+=' 混牌' return str; }, GetHuRightString: function (rules, HuKind) { var str = ''; if ((rules & this.CHR_MENQiNG) && (rules & this.CHR_ZI_MO)) { str += ' 門清自摸'; } else { if (rules & this.CHR_MENQiNG) str += ' 門清'; if (rules & this.CHR_ZI_MO) str += ' 自摸'; } if (rules & this.CHR_PENG_PENG) str += ' 碰碰胡'; if (rules & this.CHR_QI_DUI) str += ' 嚦咕嚦咕'; if (rules & this.CHR_BAXIANGUOHAI) str += ' 八仙過海'; if (rules & this.CHR_GANG_KAI) str += ' 杠上開花'; if (rules & this.CHR_KUN_SI_SE) str += ' 混一色'; if (rules & this.CHR_QING_YI_SE) str += ' 清一色'; if (rules & this.CHR_QUAN_QIU_PAO) str += ' 全求'; if (rules & this.CHR_DI_TING) str += ' 地聽'; if (rules & this.CHR_TIAN_TING) str += ' 天聽'; if (rules & this.CHR_SHAN_YUAN) str += ' 三元'; if (rules & this.CHR_SHAN_YUAN_XIAO) str += ' 小三元'; if (rules & this.CHR_XIAO_SI_XI) str += ' 小四喜'; if (rules & this.CHR_HAI_DI) str += ' 海底撈'; if (rules & this.CHR_GANG_PAO) str += ' 大三元'; if (rules & this.CHR_QI_QIANG_YI) str += ' 7抢1'; if (rules & this.CHR_QIANG_GANG) str += ' 搶杠胡'; if (rules & this.CHR_DUN_TING) str += ' 獨聽'; if (rules & this.CHR_ZI_SI_SE) str += ' 字一色'; if (rules & this.CHR_SHAN_KAN) str += ' 三暗刻'; if (rules & this.CHR_SI_KAN) str += ' 四暗刻'; if (rules & this.CHR_WU_KAN) str += ' 五暗刻'; if (rules & this.CHR_HUA_GANG) str += ' 花杠'; if (rules & this.CHR_PING_HU) str += ' 平胡'; //if (rules & this.CHR_CHI_HU ) str+=' 放炮'; if ((rules & this.CHR_MEN_FENG) && (GameDef.m_dwGameRuleArr[0] & GameDef.GAME_RULE_SP_16)) str += ' 風台'; if ((rules & this.CHR_MEN_FENG) && (GameDef.m_dwGameRuleArr[0] & GameDef.GAME_RULE_SP_15)) str += ' 門風'; if (rules & this.CHR_HUA_PAI) str += ' 花牌'; if (rules & this.CHR_FENG_QUAN) str += ' 風圈'; if (this.dwChiHuRightAdd & this.CHR_DA_SI_XI && HuKind & this.WIK_CHI_HU) str += ' 大四喜'; if (rules & this.CHR_LIAN_ZHUANG && GameDef.cbLianZhuangCount > 0) { str += ' 連' + GameDef.cbLianZhuangCount + "拉" + GameDef.cbLianZhuangCount } else { if (rules & this.CHR_BANKER && GameDef.cbLianZhuangCount == 0) str += ' 莊家'; } return str; }, IsNoCheat: function (rules) { if (rules & SERVER_RULES_GENERAL) { return false; } return true; }, }); GameDef = null;