IEnumerator initMediumShow() { var iLen = lCardDatas.Count; for (int i = 0; i < 5; i++) { for (int j = 0; j < 10; j++) { int idx = iLen - 1 - (j + 10 * i); int iCard = lCardDatas[idx]; int iCardNum = iCard % 100; int iCardType = (int)Mathf.Floor(iCard / 100); int iRow = i; CardSpider card = lCards[idx]; card.init(iCardNum, iCardType, 1, iRow, this); var iPosX = _prx - 30 * (4 - i); card.transform.localPosition = new Vector3(iPosX - 30, _ply, 0); var pos = card.gameObject.GetComponent <RectTransform>().anchoredPosition; card.showMove(iPosX - pos.x, 0, iPosX); } yield return(new WaitForSeconds(0.2f)); } }
IEnumerator playCards() { yield return(new WaitForSeconds(1.2f)); adMgr.PlaySound("start"); int len = lCardDatas.Count - 50; for (var i = 0; i < 6; i++) { for (int j = 0; j < IROWCOUNT; j++) { int idx = j + IROWCOUNT * i; if (idx >= len) { break; } int iCard = lCardDatas[idx]; int iCardNum = iCard % 100; int iCardType = (int)Mathf.Floor(iCard / 100); CardSpider card = lCards[idx]; card.init(iCardNum, iCardType, 0, j, this); var iPosX = _px + 60 * j; var iPosY = _py - 30 * i; var pos = card.gameObject.GetComponent <RectTransform>().anchoredPosition; card.showMove(iPosX - pos.x, iPosY - pos.y, iPosX); } yield return(new WaitForSeconds(0.2f)); } showInitCards(); coPlayTime = StartCoroutine(playTextTime()); yield return(new WaitForSeconds(0.5f)); setTouchable(true); }
public void moveCards(CardSpider card, int iPos, int iRow) { adMgr.PlaySound("move"); bool bAutoMove = true; if (card.transform.parent.gameObject == goMove) { bAutoMove = false; } if (bAutoMove == true && iPos == 0) { card.addItems(); } var items = card.getItems(); Transform upTrans; if (bAutoMove == true) { var cIdx = card.transform.GetSiblingIndex(); if (cIdx > 0 && card.getPos() == 0) { upTrans = card.transform.parent; var upCard = upTrans.GetChild(cIdx - 1).GetComponent <CardSpider>(); if (upCard.getBShowBg() == true) { upCard.showBg(false); } } } else { upTrans = getTransP(card.getPos(), card.getRow()); var iLen = upTrans.childCount; if (iLen > 0) { var upCard = upTrans.GetChild(iLen - 1).GetComponent <CardSpider>(); if (upCard.getBShowBg() == true) { upCard.showBg(false); } } } var trans = getTransP(iPos, iRow); card.setPos(iPos); card.setRow(iRow); card.transform.SetParent(trans); if (iPos == 0) { if (items.Count > 0) { foreach (Transform item in items) { var itemCard = item.GetComponent <CardSpider>(); itemCard.setPos(iPos); itemCard.setRow(iRow); item.SetParent(trans); } } _transWin = trans; setBMove(); showWin(); if (bAutoMove == false) { card.transform.localPosition = new Vector3(0, 0 - 30 * (trans.childCount - 1 - items.Count), 0); if (items.Count > 0) { var idx = 0; foreach (Transform item in items) { idx++; item.localPosition = new Vector3(0, 0 - 30 * (trans.childCount - 1 - items.Count + idx), 0); } } } else { card.transform.SetParent(goMove.transform); var iPosX = _px + IROWDIS * iRow; var iPosY = _py - 30 * (trans.childCount - items.Count); var pos = card.gameObject.GetComponent <RectTransform>().anchoredPosition; if (items.Count > 0) { foreach (Transform item in items) { item.SetParent(card.transform); } } card.showMove(iPosX - pos.x, iPosY - pos.y, iPosX); } } }