You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

588 lines
20 KiB

  1. -- local MJSelectRadioCompnent = require("Views.CreateRoom.Compnent.MJSelectRadioCompnent")
  2. -- local MJGroupCompnent = require("Views.CreateRoom.Compnent.MJGroupCompnent")
  3. -- local MJCheckBoxCompnent = require("Views.CreateRoom.Compnent.MJCheckBoxCompnent")
  4. -- local MJWanFa=MJFramework.ImportWanFa("MaJiang.MJWanFa")
  5. local CreateRoomItemBase=require("luaScript.Views.CreateRoom.CreateRoomItemBase")
  6. local MJCreateRoomItem=class("zigongCreateRoomItem",CreateRoomItemBase)
  7. local SELECT_COLOR = cc.c4b(213,46,11,255)
  8. local NON_SELECT_COLOR = cc.c4b(21,99,97,255)
  9. function MJCreateRoomItem:ctor(defaultValues)
  10. MJCreateRoomItem.super.ctor(self, defaultValues, "zigongmj_room.json")
  11. local ui = loadUI("res/ui/ui_chuangjian/mj_createroom_zigong.ui");
  12. self.ui = ui;
  13. self:addChild(ui);
  14. self.JuShuRadioManager = import("luaScript.Tools.RadioManager"):new();
  15. --房费
  16. self.PayRadioManager = import("luaScript.Tools.RadioManager"):new();
  17. --人数
  18. self.RenShuRadioManager = import("luaScript.Tools.RadioManager"):new();
  19. --封顶
  20. self.FengDingCheckBoxManager = import("luaScript.Tools.RadioManager"):new();
  21. --自摸
  22. self.ZiMoCheckBoxManager = import("luaScript.Tools.RadioManager"):new();
  23. --点杠
  24. self.DianGangCheckBoxManager = import("luaScript.Tools.RadioManager"):new();
  25. --飘
  26. self.PiaoCheckBoxManager = import("luaScript.Tools.RadioManager"):new();
  27. --萝卜
  28. self.LuoBoCheckBoxManager = import("luaScript.Tools.RadioManager"):new();
  29. --玩法
  30. self.WanFaCheckBoxManager = import("luaScript.Tools.CheckBoxManager"):new();
  31. --低分加分
  32. self.DiFenJiaFenCheckBoxManager = import("luaScript.Tools.RadioManager"):new();
  33. -- 其他选项
  34. self.otherCheckBoxManager = import("luaScript.Tools.CheckBoxManager"):new()
  35. self:onHideCestView() -- 隐藏cest的界面
  36. end
  37. function MJCreateRoomItem:onHideCestView()
  38. if self.ui.Items.Button_pay0_tips then
  39. self.ui.Items.Button_pay0_tips:setVisible(false)
  40. end
  41. if self.ui.Items.Button_pay1_tips then
  42. self.ui.Items.Button_pay1_tips:setVisible(false)
  43. end
  44. if self.ui.Items.ImageView_pay0_tips then
  45. self.ui.Items.ImageView_pay0_tips:setVisible(false)
  46. end
  47. if self.ui.Items.ImageView_pay1_tips then
  48. self.ui.Items.ImageView_pay1_tips:setVisible(false)
  49. end
  50. end
  51. function MJCreateRoomItem:onShowCestView()
  52. if self.ui.Items.Text_pay0 then
  53. self.ui.Items.Text_pay0:setText("免费")
  54. end
  55. if self.ui.Items.Text_pay1 then
  56. self.ui.Items.Text_pay1:setText("自费")
  57. end
  58. if self.ui.Items.Button_pay0_tips then
  59. self.ui.Items.Button_pay0_tips:setVisible(true)
  60. end
  61. if self.ui.Items.Button_pay1_tips then
  62. self.ui.Items.Button_pay1_tips:setVisible(true)
  63. end
  64. if self.ui.Items.ImageView_pay0_tips then
  65. self.ui.Items.ImageView_pay0_tips:setVisible(false)
  66. end
  67. if self.ui.Items.Button_pay0_tips then
  68. self.ui.Items.Button_pay0_tips:registerClick(function()
  69. if self.ui.Items.ImageView_pay0_tips then
  70. local isVisible = not self.ui.Items.ImageView_pay0_tips:isVisible()
  71. self.ui.Items.ImageView_pay0_tips:setVisible(isVisible)
  72. end
  73. end)
  74. end
  75. if self.ui.Items.ImageView_pay1_tips then
  76. self.ui.Items.ImageView_pay1_tips:setVisible(false)
  77. end
  78. if self.ui.Items.Button_pay1_tips then
  79. self.ui.Items.Button_pay1_tips:registerClick(function()
  80. if self.ui.Items.ImageView_pay1_tips then
  81. local isVisible = not self.ui.Items.ImageView_pay1_tips:isVisible()
  82. self.ui.Items.ImageView_pay1_tips:setVisible(isVisible)
  83. end
  84. end)
  85. end
  86. end
  87. --根据局数获取房费
  88. function MJCreateRoomItem:getCreateRoomCost(jushu)
  89. if self.cost then
  90. local costInfo = self.cost[jushu]
  91. if costInfo then
  92. local payMode = self.PayRadioManager:getResult()
  93. if payMode == 0 then
  94. return costInfo.roomCard or 0
  95. elseif payMode == 1 then
  96. return costInfo.roomCardAA or 0
  97. end
  98. end
  99. end
  100. return 0
  101. end
  102. function MJCreateRoomItem:onEnter()
  103. MJCreateRoomItem.super.onEnter(self)
  104. -- 整理不同局数对应的房卡消耗
  105. local payTypes={}
  106. local gameConfig = app.user:getGameConfig(GAME_IDS.zigongMJ)--app.gameId);
  107. if gameConfig then
  108. local arrGameRound = toNumberArray(",")(gameConfig.gameRound)
  109. local arrRequireCards = toNumberArray(",")(gameConfig.requireCards)
  110. local arrRequireCardsAA = toNumberArray(",")(gameConfig.AArequireCards)
  111. for idx, gameRound in ipairs(arrGameRound) do
  112. payTypes[gameRound] =
  113. {
  114. roomCard = arrRequireCards[idx],
  115. roomCardAA = arrRequireCardsAA[idx],
  116. }
  117. end
  118. end
  119. self.cost = payTypes
  120. -- 玩家选择局数后,更新房卡消耗
  121. --[[local function updateCost(gameRound)
  122. local costInfo = payTypes[gameRound]
  123. if costInfo then
  124. self.ui.Items.Text_FangZhu:setText(tostring(costInfo.requireCards or 0))
  125. self.ui.Items.Text_AAPay:setText(tostring(costInfo.requireCardsAA or 0))
  126. end
  127. end --]]
  128. -- 房费
  129. if self.PayRadioManager then
  130. self.PayRadioManager:addItem(self.ui.Items.CheckBox_FangZhu, 0); -- 房主支付
  131. self.PayRadioManager:addItem(self.ui.Items.CheckBox_AAPay, 1); -- AA支付
  132. --self.PayRadioManager:addItem(self.ui.Items.CheckBox_WinFinal, 2); -- 大赢家支付
  133. local default = self:getDefaultValue("deductRule") or 0
  134. self.PayRadioManager:setDefault(default)
  135. --通知创建界面更新显示
  136. local function dispatchUpdateCost()
  137. app:dispatchEvent({name = "onChangePayMode"})
  138. end
  139. self.PayRadioManager:setCallback(dispatchUpdateCost);
  140. self:setDefaultTextColor(self.PayRadioManager,"Text_pay")
  141. --self:updataTextColor(self.PayRadioManager,"Text_pay","radioBox",{0,1})
  142. end
  143. -- 人数
  144. if self.RenShuRadioManager then
  145. self.RenShuRadioManager:addItem(self.ui.Items.CheckBox_playerCount_3, 0); -- 快速开局
  146. self.RenShuRadioManager:addItem(self.ui.Items.CheckBox_playerCount_2, 3); -- 满3人开
  147. self.RenShuRadioManager:addItem(self.ui.Items.CheckBox_playerCount_1, 2); -- 满2人开
  148. local defaultValue = self:getDefaultValue("playnum") or 3
  149. local isfaststart = self:getDefaultValue("isfaststart") or 0
  150. --2人时显示低分加分
  151. local function renShuCallBack(value)
  152. if value == 3 then
  153. self.ui.Items.Layout_DiFenJiaFen:setVisible(false)
  154. self.ui.Items.ImageView_DFJF:setVisible(false)
  155. else
  156. self.ui.Items.Layout_DiFenJiaFen:setVisible(true)
  157. end
  158. if value == 2 then
  159. local default = self:getDefaultValue("twopluobonum") or 2
  160. self.LuoBoCheckBoxManager:setDefault(default)
  161. else
  162. local default = self:getDefaultValue("luobonum") or 0
  163. self.LuoBoCheckBoxManager:setDefault(default)
  164. end
  165. self.ui.Items.Layout_1:requestDoLayout()
  166. self.ui.Items.Layout_1:doLayout();
  167. end
  168. if isfaststart==1 then
  169. self.RenShuRadioManager:setDefault(0);
  170. renShuCallBack(0)
  171. else
  172. self.RenShuRadioManager:setDefault(defaultValue);
  173. renShuCallBack(defaultValue)
  174. end
  175. self:setDefaultTextColor(self.RenShuRadioManager,"Text_player")
  176. self:updataTextColor(self.RenShuRadioManager,"Text_player","radioBox",{0,3,2})
  177. self.RenShuRadioManager:setCallback(renShuCallBack);
  178. end
  179. --快速成局说明
  180. self.ui.Items.ImageView_KSCJ:setVisible(false)
  181. self.ui.Items.Button_KSCJ:registerClick(function()
  182. self.ui.Items.ImageView_KSCJ:setVisible(not self.ui.Items.ImageView_KSCJ:isVisible())
  183. end)
  184. --低分加分说明
  185. self.ui.Items.ImageView_DFJF:setVisible(false)
  186. self.ui.Items.Button_DFJF:registerClick(function()
  187. self.ui.Items.ImageView_DFJF:setVisible(not self.ui.Items.ImageView_DFJF:isVisible())
  188. end)
  189. -- 封顶
  190. if self.FengDingCheckBoxManager then
  191. self.FengDingCheckBoxManager:addItem(self.ui.Items.CheckBox_3fan, 3); -- 3番
  192. self.FengDingCheckBoxManager:addItem(self.ui.Items.CheckBox_4fan, 4); -- 4番
  193. self.FengDingCheckBoxManager:addItem(self.ui.Items.CheckBox_5fan, 5); -- 5番
  194. local default = self:getDefaultValue("limitfan") or 5
  195. self.FengDingCheckBoxManager:setDefault(default)
  196. self:setDefaultTextColor(self.FengDingCheckBoxManager,"Text_limit")
  197. --self:updataTextColor(self.FengDingCheckBoxManager,"Text_limit","radioBox",{5,6})
  198. end
  199. -- 自摸
  200. if self.ZiMoCheckBoxManager then
  201. self.ZiMoCheckBoxManager:addItem(self.ui.Items.CheckBox_ZiMo_1, 1); -- 自摸加底
  202. self.ZiMoCheckBoxManager:addItem(self.ui.Items.CheckBox_ZiMo_2, 2); -- 自摸加番
  203. self.ZiMoCheckBoxManager:addItem(self.ui.Items.CheckBox_ZiMo_3, 0); -- 自摸不加
  204. local default = self:getDefaultValue("zimomode") or 1
  205. self.ZiMoCheckBoxManager:setDefault(default)
  206. end
  207. -- 点杠
  208. if self.DianGangCheckBoxManager then
  209. self.DianGangCheckBoxManager:addItem(self.ui.Items.CheckBox_gang_1, 2); -- 自摸
  210. self.DianGangCheckBoxManager:addItem(self.ui.Items.CheckBox_gang_2, 1); -- 点炮
  211. local default = self:getDefaultValue("dianganghua") or 2
  212. self.DianGangCheckBoxManager:setDefault(default)
  213. end
  214. -- 飘
  215. if self.PiaoCheckBoxManager then
  216. self.PiaoCheckBoxManager:addItem(self.ui.Items.CheckBox_0Piao, 0); -- 不飘
  217. self.PiaoCheckBoxManager:addItem(self.ui.Items.CheckBox_1Piao, 1); -- 随飘
  218. self.PiaoCheckBoxManager:addItem(self.ui.Items.CheckBox_2Piao, 2); -- 必飘
  219. local default = self:getDefaultValue("piaomode") or 0
  220. self.PiaoCheckBoxManager:setDefault(default)
  221. end
  222. -- 萝卜
  223. if self.LuoBoCheckBoxManager then
  224. self.LuoBoCheckBoxManager:addItem(self.ui.Items.CheckBox_0LuoBo, 0); -- 0萝卜
  225. self.LuoBoCheckBoxManager:addItem(self.ui.Items.CheckBox_1LuoBo, 1); -- 1萝卜
  226. self.LuoBoCheckBoxManager:addItem(self.ui.Items.CheckBox_2LuoBo, 2); -- 2萝卜
  227. local playnum = self.RenShuRadioManager:getResult()
  228. local default = 0
  229. if playnum == 2 then
  230. default = self:getDefaultValue("twopluobonum") or 2
  231. else
  232. default = self:getDefaultValue("luobonum") or 0
  233. end
  234. self.LuoBoCheckBoxManager:setDefault(default)
  235. self:setDefaultTextColor(self.LuoBoCheckBoxManager,"Text_luobo")
  236. --self:updataTextColor(self.LuoBoCheckBoxManager,"Text_gui","radioBox",{4,8,12})
  237. end
  238. --玩法
  239. if self.WanFaCheckBoxManager then
  240. self.WanFaCheckBoxManager:addItem(self.ui.Items.CheckBox_JinGouDiao, "jingoudiao", 1, 0)
  241. self.WanFaCheckBoxManager:addItem(self.ui.Items.CheckBox_BaoJiao, "baojiao", 1, 0)
  242. self.WanFaCheckBoxManager:addItem(self.ui.Items.CheckBox_TingPai, "tingpai", 1, 0)
  243. self.WanFaCheckBoxManager:addItem(self.ui.Items.CheckBox_GZSPH, "guozhang", 0x0001, 0)
  244. self.WanFaCheckBoxManager:addItem(self.ui.Items.CheckBox_BoZiMo, "bozimo", 0x0002, 0)
  245. local jingoudiao = self:getDefaultValue("jingoudiao") or 1
  246. local baojiao = self:getDefaultValue("baojiao") or 1
  247. local tingpai = self:getDefaultValue("tingpai") or 1
  248. local specrule = self:getDefaultValue("specrule") or 0
  249. local selecteds = {}
  250. if jingoudiao==1 then
  251. table.insert(selecteds,"jingoudiao")
  252. end
  253. if baojiao==1 then
  254. table.insert(selecteds,"baojiao")
  255. else
  256. self.ui.Items.CheckBox_BoZiMo:setVisible(false)
  257. end
  258. if tingpai==1 then
  259. table.insert(selecteds,"tingpai")
  260. end
  261. if getNumBand(specrule, 0x0001)>0 then
  262. table.insert(selecteds, "guozhang")
  263. end
  264. if getNumBand(specrule, 0x0002)>0 then
  265. table.insert(selecteds, "bozimo")
  266. end
  267. self.WanFaCheckBoxManager:setDefault(selecteds)
  268. self:setDefaultTextColor()
  269. self:updataTextColor(self.WanFaCheckBoxManager,"","checkBox",{})
  270. end
  271. self.curJFBS = self:getDefaultValue("baseMulti") or 1;
  272. -- 低分加分
  273. if self.DiFenJiaFenCheckBoxManager then
  274. self.DiFenJiaFenCheckBoxManager:addItem(self.ui.Items.CheckBox_BuJiaFen, 0);-- 不加分
  275. self.DiFenJiaFenCheckBoxManager:addItem(self.ui.Items.CheckBox_JiaFen, 1); -- 加分
  276. local default = self:getDefaultValue("diFenLimit") or 0
  277. if default > 0 then
  278. default = 1
  279. end
  280. self.DiFenJiaFenCheckBoxManager:setDefault(default)
  281. --self:setDefaultTextColor(self.DiFenJiaFenCheckBoxManager,"Text_difenjiadi")
  282. end
  283. --小于多少分
  284. self._txtLimitScore = self.ui.Items.Text_limitScore
  285. local lstMin, lsMax = 1, 40
  286. self.Slider_limitScore = self.ui.Items.Slider_limitScore
  287. self.Slider_limitScore:addEventListener(function ( sender, eventType)
  288. if eventType == 0 then
  289. local per = sender:getPercent()
  290. self.limitScore = math.floor(lstMin + (lsMax-lstMin)/100 * per)
  291. self.curJFBS = self.curJFBS or 1
  292. self._txtLimitScore:setString(string.format("%d", self.limitScore * math.ceil(self.curJFBS)))
  293. end
  294. end)
  295. -- default
  296. self.limitScore = self:getDefaultValue("diFenLimit") or 5
  297. if self.limitScore == 0 then
  298. self.limitScore = 5
  299. elseif self.curJFBS > 0 then
  300. self.limitScore = self.limitScore/math.ceil(self.curJFBS)
  301. end
  302. self._txtLimitScore:setString(string.format("%d", tonumber(self.limitScore)))
  303. local lastlsPer = (self.limitScore-lstMin)/(lsMax-lstMin)*100
  304. self.Slider_limitScore:setPercent(lastlsPer)
  305. --加多少分
  306. self._txtAddScore = self.ui.Items.Text_addScore
  307. local asMin, asMax = 1, 40
  308. self.sliderAddScore = self.ui.Items.Slider_addScore
  309. self.sliderAddScore:addEventListener(function ( sender, eventType)
  310. if eventType == 0 then
  311. local per = sender:getPercent()
  312. self.addScore = math.floor(asMin + (asMax-asMin)/100 * per)
  313. self.curJFBS = self.curJFBS or 1
  314. self._txtAddScore:setString(string.format("%d", self.addScore*math.ceil(self.curJFBS)))
  315. end
  316. end)
  317. -- default
  318. self.addScore = self:getDefaultValue("diFenAdd") or 5
  319. if self.addScore == 0 then
  320. self.addScore = 5
  321. elseif self.curJFBS > 0 then
  322. self.addScore = self.addScore/math.ceil(self.curJFBS)
  323. end
  324. self._txtAddScore:setString(string.format("%d", tonumber(self.addScore)))
  325. local lastfaPer = (self.addScore-asMin)/(asMax-asMin)*100
  326. self.sliderAddScore:setPercent(lastfaPer)
  327. self:initLayoutEvent()
  328. self:initOtherCheckBoxManager()
  329. self:initJiFenBeiShu()
  330. end
  331. ---
  332. -- 初始化其他选项
  333. -- @return
  334. --
  335. function MJCreateRoomItem:initOtherCheckBoxManager ()
  336. if not self.otherCheckBoxManager then
  337. return
  338. end
  339. self.otherCheckBoxManager:addItem(self.ui.Items.CheckBox_ForbidProp, "forbidProp", 1, 0)--屏蔽快捷语与道具
  340. self.otherCheckBoxManager:addItem(self.ui.Items.CheckBox_ForbidVoice, "forbidVoice", 1, 0)--屏蔽语音
  341. local forbidProp = self:getDefaultValue("forbidProp") or 0
  342. local forbidVoice = self:getDefaultValue("forbidVoice") or 0
  343. local defaults = {}
  344. if forbidProp > 0 then
  345. table.insert(defaults, "forbidProp")
  346. end
  347. if forbidVoice == 1 then
  348. table.insert(defaults, "forbidVoice")
  349. end
  350. self.otherCheckBoxManager:setDefault(defaults)
  351. end
  352. -- 面板的点击事件,点击面板后,隐藏所有提示
  353. function MJCreateRoomItem:initLayoutEvent()
  354. self.ui.Items.Layout_1:registerClick(function()
  355. local buttons = {
  356. {buttonName = "Button_KSCJ", tipsName = "ImageView_KSCJ"},
  357. {buttonName = "Button_JFBS", tipsName = "ImageView_JFBS"},
  358. {buttonName = "Button_DFJF", tipsName = "ImageView_DFJF"},
  359. };
  360. -- 隐藏其他提示信息
  361. for k, v in ipairs(buttons) do
  362. local tipsNode = self.ui.Items[v.tipsName]
  363. tipsNode:setVisible(false)
  364. end
  365. end)
  366. end
  367. -- 初始化积分倍数
  368. function MJCreateRoomItem:initJiFenBeiShu()
  369. self.ui.Items.Button_jia:registerClick(handler(self, self.onClickAdd))
  370. self.ui.Items.Button_jian:registerClick(handler(self, self.onClickJian))
  371. self.curJFBS = self:getDefaultValue("baseMulti") or 1;
  372. self:updateJiFenBeiShu()
  373. --积分倍数说明
  374. self.ui.Items.ImageView_JFBS:setVisible(false)
  375. self.ui.Items.Button_JFBS:registerClick(function()
  376. self.ui.Items.ImageView_JFBS:setVisible(not self.ui.Items.ImageView_JFBS:isVisible())
  377. end)
  378. end
  379. --更新积分倍数
  380. function MJCreateRoomItem:updateJiFenBeiShu()
  381. self.curJFBS = self.curJFBS >= 1.0 and math.floor(self.curJFBS) or self.curJFBS;
  382. self.ui.Items.Text_jifen:setText(self.curJFBS)
  383. self.ui.Items.Button_jia:setEnabled(self.curJFBS ~= 100)
  384. self.ui.Items.Button_jian:setEnabled(self.curJFBS ~= 0.1)
  385. self._txtLimitScore:setString(string.format("%d", self.limitScore * math.ceil(self.curJFBS)))
  386. self._txtAddScore:setString(string.format("%d", self.addScore*math.ceil(self.curJFBS)))
  387. end
  388. --按钮加
  389. function MJCreateRoomItem:onClickAdd()
  390. playBtnEffect()
  391. if not self.curJFBS then
  392. return
  393. end
  394. if self.curJFBS >= 1.0 then
  395. self.curJFBS = self.curJFBS + 1.0
  396. else
  397. self.curJFBS = self.curJFBS + 0.1
  398. end
  399. if self.curJFBS >= 100 then
  400. self.curJFBS = 100;
  401. end
  402. self:updateJiFenBeiShu()
  403. end
  404. --按钮减
  405. function MJCreateRoomItem:onClickJian()
  406. playBtnEffect()
  407. if not self.curJFBS then
  408. return
  409. end
  410. if self.curJFBS <= 1.0 then
  411. self.curJFBS = self.curJFBS - 0.1
  412. else
  413. self.curJFBS = self.curJFBS - 1.0
  414. end
  415. if self.curJFBS <= 0.1 then
  416. self.curJFBS = 0.1
  417. end
  418. self:updateJiFenBeiShu()
  419. end
  420. --设置选中值默认颜色
  421. function MJCreateRoomItem:setDefaultTextColor(radio,text)
  422. if radio then
  423. local index = radio:getResult()
  424. local defaultText = string.format(text.."%d",index)
  425. self.ui.Items[defaultText]:setTextColor(SELECT_COLOR)
  426. end
  427. local result = self.WanFaCheckBoxManager:getResult2()
  428. if result.baojiao == 1 then
  429. self.ui.Items.Text_BaoJiao:setTextColor(SELECT_COLOR)
  430. end
  431. end
  432. --点击checkBox时,改变其text的颜色
  433. function MJCreateRoomItem:updataTextColor(radio,text,boxType,valueTab)
  434. local function updataRadioTextColor()
  435. if boxType == "radioBox" then
  436. local index = radio:getResult()
  437. for k,value in pairs(valueTab) do
  438. local item = string.format(text.."%d",value)
  439. self.ui.Items[item]:setTextColor(NON_SELECT_COLOR)
  440. if value == index then
  441. self.ui.Items[item]:setTextColor(SELECT_COLOR)
  442. end
  443. end
  444. elseif boxType == "checkBox" then
  445. local result = self.WanFaCheckBoxManager:getResult2()
  446. local result = self.WanFaCheckBoxManager:getResult2()
  447. if result.baojiao == 1 then
  448. self.ui.Items.Text_BaoJiao:setTextColor(SELECT_COLOR)
  449. self.ui.Items.CheckBox_BoZiMo:setVisible(true)
  450. else
  451. self.ui.Items.Text_BaoJiao:setTextColor(NON_SELECT_COLOR)
  452. self.ui.Items.CheckBox_BoZiMo:setVisible(false)
  453. end
  454. end
  455. end
  456. radio:setCallback(updataRadioTextColor);
  457. end
  458. function MJCreateRoomItem:getRuleResult()
  459. local game_num = self.JuShuRadioManager:getResult()
  460. local payMode = self.PayRadioManager:getResult()
  461. local playnum = self.RenShuRadioManager:getResult()
  462. local isfaststart = playnum==0 and 1 or 0
  463. playnum = playnum==0 and 3 or playnum
  464. --下面两局代码限制只有三人模式,没有快速成局
  465. --isfaststart = 0
  466. --playnum = 3
  467. local limitfan = self.FengDingCheckBoxManager:getResult()
  468. local luobonum = self.LuoBoCheckBoxManager:getResult()
  469. local zimomode = self.ZiMoCheckBoxManager:getResult()
  470. local dianganghua = self.DianGangCheckBoxManager:getResult()
  471. local piaomode = self.PiaoCheckBoxManager:getResult()
  472. local difenjiadi = self.DiFenJiaFenCheckBoxManager:getResult()
  473. local wanFaResult = self.WanFaCheckBoxManager:getResult2()
  474. local jingoudiao = wanFaResult.jingoudiao
  475. local baojiao = wanFaResult.baojiao
  476. local tingpai = wanFaResult.tingpai
  477. local specrule = 0
  478. specrule = getNumOr(specrule, wanFaResult.guozhang)
  479. if baojiao == 1 then
  480. specrule = getNumOr(specrule, wanFaResult.bozimo)
  481. end
  482. local diFenLimit = 0
  483. local diFenAdd = 0
  484. if difenjiadi > 0 and (playnum == 2 or isfaststart == 1) then
  485. diFenLimit = tonumber(self._txtLimitScore:getText())
  486. diFenAdd = tonumber(self._txtAddScore:getText())
  487. end
  488. local twopluobonum = self:getDefaultValue("twopluobonum") or 2
  489. if playnum == 2 then
  490. twopluobonum = luobonum
  491. end
  492. local other = self.otherCheckBoxManager:getResult2()
  493. local forbidProp = other["forbidProp"]
  494. local forbidVoice = other["forbidVoice"]
  495. self.defaultValus =
  496. {
  497. gamerule = 1,
  498. totalgamenum = game_num,
  499. deductRule = payMode,
  500. playnum = playnum,
  501. isfaststart = isfaststart,
  502. limitfan = limitfan,
  503. luobonum = luobonum,
  504. zimomode = zimomode,
  505. dianganghua = dianganghua,
  506. piaomode = piaomode,
  507. jingoudiao = jingoudiao,
  508. baojiao = baojiao,
  509. tingpai = tingpai,
  510. specrule = specrule,
  511. diFenLimit = diFenLimit,
  512. diFenAdd = diFenAdd,
  513. twopluobonum = twopluobonum,
  514. baseMulti = self.curJFBS,
  515. forbidProp = forbidProp,
  516. forbidVoice = forbidVoice,
  517. }
  518. -- 保存玩家的选择
  519. self:saveDefaultValues()
  520. local strGameInfo = json.encode(self.defaultValus);
  521. return game_num, strGameInfo
  522. end
  523. return MJCreateRoomItem