public void UpdateSysDiscountStore(COM_ADDiscountStore data) { sysDiscountStore = data; if (SysDiscountStoreEvent != null) { SysDiscountStoreEvent(data); } }
void UpdateInfo() { COM_ADDiscountStore data = MoreActivityData.instance.GetSysDiscountStore(); //COM_ADDiscountStore data = MoreActivityData.GetSysDiscountStore (); if (data == null) { return; } string sfmt = "yyyy/MM/dd"; string efmt = "yyyy/MM/dd"; Define.FormatUnixTimestamp(ref sfmt, (int)data.sinceStamp_); Define.FormatUnixTimestamp(ref efmt, (int)data.endStamp_); timeLab.text = LanguageManager.instance.GetValue("huodongshijian") + sfmt + " - " + efmt; for (int i = 0; i < CellList.Count; ++i) { grid.RemoveChild(CellList[i].transform); CellList[i].transform.parent = null; CellList[i].gameObject.SetActive(false); } CellList.Clear(); for (int i = 0; i < data.contents_.Length; i++) { GameObject objCell = Object.Instantiate(cell.gameObject) as GameObject; MoreDiscountStoreCellUI cellUI = objCell.GetComponent <MoreDiscountStoreCellUI>(); ItemCellUI cellItem = UIManager.Instance.AddItemCellUI(cellUI.item, data.contents_[i].itemId_); cellItem.showTips = true; cellUI.nameLab.text = ItemData.GetData((int)data.contents_[i].itemId_).name_; int price = (int)data.contents_[i].price_; decimal discount = (decimal)(data.contents_[i].discount_ * 10f); decimal needM = price * discount / 10; cellUI.needMoney.text = needM.ToString(); cellUI.buyNumLab.text = LanguageManager.instance.GetValue("leijikemainum").Replace("{n}", data.contents_[i].buyLimit_.ToString()); cellUI.oldMoney.text = data.contents_[i].price_.ToString(); cellUI.saleLab.text = (data.contents_[i].discount_ * 10).ToString() + LanguageManager.instance.GetValue("salezhe"); cellUI.data = data.contents_[i]; UIManager.SetButtonEventHandler(cellUI.gameObject, EnumButtonEvent.OnClick, OnGetBtn, (int)data.contents_[i].itemId_, (int)data.contents_[i].buyLimit_); objCell.transform.parent = grid.transform; objCell.SetActive(true); objCell.transform.localScale = Vector3.one; CellList.Add(objCell); } grid.Reposition(); }
void OnUpdataEvent(COM_ADDiscountStore data) { UpdateInfo(); }