public override void Query(ISFSObject obj, DVoidSfsObject sendCall, EventData evn) { currMahjong = (MahjongIcon)evn.data1; if (currMahjong == null) { return; } //向服务器发出请求 if (MahjongIcon.Flag.Ting == currMahjong.CurrFlag) { if (!_huqueryCacheList.ContainsKey(currMahjong.MahjongItem.Value)) { //听的牌,通过服务器查询 obj.PutInt(RequestKey.KeyType, MjRequestData.MJRequestTypeGetHuCards); obj.PutInt(_keyCard, currMahjong.MahjongItem.Value); sendCall(obj); } else { SetMahHuListInfo(currMahjong.MahjongItem.Value); } } /* currMahjong = (MahjongIcon)evn.data1; * if (currMahjong == null) return; * * //向服务器发出请求 * if (MahjongIcon.Flag.Ting == currMahjong.CurrFlag && !mahjongQueryCache.ContainsKey(currMahjong.MahjongItem.Value)) * { * //听的牌,通过服务器查询 * obj.PutInt(RequestKey.KeyType, MjRequestData.MJRequestTypeGetHuCards); * obj.PutInt("card", currMahjong.MahjongItem.Value); * sendCall(obj); * } * else * { * /* //不向服务器发出请求 * QueryHulistData hulistData = new QueryHulistData((int)currMahjong.CurrFlag, currMahjong.MahjongItem.Value, currMahjong.MahjongItem.MahjongIndex, laizi); * * switch (currMahjong.CurrFlag) * { * case MahjongIcon.Flag.Ting: * hulistData.Cards = mahjongQueryCache[currMahjong.MahjongItem.Value]; * //任意牌 * if (hulistData.Cards.Exists((a) => { return a == 0; })) * hulistData.LeaveMahjongCnt = leaveMahjongCnt; * EventDispatch.Dispatch((int)GameEventId.QueryHulist, new EventData(hulistData)); * break; * case MahjongIcon.Flag.Youjin: * hulistData.LeaveMahjongCnt = leaveMahjongCnt; * EventDispatch.Dispatch((int)GameEventId.QueryHulist, new EventData(hulistData)); * break; * }#1# * * //if() * * }*/ }
//点听或游金牌,查询可胡的牌 protected void OnQueryHuList(int eventId, EventData evn) { DVoidSfsObject call = (obj) => { SendGameRequest(obj); }; SFSObject sfsObject = SFSObject.NewInstance(); table.RequestQueryHuList(sfsObject, call, evn); }
protected void OnHuClick(EventData evn) { DVoidSfsObject call = (obj) => { SendGameRequest(obj); }; SFSObject sfsObject = SFSObject.NewInstance(); table.GetHuData(sfsObject, call); }
protected void OnGangClick(EventData evn) { DVoidSfsObject call = (obj) => { SendGameRequest(obj); }; ISFSObject sfsObj = SFSObject.NewInstance(); table.GetGangData(sfsObj, call); }
public override void GetGangData(ISFSObject obj, DVoidSfsObject sendCall) { List <FindGangData> findList = FindCanGang(); //如果不能杠财神,则移除可能是财神的牌 if (_cargs2.ContainsKey(Gangcaishen) && _cargs2.GetUtfString(Gangcaishen) == "0") { foreach (var findGangData in findList) { if (findGangData.cards[0] == Laizi) { findList.Remove(findGangData); break; } } } DVoidInt sendCallArray = index => { YxDebug.Log("发送服务器 杠 " + findList[index].cards); if (findList[index].type != UtilDef.DefInt) { obj.PutInt(RequestKey.KeyType, findList[index].type); } if (findList[index].ttype != UtilDef.DefInt) { obj.PutInt(RequestKeyOther.KeyTType, findList[index].ttype); } if (findList[index].cards != null && findList[index].ttype != MjRequestData.CPG_ZhuaGang) { obj.PutIntArray(RequestKey.KeyCards, findList[index].cards); } else if (findList[index].cards != null && findList[index].ttype == MjRequestData.CPG_ZhuaGang) { obj.PutInt(RequestKey.KeyOpCard, findList[index].cards[0]); } sendCall(obj); }; //如果找到的杠 大于1 if (findList.Count > 1) { YxDebug.Log("通知UI 提示杠选择 " + findList.Count); var lisiCard = findList.Select(t => t.cards).ToList(); //通知UI提示选择 EventDispatch.Dispatch((int)UIEventId.CgChoose, new EventData(lisiCard, sendCallArray, _outPutMahjong)); } else { sendCallArray(0); } }
//绝杠 protected void OnJueGang(int eventId, EventData evn) { //DVoidTArray<int> call = (array) => //{ // SFSObject sfsObject = SFSObject.NewInstance(); // sfsObject.PutInt(RequestKey.KeyType, MjRequestData.MJRequestJueGang); // sfsObject.PutIntArray(RequestKey.KeyCards, array); // SendGameRequest(sfsObject); //}; //table.GetJueGangData(call); DVoidSfsObject call = (obj) => { SendGameRequest(obj); }; ISFSObject sfsObj = SFSObject.NewInstance(); table.GetJueGangData(sfsObj, call); }
public virtual void Query(ISFSObject obj, DVoidSfsObject sendCall, EventData evn) { currMahjong = (MahjongIcon)evn.data1; if (currMahjong == null) { return; } //向服务器发出请求 if (MahjongIcon.Flag.Ting == currMahjong.CurrFlag && !mahjongQueryCache.ContainsKey(currMahjong.MahjongItem.Value)) { //听的牌,通过服务器查询 obj.PutInt(RequestKey.KeyType, MjRequestData.MJRequestTypeGetHuCards); obj.PutInt("card", currMahjong.MahjongItem.Value); sendCall(obj); } else { //不向服务器发出请求 QueryHulistData hulistData = new QueryHulistData((int)currMahjong.CurrFlag, currMahjong.MahjongItem.Value, currMahjong.MahjongItem.MahjongIndex, laizi); switch (currMahjong.CurrFlag) { case MahjongIcon.Flag.Ting: hulistData.Cards = mahjongQueryCache[currMahjong.MahjongItem.Value]; //任意牌 if (hulistData.Cards.Exists((a) => { return(a == 0); })) { hulistData.LeaveMahjongCnt = leaveMahjongCnt; } EventDispatch.Dispatch((int)GameEventId.QueryHulist, new EventData(hulistData)); break; case MahjongIcon.Flag.Youjin: hulistData.LeaveMahjongCnt = leaveMahjongCnt; EventDispatch.Dispatch((int)GameEventId.QueryHulist, new EventData(hulistData)); break; } } }