Esempio n. 1
0
    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);
    }
Esempio n. 2
0
    public string GetDefaultOption(BUY_HOW buyHow)
    {
        PriceTag defaultPriceTag = GetDefaultPriceTag(buyHow);

        if (defaultPriceTag == null || tItem == null)
        {
            return(string.Empty);
        }
        return(defaultPriceTag.GetRemainString(tItem.IsAmount));
    }
Esempio n. 3
0
 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);
 }
Esempio n. 4
0
    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);
    }
Esempio n. 5
0
    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);
    }
Esempio n. 6
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);
    }
Esempio n. 7
0
    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));
    }
Esempio n. 8
0
    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));
    }
Esempio n. 9
0
    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());
    }
Esempio n. 10
0
    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);
    }
Esempio n. 11
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]);
    }
Esempio n. 12
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);
    }
Esempio n. 13
0
    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);
    }