private void AddScrollCell(int index, GouMaiXiangGuan config) { RewardInfo investItemInfo = InvestFundManager.Instance.GetInvestItemInfo(config.type); bool canGet = false; bool hasGot = false; bool isOver = false; if (investItemInfo != null) { canGet = investItemInfo.canGet; hasGot = investItemInfo.hadGet; isOver = investItemInfo.overdue; } string title = string.Format(GameDataUtils.GetChineseContent(508201, false), config.type); string count = config.nameId.ToString(); Transform transform = this.m_ScrollList.get_transform().FindChild("InvestItem" + index); if (transform != null) { transform.get_gameObject().SetActive(true); transform.GetComponent <InvestItem>().UpdateItem(config.type, title, count, canGet, hasGot, isOver, new ButtonCustom.VoidDelegateObj(this.OnDayBtnClick)); } else { GameObject instantiate2Prefab = ResourceManager.GetInstantiate2Prefab("InvestItem"); instantiate2Prefab.get_transform().SetParent(this.m_ScrollList.get_transform(), false); instantiate2Prefab.set_name("InvestItem" + index); instantiate2Prefab.SetActive(true); instantiate2Prefab.GetComponent <InvestItem>().UpdateItem(config.type, title, count, canGet, hasGot, isOver, new ButtonCustom.VoidDelegateObj(this.OnDayBtnClick)); } }
private void RefreshScroll() { this.ClearScroll(); this.AddFirstScrollCell(); List <GouMaiXiangGuan> dataList = DataReader <GouMaiXiangGuan> .DataList; for (int i = 0; i < dataList.get_Count(); i++) { GouMaiXiangGuan config = dataList.get_Item(i); this.AddScrollCell(i, config); } }