public void PlayChuPaiAnimation(bool isMoNi) { int index = _RecyleHandCardList.Count - 1; Debug.LogWarning("[" + seatindex + "]DHM_RecyleHandCardManager+模拟出牌的ID:" + _RecyleHandCardList[index].getId()); GameObject hand = GetChuPaiWay(); if (ChuPaiCallBackEvent != null) { ChuPaiCallBackEvent(hand); } int row = getRow(index); int col = getCol(index); hand.transform.rotation = transform.rotation; hand.transform.Translate(offSetX * col, 0, offSetZ * row); DHM_HandAnimationCtr handCtr = hand.GetComponent <DHM_HandAnimationCtr>(); handCtr.SetMoNiMoPai(isMoNi); handCtr.PlayChuPaiAnimation(_RecyleHandCardList[index]); handCtr.chuPaiEndEvent += ChuPaiEndEventHandle; GameManager.m_instance.m_ProState = transform.parent.GetComponent <DHM_CardManager>(); }
void Start() { tip = Instantiate(m_Tip); tip.SetActive(false); if (_handCardMgr == null) { _handCardMgr = GetComponentInChildren <DHM_HandCardManager>(); } if (_recyleCardMgr == null) { _recyleCardMgr = GetComponentInChildren <DHM_RecyleHandCardManager>(); } if (_pengGangMgr == null) { _pengGangMgr = GetComponentInChildren <PengGangManager>(); } if (_handAnimationCtr == null) { _handAnimationCtr = GetComponentInChildren <DHM_HandAnimationCtr>(); } if (_handCardMgr != null && _recyleCardMgr != null) { _handCardMgr.chuPaiEvent += _recyleCardMgr.ChuPai; _recyleCardMgr.ChuPaiCallBackEvent += _handCardMgr.ChuPaiCallBackEventHandle; } //initHighLight(); }
public void PlayChuPaiAnimation(bool isMoNi) { Debug.LogWarning("DHM_RecyleHandCardManager+模拟摸牌的ID:" + _RecyleHandCardList[_RecyleHandCardList.Count - 1]); //设置手的偏移量 GameObject hand = GetChuPaiWay(); if (ChuPaiCallBackEvent != null) { ChuPaiCallBackEvent(hand); } int index = _RecyleHandCardList.Count - 1; int row = index / 6; int col = index % 6; hand.transform.rotation = this.transform.rotation; hand.transform.Translate(offSetX * col, 0, offSetZ * row); DHM_HandAnimationCtr handCtr = hand.GetComponent <DHM_HandAnimationCtr>(); handCtr.SetMoNiMoPai(isMoNi); //handCtr.Set_RecyleHandCardMgrPos(this.gameObject); handCtr.PlayChuPaiAnimation(_RecyleHandCardList[_RecyleHandCardList.Count - 1]); handCtr.chuPaiEndEvent += ChuPaiEndEventHandle; //hand.SendMessage("SetMoNiMoPai", isMoNi, SendMessageOptions.DontRequireReceiver); //hand.SendMessage("Set_RecyleHandCardMgrPos", this.gameObject, SendMessageOptions.DontRequireReceiver); //hand.SendMessage("PlayChuPaiAnimation", _RecyleHandCardList[_RecyleHandCardList.Count - 1], SendMessageOptions.RequireReceiver); GameManager.m_instance.m_ProState = this.transform.parent.GetComponent <DHM_CardManager>(); }
void ChaPaiEndEventHandle(DHM_HandAnimationCtr hand) { hand.moveHandEvent -= MoveHandCard; hand.chaPaiEndEvent -= ChaPaiEndEventHandle; float x = _handCardList.Count / 2.0f - newIndex; _MoHand._obj.transform.SetParent(_HandCardPlace); _MoHand._obj.transform.localPosition = Vector3.zero; _MoHand._obj.transform.localRotation = Quaternion.Euler(Vector3.zero); _MoHand._obj.transform.Translate(offSetX * x, 0, 0); _MoHand = null; ResourcesMgr.m_Instance.RemoveGameObject(hand.gameObject); GameManager.m_instance.islock = false; Debug.LogWarning("ChaPaiEndEventHandle结束:" + GameManager.m_instance.islock); }
void ChaPaiEndEventHandle(DHM_HandAnimationCtr hand) { hand.moveHandEvent -= MoveHandCard; hand.chaPaiEndEvent -= ChaPaiEndEventHandle; float x = _handCardList.Count / 2.0f - newIndex; Transform tm = _MoHand.getObj().transform; tm.SetParent(_HandCardPlace); tm.localPosition = Vector3.zero; tm.localRotation = Quaternion.Euler(Vector3.zero); tm.Translate(offSetX * x, 0, 0); _MoHand = null; ResourcesMgr.mInstance.RemoveGameObject(hand.gameObject); }
public void StopAllHands() { ResourceItem item = null; for (int i = 0; i < cacheList.Count; i++) { item = cacheList[i]; if (item.handle >= 0) { DHM_HandAnimationCtr ctrl = item.obj.GetComponent <DHM_HandAnimationCtr>(); if (ctrl != null) { ctrl.Stop(); } } } }
void Start() { switch (m_Player) { case DHM_HandCardManager.PlayerType.East: localindex = 0; break; case DHM_HandCardManager.PlayerType.South: localindex = 1; break; case DHM_HandCardManager.PlayerType.West: localindex = 2; break; case DHM_HandCardManager.PlayerType.North: localindex = 3; break; } seatindex = RoomMgr.GetInstance().getSeatIndexByLocal(localindex); _handCardMgr = GetComponentInChildren <DHM_HandCardManager>(); _recyleCardMgr = GetComponentInChildren <DHM_RecyleHandCardManager>(); _pengGangMgr = GetComponentInChildren <PengGangManager>(); _handAnimationCtr = GetComponentInChildren <DHM_HandAnimationCtr>(); _handCardMgr.seatindex = seatindex; _recyleCardMgr.seatindex = seatindex; _pengGangMgr.seatindex = seatindex; _handCardMgr.chuPaiEvent += _recyleCardMgr.ChuPai; _recyleCardMgr.ChuPaiCallBackEvent += _handCardMgr.ChuPaiCallBackEventHandle; if (RoomMgr.GetInstance().seatindex == seatindex) { SetLayer(); } }
/// <summary> /// 插牌 /// </summary> /// <param name="needIndex">需要插入的位置</param> /// <param name="obj">需要插入的对象</param> public void ChaPai(int needIndex, GameObject obj) { //创建手,设置手的位置,即,确定要插入的位置 //拿起摸到的牌 //将摸到的牌放在手上 //将手牌左移或者右移 Debug.Log("插牌下标:" + newIndex); int handIndex = 13 - (_handCardList.Count - needIndex) + 1; string name = strChaPaiHand + handIndex.ToString(); GameObject hand = ResourcesMgr.m_Instance.InstantiateGameObjectWithType(name, ResourceType.Hand); if (m_handCard_layer == (LayerMask.NameToLayer("Self"))) { foreach (var tran in hand.GetComponentsInChildren <SkinnedMeshRenderer>()) { tran.material = ResourcesMgr.m_Instance.M_transparent; } } else { foreach (var tran in hand.GetComponentsInChildren <SkinnedMeshRenderer>()) { tran.material = m_shouMaterial; } } hand.transform.rotation = _MoHandPos.rotation; hand.transform.position = _MoHandPos.TransformPoint(-0.011f, -0.0229f, 0.257f); DHM_HandAnimationCtr handAniCtr = hand.GetComponent <DHM_HandAnimationCtr>(); if (handAniCtr == null) { hand.SendMessage("PlayChaPaiAnimation", obj, SendMessageOptions.RequireReceiver); } handAniCtr.PlayChaPaiAnimation(obj); handAniCtr.moveHandEvent += MoveHandCard; handAniCtr.chaPaiEndEvent += ChaPaiEndEventHandle; //handAniCtr.Set_HandCardPlacePos(_HandCardPlace.gameObject); }
// 注册插牌事件,当出牌动画执行完毕自动调用 public void ChuPaiCallBackEventHandle(GameObject go) { DHM_HandAnimationCtr handCtr = go.GetComponent <DHM_HandAnimationCtr>(); handCtr.chaPaiEvent += chapai; }