private bool CheckGoodIsInTimeThreshold(TimeThresholdGoodsType type, uint dwDurationTime) { if (!dicGoodTypeTimeThreshold.ContainsKey(type)) { return(false); } DateTime calcTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Unspecified).AddSeconds(dwDurationTime); calcTime = calcTime.ToLocalTime(); TimeSpan ts = calcTime.Subtract(DateTime.Now).Duration(); int nDay = ts.Days; if (dwDurationTime > 0 && nDay < dicGoodTypeTimeThreshold[type]) { return(true); } else { if (dwDurationTime < 0) { Debug.LogError("this skin is overdue"); } return(false); } }
public ObservableList <UListTimeThresholdData> GetTypeListTimeThresholdData(TimeThresholdGoodsType type) { if (!dicListTimeThresholdData.ContainsKey(type)) { ObservableList <UListTimeThresholdData> ListData = new ObservableList <UListTimeThresholdData>(); dicListTimeThresholdData[type] = ListData; } return(dicListTimeThresholdData[type]); }
private void RefurbishListView(TimeThresholdGoodsType type) { this.SetVisible(true); m_wndView.ClearTypeThresholdGoodList(type); switch (type) { case TimeThresholdGoodsType.TIMETHRESHOLDGOODSTYPE_SKIN: { Dictionary <int, List <cmd_Hero_Skin_Info> > SkinData = LogicDataCenter.heroSkinDataManager.HeroSkinData; if (SkinData == null) { this.SetVisible(false); return; } foreach (int nHeroId in SkinData.Keys) { foreach (cmd_Hero_Skin_Info info in SkinData[nHeroId]) { if (!CheckGoodIsInTimeThreshold(type, info.dwDurationTime)) { continue; } SkinInfoScheme skinConfig = new SkinInfoScheme(); if (!GameLogicAPI.GetHeroSkinInfo(info.nSkinId, ref skinConfig)) { continue; } UListTimeThresholdData data = new UListTimeThresholdData(); data.nGoodId = info.nSkinId; data.nGoodIconId = nHeroId; //skinConfig.nSkinIconID; data.sGoodName[0] = "皮肤 :"; data.sGoodName[1] = skinConfig.szSkinName; data.szParam = "英雄"; data.nParam = nHeroId; data.nGoodThresholdTime = info.dwDurationTime; m_wndView.AddThresholdGoodListItem(type, data); } } } break; default: break; } bool bShow = m_wndView.SetThresholdGoodListDataSource(); this.SetVisible(bShow); }
public void AddThresholdGoodListItem(TimeThresholdGoodsType type, UListTimeThresholdData data) { if (TimeThresholdList == null) { return; } ObservableList <UListTimeThresholdData> ListData = TimeThresholdList.GetTypeListTimeThresholdData(type); if (ListData == null) { return; } ListData.Add(data); }
public void ClearTypeThresholdGoodList(TimeThresholdGoodsType type) { if (TimeThresholdList == null) { return; } ObservableList <UListTimeThresholdData> ListData = TimeThresholdList.GetTypeListTimeThresholdData(type); if (ListData == null) { return; } ListData.Clear(); }
public void SetTypeListTimeThresholdData(TimeThresholdGoodsType type, ObservableList <UListTimeThresholdData> listData) { dicListTimeThresholdData[type] = listData; }
private void SetGoodTypeTimeThreshold(TimeThresholdGoodsType timeThresholdGoodsType) { dicGoodTypeTimeThreshold[timeThresholdGoodsType] = 7; }