//初始卡牌信息 public void InitData(byte[] bcards, ushort count, SplitCardsCall tcall) { if (count < 4) { return; } leftGrid.transform.GetChild(0).localPosition = new Vector3(-45, 0, 0); leftGrid.transform.GetChild(1).localPosition = new Vector3(-15, 0, 0); leftGrid.transform.GetChild(2).localPosition = new Vector3(15, 0, 0); leftGrid.transform.GetChild(3).localPosition = new Vector3(45, 0, 0); ResetPos(); Array.Clear(_bleftcard, 0, 4); Array.Clear(_brightcard, 0, 2); splitCardsCaLL = tcall; _ucount = count; _bcard = new byte[count]; Buffer.BlockCopy(bcards, 0, _bcard, 0, count); Buffer.BlockCopy(bcards, 0, _bleftcard, 0, count); _isPeaceful = false; if (GameLogic.GetPeaceful(bcards) > 0) { _isPeaceful = true; btnSpliteCard.GetComponent <UIButton>().isEnabled = true; byte cbcardtype = GameLogic.GetPeaceful(bcards); string cardname = "a_" + cbcardtype; leftCardType.gameObject.SetActive(true); leftCardType.spriteName = cardname; return; } byte[] cardType = new byte[2]; for (int i = 0; i < 4; i++) { for (int k = i + 1; k < 4; k++) { cardType[0] = bcards[i]; cardType[1] = bcards[k]; byte headNum = GameLogic.GetCardTypeN(cardType, 2); if (headNum == GameLogic.D2H_D2H) { int dataIndex = 0; _brightcard[0] = bcards[i]; _brightcard[1] = bcards[k]; byte[] headCardType = new byte[2]; for (int j = 0; j < 4; j++) { if (j != i && j != k) { headCardType[dataIndex] = bcards[j]; dataIndex++; } } for (int j = 0; j < 4; j++) { if (j < 2) { _bleftcard[j] = headCardType[j]; } else { _bleftcard[j] = 0; } } CheckCardType(); SetSpliteCardData(); _isPeaceful = true; if (GetLeftCount() == 2) { btnSpliteCard.GetComponent <UIButton>().isEnabled = true; } return; } } } }
public void InitData(byte[] cbPlayStatus, byte[][] bcards, long[] lscore, byte cardsNum, PlayerInfo[] userdata, GameExitType endreasion = GameExitType.END_REASON_NORMAL, Action action = null) { for (byte i = 0; i < GameLogic.GAME_PLAYER; ++i) { Transform tr = content.GetChild(i); tr.GetChild(1).gameObject.SetActive(false); tr.GetChild(2).gameObject.SetActive(false); tr.GetChild(4).gameObject.SetActive(false); tr.GetChild(5).gameObject.SetActive(false); tr.GetChild(0).GetComponent <UILabel>().text = ""; tr.GetChild(3).GetComponent <UILabel>().text = ""; tr.Find("head").GetComponent <UISprite>().spriteName = "close"; tr.Find("trial").GetComponent <UISprite>().spriteName = "close"; tr.Find("peaceful").GetComponent <UISprite>().spriteName = "close"; } callbackAction = action; byte bindex = 0; for (byte i = 0; i < GameLogic.GAME_PLAYER; ++i) { if (userdata[i] != null) { Transform tr = content.GetChild(bindex); tr.gameObject.SetActive(true); tr.GetChild(0).GetComponent <UILabel>().text = userdata[i].NickName; tr.GetChild(3).GetComponent <UILabel>().text = lscore[i].ToString(); if (endreasion == GameExitType.END_REASON_NORMAL || endreasion == GameExitType.END_REASON_PASS) { ++bindex; if (cbPlayStatus[i] == 1 && cardsNum == 4 && UIGame._IsSplit == true) { byte[] headcard = new byte[2]; byte[] trialcard = new byte[2]; Buffer.BlockCopy(bcards[i], 0, headcard, 0, 2); Buffer.BlockCopy(bcards[i], 2, trialcard, 0, 2); bool isFir = GameLogic.CompareCardN(headcard, trialcard, 2); string headname = GameLogic.GetHeadTailTypeStr(headcard, 2); string trialname = GameLogic.GetHeadTailTypeStr(trialcard, 2); //交换显示 if (!isFir) { string tmp = headname; headname = trialname; trialname = tmp; } if (GameLogic.GetPeaceful(bcards[i]) > 0) { byte cbcardtype = GameLogic.GetPeaceful(bcards[i]); string cardname = "a_" + cbcardtype; tr.Find("peaceful").GetComponent <UISprite>().spriteName = cardname; tr.Find("head").GetComponent <UISprite>().gameObject.SetActive(false); tr.Find("trial").GetComponent <UISprite>().gameObject.SetActive(false); tr.Find("peaceful").GetComponent <UISprite>().gameObject.SetActive(true); } else { tr.Find("head").GetComponent <UISprite>().spriteName = headname; tr.Find("trial").GetComponent <UISprite>().spriteName = trialname; tr.Find("head").GetComponent <UISprite>().gameObject.SetActive(true); tr.Find("trial").GetComponent <UISprite>().gameObject.SetActive(true); tr.Find("peaceful").GetComponent <UISprite>().gameObject.SetActive(false); } tr.GetChild(1).gameObject.SetActive(false); tr.GetChild(2).gameObject.SetActive(false); tr.GetChild(4).gameObject.SetActive(true); tr.GetChild(5).gameObject.SetActive(true); } else { tr.Find("peaceful").GetComponent <UISprite>().gameObject.SetActive(false); tr.GetChild(1).gameObject.SetActive(true); tr.GetChild(2).gameObject.SetActive(true); tr.GetChild(4).gameObject.SetActive(true); tr.GetChild(5).gameObject.SetActive(true); } } else { tr.Find("head").GetComponent <UISprite>().gameObject.SetActive(false); tr.Find("trial").GetComponent <UISprite>().gameObject.SetActive(false); tr.Find("peaceful").GetComponent <UISprite>().gameObject.SetActive(false); tr.GetChild(1).gameObject.SetActive(false); tr.GetChild(2).gameObject.SetActive(false); tr.GetChild(4).gameObject.SetActive(false); tr.GetChild(5).gameObject.SetActive(false); } if (GetSelfChair() == i) { if (lscore[i] > 0) { getScore.text = "+" + lscore[i]; resultsp.spriteName = "win"; } else if (lscore[i] < 0) { getScore.text = "" + lscore[i]; resultsp.spriteName = "fail"; } else { getScore.text = "+" + lscore[i]; resultsp.spriteName = "draw"; } } } } }