ClubDLG.js 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610
  1. cc.Class({
  2. extends: cc.BaseClass,
  3. properties: {
  4. //动态创建排序列表
  5. m_NdClubList:cc.Node,
  6. //加入或创建相关
  7. m_WaitJoinNode:cc.Node,//等待加入
  8. //选择信息
  9. m_ClubCreater:cc.Node,
  10. m_LabClubNotice:cc.Label,
  11. //为选择或无数据时隐藏界面
  12. m_BottomNodes:[cc.Node],
  13. m_NullClubShow:[cc.Node],
  14. m_NdLv7UI:[cc.Node],
  15. m_NdLv6UI:[cc.Node],
  16. m_LeagueUI:[cc.Node],
  17. m_CreaterUI:[cc.Node],
  18. //玩家列表
  19. m_HaveUserNode:cc.Node,
  20. m_NoticeNode:cc.Node,
  21. },
  22. ctor:function () {
  23. this.m_SelClubInfo = null;
  24. this.m_RoomInfoMap = new Object();//俱乐部房间
  25. this.NORMAL_GAME = 2;
  26. this.SHOW_RANK = 4;
  27. this._AndroidCnt = 0;
  28. },
  29. start:function () {
  30. this.m_WaitJoinNode.active = false;
  31. this.m_bUpdateRoom = false;
  32. window.LoadSetting();
  33. this.onSwitchBG();
  34. },
  35. HideClubAll:function (){
  36. //this.SetClubNotice('您好,欢迎来到联盟,快去创建一个试试吧!');
  37. for (var i in this.m_LeagueUI) {
  38. this.m_LeagueUI[i].active = false;
  39. }
  40. for(var i in this.m_CreaterUI){
  41. this.m_CreaterUI[i].active = false;
  42. }
  43. for(var i in this.m_NdLv7UI){
  44. this.m_NdLv7UI[i].active = false;
  45. }
  46. for(var i in this.m_NdLv6UI){
  47. this.m_NdLv6UI[i].active = false;
  48. }
  49. this.m_NoticeNode.y = (-30);
  50. for(var i in this.m_BottomNodes){
  51. this.m_BottomNodes[i].active = false;
  52. }
  53. for(var i in this.m_NullClubShow){
  54. this.m_NullClubShow[i].active = true;
  55. }
  56. //this.$('RoomScrollView@ClubRoomView').UpdateRoomList(false, null);
  57. },
  58. update:function (dt) {
  59. if(this.m_UpdateTime == null) return
  60. var now = new Date().getTime();
  61. if(now - this.m_UpdateTime < 3000) return
  62. //this.OnClick_BtUpdate();
  63. //this.m_UpdateTime = now;
  64. },
  65. OnShowView:function (bForceUpdare) {
  66. this.m_bUpdateRoom = false;
  67. if(this.m_ListCtrl == null) this.m_ListCtrl = this.node.getComponent('CustomListCtrl');
  68. if(this.m_RoomCtrl == null) {
  69. this.m_RoomCtrl = this.$('NewNode/RoomScrollView@ClubRoomView');
  70. this.m_RoomCtrl.SetHook(this);
  71. }
  72. window.gClubClientKernel.onSetClubSink(this,this.m_RoomCtrl);
  73. if(this.m_SelClubInfo == null) this.HideClubAll();
  74. //console.log('ShowLobbyClub',ShowLobbyClub)
  75. this.$('@ClubList&Pre',this.m_NdClubList).m_Hook = this;
  76. this.$('@ClubList&Pre',this.m_NdClubList).OnUpdateList();
  77. this.m_UpdateTime = null;
  78. if(this._btAgreeInvite == null) this._btAgreeInvite = this.$('BTUI/BottomBG/BtAgreeInvire');
  79. if(this._btRefushInvite == null) this._btRefushInvite = this.$('BTUI/BottomBG/BtRefushInvire');
  80. },
  81. OnClick_BtUpdate:function () {
  82. ShowLobbyClub = this.m_SelClubInfo.dwClubID;
  83. this.OnShowView(true);
  84. },
  85. OnHideView:function () {
  86. this.m_WaitJoinNode.active = false;
  87. this.m_Hook.m_bNeedUpdate = true;
  88. this.ResetView();
  89. window.gClubClientKernel.onSendEnetrOrLeave(false,g_ShowClubInfo.dwClubID,0);
  90. window.gClubClientKernel.onSetClubSink(null,null);
  91. g_ShowClubInfo = null;
  92. ShowLobbyClub = 0;
  93. cc.director.emit('Lobby_InitShareInfo');
  94. this.node.active = false;
  95. },
  96. OnChangeClub:function (ClubInfo) {
  97. this.m_UpdateTime = new Date().getTime();
  98. ShowLobbyClub = 0;
  99. var OldClub = 0;
  100. if(this.m_SelClubInfo) OldClub = this.m_SelClubInfo.dwClubID;
  101. this.m_SelClubInfo = ClubInfo;
  102. g_ShowClubInfo = ClubInfo;
  103. this.m_RoomCtrl.InitRoomView(this.m_SelClubInfo);
  104. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  105. //if(OldClub == 0 || OldClub != this.m_SelClubInfo.dwClubID){
  106. this.$('@UserCtrl', this.m_ClubCreater).SetUserByID(pGlobalUserData.dwUserID)//ClubInfo.CreaterID
  107. this.$('@UserCtrl', this.m_ClubCreater).SetShowFullName(false, 6);
  108. //}
  109. this.$('BTUI/Top/ClubCtrl/ClubID@Label').string = ClubInfo.dwAllianceID;
  110. this.$('BTUI/Top/ClubCtrl/ClubName@Label').string = ClubInfo.szClubName;
  111. this.$('BTUI/Top/UserNode/UserCtrl/CardNum/CardNum@Label').string = pGlobalUserData.llUserIngot;
  112. this.$('BTUI/Top/UserNode/UserCtrl/ScoreNum/ScoreNum@Label').string = Score2Str(parseInt(ClubInfo.llScore));
  113. this.SetClubNotice(ClubInfo.szNotice);
  114. this.m_NoticeNode.y=(0);
  115. for(var i in this.m_BottomNodes){
  116. this.m_BottomNodes[i].active = true;
  117. }
  118. for (var i in this.m_LeagueUI) {
  119. this.m_LeagueUI[i].active = this.m_SelClubInfo.wKindID > CLUB_KIND_0;
  120. }
  121. if(this.m_SelClubInfo.wKindID > CLUB_KIND_0){
  122. for(var i in this.m_NdLv6UI){
  123. this.m_NdLv6UI[i].active = this.m_SelClubInfo.cbClubLevel >= CLUB_LEVEL_PARTNER;
  124. }
  125. }
  126. for(var i in this.m_CreaterUI){
  127. this.m_CreaterUI[i].active = this.m_SelClubInfo.cbClubLevel >= CLUB_LEVEL_MANAGER;
  128. }
  129. this.$('BTUI/Top/UserNode/UserCtrl/ScoreNum').active = ClubInfo.wKindID > CLUB_KIND_0;
  130. this.$('BTUI/BottomBG/Layout/BtAdJustScore').active = ClubInfo.wKindID > CLUB_KIND_0;
  131. this.$('BTUI/BottomBG/Layout/BtRand').active = ClubInfo.wKindID == CLUB_KIND_0;
  132. this.$('BTUI/BottomBG/Layout/BtSet').active = ClubInfo.wKindID == CLUB_KIND_2;
  133. this.$('BTUI/BottomBG/Layout/BtSet2').active = ClubInfo.wKindID < CLUB_KIND_2;
  134. if(this.m_SelClubInfo.cbClubLevel > CLUB_LEVEL_MEMBER && this.m_SelClubInfo.cbClubLevel == CLUB_LEVEL_MANAGER){
  135. this.$('BTUI/BottomBG/Layout/BtMyselfCard').active = false;
  136. }
  137. this.$('CloseFlag').active = this.m_SelClubInfo.cbCloseStatus == 1;
  138. this._btAgreeInvite.active = ClubInfo.cbIsInvite == 0;
  139. this._btRefushInvite.active = ClubInfo.cbIsInvite == 1;
  140. this.UpdateUserList(false);
  141. var webUrl = window.PHP_HOME+'/ClubAndroid.php?&GetMark=0&dwUserID='+pGlobalUserData.dwUserID;
  142. webUrl += '&dwClubID='+g_ShowClubInfo.dwClubID;
  143. WebCenter.GetData(webUrl, null, function (data) {
  144. var AndroidInfo = JSON.parse(data);
  145. this.$('BTUI/Top/ButtomNode/Layout/BtClubAndroid').active = AndroidInfo[0]>0;
  146. }.bind(this));
  147. window.gClubClientKernel.onSendEnetrOrLeave(true,ClubInfo.dwClubID,ClubInfo.cbClubLevel);
  148. },
  149. UpdateUserList:function(bForceUpdare) {
  150. if(this.m_SelClubInfo == null) return;
  151. var ClubID = this.m_SelClubInfo.dwClubID;
  152. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  153. var webUrl = window.PHP_HOME+'/League.php?&GetMark=7&dwUserID='+pGlobalUserData.dwUserID;
  154. webUrl += '&ClubID='+ClubID;
  155. WebCenter.GetData(webUrl, null, function (data) {
  156. var UserMap = JSON.parse(data);
  157. this.m_HaveUserNode.active = (UserMap[2] && UserMap[2].length > 0);
  158. }.bind(this));
  159. },
  160. UpdateUserScore:function() {
  161. if(this.m_SelClubInfo == null) return;
  162. this.$('BTUI/Top/UserNode/UserCtrl/ScoreNum/ScoreNum@Label').string = Score2Str(parseInt(this.m_SelClubInfo.llScore));
  163. },
  164. OnShowRedPoint:function(bShow){
  165. this.m_HaveUserNode.active = bShow;
  166. },
  167. //设置俱乐部滚动公告
  168. SetClubNotice:function (str) {
  169. this.m_LabClubNotice.node.stopAllActions();
  170. this.m_LabClubNotice.string = str;
  171. this.m_LabClubNotice.node.x=(800);
  172. if(str!= null && str.length > 0){
  173. var act = cc.sequence(cc.moveTo(0,cc.v2(800,0)), cc.moveTo(10,cc.v2(-800,0)));
  174. this.m_LabClubNotice.node.runAction(cc.repeatForever(act));
  175. }
  176. },
  177. //显示创建房间界面
  178. OnBtShowCreateRoom:function(Tag,Data){
  179. cc.gSoundRes.PlaySound('Button');
  180. //g_Lobby.SendReLinkQuery();
  181. this.ShowPrefabDLG('SelectGame',this.node,function(Js){
  182. var TempType = 0;
  183. if( this.m_SelClubInfo.wKindID>CLUB_KIND_0 && (this.m_SelClubInfo.dwRules&this.NORMAL_GAME) > 1) TempType = 1;
  184. Js.OnSetRoomType(TempType);
  185. }.bind(this));
  186. // this.ShowPrefabDLG('CreateRoom',this.node,function(Js){
  187. // var TempType = 0;
  188. // if( this.m_SelClubInfo.wKindID>CLUB_KIND_0 && (this.m_SelClubInfo.dwRules&this.NORMAL_GAME) > 1) TempType = 1;
  189. // Js.OnClubAutoView(TempType);
  190. // }.bind(this));
  191. },
  192. //创建房间
  193. OnCreateRoom:function(wKindID, RulesArr, ServerRules, Name){
  194. if(this.m_SelClubInfo.cbCloseStatus == 1) return g_Lobby.ShowTips('已經打烊,不能創建房間');
  195. this.m_createRoomInfor = {};
  196. this.m_createRoomInfor.wKindID = wKindID;
  197. this.m_createRoomInfor.RulesArr = RulesArr;
  198. this.m_createRoomInfor.ServerRules = ServerRules;
  199. this.m_createRoomInfor.Name = Name;
  200. this.ShowPrefabDLG('ClubTableSet',null,function(Js){
  201. Js.OnSetRuleInfor(wKindID,this.m_SelClubInfo.wKindID,null);
  202. }.bind(this));
  203. },
  204. OnModifyTableRule:function(RoomInfor){
  205. this.ShowPrefabDLG('ClubTableSet',null,function(Js){
  206. Js.OnSetRuleInfor(RoomInfor.wKindID,this.m_SelClubInfo.wKindID,RoomInfor);
  207. }.bind(this));
  208. },
  209. OnSendModifyTableRule:function(ObjParas){
  210. var Obj = new CMD_GP_C_ModifyTableRule();
  211. Obj.dwUserID = g_GlobalUserInfo.GetGlobalUserData().dwUserID;
  212. Obj.dwRoomID=ObjParas.RoomID;
  213. Obj.llSitScore = ObjParas.llSitScore; //参与分
  214. Obj.llStandScore = ObjParas.llStandScore; //淘汰分
  215. Obj.dwBigRevRules = ObjParas.dwBigRevRules; //大局表情规则
  216. Obj.dwBigMinScore = ObjParas.dwBigMinScore; //大局表情起曾分
  217. Obj.dwBigCnt = ObjParas.dwBigCnt; //大局百分比或固定数量
  218. Obj.dwSmallRevRules = ObjParas.dwSmallRevRules; //小局表情规则
  219. Obj.dwSmallMinScore = ObjParas.dwSmallMinScore; //小局表情起曾分
  220. Obj.dwSmallCnt = ObjParas.dwSmallCnt; //小局百分比或固定数量
  221. Obj.cbReturnType = ObjParas.cbReturnType; //反水类型
  222. Obj.bNegativeScore = ObjParas.bNegativeScore; //反水类型
  223. Obj.dwMagnification = ObjParas.dwMagnification; //倍率
  224. Obj.szTag = ObjParas.szTag; //标签
  225. window.gClubClientKernel.OnSendModifyTableRule(this,Obj);
  226. //var LoginMission = new CGPLoginMission(this, MDM_GP_GET_SERVER, SUB_GP_MODIFY_TABLE_RULE, Obj);
  227. },
  228. OnSendCreateRoom:function(Obj){
  229. if(g_Lobby.OnCheckGame(this.m_createRoomInfor.wKindID)) return
  230. //g_Lobby.ShowLoading();
  231. var QueryGR = new CMD_GP_C_CreateRoom();
  232. QueryGR.dwUserID = g_GlobalUserInfo.GetGlobalUserData().dwUserID;
  233. QueryGR.wKindID=this.m_createRoomInfor.wKindID;
  234. for(var i=0;i<5;i++){
  235. if(this.m_createRoomInfor.RulesArr[i]==null) this.m_createRoomInfor.RulesArr[i]=0;
  236. QueryGR.dwRules[i] = this.m_createRoomInfor.RulesArr[i];
  237. }
  238. QueryGR.dwClubID=this.m_SelClubInfo.dwClubID;
  239. QueryGR.byPartID=0;
  240. QueryGR.dwServerRules=this.m_createRoomInfor.ServerRules;
  241. QueryGR.szRoomName=this.m_createRoomInfor.Name;
  242. QueryGR.cbClubKind = this.m_SelClubInfo.wKindID; //俱乐部类型
  243. QueryGR.llSitScore = Obj.llSitScore; //参与分
  244. QueryGR.llStandScore = Obj.llStandScore; //淘汰分
  245. QueryGR.dwBigRevRules = Obj.dwBigRevRules; //大局表情规则
  246. QueryGR.dwBigMinScore = Obj.dwBigMinScore; //大局表情起曾分
  247. QueryGR.dwBigCnt = Obj.dwBigCnt; //大局百分比或固定数量
  248. QueryGR.dwSmallRevRules = Obj.dwSmallRevRules; //小局表情规则
  249. QueryGR.dwSmallMinScore = Obj.dwSmallMinScore; //小局表情起曾分
  250. QueryGR.dwSmallCnt = Obj.dwSmallCnt; //小局百分比或固定数量
  251. QueryGR.cbReturnType = Obj.cbReturnType; //反水类型
  252. QueryGR.bNegativeScore = Obj.bNegativeScore; //反水类型
  253. QueryGR.dwMagnification = Obj.dwMagnification; //倍率
  254. QueryGR.szTag = Obj.szTag; //标签
  255. //var LoginMission = new CGPLoginMission(this, MDM_GP_GET_SERVER, SUB_GP_CREATE_ROOM, QueryGR);
  256. window.gClubClientKernel.OnSendCreateRoom(this,QueryGR);
  257. },
  258. OnCreatRoomRes:function (RoomSuc){//CMD_GP_S_CreatSuccess
  259. g_Lobby.StopLoading();
  260. this.ShowTips("創建成功!");
  261. },
  262. //创建&加入失败信息
  263. OnQueryFailed:function (FailedRes){
  264. //g_Lobby.StopLoading();
  265. if(FailedRes.byRes == 16){
  266. this.ShowAlert(FailStr[FailedRes.byRes],Alert_Yes,function(){
  267. WebCenter.SetDataOutTime(this.m_SelClubInfo.ClubID+'');
  268. if(this['m_JsClubSet']) this['m_JsClubSet'].HideView();
  269. this.HideView();
  270. }.bind(this));
  271. }
  272. else{
  273. this.ShowTips( FailStr[FailedRes.byRes]);
  274. }
  275. },
  276. //进入服务器信息
  277. OnQueryServerRes:function (ReturnServer){
  278. this.StopLoading();
  279. if(ReturnServer.wKindID == 0) return
  280. if(!this.BeLoadRes(ReturnServer.wKindID)) return;
  281. g_ServerListDataLast = new CGameServerItem();
  282. g_ServerListDataLast.wKindID = ReturnServer.wKindID;
  283. g_ServerListDataLast.wServerPort = ReturnServer.wServerPort;
  284. g_ServerListDataLast.szServerAddr = ReturnServer.szServerAddr;
  285. g_ServerListDataLast.wServerType = ReturnServer.wServerType;
  286. g_ServerListDataLast.llEnterScore = ReturnServer.llEnterScore;
  287. g_ServerListDataLast.szServerName = "";
  288. if(ReturnServer.byTipsReturn){
  289. var game = window.GameList[ReturnServer.wKindID];
  290. if(game == null) game = ReturnServer.wKindID;
  291. this.ShowAlert('您已在遊戲 '+game+' 內,點擊確定回到遊戲!',Alert_YesNo,'EnterGameScene',this)
  292. }else{
  293. this.EnterGameScene(1);
  294. }
  295. },
  296. OnEnterRoom:function(RoomID) {
  297. this.m_Hook.OnQueryRoom(RoomID, this.m_SelClubInfo.ClubID);
  298. },
  299. OnDissolveRoom:function(RoomID, CreaterID, Force) {
  300. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  301. if(pGlobalUserData.dwUserID != CreaterID && this.m_SelClubInfo.cbClubLevel < CLUB_LEVEL_MANAGER ){
  302. this.ShowTips("您不是房主,無法解散房間!");
  303. return;
  304. }
  305. this.m_Hook.OnDissolveClubRoom(RoomID,this.m_SelClubInfo.ClubID,this.m_SelClubInfo.LeagueID,pGlobalUserData.dwUserID,Force);
  306. },
  307. OnBtShowDlg:function(Tag,Data){
  308. if('ClubScoreRecord' != Data) cc.gSoundRes.PlaySound('Button');
  309. if(this.m_SelClubInfo == null) return;
  310. this.ShowPrefabDLG(Data);
  311. },
  312. OnClick_BtNotice:function(){
  313. cc.gSoundRes.PlaySound('Button');
  314. this.ShowPrefabDLG('Activity',this.node,function(Js){
  315. Js.OnShowData(0, this.m_SelClubInfo.dwClubID,this.m_SelClubInfo.wKindID);
  316. }.bind(this));
  317. },
  318. OnBtShowAndroidManager:function(){
  319. if(this.m_SelClubInfo.cbClubLevel<9) return;
  320. this.ShowPrefabDLG('ClubAndroidList');
  321. },
  322. //退出/解散 俱乐部
  323. OnBtExitClub:function() {
  324. var str = '確認退出?'//该联盟
  325. if(this.m_SelClubInfo.ClubLevel == 9) str ='確認解散?';//该联盟
  326. this.ShowAlert(str,Alert_YesNo, function(Res) {
  327. if(Res) {
  328. //g_Lobby.ShowLoading();
  329. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  330. var QueryEC = new CMD_GP_C_ExitClub();
  331. QueryEC.dwUserID=pGlobalUserData.dwUserID;
  332. QueryEC.dwClubID=this.m_SelClubInfo.dwClubID;
  333. QueryEC.szPassWord=pGlobalUserData.szPassword;
  334. window.gClubClientKernel.onSendDissClub(this,QueryEC);
  335. }
  336. }.bind(this));
  337. },
  338. //显示合伙人关系
  339. OnClickShowLeaderData:function(_,data){
  340. cc.gSoundRes.PlaySound('Button');
  341. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  342. this.ShowPrefabDLG('ClubPartner', this.node, function(Js){
  343. Js.OnShowSubData(0,pGlobalUserData.dwUserID, pGlobalUserData.dwGameID,this.m_SelClubInfo.cbClubLevel, 1);
  344. }.bind(this));
  345. },
  346. //俱乐部赠送
  347. OnGiveScore:function(UserID, Type, Score,Remark) {
  348. this.m_GRecord = true;
  349. //g_Lobby.ShowLoading();
  350. //this.m_Hook.OnClubGiveUserScore(UserID, Score, Type,this.m_SelClubInfo.ClubID,this.m_SelClubInfo.ClubID);
  351. var QueryCG = new CMD_GP_C_ClubGive();
  352. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  353. QueryCG.dwUserID = pGlobalUserData.dwUserID;
  354. QueryCG.szPassWord = pGlobalUserData.szPassword;
  355. QueryCG.dwTagUserID = parseInt(UserID);
  356. QueryCG.lScore = parseInt(Score); //金额
  357. QueryCG.byType = parseInt(Type); //种类
  358. QueryCG.dwClubID1 = this.m_SelClubInfo.dwClubID;
  359. QueryCG.dwClubID2 = this.m_SelClubInfo.dwClubID;
  360. QueryCG.szRemark = Remark;
  361. window.gClubClientKernel.OnSendGiveScore(null,QueryCG);
  362. },
  363. //俱乐部下分
  364. OnTakeScore:function(UserID, Type, Score) {
  365. this.m_GRecord = true;
  366. //g_Lobby.ShowLoading();
  367. //this.m_Hook.OnClubTakeUserScore(UserID, Score, Type,this.m_SelClubInfo.ClubID,this.m_SelClubInfo.ClubID);
  368. var QueryCG = new CMD_GP_C_ClubGive();
  369. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  370. QueryCG.dwUserID = pGlobalUserData.dwUserID;
  371. QueryCG.szPassWord = pGlobalUserData.szPassword;
  372. QueryCG.dwTagUserID = parseInt(UserID);
  373. QueryCG.lScore = parseInt(Score); //金额
  374. QueryCG.byType = parseInt(Type); //种类
  375. QueryCG.dwClubID1 = this.m_SelClubInfo.dwClubID;
  376. QueryCG.dwClubID2 = this.m_SelClubInfo.dwClubID;
  377. window.gClubClientKernel.OnSendTakeScore(null,QueryCG);
  378. },
  379. //操作结果
  380. // OnMsgRes:function(Msg){
  381. // g_Lobby.StopLoading();
  382. // WebCenter.SetDataOutTime('GetMark=10');//上下分 更新
  383. // this.ShowAlert(Msg, Alert_Yes, function(Res) {
  384. // this.OnShowView(true);
  385. // }.bind(this));
  386. // },
  387. //战绩
  388. OnBtShowClubRecord:function(Tag, Data){
  389. cc.gSoundRes.PlaySound('Button');
  390. g_Lobby.ShowLoading();
  391. this.ShowPrefabDLG('GameRecord');
  392. },
  393. ShowUserInfo: function(UserID, Level, ClubID){
  394. this.ShowPrefabDLG("ClubUserSet",this.node,function(Js){
  395. Js.OnShowClubUser(UserID, Level, ClubID) ;
  396. }.bind(this));
  397. },
  398. ShowUserScoreInfo: function(UserID, View){
  399. this.ShowPrefabDLG("ClubUserScore",this.node,function(Js){
  400. Js.OnShowClubUser(UserID, this.m_SelClubInfo.ClubID, View) ;
  401. }.bind(this));
  402. },
  403. OnBtShare: function(){
  404. if(this.m_SelClubInfo == null ){
  405. this.ShowTips("請先進入!");//联盟
  406. return;
  407. }
  408. this.ShowPrefabDLG("SharePre")
  409. },
  410. //分享信息
  411. GetShareInfo: function() {
  412. var ShareInfo = new Object();
  413. ShareInfo.title = '【'+this.m_SelClubInfo.ClubName+'】 同盟會 ID:'+this.m_SelClubInfo.dwClubID;
  414. ShareInfo.desc = '歡迎加入【'+ g_GlobalUserInfo.m_UserInfoMap[this.m_SelClubInfo.dwCreaterID].NickName+'】ID:'
  415. +g_GlobalUserInfo.m_UserInfoMap[this.m_SelClubInfo.dwCreaterID].GameID+'的同盟會';
  416. ShareInfo.link = cc.share.MakeLink_InviteClub(this.m_SelClubInfo.wKindID, this.m_SelClubInfo.dwAllianceID, cc.share.Mode.ToH5);
  417. return ShareInfo;
  418. },
  419. SendClubConfig: function(bSeeNull,bMC){
  420. var QueryCS = new CMD_GP_C_ClubSet();
  421. QueryCS.dwUserID = g_GlobalUserInfo.GetGlobalUserData().dwUserID;
  422. QueryCS.dwClubID = parseInt(this.m_SelClubInfo.ClubID);
  423. QueryCS.dwLeagueID = parseInt(this.m_SelClubInfo.LeagueID);
  424. QueryCS.bySeeNullRoom = bSeeNull?1:0; //成员仅见空房
  425. QueryCS.byMemberCreat = bMC?3:9; //成员开房
  426. var LoginMission = new CGPLoginMission(this, MDM_GP_GET_SERVER, SUB_GP_CLUB_SET, QueryCS);
  427. },
  428. //俱乐部配置结果
  429. OnClubSetSuc:function(){
  430. g_Lobby.StopLoading();
  431. this.ShowTips("伺服器接受了配置信息!!!");
  432. //this.$('RoomScrollView@ClubRoomView').UpdateRoomList(true, this.m_SelClubInfo);
  433. },
  434. OnOpNoChat: function(bNoChat){
  435. var QueryCS = new CMD_GP_C_ClubRoomSet();
  436. QueryCS.dwUserID = g_GlobalUserInfo.GetGlobalUserData().dwUserID;
  437. QueryCS.dwClubID = parseInt(this.m_SelClubInfo.ClubID);
  438. QueryCS.dwLeagueID = parseInt(this.m_SelClubInfo.LeagueID);
  439. QueryCS.byNoChat = bNoChat?1:0; //成员仅见空房
  440. var LoginMission = new CGPLoginMission(this, MDM_GP_GET_SERVER, SUB_GP_CLUB_ROOM_SET, QueryCS);
  441. },
  442. //设置俱乐部配置
  443. OnSetClubRevenue:function(ClubID,LeagueID,Mark,Limit,Rate,Cnt,byNoUpdateScore){
  444. var QueryCS = new CMD_GP_C_ClubRevenueSet();
  445. QueryCS.dwUserID = g_GlobalUserInfo.GetGlobalUserData().dwUserID;
  446. QueryCS.dwClubID = ClubID;
  447. QueryCS.dwLeagueID = LeagueID;
  448. QueryCS.dwMark = Mark;
  449. QueryCS.dwLimit = Limit;
  450. QueryCS.wRate = Rate;
  451. QueryCS.wCnt = Cnt;
  452. QueryCS.byNoUpdateScore = byNoUpdateScore;
  453. var LoginMission = new CGPLoginMission(this, MDM_GP_GET_SERVER, SUB_GP_CLUB_REVENUE_SET, QueryCS);
  454. },
  455. OnRePlayGame:function( RecordID, KindID, LookUser){
  456. this.m_Hook.OnRePlayGame(RecordID, KindID, LookUser);
  457. },
  458. OnOpClubUserLv:function(UserID, Level){
  459. window.gClubClientKernel.onSendSetClubUserLvL(UserID,this.m_SelClubInfo.dwClubID,Level);
  460. },
  461. //俱乐部列表
  462. OnClickShowClubList:function(){
  463. ShowL2C(this.m_NdClubList);
  464. },
  465. OnClickMoreClub:function(){
  466. this.ShowPrefabDLG('ClubFreeDLG');
  467. },
  468. //俱乐部流水
  469. OnClickGameRecordClub: function(){
  470. g_Lobby.ShowLoading();
  471. this.ShowPrefabDLG('ClubGameRecord');
  472. },
  473. OnClick_ShowRoomKind:function() {
  474. this.OnShowView();
  475. },
  476. OnShowRevenueList:function (LeaderID) {
  477. this.ShowPrefabDLG('ClubRevenueList&Pre',this.node,function(Js){
  478. Js.OnUpdateList(LeaderID, this.m_SelClubInfo.ClubID);
  479. }.bind(this));
  480. },
  481. OnUpdateScore:function(obj){
  482. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  483. if(obj.cbType == 0){
  484. if(pGlobalUserData.dwUserID == obj.dwUserID){
  485. obj.lScore = -obj.lScore;
  486. }
  487. }else{
  488. if(pGlobalUserData.dwUserID != obj.dwUserID){
  489. obj.lScore = -obj.lScore;
  490. }
  491. }
  492. this.UpdateScore(obj.lScore);
  493. //刷新
  494. if(this['m_JsClubRank']&&this['m_JsClubRank'].node.active) this['m_JsClubRank'].m_bNeedUpdate = true;
  495. },
  496. UpdateScore:function(lScore){
  497. this.m_SelClubInfo.llScore = (parseInt(this.m_SelClubInfo.llScore)+parseInt(lScore));
  498. this.$('BTUI/Top/UserNode/UserCtrl/ScoreNum/ScoreNum@Label').string = Score2Str(parseInt(this.m_SelClubInfo.llScore));
  499. },
  500. OnUpdateCard:function(obj){
  501. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  502. this.$('BTUI/Top/UserNode/UserCtrl/CardNum/CardNum@Label').string = pGlobalUserData.llUserIngot;
  503. },
  504. OnBtShowPeopleCard:function(_,Data){
  505. cc.gSoundRes.PlaySound('Button');
  506. this.ShowPrefabDLG('ClubPeopleCard',this.node,function(Js){
  507. Js.OnSetParam(Data);
  508. }.bind(this));
  509. },
  510. onDisClubRes:function(UserID){
  511. if(UserID==this.m_SelClubInfo.dwCreaterID) return;
  512. this.ShowAlert("俱樂部被解散!",Alert_Yes,function(){
  513. this.HideView();
  514. }.bind(this));
  515. },
  516. OnBtInviteStatus:function(_,Data){
  517. this._btAgreeInvite.active = !this._btAgreeInvite.active;
  518. this._btRefushInvite.active = !this._btRefushInvite.active;
  519. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  520. this.m_SelClubInfo.cbIsInvite = parseInt(Data);
  521. var webUrl = window.PHP_HOME+ '/League.php?GetMark=138&dwUserID='+pGlobalUserData.dwUserID+'&dwClubID='+this.m_SelClubInfo.dwClubID+'&isInvite='+Data;
  522. WebCenter.GetData(webUrl, null, function (data) {
  523. var Res = JSON.parse(data);
  524. this.ShowTips(Res.Describe);
  525. }.bind(this));
  526. },
  527. ResetView:function(){
  528. this['m_JsClubSet'] && this['m_JsClubSet'].HideView();
  529. },
  530. OnBtSelfInfo:function(){
  531. if(g_Lobby&&g_Lobby['m_JsSelfInfo']){
  532. g_Lobby['m_JsSelfInfo'].node.destroy();
  533. g_Lobby['m_JsSelfInfo'] = null;
  534. }
  535. g_Lobby && g_Lobby.OnBtnSelfInfo();
  536. },
  537. OnUpload_Finish:function(){
  538. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  539. this.$('@UserCtrl', this.m_ClubCreater).SetUserByID(pGlobalUserData.dwUserID, true)//ClubInfo.CreaterID
  540. this.$('@UserCtrl', this.m_ClubCreater).SetShowFullName(false, 6);
  541. },
  542. onSwitchBG:function(index){
  543. if(index == null) index = window.g_Setting[window.SetKey_CLUB_BG];
  544. var bg = this.$('BGClub@Sprite');
  545. cc.gPreLoader.LoadRes('Image_BG_CBG' + index, 'Club', function(sf){
  546. bg.spriteFrame = sf;
  547. });
  548. },
  549. onSwitchTableBG:function(index){
  550. if(index == null) index = window.g_Setting[window.SetKey_CLUB_TABLE_COLOR];
  551. if(this.m_RoomCtrl)this.m_RoomCtrl.OnSwitchTableBG(index);
  552. },
  553. });