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.

599 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("zigong7zCreateRoomItem",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, "zigong7zmj_room.json")
  11. local ui = loadUI("res/ui/ui_chuangjian/mj_createroom_zigong7z.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.zigong7zMJ)--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_1, 3); -- 3人
  146. self.RenShuRadioManager:addItem(self.ui.Items.CheckBox_playerCount_2, 4); -- 4人
  147. self.RenShuRadioManager:addItem(self.ui.Items.CheckBox_playerCount_3, 5); -- 5人
  148. self.RenShuRadioManager:addItem(self.ui.Items.CheckBox_playerCount_4, 6); -- 6人
  149. self.RenShuRadioManager:addItem(self.ui.Items.CheckBox_playerCount_5, 0); -- 快速开局
  150. local defaultValue = self:getDefaultValue("playnum") or 3
  151. local isfaststart = self:getDefaultValue("isfaststart") or 0
  152. --2人时显示低分加分
  153. local function renShuCallBack(value)
  154. -- if value == 3 then
  155. -- self.ui.Items.Layout_DiFenJiaFen:setVisible(false)
  156. -- self.ui.Items.ImageView_DFJF:setVisible(false)
  157. -- else
  158. -- self.ui.Items.Layout_DiFenJiaFen:setVisible(true)
  159. -- end
  160. if value == 2 then
  161. local default = self:getDefaultValue("twopluobonum") or 2
  162. self.LuoBoCheckBoxManager:setDefault(default)
  163. else
  164. local default = self:getDefaultValue("luobonum") or 0
  165. self.LuoBoCheckBoxManager:setDefault(default)
  166. end
  167. -- self.ui.Items.Layout_1:requestDoLayout()
  168. -- self.ui.Items.Layout_1:doLayout();
  169. end
  170. if isfaststart==1 then
  171. self.RenShuRadioManager:setDefault(0);
  172. renShuCallBack(0)
  173. else
  174. self.RenShuRadioManager:setDefault(defaultValue);
  175. renShuCallBack(defaultValue)
  176. end
  177. self:setDefaultTextColor(self.RenShuRadioManager,"Text_player")
  178. self:updataTextColor(self.RenShuRadioManager,"Text_player","radioBox",{3,4,5,6,0})
  179. self.RenShuRadioManager:setCallback(renShuCallBack);
  180. end
  181. --快速成局说明
  182. self.ui.Items.ImageView_KSCJ:setVisible(false)
  183. self.ui.Items.Button_KSCJ:registerClick(function()
  184. self.ui.Items.ImageView_KSCJ:setVisible(not self.ui.Items.ImageView_KSCJ:isVisible())
  185. end)
  186. --低分加分说明
  187. self.ui.Items.ImageView_DFJF:setVisible(false)
  188. self.ui.Items.Button_DFJF:registerClick(function()
  189. self.ui.Items.ImageView_DFJF:setVisible(not self.ui.Items.ImageView_DFJF:isVisible())
  190. end)
  191. -- 封顶
  192. if self.FengDingCheckBoxManager then
  193. self.FengDingCheckBoxManager:addItem(self.ui.Items.CheckBox_3fan, 3); -- 3番
  194. self.FengDingCheckBoxManager:addItem(self.ui.Items.CheckBox_4fan, 4); -- 4番
  195. self.FengDingCheckBoxManager:addItem(self.ui.Items.CheckBox_5fan, 5); -- 5番
  196. local default = self:getDefaultValue("limitfan") or 5
  197. self.FengDingCheckBoxManager:setDefault(default)
  198. self:setDefaultTextColor(self.FengDingCheckBoxManager,"Text_limit")
  199. --self:updataTextColor(self.FengDingCheckBoxManager,"Text_limit","radioBox",{5,6})
  200. end
  201. -- 自摸
  202. if self.ZiMoCheckBoxManager then
  203. self.ZiMoCheckBoxManager:addItem(self.ui.Items.CheckBox_ZiMo_1, 1); -- 自摸加底
  204. self.ZiMoCheckBoxManager:addItem(self.ui.Items.CheckBox_ZiMo_2, 2); -- 自摸加番
  205. self.ZiMoCheckBoxManager:addItem(self.ui.Items.CheckBox_ZiMo_3, 0); -- 自摸不加
  206. local default = self:getDefaultValue("zimomode") or 1
  207. self.ZiMoCheckBoxManager:setDefault(default)
  208. end
  209. -- 点杠
  210. if self.DianGangCheckBoxManager then
  211. self.DianGangCheckBoxManager:addItem(self.ui.Items.CheckBox_gang_1, 2); -- 自摸
  212. self.DianGangCheckBoxManager:addItem(self.ui.Items.CheckBox_gang_2, 1); -- 点炮
  213. local default = self:getDefaultValue("dianganghua") or 2
  214. self.DianGangCheckBoxManager:setDefault(default)
  215. end
  216. -- 飘
  217. if self.PiaoCheckBoxManager then
  218. self.PiaoCheckBoxManager:addItem(self.ui.Items.CheckBox_0Piao, 0); -- 不飘
  219. self.PiaoCheckBoxManager:addItem(self.ui.Items.CheckBox_1Piao, 1); -- 随飘
  220. self.PiaoCheckBoxManager:addItem(self.ui.Items.CheckBox_2Piao, 2); -- 必飘
  221. local default = self:getDefaultValue("piaomode") or 0
  222. self.PiaoCheckBoxManager:setDefault(default)
  223. end
  224. -- 萝卜
  225. if self.LuoBoCheckBoxManager then
  226. self.LuoBoCheckBoxManager:addItem(self.ui.Items.CheckBox_0LuoBo, 0); -- 0萝卜
  227. self.LuoBoCheckBoxManager:addItem(self.ui.Items.CheckBox_1LuoBo, 1); -- 1萝卜
  228. self.LuoBoCheckBoxManager:addItem(self.ui.Items.CheckBox_2LuoBo, 2); -- 2萝卜
  229. local playnum = self.RenShuRadioManager:getResult()
  230. local default = 0
  231. if playnum == 2 then
  232. default = self:getDefaultValue("twopluobonum") or 2
  233. else
  234. default = self:getDefaultValue("luobonum") or 0
  235. end
  236. self.LuoBoCheckBoxManager:setDefault(default)
  237. self:setDefaultTextColor(self.LuoBoCheckBoxManager,"Text_luobo")
  238. --self:updataTextColor(self.LuoBoCheckBoxManager,"Text_gui","radioBox",{4,8,12})
  239. end
  240. --玩法
  241. if self.WanFaCheckBoxManager then
  242. self.WanFaCheckBoxManager:addItem(self.ui.Items.CheckBox_JinGouDiao, "jingoudiao", 1, 0)
  243. self.WanFaCheckBoxManager:addItem(self.ui.Items.CheckBox_BaoJiao, "baojiao", 1, 0)
  244. self.WanFaCheckBoxManager:addItem(self.ui.Items.CheckBox_TingPai, "tingpai", 1, 0)
  245. self.WanFaCheckBoxManager:addItem(self.ui.Items.CheckBox_GZSPH, "guozhang", 0x0001, 0)
  246. self.WanFaCheckBoxManager:addItem(self.ui.Items.CheckBox_BoZiMo, "bozimo", 0x0002, 0)
  247. local jingoudiao = self:getDefaultValue("jingoudiao") or 1
  248. local baojiao = self:getDefaultValue("baojiao") or 1
  249. local tingpai = self:getDefaultValue("tingpai") or 1
  250. local specrule = self:getDefaultValue("specrule") or 0
  251. local selecteds = {}
  252. if jingoudiao==1 then
  253. table.insert(selecteds,"jingoudiao")
  254. end
  255. if baojiao==1 then
  256. table.insert(selecteds,"baojiao")
  257. else
  258. self.ui.Items.CheckBox_BoZiMo:setVisible(false)
  259. end
  260. if tingpai==1 then
  261. table.insert(selecteds,"tingpai")
  262. end
  263. if getNumBand(specrule, 0x0001)>0 then
  264. table.insert(selecteds, "guozhang")
  265. end
  266. if getNumBand(specrule, 0x0002)>0 then
  267. table.insert(selecteds, "bozimo")
  268. end
  269. self.WanFaCheckBoxManager:setDefault(selecteds)
  270. self:setDefaultTextColor()
  271. self:updataTextColor(self.WanFaCheckBoxManager,"","checkBox",{})
  272. end
  273. self.curJFBS = self:getDefaultValue("baseMulti") or 1;
  274. -- 低分加分
  275. if self.DiFenJiaFenCheckBoxManager then
  276. self.DiFenJiaFenCheckBoxManager:addItem(self.ui.Items.CheckBox_BuJiaFen, 0);-- 不加分
  277. self.DiFenJiaFenCheckBoxManager:addItem(self.ui.Items.CheckBox_JiaFen, 1); -- 加分
  278. local default = self:getDefaultValue("diFenLimit") or 0
  279. if default > 0 then
  280. default = 1
  281. end
  282. self.DiFenJiaFenCheckBoxManager:setDefault(default)
  283. --self:setDefaultTextColor(self.DiFenJiaFenCheckBoxManager,"Text_difenjiadi")
  284. end
  285. --小于多少分
  286. self._txtLimitScore = self.ui.Items.Text_limitScore
  287. local lstMin, lsMax = 1, 40
  288. self.Slider_limitScore = self.ui.Items.Slider_limitScore
  289. self.Slider_limitScore:addEventListener(function ( sender, eventType)
  290. if eventType == 0 then
  291. local per = sender:getPercent()
  292. self.limitScore = math.floor(lstMin + (lsMax-lstMin)/100 * per)
  293. self.curJFBS = self.curJFBS or 1
  294. self._txtLimitScore:setString(string.format("%d", self.limitScore * math.ceil(self.curJFBS)))
  295. end
  296. end)
  297. -- default
  298. self.limitScore = self:getDefaultValue("diFenLimit") or 5
  299. if self.limitScore == 0 then
  300. self.limitScore = 5
  301. elseif self.curJFBS > 0 then
  302. self.limitScore = self.limitScore/math.ceil(self.curJFBS)
  303. end
  304. self._txtLimitScore:setString(string.format("%d", tonumber(self.limitScore)))
  305. local lastlsPer = (self.limitScore-lstMin)/(lsMax-lstMin)*100
  306. self.Slider_limitScore:setPercent(lastlsPer)
  307. --加多少分
  308. self._txtAddScore = self.ui.Items.Text_addScore
  309. local asMin, asMax = 1, 40
  310. self.sliderAddScore = self.ui.Items.Slider_addScore
  311. self.sliderAddScore:addEventListener(function ( sender, eventType)
  312. if eventType == 0 then
  313. local per = sender:getPercent()
  314. self.addScore = math.floor(asMin + (asMax-asMin)/100 * per)
  315. self.curJFBS = self.curJFBS or 1
  316. self._txtAddScore:setString(string.format("%d", self.addScore*math.ceil(self.curJFBS)))
  317. end
  318. end)
  319. -- default
  320. self.addScore = self:getDefaultValue("diFenAdd") or 5
  321. if self.addScore == 0 then
  322. self.addScore = 5
  323. elseif self.curJFBS > 0 then
  324. self.addScore = self.addScore/math.ceil(self.curJFBS)
  325. end
  326. self._txtAddScore:setString(string.format("%d", tonumber(self.addScore)))
  327. local lastfaPer = (self.addScore-asMin)/(asMax-asMin)*100
  328. self.sliderAddScore:setPercent(lastfaPer)
  329. self:initLayoutEvent()
  330. self:initOtherCheckBoxManager()
  331. self:initJiFenBeiShu()
  332. -- 隐藏底分加分选项
  333. self.ui.Items.Layout_DiFenJiaFen:setVisible(false)
  334. self.ui.Items.Layout_1:requestDoLayout()
  335. self.ui.Items.Layout_1:doLayout()
  336. -- 隐藏搏自摸选项
  337. self.ui.Items.CheckBox_BoZiMo:setVisible(false)
  338. end
  339. ---
  340. -- 初始化其他选项
  341. -- @return
  342. --
  343. function MJCreateRoomItem:initOtherCheckBoxManager ()
  344. if not self.otherCheckBoxManager then
  345. return
  346. end
  347. self.otherCheckBoxManager:addItem(self.ui.Items.CheckBox_ForbidProp, "forbidProp", 1, 0)--屏蔽快捷语与道具
  348. self.otherCheckBoxManager:addItem(self.ui.Items.CheckBox_ForbidVoice, "forbidVoice", 1, 0)--屏蔽语音
  349. local forbidProp = self:getDefaultValue("forbidProp") or 0
  350. local forbidVoice = self:getDefaultValue("forbidVoice") or 0
  351. local defaults = {}
  352. if forbidProp > 0 then
  353. table.insert(defaults, "forbidProp")
  354. end
  355. if forbidVoice == 1 then
  356. table.insert(defaults, "forbidVoice")
  357. end
  358. self.otherCheckBoxManager:setDefault(defaults)
  359. end
  360. -- 面板的点击事件,点击面板后,隐藏所有提示
  361. function MJCreateRoomItem:initLayoutEvent()
  362. self.ui.Items.Layout_1:registerClick(function()
  363. local buttons = {
  364. {buttonName = "Button_KSCJ", tipsName = "ImageView_KSCJ"},
  365. {buttonName = "Button_JFBS", tipsName = "ImageView_JFBS"},
  366. {buttonName = "Button_DFJF", tipsName = "ImageView_DFJF"},
  367. };
  368. -- 隐藏其他提示信息
  369. for k, v in ipairs(buttons) do
  370. local tipsNode = self.ui.Items[v.tipsName]
  371. tipsNode:setVisible(false)
  372. end
  373. end)
  374. end
  375. -- 初始化积分倍数
  376. function MJCreateRoomItem:initJiFenBeiShu()
  377. self.ui.Items.Button_jia:registerClick(handler(self, self.onClickAdd))
  378. self.ui.Items.Button_jian:registerClick(handler(self, self.onClickJian))
  379. self.curJFBS = self:getDefaultValue("baseMulti") or 1;
  380. self:updateJiFenBeiShu()
  381. --积分倍数说明
  382. self.ui.Items.ImageView_JFBS:setVisible(false)
  383. self.ui.Items.Button_JFBS:registerClick(function()
  384. self.ui.Items.ImageView_JFBS:setVisible(not self.ui.Items.ImageView_JFBS:isVisible())
  385. end)
  386. end
  387. --更新积分倍数
  388. function MJCreateRoomItem:updateJiFenBeiShu()
  389. self.curJFBS = self.curJFBS >= 1.0 and math.floor(self.curJFBS) or self.curJFBS;
  390. self.ui.Items.Text_jifen:setText(self.curJFBS)
  391. self.ui.Items.Button_jia:setEnabled(self.curJFBS ~= 100)
  392. self.ui.Items.Button_jian:setEnabled(self.curJFBS ~= 0.1)
  393. self._txtLimitScore:setString(string.format("%d", self.limitScore * math.ceil(self.curJFBS)))
  394. self._txtAddScore:setString(string.format("%d", self.addScore*math.ceil(self.curJFBS)))
  395. end
  396. --按钮加
  397. function MJCreateRoomItem:onClickAdd()
  398. playBtnEffect()
  399. if not self.curJFBS then
  400. return
  401. end
  402. if self.curJFBS >= 1.0 then
  403. self.curJFBS = self.curJFBS + 1.0
  404. else
  405. self.curJFBS = self.curJFBS + 0.1
  406. end
  407. if self.curJFBS >= 100 then
  408. self.curJFBS = 100;
  409. end
  410. self:updateJiFenBeiShu()
  411. end
  412. --按钮减
  413. function MJCreateRoomItem:onClickJian()
  414. playBtnEffect()
  415. if not self.curJFBS then
  416. return
  417. end
  418. if self.curJFBS <= 1.0 then
  419. self.curJFBS = self.curJFBS - 0.1
  420. else
  421. self.curJFBS = self.curJFBS - 1.0
  422. end
  423. if self.curJFBS <= 0.1 then
  424. self.curJFBS = 0.1
  425. end
  426. self:updateJiFenBeiShu()
  427. end
  428. --设置选中值默认颜色
  429. function MJCreateRoomItem:setDefaultTextColor(radio,text)
  430. if radio then
  431. local index = radio:getResult()
  432. local defaultText = string.format(text.."%d",index)
  433. self.ui.Items[defaultText]:setTextColor(SELECT_COLOR)
  434. end
  435. local result = self.WanFaCheckBoxManager:getResult2()
  436. if result.baojiao == 1 then
  437. self.ui.Items.Text_BaoJiao:setTextColor(SELECT_COLOR)
  438. end
  439. end
  440. --点击checkBox时,改变其text的颜色
  441. function MJCreateRoomItem:updataTextColor(radio,text,boxType,valueTab)
  442. local function updataRadioTextColor()
  443. if boxType == "radioBox" then
  444. local index = radio:getResult()
  445. for k,value in pairs(valueTab) do
  446. local item = string.format(text.."%d",value)
  447. self.ui.Items[item]:setTextColor(NON_SELECT_COLOR)
  448. if value == index then
  449. self.ui.Items[item]:setTextColor(SELECT_COLOR)
  450. end
  451. end
  452. elseif boxType == "checkBox" then
  453. local result = self.WanFaCheckBoxManager:getResult2()
  454. local result = self.WanFaCheckBoxManager:getResult2()
  455. if result.baojiao == 1 then
  456. self.ui.Items.Text_BaoJiao:setTextColor(SELECT_COLOR)
  457. -- self.ui.Items.CheckBox_BoZiMo:setVisible(true)
  458. else
  459. self.ui.Items.Text_BaoJiao:setTextColor(NON_SELECT_COLOR)
  460. self.ui.Items.CheckBox_BoZiMo:setVisible(false)
  461. end
  462. end
  463. end
  464. radio:setCallback(updataRadioTextColor);
  465. end
  466. function MJCreateRoomItem:getRuleResult()
  467. local game_num = self.JuShuRadioManager:getResult()
  468. local payMode = self.PayRadioManager:getResult()
  469. local playnum = self.RenShuRadioManager:getResult()
  470. local isfaststart = playnum==0 and 1 or 0
  471. playnum = playnum==0 and 6 or playnum
  472. --下面两局代码限制只有三人模式,没有快速成局
  473. --isfaststart = 0
  474. --playnum = 3
  475. local limitfan = self.FengDingCheckBoxManager:getResult()
  476. local luobonum = self.LuoBoCheckBoxManager:getResult()
  477. local zimomode = self.ZiMoCheckBoxManager:getResult()
  478. local dianganghua = self.DianGangCheckBoxManager:getResult()
  479. local piaomode = self.PiaoCheckBoxManager:getResult()
  480. local difenjiadi = 0 -- self.DiFenJiaFenCheckBoxManager:getResult()
  481. local wanFaResult = self.WanFaCheckBoxManager:getResult2()
  482. local jingoudiao = wanFaResult.jingoudiao
  483. local baojiao = wanFaResult.baojiao
  484. local tingpai = wanFaResult.tingpai
  485. local specrule = 0
  486. specrule = getNumOr(specrule, wanFaResult.guozhang)
  487. if baojiao == 1 then
  488. -- specrule = getNumOr(specrule, wanFaResult.bozimo)
  489. end
  490. local diFenLimit = 0
  491. local diFenAdd = 0
  492. if difenjiadi > 0 and (playnum == 2 or isfaststart == 1) then
  493. diFenLimit = tonumber(self._txtLimitScore:getText())
  494. diFenAdd = tonumber(self._txtAddScore:getText())
  495. end
  496. local twopluobonum = self:getDefaultValue("twopluobonum") or 2
  497. if playnum == 2 then
  498. twopluobonum = luobonum
  499. end
  500. local other = self.otherCheckBoxManager:getResult2()
  501. local forbidProp = other["forbidProp"]
  502. local forbidVoice = other["forbidVoice"]
  503. self.defaultValus =
  504. {
  505. gamerule = 1,
  506. totalgamenum = game_num,
  507. deductRule = payMode,
  508. playnum = playnum,
  509. isfaststart = isfaststart,
  510. limitfan = limitfan,
  511. luobonum = luobonum,
  512. zimomode = zimomode,
  513. dianganghua = dianganghua,
  514. piaomode = piaomode,
  515. jingoudiao = jingoudiao,
  516. baojiao = baojiao,
  517. tingpai = tingpai,
  518. specrule = specrule,
  519. diFenLimit = diFenLimit,
  520. diFenAdd = diFenAdd,
  521. twopluobonum = twopluobonum,
  522. baseMulti = self.curJFBS,
  523. forbidProp = forbidProp,
  524. forbidVoice = forbidVoice,
  525. }
  526. -- 保存玩家的选择
  527. self:saveDefaultValues()
  528. local strGameInfo = json.encode(self.defaultValus);
  529. return game_num, strGameInfo
  530. end
  531. return MJCreateRoomItem