public void Chou(int index) { int id = pop.viewList[index].data.id; curChouView = pop.viewList[index]; bool mian = false; if (id == 2) { if (pop.viewList[index].data.lefttime < 1) { mian = true; } pop.cur = pop.viewList[index]; if (UserManager.Instance.ResByType((int)pop.cur.data.type, pop.cur.data.money) || mian) { curChouView.abuyBtn.isEnabled = false; NetworkManager.Instance.LotteryChou(id, mian); } else { MainUI.Instance.DiomandToClick(); } } else if (id == 1) { if (pop.viewList[index].data.drawnum < 1) { pop.cur = pop.viewList[index]; mian = true; if (UserManager.Instance.ResByType((int)pop.cur.data.type, pop.cur.data.money)) { curChouView.abuyBtn.isEnabled = false; NetworkManager.Instance.LotteryChou(id, mian); } else { ToastManager.Instance.Show("好友点数不够"); } } else { ToastManager.Instance.Show("只能抽一次"); } } else if (id == 3) { pop.cur = pop.viewList[index]; if (UserManager.Instance.ResByType((int)pop.cur.data.type, pop.cur.data.money)) { curChouView.abuyBtn.isEnabled = false; NetworkManager.Instance.LotteryChou(id, mian); } else { MainUI.Instance.DiomandToClick(); } } }
public void SetList(List <LotteryData> list) { while (table.transform.childCount > 0) { DestroyImmediate(table.transform.GetChild(0).gameObject); } viewList = new List <LotteryView>(); for (int i = 0; i < list.Count; i++) { GameObject obj = Instantiate(itemPrefab); obj.SetActive(true); LotteryView v = obj.GetComponent <LotteryView>(); v.InitData(this, list[i], i); v.transform.parent = table.transform; v.transform.localPosition = Vector3.zero; v.transform.localScale = Vector3.one; viewList.Add(v); } table.Reposition(); scroll.ResetPosition(); }
private void LotteryClick(object obj) { LotteryView LV = new LotteryView(); LV.ShowDialog(); }