public string GetPrizeType(PrizeTypes PrizeType, int PrizeValue) { string result = string.Empty; switch (PrizeType) { case PrizeTypes.Integral: result = PrizeValue + "积分; "; break; case PrizeTypes.Coupou: { CouponInfo coupon = CouponHelper.GetCoupon(PrizeValue); result = ((coupon == null) ? " " : ((!(coupon.ClosingTime > coupon.StartTime)) ? (coupon.Price + "元优惠券<font style='color:red;'>(已失效)</font>; ") : (coupon.Price + "元优惠券; "))); break; } case PrizeTypes.Gift: { GiftInfo giftDetails = GiftHelper.GetGiftDetails(PrizeValue); result = ((giftDetails == null) ? " " : (giftDetails.Name + "; ")); break; } } return(result); }
public static AbstractPrize GetPrize(PrizeTypes prizeType, Vector position) { switch (prizeType) { case PrizeTypes.NONE: return(null); case PrizeTypes.PAC_DOTS: return(new PacDot(position)); case PrizeTypes.POWER_PELLETS: return(new PowerPellet(position)); } throw new PacException($"Prize of type {prizeType} is not implemented in PrizeFactory.GetPrize"); }