| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- cc.Class({
- extends: cc.BaseClass,
- properties: {
- },
- ctor:function(){
- },
- InitPre:function(){
- if(this.m_ListCtrl == null) this.m_ListCtrl = this.$('@CustomListCtrl');
- this.m_ListCtrl.InitList(0, 'RecordUserItem2', this);
- this.node.active = false;
- },
- SetPreInfo:function(ParaArr){//0 Kind 1 RecordID 2 index 3 info
- this.node.active = true;
- this.m_KindID = ParaArr[0];
- this.m_RecordID = ParaArr[1];
- this.m_GameIndex = ParaArr[2];
- this.m_ScoreInfo = ParaArr[3];
- this.$('Info/LabTime@Label').string = this.m_ScoreInfo['Time'];
- this.$('Info/LbIndex@Label').string = pad(this.m_GameIndex, 2) ;
- var sortIDArr = this.SortUserIndexByScore(this.m_ScoreInfo);
- for (var i in sortIDArr)
- {
- this.m_ListCtrl.InsertListInfo(0, [sortIDArr[i], this.m_ScoreInfo[sortIDArr[i]]]);
- }
- // for(var i in this.m_ScoreInfo){
- // if(i == 'Time') continue;
- // this.m_ListCtrl.InsertListInfo(0, [i, this.m_ScoreInfo[i]]);
- // }
- },
- SortUserIndexByScore:function(ScoreInfo){
- var indexArr = new Array();
- var scoreArr = new Array();
- var totalCnt = 0;
- for(var i in ScoreInfo){
- if(i == 'Time') continue;
- indexArr[totalCnt] = i;
- scoreArr[totalCnt] = ScoreInfo[i];
- totalCnt++;
- }
- for (var i = 0 ; i < totalCnt - 1 ; i++)
- {
- for (var j = i + 1 ; j < totalCnt ; j++)
- {
- if (scoreArr[i] < scoreArr[j])
- {
- var score = scoreArr[i];
- scoreArr[i] = scoreArr[j];
- scoreArr[j] = score;
-
- var index = indexArr[i];
- indexArr[i] = indexArr[j];
- indexArr[j] = index;
- }
- }
- }
- return indexArr;
- },
- OnClick_RePlayGame:function(){
- var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
- g_Lobby.OnRePlayGame(this.m_RecordID, this.m_KindID, pGlobalUserData, this.m_GameIndex - 1);
- },
- OnAnalysisReplay:function(){
- return
- GameDef = new window['CMD_GAME_'+this.m_KindID]();
- //显示手牌(回放 处理逻辑 )
- try {
- this.m_ReplayEngine = this.node.getComponent('ReplayEngine_'+this.m_KindID);
- if(this.m_ReplayEngine == null) this.m_ReplayEngine = this.node.addComponent('ReplayEngine_'+this.m_KindID);
- } catch (error) {
- if(window.LOG_NET_DATA)console.log(error)
- return false;
- }
- var webUrl = window.PHP_HOME+'/GameRecord.php?&GetMark=1&ID='+this.m_RecordID+'&GameIndex='+(this.m_GameIndex-1);
- WebCenter.GetData(webUrl, 999999, function (data) {
- if(data.length < 50){
- console.log('err 11111 ',webUrl)
- return
- }
- var RecordInfo = JSON.parse(data);
- if(RecordInfo[0] == 0) {
- console.log('err 22222 ',webUrl)
- return
- }
- if(this.m_ReplayEngine){
- this.m_ReplayEngine.SetData(RecordInfo[3], 0, true);
- for(var i in this.m_ReplayEngine.GameData[0].user){
- var TempUserID = this.m_ReplayEngine.GameData[0].user[i].dwUserID;
- var TempChairID = this.m_ReplayEngine.GameData[0].user[i].wChairID;
- var Score,CardData,CardType,Banker,Player,bBanker;
- Score = this.m_ReplayEngine.GameData.GameEnd.llGameScore[TempChairID];
- if(this.m_ReplayEngine.GameData.CardData) CardData = this.m_ReplayEngine.GameData.CardData[TempChairID];
- //牌型
- if(this.m_ReplayEngine.GameData.OxType) CardType = this.m_ReplayEngine.GameData.OxType[TempChairID];
- //庄显示
- if(this.m_ReplayEngine.GameData.lBankerCall) Banker = this.m_ReplayEngine.GameData.lBankerCall[TempChairID];
- if(Banker == 0xff) Banker='';
- if(Banker == 0) Banker='不搶';
- if(Banker > 0 && Banker < 0xff) Banker+='倍';
- //闲显示
- if(this.m_ReplayEngine.GameData.lPlayerCall) Player = this.m_ReplayEngine.GameData.lPlayerCall[TempChairID];
- if(Player == 0) Player='';
- if(Player > 0 ) Player='X'+Player;
- bBanker = this.m_ReplayEngine.GameData.wBankerUser == TempChairID;
- this.m_ListCtrl.InsertListInfo(0, [TempUserID, Score, CardData, this.m_ReplayEngine.GameData.CardCnt, CardType, Banker, Player, bBanker]);//0 UserID 1 Score 2 Card 3 CardCnt 4 Type 5Banker 6Player 7bBanker
- }
- }
- }.bind(this));
- },
- });
|