public bool checkObj(HandCardItem item) { if (item == null || !item.valid()) { return(false); } return(item.getObj().Equals(_obj)); }
void hideMopai() { HandCardItem item = _MoHand; if (item != null && item.valid()) { item.destroy(); } _MoHand = null; }
void ResetCards() { m_pengOrGangMoveCount = 0; _HandCardPlace.position = m_HandCardPlace_StartPos; _HandCardPlace.localRotation = Quaternion.identity; _MoHandPos.localRotation = Quaternion.identity; this.transform.position = m_HandCardMgr_StartPos; isPeng = false; newIndex = -1; oldIndex = -1; idArray.Clear(); _handCardList.Clear(); Transform[] trans = _HandCardPlace.GetComponentsInChildren <Transform>(); for (int i = trans.Length - 1; i >= 0; i--) { if (trans[i] != _HandCardPlace) { DestroyImmediate(trans[i].gameObject); } } if (_MoHand != null && _MoHand.valid()) { _MoHand.destroy(); } _MoHand = null; currentObj = null; if (huPaiSpawn != null) { Transform[] tranArray = huPaiSpawn.GetComponentsInChildren <Transform>(); for (int i = tranArray.Length - 1; i >= 0; i--) { if (tranArray[i] != huPaiSpawn) { DestroyImmediate(tranArray[i].gameObject); } } } }
public void onMJClicked(HandCardItem item) { if (item == null || !item.valid()) { return; } RoomMgr rm = RoomMgr.GetInstance(); if (_gangState == 0) { onMJChoosed(item); return; } if (!rm.isMyTurn() || shot) { return; } HandCardItem old = selected; GameObject ob = item.getObj(); if (old != null && item.checkObj(old)) { if (_tingState != 0) { old.choosed(false); } Highlight(old.getId(), false); ob.transform.position = selPos; selected = null; selPos = Vector3.zero; shoot(item); shot = true; hidePrompt(); return; } if (old != null && old.valid()) { ob = old.getObj(); // NOTE: old maybe in recycle if (old.getLayer() == "Self") { ob.transform.position = selPos; if (_tingState != 0) { old.choosed(false); } Highlight(old.getId(), false); } selected = null; } ob = item.getObj(); selPos = ob.transform.position; selected = item; ob.transform.Translate(0, 0.01f, 0); onMJChoosed(item); }