/// <summary> /// 副露の配列をコピーする /// </summary> public static bool copyFuuros(Fuuro[] dest, Fuuro[] src, int length) { if (length > FUURO_MAX) { return(false); } for (int i = 0; i < length; i++) { Fuuro.copy(dest[i], src[i]); } return(true); }
/// <summary> /// Copy the specified src furro to dest. /// 副露をコピーする /// </summary> public static void copy(Fuuro dest, Fuuro src) { dest._type = src._type; dest._fromRelation = src._fromRelation; dest._newPickIndex = src._newPickIndex; if (src._hais != null) { List <Hai> hai_copy = new List <Hai>(); for (int i = 0; i < src._hais.Length; i++) { hai_copy.Add(new Hai(src._hais[i])); } dest._hais = hai_copy.ToArray(); } }
public int calcPoint(Hand hand, Tile lastTile, Direction gameDirection, Direction playerDirection, Fuuro fuuro, Dora dora, bool isRiichi) { lock (process) { send("mjscore"); int[] handTmp = new int[41]; foreach (var tile in hand) { handTmp[getTileId(tile)]++; } send(string.Join(" ", handTmp)); send(getTileId(lastTile)); send((int)gameDirection + 30); send((int)playerDirection + 30); send(fuuro.Count); foreach (var group in fuuro) { send(getFuuroType(group), group.Min(t => t.GenaralId)); } int[] doraTmp = new int[10]; for (int i = 0; i < dora.Count; i++) { doraTmp[i] = dora[i].GenaralId; } send(string.Join(" ", doraTmp)); send(isRiichi ? 1 : 0); var res = int.Parse(process.StandardOutput.ReadLine()); return(res); } }
public void UpdateFuuro(Fuuro[] fuuros) { if (fuuros == null) { return; } // clear all fuuro. Clear(); // create new. for (int i = 0; i < fuuros.Length; i++) { Fuuro fuu = fuuros[i]; EFuuroType fuuroType = fuu.Type; if (i > 0) { curMaxPosX -= FuuroOffsetX; } int newPickIndex = fuu.NewPickIndex; Hai[] hais = fuu.Hais; //int relation = fuu.Relation; bool shouldSetLand = false; switch (fuuroType) { case EFuuroType.MinShun: //Chii. case EFuuroType.MinKou: // Pon. case EFuuroType.KaKan: // 加杠. case EFuuroType.DaiMinKan: // 大明杠. { for (int j = 0; j < hais.Length; j++) { if (hais[j].ID < 0) { continue; } shouldSetLand = (j == newPickIndex); float posX = curMaxPosX - GetMahjongRange(shouldSetLand) * 0.5f; Vector3 localPos = new Vector3(posX, 0, 0); MahjongPai pai = PlayerUI.CreateMahjongPai(transform, localPos, hais[j], true); if (shouldSetLand) { pai.SetOrientation(EOrientation.Landscape_Left); pai.transform.localPosition += new Vector3(0, MahjongPai.LandHaiPosOffsetY, 0); } pai.DisableInput(); fuuroHais.Add(pai); // update curMaxPosX. curMaxPosX -= GetMahjongRange(shouldSetLand); } } break; case EFuuroType.AnKan: // 暗杠. { for (int j = 0; j < hais.Length; j++) { if (hais[j].ID < 0) { continue; } shouldSetLand = false; float posX = curMaxPosX - GetMahjongRange(shouldSetLand) * 0.5f; Vector3 localPos = new Vector3(posX, 0, 0); bool isShow = (j != 0 && j != hais.Length - 1); // 2 sides hide. MahjongPai pai = PlayerUI.CreateMahjongPai(transform, localPos, hais[j], isShow); fuuroHais.Add(pai); // update curMaxPosX. curMaxPosX -= GetMahjongRange(shouldSetLand); } } break; } } // end for(). }
public void UpdateFuuro(Fuuro[] fuuros, bool isAI) { if (fuuros == null) { return; } // clear all fuuro. Clear(); // create new. for (int i = 0; i < fuuros.Length; i++) { Fuuro fuu = fuuros[i]; EFuuroType fuuroType = fuu.Type; if (i > 0) { curMaxPosX -= FuuroOffsetX; } int newPickIndex = fuu.NewPickIndex; Hai[] hais = fuu.Hais; //int relation = fuu.Relation; bool shouldSetLand = false; switch (fuuroType) { case EFuuroType.MinShun: //Chii. case EFuuroType.MinKou: // Pon. case EFuuroType.KaKan: // 加杠. case EFuuroType.DaiMinKan: // 大明杠. { for (int j = 0; j < hais.Length; j++) { if (hais[j].ID < 0) { continue; } shouldSetLand = (j == newPickIndex); //是否擺橫的 float posX = curMaxPosX - GetMahjongRange(shouldSetLand) * 0.5f; Vector3 localPos = new Vector3(posX, 0, 0); //吃牌要擺中間 if (j == 0) { localPos = new Vector3(posX - GetMahjongRange(shouldSetLand), 0, 0); } else if (j == 1) { localPos = new Vector3(posX + GetMahjongRange(shouldSetLand), 0, 0); } else if (j == 3) { localPos = new Vector3(posX + GetMahjongRange(shouldSetLand) * 2, 0.4f, 0); } MahjongPai pai = PlayerUI.CreateMahjongPai(transform, localPos, hais[j], true); if (!isAI) { Utils.SetLayerRecursively(pai.gameObject, LayerMask.NameToLayer("PlayerFuuro")); } else { Utils.SetLayerRecursively(pai.gameObject, LayerMask.NameToLayer("Default")); } //if( shouldSetLand ) { // //pai.SetOrientation(EOrientation.Landscape_Left); // pai.transform.localPosition += new Vector3(0, MahjongPai.LandHaiPosOffsetY, 0); //} pai.DisableInput(); fuuroHais.Add(pai); // update curMaxPosX. if (j != 3) { curMaxPosX -= GetMahjongRange(shouldSetLand); } } } break; case EFuuroType.AnKan: // 暗杠. { for (int j = 0; j < hais.Length; j++) { if (hais[j].ID < 0) { continue; } shouldSetLand = false; float posX = curMaxPosX - GetMahjongRange(shouldSetLand) * 0.5f; Vector3 localPos = new Vector3(posX, 0, 0); //bool isShow = (j != 0 && j != hais.Length - 1); // 2 sides hide. bool isShow = (j == 3); // 2 sides hide. //第四張擺上面 if (j == 3) { localPos = new Vector3(posX + GetMahjongRange(shouldSetLand) * 2, 0.4f, 0); } MahjongPai pai = PlayerUI.CreateMahjongPai(transform, localPos, hais[j], isShow); if (!isAI) { Utils.SetLayerRecursively(pai.gameObject, LayerMask.NameToLayer("PlayerFuuro")); } else { Utils.SetLayerRecursively(pai.gameObject, LayerMask.NameToLayer("Default")); } fuuroHais.Add(pai); // update curMaxPosX. if (j != 3) { curMaxPosX -= GetMahjongRange(shouldSetLand); } } } break; } } // end for(). }
public Fuuro(Fuuro other) { copy(this, other); }