ClubTableSet.js 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. cc.Class({
  2. extends: cc.BaseClass,
  3. properties: {
  4. Lab1:cc.Label,
  5. Lab2:cc.Label,
  6. Lab3:cc.Label,
  7. Lab4:cc.Label,
  8. LabColor:cc.Label,
  9. Mode1:cc.Node,
  10. Mode2:cc.Node,
  11. Mode3:cc.Node,
  12. Mode4:cc.Node,
  13. Mode5:cc.Node,
  14. ED1:cc.EditBox,
  15. ED2:cc.EditBox,
  16. ED3:cc.EditBox,
  17. ED4:cc.EditBox,
  18. ED5:cc.EditBox,
  19. ED6:cc.EditBox,
  20. ED7:cc.EditBox,
  21. ED8:cc.EditBox,
  22. },
  23. onLoad:function () {
  24. this['1'] = ['大赢家','赢家','所有人'];
  25. this['2'] = ['固定贈送','比例贈送'];
  26. this['3'] = ['紅色','綠色','藍色'];
  27. },
  28. OnShowView:function(){
  29. this.ED1.string = '';
  30. this.ED2.string = '';
  31. this.ED3.string = '';
  32. this.ED4.string = '';
  33. this.ED5.string = '';
  34. this.ED6.string = '';
  35. this.ED7.string = '';
  36. this.ED8.string = '';
  37. },
  38. OnSetRuleInfor:function (wKindID,type,RoomInfor) {
  39. this.$('Node1').active = type>CLUB_KIND_0;
  40. this.RoomInfor = RoomInfor;
  41. // 负分显示
  42. var bMinusMark = false;
  43. for(var i in window.GameMinusMarkList){
  44. if(wKindID == window.GameMinusMarkList[i]){
  45. bMinusMark = true;
  46. }
  47. }
  48. this.$('Node1/Layout2').active = !bMinusMark;
  49. if(!RoomInfor) return;
  50. this.ED1.string = Score2Str(parseInt(RoomInfor.llSitScore));
  51. this.ED2.string = Score2Str(parseInt(RoomInfor.llStandScore));
  52. if(RoomInfor.dwBigRevRules&CLUB_GAME_RULE_1){
  53. this.OnBtTogClick(null,'1_1_0');
  54. }else if(RoomInfor.dwBigRevRules&CLUB_GAME_RULE_2){
  55. this.OnBtTogClick(null,'1_1_1');
  56. }else{
  57. this.OnBtTogClick(null,'1_1_2');
  58. }
  59. if(RoomInfor.dwBigRevRules&CLUB_GAME_RULE_4){
  60. this.OnBtTogClick(null,'2_2_0');
  61. this.ED4.string =Score2Str(parseInt(RoomInfor.dwBigCnt));
  62. }else{
  63. this.OnBtTogClick(null,'2_2_1');
  64. this.ED4.string =RoomInfor.dwBigCnt;
  65. }
  66. if(RoomInfor.dwSmallRevRules&CLUB_GAME_RULE_1){
  67. this.OnBtTogClick(null,'3_1_0');
  68. }else if(RoomInfor.dwSmallRevRules&CLUB_GAME_RULE_2){
  69. this.OnBtTogClick(null,'3_1_1');
  70. }else{
  71. this.OnBtTogClick(null,'3_1_2');
  72. }
  73. if(RoomInfor.dwSmallRevRules&CLUB_GAME_RULE_4){
  74. this.OnBtTogClick(null,'4_2_0');
  75. this.ED6.string =Score2Str(parseInt(RoomInfor.dwSmallCnt));
  76. }else{
  77. this.OnBtTogClick(null,'4_2_1');
  78. this.ED6.string =RoomInfor.dwSmallCnt;
  79. }
  80. this.ED3.string =Score2Str(parseInt(RoomInfor.dwBigMinScore));
  81. // this.ED4.string =RoomInfor.dwBigCnt;
  82. this.ED5.string =Score2Str(parseInt(RoomInfor.dwSmallMinScore));
  83. // this.ED6.string =RoomInfor.dwSmallCnt;
  84. if(RoomInfor.cbReturnType == 1){
  85. this.$('Node1/Layout1/Tog_1@Toggle').check();
  86. }else if(RoomInfor.cbReturnType == 2){
  87. this.$('Node1/Layout1/Tog_2@Toggle').check();
  88. }else{
  89. this.$('Node1/Layout1/Tog_3@Toggle').check();
  90. }
  91. if(RoomInfor.bNegativeScore){
  92. this.$('Node1/Layout2/Tog_1@Toggle').check();
  93. }else{
  94. this.$('Node1/Layout2/Tog_2@Toggle').check();
  95. }
  96. this.ED8.string = RoomInfor.dwMagnification;
  97. this.ED7.string = RoomInfor.szTag;
  98. },
  99. OnBtShowMode:function(_,Data){
  100. this['Mode'+Data].active = true;
  101. },
  102. OnBtTogClick:function(_,Data){
  103. var paraArr = Data.split('_');
  104. if(paraArr.length == 3){
  105. this['Lab'+paraArr[0]].string = this[paraArr[1]][paraArr[2]];
  106. this['Mode'+paraArr[0]].active = false;
  107. }else{
  108. this.LabColor.string = this[paraArr[0]][paraArr[1]];
  109. this.Mode5.active = false;
  110. }
  111. },
  112. OnClickClose:function(){
  113. this.Mode1.active = false;
  114. this.Mode2.active = false;
  115. this.Mode3.active = false;
  116. this.Mode4.active = false;
  117. this.Mode5.active = false;
  118. },
  119. CheckRules:function(){
  120. // if(this.$('Node1/Layout1/Tog_3@Toggle').isChecked && (this.$('BigMode/Mode/Tog2@Toggle').isChecked == false||this.$('BigWinOrAll/Mode/Tog2@Toggle').isChecked == false)){
  121. // this.ShowAlert("输赢平摊模式只支持所有赢家百分比赠送的模式!");
  122. // return false;
  123. // }
  124. // if(this.$('Node1/Layout1/Tog_3@Toggle').isChecked && (this.$('SmallMode/Mode/Tog2@Toggle').isChecked == false||this.$('SmallWinOrAll/Mode/Tog2@Toggle').isChecked == false)){
  125. // this.ShowAlert("输赢平摊模式只支持所有赢家百分比赠送的模式!");
  126. // return false;
  127. // }
  128. if(this.$('Node1/Layout1/Tog_3@Toggle').isChecked && this.$('BigWinOrAll/Mode/Tog3@Toggle').isChecked){
  129. this.ShowAlert("所有人不能選擇輸贏平攤模式!");
  130. return false;
  131. }
  132. if(this.$('Node1/Layout1/Tog_3@Toggle').isChecked && this.$('SmallWinOrAll/Mode/Tog3@Toggle').isChecked){
  133. this.ShowAlert("所有人不能選擇輸贏平攤模式!");
  134. return false;
  135. }
  136. if(this.$('BigMode/Mode/Tog2@Toggle').isChecked && this.$('BigWinOrAll/Mode/Tog3@Toggle').isChecked){
  137. this.ShowAlert("所有人只支持固定贈送!");
  138. return false;
  139. }
  140. if(this.$('SmallMode/Mode/Tog2@Toggle').isChecked && this.$('SmallWinOrAll/Mode/Tog3@Toggle').isChecked){
  141. this.ShowAlert("所有人只支持固定贈送!");
  142. return false;
  143. }
  144. if(parseInt(this.ED4.string)>0 && parseInt(this.ED6.string)>0){
  145. this.ShowAlert("大小局不能同時設定!");
  146. return false;
  147. }
  148. return true;
  149. },
  150. GetRules:function(){
  151. if(this.CheckRules() == false) return null;
  152. var Obj = {};
  153. Obj.llSitScore = this.ED1.string == ''?0:parseInt(this.ED1.string); //参与分
  154. Obj.llStandScore = this.ED2.string == ''?0:parseInt(this.ED2.string); //淘汰分
  155. Obj.dwBigRevRules = 0; //大局表情规则
  156. if(this.$('BigWinOrAll/Mode/Tog1@Toggle').isChecked){
  157. Obj.dwBigRevRules |= CLUB_GAME_RULE_1;
  158. }else if(this.$('BigWinOrAll/Mode/Tog2@Toggle').isChecked){
  159. Obj.dwBigRevRules |= CLUB_GAME_RULE_2;
  160. }else{
  161. Obj.dwBigRevRules |= CLUB_GAME_RULE_3;
  162. }
  163. if(this.$('BigMode/Mode/Tog1@Toggle').isChecked){
  164. Obj.dwBigRevRules |= CLUB_GAME_RULE_4;
  165. }else{
  166. Obj.dwBigRevRules |= CLUB_GAME_RULE_5;
  167. }
  168. Obj.dwBigMinScore = this.ED3.string == ''?0:parseInt(this.ED3.string); //大局表情起曾分
  169. Obj.dwBigCnt = this.ED4.string == ''?0:parseInt(this.ED4.string); //大局百分比或固定数量
  170. Obj.dwSmallRevRules = 0; //小局表情规则
  171. if(this.$('SmallWinOrAll/Mode/Tog1@Toggle').isChecked){
  172. Obj.dwSmallRevRules |= CLUB_GAME_RULE_1;
  173. }else if(this.$('SmallWinOrAll/Mode/Tog2@Toggle').isChecked){
  174. Obj.dwSmallRevRules |= CLUB_GAME_RULE_2;
  175. }else{
  176. Obj.dwSmallRevRules |= CLUB_GAME_RULE_3;
  177. }
  178. if(this.$('SmallMode/Mode/Tog1@Toggle').isChecked){
  179. Obj.dwSmallRevRules |= CLUB_GAME_RULE_4;
  180. }else{
  181. Obj.dwSmallRevRules |= CLUB_GAME_RULE_5;
  182. }
  183. Obj.dwSmallMinScore = this.ED5.string == ''?0:parseInt(this.ED5.string); //小局表情起曾分
  184. Obj.dwSmallCnt = this.ED6.string == ''?0:parseInt(this.ED6.string); //小局百分比或固定数量
  185. Obj.cbReturnType = this.$('Node1/Layout1/Tog_1@Toggle').isChecked?1:(this.$('Node1/Layout1/Tog_2@Toggle').isChecked?2:3); //反水类型
  186. Obj.bNegativeScore = this.$('Node1/Layout2/Tog_1@Toggle').isChecked; //负分
  187. Obj.dwMagnification = this.ED8.string == ''?1:parseInt(this.ED8.string); //倍率
  188. Obj.szTag = this.ED7.string; //标签
  189. if((Obj.dwBigRevRules&CLUB_GAME_RULE_5) && (Obj.dwBigCnt>100||Obj.dwBigCnt<0)){
  190. this.ShowAlert("比例贈送,贈送數值不能大於100!");
  191. return null;
  192. }
  193. if((Obj.dwSmallRevRules&CLUB_GAME_RULE_5) && (Obj.dwSmallCnt>100||Obj.dwSmallCnt<0)){
  194. this.ShowAlert("比例贈送,贈送數值不能大於100!");
  195. return null;
  196. }
  197. return Obj;
  198. },
  199. OnSendCulbRule:function(){
  200. var Rule = this.GetRules();
  201. if(Rule == null) return;
  202. if(this.RoomInfor){
  203. Rule.RoomID = this.RoomInfor.dwRoomID;
  204. this.m_Hook.OnSendModifyTableRule(Rule);
  205. }else{
  206. this.m_Hook.OnSendCreateRoom(Rule);
  207. }
  208. this.HideView();
  209. },
  210. });