/// <summary> /// 调整手牌位置 /// </summary> /// <param name="type"></param> public static void AdjustCardSpritsPosition(CharacterType type) { if (type == CharacterType.Desk) { DeskCardsCache instance = DeskCardsCache.Instance; CardSprite[] cs = GameObject.Find(type.ToString()).GetComponentsInChildren <CardSprite>(); for (int i = 0; i < cs.Length; i++) { for (int j = 0; j < cs.Length; j++) { if (cs[j].Poker == instance[i]) { cs[j].GoToPosition(GameObject.Find(type.ToString()), i); } } } } else { HandCards hc = GameObject.Find(type.ToString()).GetComponent <HandCards>(); CardSprite[] cs = GameObject.Find(type.ToString()).GetComponentsInChildren <CardSprite>(); for (int i = 0; i < hc.CardsCount; i++) { for (int j = 0; j < cs.Length; j++) { if (cs[j].Poker == hc[i]) { cs[j].GoToPosition(GameObject.Find(type.ToString()), i); } } } } }
/// <summary> /// 精灵化角色手牌 /// </summary> /// <param name="type"></param> /// <param name="isSelected"></param> void MakeHandCardsSprite(CharacterType type, bool isSelected) { if (type == CharacterType.Desk) { DeskCardsCache instance = DeskCardsCache.Instance; for (int i = 0; i < instance.CardsCount; i++) { MakeSprite(type, instance[i], isSelected, i); } } else { GameObject parentObj = GameObject.Find(type.ToString()); HandCards cards = parentObj.GetComponent <HandCards>(); //排序 cards.Sort(); //精灵化 for (int i = 0; i < cards.CardsCount; i++) { if (!cards[i].isSprite) { MakeSprite(type, cards[i], isSelected, i); } } //显示剩余扑克 UpdateLeftCardsCount(cards.cType, cards.CardsCount); } //调整精灵位置 AdjustCardSpritsPosition(type); }