public static long GetCurrentTimeSecond() { DateTime curDT = CommonTools.GetCurrentTime(); long totalSecond = curDT.Hour * 60 * 60 + curDT.Minute * 60 + curDT.Second; return(totalSecond); }
public long GetLoginTypeLeftTime() { long min_end_time = 0L; foreach (var item in m_login_push_infos) { if (item.Buyed) { continue; } if (0L == min_end_time || item.EndTime < min_end_time) { min_end_time = item.EndTime; } } //Debug.Log("min end time = " + CommonTools.SecondToTitleString(min_end_time)); long ret = min_end_time - CommonTools.DateTimeToTimeStamp(CommonTools.GetCurrentTime()) / 10000000; return(Math.Max(ret, 0)); }
public static ShopPropData getShopData(MarketResponse shopdata) { if (shopdata == null) { return(null); } ShopPropData pdata = new ShopPropData(); pdata.m_itemdata = new List <ShopItemData>(); List <ShopItemData> m_giftData = new List <ShopItemData>(); //礼盒 if (shopdata.Category == Category.Black && shopdata.MarketBlack != null) { pdata.m_reflashCost = shopdata.MarketBlack.FreshCost; pdata.m_reflashCount = shopdata.MarketBlack.FreshLimit; pdata.m_LastReflashTime = shopdata.MarketBlack.LastUpdateTime * 10000; pdata.m_NextReflashTime = shopdata.MarketBlack.NextUpdateTime * 10000; } for (int i = 0; i < shopdata.MarketItems.Count; i++) { ShopItemData itemdata = new ShopItemData(); MarketItemMsg markitem = shopdata.MarketItems[i]; if (markitem != null) { ConfProp prop = ConfProp.Get(markitem.SellId); itemdata.m_number = markitem.SellCount; itemdata.marketID = markitem.Id; itemdata.m_oriPrice = markitem.Cost; itemdata.m_limitNumber = markitem.BuyLimit; itemdata.m_maxNumber = markitem.MaxLimit; itemdata.m_costType = markitem.CostType; if (markitem.DiscountInfo != null) { System.DateTime startTime = CommonTools.TimeStampToDateTime(markitem.DiscountInfo.DiscountStart * 10000); System.DateTime endTime = CommonTools.TimeStampToDateTime(markitem.DiscountInfo.DiscountEnd * 10000); System.DateTime nowTime = CommonTools.GetCurrentTime(); if (markitem.DiscountInfo.Discount == 0 || nowTime < startTime || nowTime > endTime) { itemdata.m_hasDis = false; } else { itemdata.m_hasDis = true; itemdata.m_disPrice = markitem.DiscountInfo.DiscountCost; itemdata.m_disCount = markitem.DiscountInfo.Discount; itemdata.m_disIcon = markitem.DiscountInfo.DiscountIcon; } } else { itemdata.m_hasDis = false; } if (prop != null) { itemdata.m_prop = prop; //todo 临时修改礼盒最前面 if (itemdata.m_prop.type == (int)PROP_TYPE.E_GIFT) { m_giftData.Add(itemdata); } else { pdata.m_itemdata.Add(itemdata); } } else { Debug.LogError("item id is not exist:" + markitem.SellId); } } } pdata.m_itemdata.InsertRange(0, m_giftData); ShopDataCache[shopdata.Category] = pdata; return(pdata); }