protected virtual void SpawnMJ_CPG(CPG_Struct data) { for (int i = 0; i < data.MJList.Count; i++) { if (data.type == CPG_TYPE.暗杠) { if (i < 3 || dir != SEAT_DIR.DIR_BOTTOM) { AddMJ(data.MJList[i], MJ_STAGE.CPG, true); continue; } } MJ mj = AddMJ(data.MJList[i], MJ_STAGE.CPG); switch (data.dir) { case SEAT_DIR.DIR_BOTTOM: break; case SEAT_DIR.DIR_RIGHT: if (i == 2) { mj.sprite.color = Color.green; } break; case SEAT_DIR.DIR_TOP: if (data.type == CPG_TYPE.杠) { if (i == 3) { mj.sprite.color = Color.green; } } else { if (i == 1) { mj.sprite.color = Color.green; } } break; case SEAT_DIR.DIR_LEFT: if (i == 0) { mj.sprite.color = Color.green; } break; case SEAT_DIR.DIR_NULL: break; default: break; } } }
private PlayerData GetNewPlayerData(int playerId) { PlayerData data = new PlayerData(playerId); for (int i = 0; i < 1; i++) { CPG_Struct cs = new CPG_Struct(); cs.type = CPG_TYPE.碰; cs.Init(CPG_TYPE.碰, new List <MJType>() { MJType.条_1 + playerId, MJType.条_1 + playerId, MJType.条_1 + playerId }, SEAT_DIR.DIR_RIGHT); data.MJ_CPG_List.Add(cs); cs = new CPG_Struct(); cs.type = CPG_TYPE.杠; cs.Init(CPG_TYPE.杠, new List <MJType>() { MJType.条_5, MJType.条_5, MJType.条_5, MJType.条_5 }, SEAT_DIR.DIR_RIGHT); data.MJ_CPG_List.Add(cs); cs = new CPG_Struct(); cs.type = CPG_TYPE.暗杠; cs.Init(CPG_TYPE.暗杠, new List <MJType>() { MJType.条_6, MJType.条_6, MJType.条_6, MJType.条_6 }, SEAT_DIR.DIR_RIGHT); data.MJ_CPG_List.Add(cs); } for (int i = 0; i < 8; i++) { data.MJ_OUT_List.Add((MJType)(RandomMgr.Range((int)MJType.万_1, (int)MJType.MJ_白板))); } for (int i = 0; i < 7; i++) { data.MJ_IN_List.Add((MJType)(RandomMgr.Range((int)MJType.万_1, (int)MJType.MJ_白板))); } return(data); }
public void UpdateData() { UpdateLabelInfo(); Vector3 pos = startMJPos; PlayerData data = DataCenter.Instance.players[playerId]; int iSpace = GameGD.MJ_BOTTOM_CPG_W - 5; //吃碰杠的牌 for (int i = 0; i < data.MJ_CPG_List.Count; i++) { CPG_Struct cs = data.MJ_CPG_List[i]; for (int j = 0; j < cs.MJList.Count; j++) { MJ mj = null; if (cs.type == CPG_TYPE.暗杠) { if (j <= 2) { mj = AddMJ(DataCenter.Instance.gamedata.PlayerID, cs.MJList[j], MJ_STAGE.CPG, true); } } if (mj == null) { mj = AddMJ(DataCenter.Instance.gamedata.PlayerID, cs.MJList[j], MJ_STAGE.CPG); } if (i != 0 || j != 0) { pos.x += iSpace; } switch (cs.dir) { case SEAT_DIR.DIR_BOTTOM: break; case SEAT_DIR.DIR_RIGHT: if (j == 2) { mj.sprite.color = Color.green; } break; case SEAT_DIR.DIR_TOP: if (cs.type == CPG_TYPE.杠 || cs.type == CPG_TYPE.暗杠) { if (j == 3) { mj.sprite.color = Color.green; } } else { if (j == 1) { mj.sprite.color = Color.green; } } break; case SEAT_DIR.DIR_LEFT: if (j == 0) { mj.sprite.color = Color.green; } break; case SEAT_DIR.DIR_NULL: break; default: break; } Vector3 MJPos = pos; if (cs.type == CPG_TYPE.杠 || cs.type == CPG_TYPE.暗杠) { if (j == 3) { MJPos.y += 10; pos.x -= iSpace; MJPos.x -= 2 * iSpace; pos.x += 5; } } mj.transform.localPosition = MJPos; } pos.x += 15; } //手中的牌 if (data.MJ_CPG_List.Count != 0) { pos.x += 30; } for (int i = 0; i < data.MJ_IN_List.Count; i++) { MJ mj = AddMJ(DataCenter.Instance.gamedata.PlayerID, data.MJ_IN_List[i], MJ_STAGE.CPG); mj.transform.localPosition = pos; pos.x += GameGD.MJ_BOTTOM_CPG_W - 5; } //胡牌 sprite_胡.gameObject.SetActive(false); if (data.gameOver.IsWin) { pos.x += 150; sprite_胡.gameObject.SetActive(true); sprite_胡.transform.localPosition = new Vector3(pos.x, sprite_胡.transform.localPosition.y, 0); pos.x += 50; MJ mj = AddMJ(DataCenter.Instance.gamedata.PlayerID, data.gameOver.huPaiMJType, MJ_STAGE.CPG); mj.transform.localPosition = pos; //mj.GetComponent<UISprite>().SetAnchor(sprite_胡,0,50) //mj.GetComponent<UISprite>().leftAnchor.relative = 1f; //mj.GetComponent<UISprite>().leftAnchor.absolute = 10; } //中鱼 ShowZhongYu(false); if (DataCenter.Instance.players[playerId].gameOver.IsWin) { ShowZhongYu(DataCenter.Instance.players[playerId].gameOver.ZhongYuList); } label_DeFen.text = "" + DataCenter.Instance.players[playerId].gameOver.DeFen; }