public int noticeSid; // 相关公告sid public override void copy(object destObj) { base.copy(destObj); LuckyDrawSample dest = destObj as LuckyDrawSample; if (this.ids != null) { dest.ids = new int[this.ids.Length]; for (int i = 0; i < this.ids.Length; i++) { dest.ids [i] = this.ids [i]; } } if (this.ways != null) { dest.ways = new DrawWaySample[this.ways.Length]; for (int i = 0; i < this.ways.Length; i++) { dest.ways [i] = this.ways [i].Clone() as DrawWaySample; } } if (this.luckyPoints != null) { dest.luckyPoints = new string[this.luckyPoints.Length]; for (int i = 0; i < this.luckyPoints.Length; i++) { dest.luckyPoints [i] = this.luckyPoints [i]; } } }
private void showTopInfo() { LuckyDrawSample luckySample = lucky.getSample(); string[] luckyPoints = luckySample.luckyPoints; //大于0表示要显示 if (StringKit.toInt(luckyPoints [0]) > 0) { //大条目已抽奖总次数(多加一次抽奖信息) int allCount = 1; for (int i = 0; i < lucky.ways.Length; i++) { allCount += lucky.ways [i].getNum(); } int quality = 0, count = int.MaxValue; string des = ""; int temp; for (int i = 1; i < luckyPoints.Length; i += 3) { temp = allCount % StringKit.toInt(luckyPoints [i + 1]); if (temp > 0) { temp = StringKit.toInt(luckyPoints [i + 1]) - temp; } if (temp > count) { continue; } if (temp < count) { count = temp; quality = StringKit.toInt(luckyPoints [i]); des = luckyPoints [i + 2]; } else if (StringKit.toInt(luckyPoints [i]) > quality) { quality = StringKit.toInt(luckyPoints [i]); des = luckyPoints [i + 2]; } } count += 1; string str = ""; //本次不是必出 if (count > 1) { str = LanguageConfigManager.Instance.getLanguage("luckdraw11", count.ToString(), des); } else { str = LanguageConfigManager.Instance.getLanguage("luckdraw12", des); } topinfo.text = str; } else { topinfo.text = lucky.getDescribe(); } }
//解析模板数据 public override void parseSample(int sid) { LuckyDrawSample sample = new LuckyDrawSample(); string dataStr = getSampleDataBySid(sid); sample.parse(sid, dataStr); samples.Add(sid, sample); }
public LuckyDraw getStarLuckyDraw() { int max = array.Length; for (int i = 0; i < max; i++) { LuckyDrawSample sample = LuckyDrawSampleManager.Instance.getLuckyDrawSampleBySid(array [i].sid); if (array [i].isShow() && sample.drawType == 2) { return(array [i]); } } return(null); }
//获得主界面抽奖信息 public LuckyDraw[] getLuckyDrawArr() { List <LuckyDraw> list = new List <LuckyDraw> (); int max = array.Length; for (int i = 0; i < max; i++) { LuckyDrawSample sample = LuckyDrawSampleManager.Instance.getLuckyDrawSampleBySid(array [i].sid); bool isValid = isValidLuckyDrawSample(sample); if (!isValid) { continue; } if (array [i].isShow() && sample.drawType == 1 && sample.idsType == "1") { list.Add(array [i]); } } return(list.ToArray()); }
/** 是否为有效的抽奖条目 */ public bool isValidLuckyDrawSample(LuckyDrawSample sample) { if (sample.noticeSid != 0) { NoticeSample tmp = NoticeSampleManager.Instance.getNoticeSampleBySid(sample.noticeSid); Notice notice = NoticeManagerment.Instance.getValidNoticeBySid(sample.noticeSid, tmp.entranceId); if (notice == null || !notice.isValid()) { return(false); } if (notice is LuckyDrawNotice) // 有效的活动抽奖条目,更新抽奖模板时间 { LuckyDrawNotice ldn = notice as LuckyDrawNotice; int noticeOpenTime = ldn.activeTime.getDetailStartTime(); int remainTime = noticeOpenTime - ServerTimeKit.getSecondTime(); if (remainTime <= 0) { int noticeCloseTime = ldn.activeTime.getDetailEndTime(); int remainCloseTime = noticeCloseTime - ServerTimeKit.getSecondTime(); if (remainCloseTime <= 0) { sample.startTime = 0; sample.endTime = 0; } else { sample.startTime = 0; sample.endTime = noticeCloseTime; } } else { sample.startTime = noticeOpenTime; sample.endTime = 0; } } return(true); } return(true); }
/* methods */ public void initContent(NoticeWindow win, Notice notice) { this.notice = notice as LuckyDrawNotice; SidNoticeContent content = notice.getSample().content as SidNoticeContent; this.lucky = LuckyDrawManagerment.Instance.getLuckyDrawBySid(content.sids [0]); this.luckySample = lucky.getSample(); this.win = win; this.openTimeNoticeText = LanguageConfigManager.Instance.getLanguage("s0503"); this.closeTimeNoticeText = LanguageConfigManager.Instance.getLanguage("s0570"); if (this.luckySample.idsType == "2") //限时抽装备 { showEquip = EquipManagerment.Instance.createEquip(luckySample.ids [0]); showGoods.setFatherWindow(this.win); showGoods.init(showEquip); drawButton1.gameObject.SetActive(true); drawButton2.gameObject.SetActive(true); gotoButton.gameObject.SetActive(false); equipTitle.SetActive(true); drawInfoDesc.gameObject.SetActive(true); radioCtrl.radioType = 2; } else { StarSoulSample tmpSample = StarSoulSampleManager.Instance.getStarSoulSampleBySid(luckySample.ids[0]); if (tmpSample != null) { showSoul = StarSoulManager.Instance.createStarSoul(luckySample.ids [0]); showGoods.init(showSoul); } else { showProp = PropManagerment.Instance.createProp(luckySample.ids [0]); showGoods.init(showProp); } showGoods.setFatherWindow(this.win); setNoticeOpenTime(); gotoButton.gameObject.SetActive(true); gotoButton.disableButton(noticeOpenTime - ServerTimeKit.getSecondTime() > 0); drawButton1.gameObject.SetActive(false); drawButton2.gameObject.SetActive(false); propTitle.gameObject.SetActive(true); drawInfoDesc.gameObject.SetActive(false); if (luckySample.idsType == "3") //luckysample isdType 3 猎魂 4 炼金 { radioCtrl.radioType = 3; if (luckySample.name.EndsWith("1")) { propTitle.spriteName = "kf_xs_xinghun"; propTitle.gameObject.SetActive(true); xs_liehun.gameObject.SetActive(false); } else { propTitle.gameObject.SetActive(false); xs_liehun.gameObject.SetActive(true); } gotoButton.textLabel.text = LanguageConfigManager.Instance.getLanguage("StarSoulWindow_Hunt_go"); } if (luckySample.idsType == "4") { showRadio.SetActive(false); if (luckySample.name.EndsWith("1")) { propTitle.spriteName = "kf_xs_lianjin"; propTitle.gameObject.SetActive(true); xs_lianjin.gameObject.SetActive(false); } else { propTitle.gameObject.SetActive(false); xs_lianjin.gameObject.SetActive(true); } gotoButton.textLabel.text = LanguageConfigManager.Instance.getLanguage("go_get_money"); } } // 与服务器通讯 if (luckySample.idsType == "2") { (FPortManager.Instance.getFPort("LuckyEquipFPort") as LuckyEquipFPort).access(notice.sid, OnLoadDataResault); } else { (FPortManager.Instance.getFPort("LuckyXianshiFPort") as LuckyXianshiFPort).access(notice.sid, OnLoadDataResault, StringKit.toInt(luckySample.idsType)); } }