public void AddPai(MahjongPai pai, bool newPicked = false, bool isShow = false) { int index = tehaiList.Count; float posX = AlignLeftLocalPos.x + MahjongPai.Width * index + HaiPosOffsetX * index; pai.transform.parent = transform; pai.transform.localPosition = new Vector3(posX, AlignLeftLocalPos.y, 0); if (isShow) { pai.Show(); } else { pai.Hide(); } if (OwnerPlayer.IsAI == false) { pai.SetOnClick(OnClickMahjong); } pai.gameObject.name = pai.ID.ToString(); tehaiList.Add(pai); if (newPicked) { pai.transform.localPosition += new Vector3(NewHaiPosOffsetX, 0, 0); } }
public void Show() { Hai[] init_hais = new Hai[4] { new Hai(Hai.ID_TON), new Hai(Hai.ID_NAN), new Hai(Hai.ID_SYA), new Hai(Hai.ID_PE), }; Hai temp; for (int i = 0; i < init_hais.Length; i++) { int index = Random.Range(0, init_hais.Length); temp = init_hais[i]; init_hais[i] = init_hais[index]; init_hais[index] = temp; } gameObject.SetActive(true); for (int i = 0; i < init_hais.Length; i++) { MahjongPai pai = PlayerUI.CreateMahjongPai(transform, new Vector3(leftPosX + i * offset, posY, 0), init_hais[i], false); pai.SetOnClick(OnClickMahjong); pai.EnableInput(); kazePaiList.Add(pai); } }
public void AddPai(MahjongPai pai, bool newPicked = false, bool isShow = false) { int index = tehaiList.Count; float posX = AlignLeftLocalPos.x + MahjongPai.Width * index + HaiPosOffsetX * index; pai.transform.parent = transform; pai.transform.localPosition = new Vector3(posX, AlignLeftLocalPos.y, 0); if (isShow) { pai.Show(); } else { pai.Hide(); } if (OwnerPlayer.IsAI == false) { //pai.gameObject.layer = LayerMask.NameToLayer("PlayerTehai"); Utils.SetLayerRecursively(pai.gameObject, LayerMask.NameToLayer("PlayerTehai")); pai.SetOnClick(OnClickMahjong); pai.isPlayer = true; } else { Utils.SetLayerRecursively(pai.gameObject, LayerMask.NameToLayer("Default")); } pai.gameObject.name = pai.ID.ToString(); tehaiList.Add(pai); if (newPicked) { pai.transform.localPosition += new Vector3(NewHaiPosOffsetX, 0, 0); } }