public static TimeSpan GetTimeSpanToDiscountOff(ShopTemplate shopT) { if (shopT == null) { return(TimeSpan.MaxValue); } return(GameUtils.ConvertStringToDateTime(shopT.getDiscountOff()) - ObjectSelf.GetInstance().ServerDateTime); }
/// <summary> /// 根据当前时间判断物品是否在打折; /// </summary> /// <param name="shopT"></param> /// <returns></returns> public static bool IsShopItemInDiscount(ShopTemplate shopT) { DateTime dt1 = GameUtils.ConvertStringToDateTime(shopT.getDiscountOn()); DateTime dt2 = GameUtils.ConvertStringToDateTime(shopT.getDiscountOff()); if (ObjectSelf.GetInstance().ServerDateTime > dt1 && ObjectSelf.GetInstance().ServerDateTime < dt2) { return(true); } return(false); }