void OnClickChiBtn() { Game.SoundManager.PlayClick(); if (MJUtils.Chi() || MJUtils.TingChi()) { List <GameOperChiArg> list = RoomMgr.actionNotify.chiArg; //List<int[]> list = Game.MJMgr.MyPlayer.GetChiList (Game.MJMgr.lastDropCard); if (null != list && list.Count > 0) { detail.CtrlPanel_UIItem.gameObject.SetActive(false); if (list.Count == 1) { GameOperChiArg chiArg = list[0]; Game.MJMgr.MyPlayer.Chi(chiArg); //Game.SoundManager.PlayChi (); //detail.DropButton_Button.gameObject.SetActive(true); } else { ClearSelectPanel(); detail.SelectPanel_UIItem.gameObject.SetActive(true); List <int> sortTemp = new List <int> (); for (int i = list.Count - 1; i >= 0; i--) //for (int i = 0; i < list.Count; i++) { GameOperChiArg chiArg = list[i]; GameObject selectGroup = PrefabUtils.AddChild(detail.SelectRoot_HorizontalLayoutGroup, detail.GroupButton_Button.gameObject); selectGroup.SetActive(true); sortTemp.Clear(); sortTemp.Add(chiArg.myCard1); sortTemp.Add(chiArg.myCard2); sortTemp.Add(chiArg.targetCard); sortTemp.Sort(); foreach (int card in sortTemp) { GameObject card0 = Game.PoolManager.MjPool.Spawn(card.ToString()); card0.transform.SetParent(selectGroup.transform); card0.transform.localScale = Vector3.one; card0.transform.localRotation = Quaternion.identity; } Button btn = selectGroup.GetComponent <Button> (); btn.onClick.AddListener(() => { Game.MJMgr.MyPlayer.Chi(chiArg); detail.SelectPanel_UIItem.gameObject.SetActive(false); //detail.DropButton_Button.gameObject.SetActive(true); }); } } } } }
public void Chi(GameOperChiArg chiArg) { int card = chiArg.targetCard; if (MJUtils.Chi() || MJUtils.TingChi()) { Game.SocketGame.DoChi(chiArg.myCard1, chiArg.myCard2); } }
public void OnGameOperPlayerActionNotify(GameOperPlayerActionNotify data) { RoomMgr.actionNotify = data; int position = data.position; int actions = data.actions; int lastActionPosition = data.lastActionPosition; int lastActionCard = data.lastActionCard; string pengArg = ""; if (MJUtils.Peng()) { pengArg = GetCardStr(data.pengArg); } string chi = ""; if (MJUtils.Chi()) { int count = data.chiArg.Count; for (int i = 0; i < count; i++) { GameOperChiArg arg = data.chiArg[i]; chi += "[" + GetCardStr(arg.myCard1) + "," + GetCardStr(arg.myCard2) + "]-" + GetCardStr(arg.targetCard) + " "; } } Debug.LogFormat("===<color=blue>提示</color>,最后操作[{0}]; 牌[{1}]", strs[lastActionPosition], GetCardStr(lastActionCard)); Debug.LogFormat("===<color=blue>提示</color>,{0} <color=yellow>{1}</color>,[{2}] 支对:[{3}],听列表:[{4}]", strs[data.position], ActionStr(data.actions), pengArg + chi, ToStr(data.tingDzs), ToStr(data.tingList)); if (lastActionPosition >= 0 && lastActionCard > 0) { MJPlayer p = Game.MJMgr.GetPlayerByPosition(lastActionPosition); GameObject go = p.dropCardLayout.last; if (null != go) { MJEntity et = go.GetComponent <MJEntity>(); if (null != et) { Game.MJMgr.LastDropCard = et; Game.MJMgr.targetFlag.gameObject.SetActive(true); Game.MJMgr.targetFlag.position = go.transform.position; } } } else { Game.MJMgr.targetFlag.gameObject.SetActive(false); } EventDispatcher.DispatchEvent(MessageCommand.MJ_UpdatePlayPage); }