public void updateItem(NoticeActiveGoods goods, NoticeSample sample) { NoticeActiveServerInfo serverInfo = fatherContent.serverInfo; activeGoods = goods; //2014.7.17 modified //conditionDes.text = Language ("ConsumeRebate_01", activeGoods.getSample().rmbCondition, // Mathf.Min (serverInfo.consumeValue, activeGoods.getSample().rmbCondition), activeGoods.getSample().rmbCondition); conditionDes.text = Language("ConsumeRebate_01", activeGoods.getSample().rmbCondition, activeGoods.getRoleCountCanBuy(), activeGoods.getSample().maxBuyCount); costNumLabel.text = "X " + activeGoods.getCostPrice(); totalCountLabel.text = Language("ConsumeRebate_04", activeGoods.getServerCountCanBuy()); //maxBuyLabel.text = Language ("ConsumeRebate_03", activeGoods.getRoleCountCanBuy (), activeGoods.getSample().maxBuyCount); maxBuyLabel.text = Language("ConsumeRebate_03", activeGoods.getSample().rmbCondition - serverInfo.consumeValue > 0 ? activeGoods.getSample().rmbCondition - serverInfo.consumeValue : 0); if (goodsShowPos.transform.childCount > 0) { goodsShowPos.transform.GetChild(0).GetComponent <GoodsView> ().init(activeGoods.getGoodsType(), activeGoods.getGoodsSid(), activeGoods.getGoodsShowNum()); } else { GoodsView goodsView = (NGUITools.AddChild(goodsShowPos, goodsViewPref) as GameObject).GetComponent <GoodsView> (); goodsView.init(activeGoods.getGoodsType(), activeGoods.getGoodsSid(), activeGoods.getGoodsShowNum()); goodsView.fatherWindow = fatherContent.win; } if (activeGoods.getRoleCountCanBuy() < 1 || activeGoods.getServerCountCanBuy() < 1) { buyButton.disableButton(true); } else { buyButton.disableButton(false); buyButton.fatherWindow = fatherContent.win; buyButton.onClickEvent = clickBuyButton; } }
//serverInfo=[[400000000商品id,1全服已购买次数]],userInfo=[[[consume_rmb类型,200活动期间消耗]暂时只有一个],[[[role_times,400000000],1]个人消耗次数,...]] private void initConsumeRebateGoods(int activeID, ErlArray serverInfo, ErlArray userInfo) { NoticeActiveServerInfo consumeInfo = activeInfo.get(activeID) as NoticeActiveServerInfo; if (consumeInfo == null) { consumeInfo = new NoticeActiveServerInfo(); activeInfo.put(activeID, consumeInfo); } ErlArray temp, temp1; NoticeActiveGoods goods; int sid; for (int i = 0; i < serverInfo.Value.Length; i++) { temp = serverInfo.Value[i] as ErlArray; sid = StringKit.toInt(temp.Value[0].getValueString()); goods = consumeInfo.goodsList.get(sid) as NoticeActiveGoods; if (goods == null) { goods = new NoticeActiveGoods(sid); goods.timeID = activeID; consumeInfo.goodsList.put(sid, goods); } goods.serverBuyCount = StringKit.toInt(temp.Value[1].getValueString()); } if (userInfo.Value.Length > 0) { temp = (userInfo.Value[0] as ErlArray); if (temp.Value.Length > 0) { consumeInfo.consumeValue = StringKit.toInt((temp.Value[0] as ErlArray).Value[1].getValueString()); //兑换rmb消耗入门限制 } temp = userInfo.Value[1] as ErlArray; for (int i = 0; i < temp.Value.Length; i++) { temp1 = temp.Value[i] as ErlArray; sid = StringKit.toInt((temp1.Value[0] as ErlArray).Value[1].getValueString()); goods = consumeInfo.goodsList.get(sid) as NoticeActiveGoods; if (goods == null) { goods = new NoticeActiveGoods(sid); goods.timeID = activeID; consumeInfo.goodsList.put(sid, goods); } goods.roleBuyCount = StringKit.toInt(temp1.Value[1].getValueString()); } } }
public void initContent(Notice notice, WindowBase win) { this.notice = notice; this.win = win; rechargeButton.fatherWindow = win; rechargeButton.onClickEvent = (gameobj) => { UiManager.Instance.openWindow <rechargeWindow> (); }; rmbNumLabel.text = "X " + UserManager.Instance.self.getRMB(); FPortManager.Instance.getFPort <NoticeActiveGetFPort> ().access(notice.sid, () => { serverInfo = NoticeActiveManagerment.Instance.getActiveInfoBySid(notice.sid) as NoticeActiveServerInfo; content.initContent(notice, win, this); content.Initialize(); initDesTime(); }); }
public void updateExchange(int activeID, int sid, int num) { NoticeActiveServerInfo serverInfo = activeInfo.get(activeID) as NoticeActiveServerInfo; if (serverInfo == null) { return; } else { foreach (NewExchange exchange in serverInfo.goodsList.valueArray()) { if (exchange.sid == sid) { exchange.addNum(num); ExchangeManagerment.Instance.setCompleteSid(sid); return; } } } }
//初始化新兑换活动 serverInfo=[[400000000商品id,1全服已购买次数]],userInfo=[[[consume_rmb类型,200活动期间消耗]暂时只有一个],[[[role_times,400000000],1]个人消耗次数,...]] private void initNewExchange(int activeID, ErlArray serverInfo, ErlArray userInfo) { NoticeActiveServerInfo exchangeInfo = activeInfo.get(activeID) as NoticeActiveServerInfo; if (exchangeInfo == null) { exchangeInfo = new NoticeActiveServerInfo(); activeInfo.put(activeID, exchangeInfo); } ErlArray temp, temp1; NewExchange exchange; int sid; for (int i = 0; i < serverInfo.Value.Length; i++) { //暂时不考虑全服数据 } if (userInfo.Value.Length > 0) { temp = (userInfo.Value[0] as ErlArray); if (temp.Value.Length > 0) { exchangeInfo.consumeValue = StringKit.toInt((temp.Value[0] as ErlArray).Value[1].getValueString()); //兑换rmb消耗入门限制 } temp = userInfo.Value[1] as ErlArray; for (int i = 0; i < temp.Value.Length; i++) { temp1 = temp.Value[i] as ErlArray; sid = StringKit.toInt((temp1.Value[0] as ErlArray).Value[1].getValueString()); exchange = exchangeInfo.goodsList.get(sid) as NewExchange; if (exchange == null) { exchange = new NewExchange(sid, 0); exchange.timeID = activeID; exchangeInfo.goodsList.put(sid, exchange); } exchange.setNum(StringKit.toInt(temp1.Value[1].getValueString())); } } }