Пример #1
0
    private static int GetBuyMetalNeedCash(float metalCount)
    {
        DataInitialConfig initialConfig = DataManager.instance.dataInitialConfigGroup.GetDataInitialConfig();
        DataDiscount      discount      = DataManager.instance.dataDiscountGroup.GetDiscount(metalCount);

        return(Mathf.CeilToInt(metalCount * initialConfig.metalToCashRate * discount.metalDiscount));
    }
Пример #2
0
    private static int GetBuyRareNeedCash(float rareCount)
    {
        DataInitialConfig initialConfig = DataManager.instance.dataInitialConfigGroup.GetDataInitialConfig();
        DataDiscount      discount      = DataManager.instance.dataDiscountGroup.GetDiscount(rareCount);

        return(Mathf.CeilToInt(rareCount * initialConfig.rareToCashRate * discount.rareDiscount));
    }
Пример #3
0
    // 资源与钻石的换算方式:
    // 玩家实际需要花费的钻石数 =(当前购买的资源量*资源换算比)*当前购买的资源区间折扣数(Discount表格)
    private static int GetBuyFoodNeedCash(float foodCount)
    {
        DataInitialConfig initialConfig = DataManager.instance.dataInitialConfigGroup.GetDataInitialConfig();
        DataDiscount      discount      = DataManager.instance.dataDiscountGroup.GetDiscount(foodCount);

        return(Mathf.CeilToInt(foodCount * initialConfig.foodToCashRate * discount.foodDiscount));
    }
Пример #4
0
        public void GetDiscountByCodeTest()
        {
            // Arrange
            DataDiscount dataDiscount = new DataDiscount();

            // Act
            decimal Amount = (decimal)dataDiscount.GetDiscountByCode("RABAT10");

            // Assert
            Assert.AreEqual(0.90m, Amount);
        }
Пример #5
0
    public void Load(string name)
    {
        byte[] bin     = DynamicFileControl.QueryFileContent(name);
        string content = StringHelper.ReadFromBytes(bin);

        LitJson.JSONNode json = LitJson.JSON.Parse(content);

        foreach (LitJson.JSONNode subNode in json.Childs)
        {
            DataDiscount data = new DataDiscount();
            data.Load(subNode);
            _discount.Add(data);
        }
    }
Пример #6
0
    public DataDiscount GetDiscount(float resourcesCount)
    {
        int selectIndex = 0;
        int count       = _discount.Count;

        for (int i = 1; i < count; ++i)
        {
            DataDiscount discount = _discount[i];
            if (resourcesCount >= discount.resourcesMin)
            {
                ++selectIndex;
            }
        }

        return(_discount [selectIndex]);
    }
Пример #7
0
 public DiscountControl()
 {
     dataDiscount = new DataDiscount();
 }