private void Call3(int[] cardsId, int discard, int callPlayer, int discardPlayer) { int count = 0; //手牌からの牌のカウンタ for (int i = 0; i < 3; i++) { CallCard callCard = new CallCard(); if ((i + callPlayer + 1) % 4 == discardPlayer) { //捨て牌情報 callCard.cardId = discard; callCard.discardPlayer = discardPlayer; } else { //手牌からの牌の場合はカウンタに従って情報を取得 callCard.cardId = cardsId[count]; count++; callCard.discardPlayer = callPlayer; } callCards.Add(callCard); //牌情報を格納 } }
//明カン public void OpenKan(int[] cardsId, int discard, int callPlayer, int discardPlayer) { int count = 0; //手牌からの牌のカウンタ for (int i = 0; i < 4; i++) { CallCard callCard = new CallCard(); if ((i + callPlayer + 1) % 4 == discardPlayer) { //捨て牌 callCard.cardId = discard; callCard.discardPlayer = discardPlayer; } else { //手牌からの牌の場合はカウンタに従って情報を取得 callCard.cardId = cardsId[count]; count++; callCard.discardPlayer = callPlayer; } if (i >= 3) { //位置調整のために最後の牌のみ間に入れる callCards.Insert(1, callCard); } else { //牌情報を格納 callCards.Add(callCard); } } callKind = KAN; }
//鳴き牌表示 private void ShowCallCard_Only(int player) { GameManagerScript.DestroyGameObjects(ref callObjects[player]); //表示している手牌のゲームオブジェクトを削除 Vector2 position = new Vector2(Layouts.callOffsets[player].x, Layouts.callOffsets[player].y); //表示位置の初期地点 for (int s = 0; s < calls[player].Count; s++) { for (int i = 0; i < calls[player][s].callCards.Count; i++) { CallCard callCard = calls[player][s].callCards[i]; //牌の情報を取得 GameObject card = new GameObject(); Sprite sprite; if (callCard.closedKan_hide) { sprite = CardImages.Image_Back(); //裏向き } else { sprite = CardImages.Image_Front(callCard.cardId); //表向き } card.AddComponent <SpriteRenderer>().sprite = sprite; //画像を格納 card.transform.localScale = Layouts.callScales[player]; //大きさを決定 float addDirection; //回転した牌のための余白を用意するかどうかのフラグ Vector3 addRotation; //回転した牌の場合に追加する回転量 Vector2 addY = new Vector2(0f, 0f); //加カン牌用のずらしフラグ if (callCard.discardPlayer == player) { //自分の鳴き牌の場合は回転はなし addDirection = 0f; addRotation = new Vector3(0f, 0f, 0f); } else { //他家の捨て牌の場合は回転させる position += Layouts.callLineupRotatedAddDirections[player]; //回転分の座標補正 addDirection = 1.0f; //余白用意フラグを立てる addRotation = new Vector3(0f, 0f, 90f); //回転させる addY = Layouts.callLineupRotatedAddYPositions[player]; //高さ補正 } if (callCard.addKan) { //加カン牌の場合は基本位置xを戻す。yはずらすフラグを立てる position -= Layouts.callLineupDirections[player] + Layouts.callLineupRotatedAddDirections[player]; addY = Layouts.callLineupRotatedAddYPositions[player] + Layouts.callLineupAddDoubleYPositions[player]; addDirection = 1.0f; //余白用意フラグを立てる addRotation = new Vector3(0f, 0f, 90f); //回転させる } card.transform.position = position + addY; //牌の表示位置を決定 //回転の有無を考慮して次の牌の基本位置を決定 position += Layouts.callLineupDirections[player] + Layouts.callLineupRotatedAddDirections[player] * addDirection; card.transform.rotation = Quaternion.Euler(Layouts.callRotations[player] + addRotation); //牌の角度を決定 callObjects[player].Add(card); //メモリ解放用のリストに格納 } } }