/// <summary> /// 检测显示对家牌 /// </summary> void CheckShowTeamerCards(List <uint> djList) { if (djList == null) { return; } duijiaIcon.gameObject.SetActive(djList.Count > 0); if (djList.Count == 0) { return; } DestroyChildren(cardItemContainer); var data = djList; curTeamerCardCount = data.Count; List <SingleCard> cardList = new List <SingleCard>(); List <List <SingleCard> > dic = new List <List <SingleCard> >(); for (int i = 0; i < curTeamerCardCount; i++) { GameObject item = Instantiate(singleCardPrefab); item.transform.SetParent(cardItemContainer); item.transform.localPosition = Vector3.zero; item.transform.localScale = Vector3.one; SingleCard singleCard = item.GetComponent <SingleCard>(); singleCard.SetCardData(data[i]); singleCard.posType = EPlayerPositionType.ENull; cardList.Add(singleCard); } SelfCardsManager.Instance.InitRefreshRealCardDic(cardList, dic); SetTeamCardPosAndDepth(dic); // 刷新底部牌 }
void SetSelfPutOutSuc(LocalNotification e) { ArgsCanputOutCard args = e.param as ArgsCanputOutCard; if (args.msgCardGroup != null) //判断是否有两种重复类型需要选择 { ShowCardCTSelect(args.msgCardGroup); return; } //不要和其他显示效果不同 bool isBuyao = args.putOutType == TGuanDanCT.CT_BUCHU; var manager = SelfCardsManager.Instance; if (!isBuyao) { manager.mCurSelectCardIds = args.cards; AudioManager.Instance.PlayEffectAudio(manager.GetCardAudioFileName(args.putOutType, args.cards[0], AudioManager.Instance.mAudioStyle)); //存储当前的卡牌 //页面动画打出及显示 for (int i = 0; i < args.cards.Count; i++) { SingleCard singleCard = manager.GetSingleCardById(args.cards[i]); if (singleCard == null) { Debug.LogError("item为null,idx:" + args.cards[i]); return; } singleCard.SwitchStatus(ECardStatus.EOuted); } //Play Tween 根据服务器发送过来的牌的类型播放动画 TweenManager.Instance.PlayCardTween(args.putOutType, outTargetPos); } else { AudioManager.Instance.PlayEffectAudio(manager.GetCardAudioFileName(args.putOutType, 0, AudioManager.Instance.mAudioStyle)); GameObject item = Instantiate(singleCardPrefab, cardItemContainer); item.transform.localPosition = Vector3.zero; //GlobalData.mSelectCardToTargetPos; //item.transform.localScale = Vector3.one; SingleCard singleCard = item.GetComponent <SingleCard>(); //将多余的牌拿出来 singleCard.SetCardData(GlobalData.mRefuseCardNumId); singleCard.SwitchStatus(ECardStatus.EOuted); } //刷新Controller层数据 for (int i = 0; i < args.cards.Count; i++) { manager.UpdatePutOutInCardList(args.cards[i]); //更新了isIn状态 } manager.ClearAllSelectCards(); //清空所有被选中的打出的牌 manager.SendShakeNormalCards(); manager.RefreshRealDic(); //刷新isIn SetCardPosAndDepth(manager.mRealCardDic); // 刷新底部牌 }
void InitSingleCard(uint i) { GameObject item = GameObject.Instantiate(singleCardPrefab) as GameObject; item.transform.SetParent(cardItemContainer); item.transform.localPosition = Vector3.zero; item.transform.localScale = Vector3.one; SingleCard singleCard = item.GetComponent <SingleCard>(); singleCard.SetCardData(i); singleCard.mIsIn = true; SelfCardsManager.Instance.mCardDataList.Add(singleCard); }
/// <summary> /// 改变最初始的牌(专门用于进贡,回贡,改变最基础的牌) /// </summary> public void ChangeBaseSelfCard(uint id, bool isAdd) { var playingManager = PlayingGameInfo.Instance; var selfManager = SelfCardsManager.Instance; if (isAdd == true) { GameObject item = GameObject.Instantiate(singleCardPrefab) as GameObject; item.transform.SetParent(cardItemContainer); item.transform.localPosition = Vector3.zero; item.transform.localScale = Vector3.one; SingleCard singleCard = item.GetComponent <SingleCard>(); singleCard.SetCardData(id); singleCard.mIsIn = true; playingManager.mSelfBaseCardIdList.Add(id); selfManager.AddCardDataListItem(singleCard); } else { GameObject.Destroy(selfManager.GetSingleCardById(id).gameObject); playingManager.mSelfBaseCardIdList.Remove(id); selfManager.RemoveCardDataListItem(id); } // 存理牌记录,自动理牌n次 selfManager.ClearAllSelectCards(); selfManager.InitRefreshRealCardDic(SelfCardsManager.Instance.mCardDataList, SelfCardsManager.Instance.mRealCardDic); int sortCardRecordCount = SelfCardsManager.Instance.mSortRecordList.Count; if (sortCardRecordCount > 0) { for (int i = 0; i < sortCardRecordCount; i++) { AutoSortRealCard(i); } SelfCardsManager.Instance.ClearAllSelectCards(); } SetCardPosAndDepth(SelfCardsManager.Instance.mRealCardDic); // 刷新底部牌 //---------- if (isAdd) { //显示增加的牌(改变颜色) selfManager.AddSelectCard(id); selfManager.PostSendCardToSelectStatus(selfManager.mCurSelectCardIds, ECardStatus.ESelected); } selfManager.SendShakeNormalCards(); }