| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236 |
- cc.Class({
- extends: cc.BaseClass,
- properties: {
- m_EndScore:cc.Label,
- m_GangScore:cc.Label,
- // m_BirdCount:cc.Label,
- m_Piao:cc.Label,
- m_Double:cc.Node,
- m_CardCtrl:cc.Node,
- m_LittleResultBanker:cc.Node,
- m_Rule:cc.Label,
- m_Hu:cc.Node,
- m_DianPao:cc.Node,
- m_ZiMo:cc.Node,
- m_LiuJu:cc.Node,
- m_HandControlPrefab:cc.Prefab,
- m_Font:[cc.Font],
- m_diamond:cc.Node,
- },
- // LIFE-CYCLE CALLBACKS:
- // onLoad () {},
- ctor:function(){
- },
- start:function () {
-
- },
- onLoad(){
- this.m_LittleResultBanker.active = false;
- this.m_DianPao.active = false;
- this.m_EndScore.string = "";
- this.m_diamond.active = false;
- var node = cc.instantiate(this.m_HandControlPrefab);
- node.setPosition(cc.v2(0,0));
- this.m_CardCtrl.addChild(node);
- this.m_UserCard = node.getComponent('CardControl');
- this.m_WeaveCtrl = node.getComponent('WeaveControl');
- this.m_WeaveCtrl.Init(GameDef.HAND_BOTTOM);
- this.m_UserCard.SetPositively(false);
- },
- AddCountString:function(count){
- if (count == 0) {
- count = 1;
- }
- return 'x'+count;
- },
- // GetHuRightString:function(rules,EndInfo,wChair){
- // var str ='';
- // if (rules & GameDef.CHR_MENQiNG ) str+=' 門清';
- // if (rules & GameDef.CHR_PENG_PENG ) str+=' 碰碰胡';
- // if (rules & GameDef.CHR_QI_DUI ) str+=' 八對';
- // if (rules & GameDef.CHR_BAXIANGUOHAI ) str+=' 八仙過海';
- // if (rules & GameDef.CHR_GANG_KAI ) str+=' 杠上開花';
- // if (rules & GameDef.CHR_KUN_SI_SE ) str+=' 混一色';
- // if (rules & GameDef.CHR_QING_YI_SE ) str+=' 清一色';
- // if (rules & GameDef.CHR_QUAN_QIU_PAO ) str+=' 全求';
- // if (rules & GameDef.CHR_DI_TING ) str+=' 地聼';
- // if (rules & GameDef.CHR_TIAN_TING ) str+=' 天聼';
- // if (rules & GameDef.CHR_SHAN_YUAN ) str+=' 三元';
- // if (rules & GameDef.CHR_SHAN_YUAN_XIAO ) str+=' 小三元';
- // if (rules & GameDef.CHR_XIAO_SI_XI ) str+=' 小四喜';
- // if (rules & GameDef.CHR_HAI_DI ) str+=' 海底撈';
- // if (rules & GameDef.CHR_GANG_PAO ) str+=' 杠后炮';
- // if (rules & GameDef.CHR_QI_QIANG_YI ) str+=' 7抢1';
- // if (rules & GameDef.CHR_QIANG_GANG ) str+=' 搶杠胡';
- // if (rules & GameDef.CHR_DUN_TING ) str+=' 獨聼';
- // if (rules & GameDef.CHR_ZI_SI_SE ) str+=' 字一色';
- // if (rules & GameDef.CHR_SHAN_KAN ) str+=' 三暗坎';
- // if (rules & GameDef.CHR_SI_KAN ) str+=' 四暗坎';
- // if (rules & GameDef.CHR_WU_KAN ) str+=' 五暗坎';
- // if (rules & GameDef.CHR_HUA_GANG ) str+=' 花杠';
- // if (rules & GameDef.CHR_PING_HU ) str+=' 平胡';
- // if (rules & GameDef.CHR_ZI_MO ) str+=' 自摸';
- // if (rules & GameDef.CHR_CHI_HU ) str+=' 放炮';
- // if (rules & GameDef.CHR_MEN_FENG ) str+=' 門風';
- // return str;
- // },
- InitPre:function(){
- this.node.active = false;
- },
- SetPreInfo:function(ParaArr) {
- this.node.active = true;
- this.SetEndInfo(ParaArr[0],ParaArr[1],ParaArr[2],ParaArr[3]);
- },
- SetEndInfo:function(wChair, EndInfo, bBanker, Rule) {
- this.ResetControl();
- this.m_dwUserID = EndInfo.dwUserID[wChair];
- this.node.getComponent('UserCtrl').SetUserByID( this.m_dwUserID);
- this.node.getComponent('UserCtrl').SetShowFullName(false, 5);
-
-
- console.log(EndInfo,"1122333")
-
- this.m_Double.active = EndInfo.cbDouble[wChair] > 1;
- //文字
- if(EndInfo.dwChiHuKind[wChair] == GameDef.WIK_CHI_HU)
- {
- if(EndInfo.dwChiHuRight[wChair] & GameDef.CHR_ZI_MO)
- {
- this.m_Hu.active = false;
- this.m_ZiMo.active = true;
- }
- else
- {
- this.m_Hu.active = true;
- this.m_ZiMo.active = false;
- }
- }
- else
- {
- this.m_Hu.active = false;
- this.m_ZiMo.active = false;
-
- }
- this.m_DianPao.active = (EndInfo.dwChiHuRight[wChair] & GameDef.CHR_CHI_HU);
- if( EndInfo.cbWinner == 255)
- {
- this.m_LiuJu.active = true;
- this.m_DianPao.active = false;
- this.m_Hu.active = false;
- this.m_ZiMo.active = false;
- }
- else
- {
- this.m_LiuJu.active = false;
- }
- var hrS = EndInfo.cbWinner == 255 ? GameDef.GetHuRightString(0) : GameDef.GetHuRightString(EndInfo.dwChiHuRight[wChair],EndInfo.dwChiHuKind[wChair]); //this.GetHuRightString(EndInfo.dwChiHuRight[wChair],EndInfo,wChair)
- //胡法
- this.m_Rule.string = hrS;
- console.log("規則:",hrS)
- //总分
- var Score = /* EndInfo.lGameScore[wChair] + EndInfo.lGangScore[wChair];// + */EndInfo.lGangScore[wChair];
- console.log("Score:",Score);
- if (Score > 0) {
- this.m_EndScore.string =""+ Score;//"+" + Score2Str(Score);
- // this.m_EndScore.node.color = cc.color(0, 151,64);
- // this.m_EndScore.font = this.m_Font[0];
- } else {
- this.m_EndScore.string = ""+Score;//Score2Str(Score);
- // this.m_EndScore.node.color = cc.color(225,75,43);
- //this.m_EndScore.font = this.m_Font[1];
- }
- //杠分
- // var GangScore = EndInfo.lGangScore[wChair];
- // if(GangScore > 0)
- // {
- // this.m_GangScore.string = '+' + Score2Str(GangScore);
- // this.m_GangScore.font = this.m_Font[0];
- // }
- // else
- // {
- // this.m_GangScore.string = Score2Str(GangScore);
- // this.m_GangScore.font = this.m_Font[1];
- // }
- //鸟
- // if(EndInfo.dwChiHuKind[wChair] == GameDef.WIK_CHI_HU)
- // {
- // this.m_BirdCount.string = EndInfo.wBirdCount;
- // this.m_BirdCount.font = this.m_Font[0];
- // }
- // else
- // {
- // this.m_BirdCount.string = 0;
- // this.m_BirdCount.font = this.m_Font[0];
- // }
- //飘
- var fen = EndInfo.lGameScore[wChair];
- if (fen > 0) {
- this.m_Piao.string = ""+fen;//"+" + Score2Str(Score);
- //this.m_Piao.font = this.m_Font[0];
- } else {
- this.m_Piao.string =""+ fen;//Score2Str(Score);
- //this.m_Piao.font = this.m_Font[1];
- }
- if(bBanker){
- this.m_LittleResultBanker.active = true;
- }else{
- this.m_LittleResultBanker.active = false;
- }
- var cbCardData = EndInfo.cbCardData[wChair];
- var wCardCount = EndInfo.cbCardCount[wChair];
- this.m_UserCard.SetMagicIndex(EndInfo.cbMagicIndex);
- if((wCardCount+1)%3==0) {
- var tmpCardData = new Array();
- for (var j = 0; j < wCardCount; j++) {
- tmpCardData[j] = cbCardData[j];
- }
- var cbRemoveCard = new Array();
- if( EndInfo.cbProvideCard != 0){
- cbRemoveCard[0] = EndInfo.cbProvideCard;
- }
- else{
- cbRemoveCard[0] = tmpCardData[wCardCount-1];
- }
- if (EndInfo.cbLastCardData[wChair]) {
- cbRemoveCard[0] = EndInfo.cbLastCardData[wChair];
- }
- if(GameDef.g_GameLogic.RemoveCard4(tmpCardData,wCardCount,cbRemoveCard,1)){
- this.m_UserCard.SetCardData(tmpCardData,wCardCount-1, false, true);
- this.m_UserCard.SetCurrentCard(cbRemoveCard[0], false, true);
- }
- }else{
- this.m_UserCard.SetCardData(cbCardData,wCardCount, false, true);
- }
- for(var j=0;j<EndInfo.cbWeaveCount[wChair];++j){
- var cbCenterCard = EndInfo.weaveItem[wChair][j].cbCenterCard;
- var wWeaveKind=EndInfo.weaveItem[wChair][j].wWeaveKind;
- var cbCardData = EndInfo.weaveItem[wChair][j].cbCardData;
- var cbWeaveCardCount=EndInfo.weaveItem[wChair][j].cbCardCount;
- var cbPublicCard=EndInfo.weaveItem[wChair][j].cbPublicCard;
- this.m_WeaveCtrl.SetWeaveData(j,cbCardData,cbWeaveCardCount,cbPublicCard);
- this.m_WeaveCtrl.SetWeaveState(j,EndInfo.weaveItem[wChair][j], true);
- if( !cbPublicCard && cbWeaveCardCount == 4){
- this.m_WeaveCtrl.SetWeaveState(j,GameDef.GAME_THREE_BACK_SELF);
- }
- }
- this.m_diamond.active = false;
- if (GameDef.m_dwGameRuleArr[3] > 0) {
- this.m_diamond.active = true;
- }
- },
- ResetControl:function(wChair,EndInfo){
- this.m_WeaveCtrl.ResetData();
- this.m_UserCard.SetPositively(false);
- },
- // update (dt) {},
- });
|