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)); }
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)); }
// 资源与钻石的换算方式: // 玩家实际需要花费的钻石数 =(当前购买的资源量*资源换算比)*当前购买的资源区间折扣数(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)); }
public void GetDiscountByCodeTest() { // Arrange DataDiscount dataDiscount = new DataDiscount(); // Act decimal Amount = (decimal)dataDiscount.GetDiscountByCode("RABAT10"); // Assert Assert.AreEqual(0.90m, Amount); }
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); } }
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]); }
public DiscountControl() { dataDiscount = new DataDiscount(); }