public void AchieveHandGrid(GameContainerItem handGridItem, bool myself) { //清除 foreach (HandCellView handCellView in handCellViews) { handCellPool.Push(handCellView); } //重新 for (int i = 0; i < handGridItem.cardEntryList.Count(); i++) { CardEntry handCellItem = handGridItem.cardEntryList[i]; Vector3 position = new Vector3(); //position = HandMetrics.erectPosition(position, handCellItem.X); //创建一个格子实例 // HandCellView cell = Instantiate<HandCellView>(cellPrefab); HandCellView cell = handCellPool.Pop(); //设置图片 //cell.GetComponent<HandCellInstance>().SetImage(); cell.transform.SetParent(transform, false); cell.transform.localPosition = position; cell.myself = myself; cell.LoadHandCellItem(handCellItem); handCellViews.Add(cell); } //渲染需要放在格子生成完毕后 //不再渲染,改为用贴图 //handMesh.Triangulate(handCellViews); }
//添加一张牌的动画 public IEnumerator PlayerDrawOneCardEnumerator(CardEntry handCellItem, UnityAction callBack) { Vector3 position = new Vector3(); //position = HandMetrics.erectPosition(position, handCellItem.X); //创建一个格子实例 // HandCellView cell = Instantiate<HandCellView>(cellPrefab); HandCellView cell = handCellPool.Pop(); //设置图片 //cell.GetComponent<HandCellInstance>().SetImage(); cell.transform.SetParent(transform, false); cell.transform.localPosition = position; cell.myself = myself; cell.LoadHandCellItem(handCellItem); handCellViews.Add(cell); yield return(new WaitForSeconds(0.25f)); callBack(); }