void addOption(string op, int pai = 0) { if (op != "btn_ting") { op = "grid/" + op; } Transform tm = options.Find(op); if (tm == null) { return; } Mahjong2D mj = tm.GetComponentInChildren <Mahjong2D>(); tm.gameObject.SetActive(true); if (mj != null) { mj.gameObject.SetActive(pai != 0); } if (pai == 0) { return; } if (mj != null) { mj.setScale(0.8f); mj.setID(pai); } }
Mahjong2D initMahjong(Transform seat, int id, Vector2 pos, int depth) { GameObject ob = Instantiate(mahjong2d); ob.transform.SetParent(seat); ob.transform.localPosition = pos; Mahjong2D mj = ob.GetComponent <Mahjong2D> (); mj.setDepth(depth); mj.setScale(0.5f); mj.setID(id); return(mj); }
void initPengGangs(Transform seat, int id, string type, int offset) { int y = -20; id = id % 100; for (int i = 0; i < 3; i++) { Mahjong2D mj = initMahjong(seat, type == "angang" ? 0 : id, new Vector2(offset + i * 55, y), 4); } if (type != "peng") { initMahjong(seat, id, new Vector2(offset + 55, y + 16), 6); } }