public void RemoveGameObj(int id, int Number) { id = id % 100; int count = 0; HandCardItem item = null; for (int i = _handCardList.Count - 1; i >= 0; i--) { item = _handCardList[i]; if (item.checkId(id)) { count++; item.destroy(); _handCardList.RemoveAt(i); if (count == Number) { UpdateHandCard(); return; } } } item = _MoHand; if (item != null && item.checkId(id)) { count++; item.destroy(); _MoHand = null; } else { Debug.LogError("mohand id != " + id.ToString()); } if (count != Number) { Debug.LogError("count < number!!!!"); } UpdateHandCard(); }
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 RemoveMoHandCard(int id) { HandCardItem item = _MoHand; if (item != null) { item.destroy(); } _MoHand = null; }
void hideMopai() { HandCardItem item = _MoHand; if (item != null && item.valid()) { item.destroy(); } _MoHand = null; }
public void DeleteCard() { if (_RecyleHandCardList.Count == 0) { return; } int id = _RecyleHandCardList.Count - 1; HandCardItem item = _RecyleHandCardList[id]; detachFocus(); _RecyleHandCardList.RemoveAt(id); item.destroy(); lastChuPai = null; }
HandCardItem GetRandomHandCardItem(int id) { int cnt = _handCardList.Count; System.Random rd = new System.Random(); int start = _MoHand != null ? -1 : 0; int off = rd.Next(start, cnt); HandCardItem item = null; if (-1 == off) { item = _MoHand; } else { item = _handCardList[off]; } GameObject obj = ResourcesMgr.GetInstance().LoadMJ(id); obj.layer = m_handCard_layer; obj.gameObject.tag = tagValue; obj.transform.SetParent(_HandCardPlace); HandCardItem card = new HandCardItem(id, obj); obj.transform.localPosition = item.getObj().transform.localPosition; obj.transform.localRotation = item.getObj().transform.localRotation; if (-1 == off) { _MoHand = card; } else { _handCardList[off] = card; } item.destroy(); return(card); }
IEnumerator _HuPai(HuPushInfo info, Action cb) { bool myself = isMyself(); bool zimo = info.iszimo; int layer = myself ? LayerMask.NameToLayer("Self") : LayerMask.NameToLayer("ZhuoPai"); List <int> holds = info.holds; holds.Sort((a, b) => a - b); if (!myself) { for (int i = 0; i < _handCardList.Count && i < holds.Count; i++) { HandCardItem item = _handCardList [i]; int id = holds [i]; GameObject obj = ResourcesMgr.GetInstance().LoadMJ(id); HandCardItem card = new HandCardItem(id, obj); obj.layer = layer; obj.tag = tagValue; obj.transform.SetParent(_HandCardPlace); obj.transform.localRotation = item.getObj().transform.localRotation; obj.transform.localPosition = item.getObj().transform.localPosition; _handCardList [i] = card; item.destroy(); } foreach (HandCardItem item in _handCardList) { item.setLayer("ZhuoPai"); } } if (_MoHand != null) { _MoHand.destroy(); } if (true) { int id = info.hupai; GameObject obj = ResourcesMgr.GetInstance().LoadMJ(id); _MoHand = new HandCardItem(id, obj); obj.layer = layer; obj.tag = tagValue; obj.transform.SetParent(_MoHandPos); obj.transform.rotation = _MoHandPos.rotation; obj.transform.position = _MoHandPos.TransformPoint(0.0731f * offSetX, 0, 0); } _MoHand.setInteractable(false, false); bool anim = false; bool replay = ReplayMgr.GetInstance().isReplay(); if (!myself && !replay) { _MoHandPos.transform.Translate(0, 0, 0.04f); _MoHandPos.transform.Rotate(-90, 0, 0); anim = true; } if (anim) { Transform huHandSpawn = this.transform.parent.Find("HandSpawn"); GameObject huHand = ResourcesMgr.mInstance.InstantiateGameObjectWithType("HupaiHand", ResourceType.Hand); huHand.transform.rotation = huHandSpawn.rotation; huHand.transform.position = huHandSpawn.position; huHand.GetComponent <DHM_HandAnimationCtr> ().huPaiEvent += HuPaiEventHandle; } if (!zimo) { DHM_RecyleHandCardManager.playHu(); } else { Transform trans = _MoHand.getObj().transform; if (!myself) { GameObject ob = Instantiate(Resources.Load("Prefab/Meishu/fx_hu"), trans) as GameObject; Transform ts = ob.transform; ts.localPosition = new Vector3(0, 0.24f, 0.13f); } } _MoHand.setHu(); yield return(new WaitForSeconds(1.0f)); /* * if (huPaiSpawn == null) * huPaiSpawn = this.transform.parent.Find("HuPaiSpwan"); * * GameObject effectObj = Instantiate(_huEffect); * effectObj.SetActive(true); * effectObj.transform.position = huPaiSpawn.position; * * GameObject huCard = ResourcesMgr.GetInstance ().LoadMJ (id); * huCard.transform.rotation = huPaiSpawn.rotation; * huCard.transform.position = huPaiSpawn.position; * huCard.transform.SetParent(huPaiSpawn); */ AudioManager.GetInstance().PlayEffectAudio("hu"); MainViewMgr mm = MainViewMgr.GetInstance(); if (zimo) { mm.showAction(seatindex, "zimo"); } else { mm.showAction(seatindex, "hu"); if (info.target >= 0) { mm.showAction(info.target, "dianpao"); } } yield return(new WaitForSeconds(4.0f)); cb(); }