private void OnShowXjfdListPanel(EvtHandlerArgs args) { XjfdListArgs eventArgs = args as XjfdListArgs; PanelShowXjfdList panel = GameCenter.Hud.GetPanel <PanelShowXjfdList>(); if (null != panel) { panel.Open(eventArgs); } }
/// <summary> /// 选择小鸡飞蛋的牌 /// </summary> protected void ChooseXjfd() { var c2s = GameCenter.Network.C2S.Custom <C2SCustom>(); Action <int[]> sendCall = (index) => { c2s.Network.OnRequestC2S((sfs) => { sfs.PutInt(RequestKey.KeyType, NetworkProtocol.MJRequestTypeDan); sfs.PutIntArray(RequestKey.KeyCards, index); return(sfs); }); }; var dataCenter = GameCenter.DataCenter; List <int> cards = dataCenter.OneselfData.HardCards; MahjongUtility.SortMahjong(cards); Dictionary <int, int> dic = c2s.GetCardAmountOnXjfd(cards); _canChoose = FindCanXjfd(); if (_canChoose == null || _canChoose.Count == 0) { YxDebug.LogError("本地遍历可蛋的数量为空"); return; } var args = new XjfdListArgs(); _canChoose.Sort(); var canDic = c2s.GetCardAmountOnXjfd(_canChoose); if (_canChoose.Count == 1)//&& dic[_canChoose[0]] == 1 { int can = _canChoose[0]; if (!ChackCardsIsHasDan(can)) { sendCall(_canChoose.ToArray()); ResetPlayerHandMahjong();//重新设置麻将状态 return; } } else if (_canChoose.Count == 3 || _canChoose.Count == 4) { int yaoNum = 0; if (canDic.ContainsKey(33)) { yaoNum = canDic[33]; canDic.Remove(33); } //if (yaoNum == 0 && IsOnlyOneInHand(_canChoose, dic) && ChackCardsIsHasDan(canDic, yaoNum)) if (ChackCardsIsHasDan(canDic, yaoNum)) { sendCall(_canChoose.ToArray()); ResetPlayerHandMahjong();//重新设置麻将状态 return; } } if (IsChooseBySelf) { //显示选择小鸡飞蛋界面 GameCenter.EventHandle.Dispatch((int)UIEventProtocol.ShowChooseXjfd, args); var list = PlayerHand.MahjongList; MahjongContainer item; for (int i = 0; i < list.Count; i++) { item = list[i]; item.ResetPos(); if (!_canChoose.Contains(item.Value)) { item.Lock = true; item.RemoveMahjongScript(); } } for (int i = 0; i < _canChoose.Count; i++) { for (int j = 0; j < list.Count; j++) { item = list[j]; if (item.Value == _canChoose[i]) { item.SetMahjongScript(); item.SetAllowOffsetStatus(false); item.SetThowOutCall(XjfdClickEvent); } } } return; } int yao = dic.ContainsKey(33) && dataCenter.ConfigData.FeiDan ? dic[33] : 0; //弹出列表 var target = ShowChooseXjfdPanel(yao); if (target.Count > 0) { args.XjfdList = target; LockHandCard(); GameCenter.EventHandle.Dispatch((int)UIEventProtocol.ShowXjfdList, args); } }