public string GetPriceString(int sel, BUY_HOW buyHow) { if (sel >= prices.Count) { return(string.Empty); } int percent = 0; if (BuildOption.Instance.Props.usePriceDiscount && tItem.type == TItem.TYPE.WEAPON) { TWeapon tWeapon = (TWeapon)tItem; percent = tWeapon.GetDiscountRatio(); } int num = 0; for (int i = 0; i < prices.Count; i++) { if (prices[i].CanBuy(buyHow)) { if (num == sel) { return(prices[i].GetPriceString(buyHow, percent)); } num++; } } return(string.Empty); }
public string GetDefaultOption(BUY_HOW buyHow) { PriceTag defaultPriceTag = GetDefaultPriceTag(buyHow); if (defaultPriceTag == null || tItem == null) { return(string.Empty); } return(defaultPriceTag.GetRemainString(tItem.IsAmount)); }
public int GetPriceByOpt(int opt, BUY_HOW buyHow) { for (int i = 0; i < prices.Count; i++) { if (prices[i].option == opt) { return(prices[i].GetPrice(buyHow)); } } return(-1); }
public bool CanBuy(BUY_HOW buyHow, bool rebuy) { bool result = false; foreach (PriceTag price in prices) { if (price.CanBuy(buyHow, rebuy)) { result = true; } } return(result); }
public int GetCashback() { BUY_HOW buyHow = BUY_HOW.CASH_POINT; PriceTag defaultPriceTag = GetDefaultPriceTag(buyHow); if (defaultPriceTag == null) { return(0); } if (defaultPriceTag.CashBack > 0) { return(defaultPriceTag.CashBack); } return(0); }
public int GetOption(int sel, BUY_HOW buyHow) { int num = 0; for (int i = 0; i < prices.Count; i++) { if (prices[i].CanBuy(buyHow)) { if (num == sel) { return(prices[i].option); } num++; } } return(-1); }
public string GetDefaultTokenPrice() { BUY_HOW buyHow = BUY_HOW.CASH_POINT; PriceTag defaultPriceTag = GetDefaultPriceTag(buyHow); if (defaultPriceTag == null) { return(string.Empty); } int percent = 0; if (BuildOption.Instance.Props.usePriceDiscount && tItem.type == TItem.TYPE.WEAPON) { TWeapon tWeapon = (TWeapon)tItem; percent = tWeapon.GetDiscountRatio(); } return(defaultPriceTag.GetPriceString(buyHow, percent)); }
public string GetDefaultBrickPrice() { BUY_HOW buyHow = BUY_HOW.BRICK_POINT; PriceTag defaultPriceTag = GetDefaultPriceTag(buyHow); if (defaultPriceTag == null) { return(string.Empty); } int percent = 0; if (tItem.type == TItem.TYPE.WEAPON) { TWeapon tWeapon = (TWeapon)tItem; percent = tWeapon.GetDiscountRatio(); } return(defaultPriceTag.GetPriceString(buyHow, percent)); }
public string[] GetOptionStrings(BUY_HOW buyHow, int percent) { if (tItem == null) { return(null); } List <string> list = new List <string>(); for (int i = 0; i < prices.Count; i++) { string optionString = prices[i].GetOptionString(buyHow, tItem.IsAmount, percent); if (optionString.Length > 0) { list.Add(optionString); } } return(list.ToArray()); }
public int GetDefaultPriceSel(BUY_HOW buyHow) { List <PriceTag> list = new List <PriceTag>(); for (int i = 0; i < prices.Count; i++) { if (prices[i].CanBuy(buyHow)) { list.Add(prices[i]); } } if (list.Count <= 0) { return(-1); } if (list.Count > 1) { return(1); } return(0); }
private PriceTag GetDefaultPriceTag(BUY_HOW buyHow) { List <PriceTag> list = new List <PriceTag>(); for (int i = 0; i < prices.Count; i++) { if (prices[i].CanBuy(buyHow)) { list.Add(prices[i]); } } if (list.Count <= 0) { return(null); } if (list.Count > 1) { return(list[1]); } return(list[0]); }
public string GetRemainString(int sel, BUY_HOW buyHow) { if (sel >= prices.Count || tItem == null) { return(string.Empty); } int num = 0; for (int i = 0; i < prices.Count; i++) { if (prices[i].CanBuy(buyHow)) { if (num == sel) { return(prices[i].GetRemainString(tItem.IsAmount)); } num++; } } return(string.Empty); }
public int GetOriginalPrice(int sel, BUY_HOW buyHow) { if (sel >= prices.Count || tItem == null) { return(-1); } int percent = 0; int num = 0; for (int i = 0; i < prices.Count; i++) { if (prices[i].CanBuy(buyHow)) { if (num == sel) { return(prices[i].GetPrice(buyHow, percent)); } num++; } } return(-1); }