public void AddMoney_Test() { //Act Money addMoney = new Money(); //Method is Balance += amountInserted. //Assert Assert.AreEqual(10, addMoney.AddMoney(10)); Assert.AreEqual(15, addMoney.AddMoney(5)); Assert.AreEqual(16, addMoney.AddMoney(1)); Assert.AreEqual(18, addMoney.AddMoney(2)); }
public void Sell(GameObject card) { CardHelper c = card.GetComponent <CardHelper>(); deck.Remove(CopyCard(card)); Money.AddMoney(c.card.goldCost); UpdateMoney(); }
public void AddMoneyNullFail() { //Arrange Money money = new Money(1, Currency.AUD); //Assert var ex = Assert.Throws <ArgumentException>(() => money.AddMoney(null)); Assert.AreEqual(ExceptionMessages.MoneyAdditionNullFail(), ex.Message); }
public async Task HandleDeliveryDropOff() { if (Game.Player.WantedLevel > 0) { if (!wantedLevelWarned) { MissionHelper.DrawTaskSubtitle(Strings.MISSION_LOSE_WANTED); importBlip.Alpha = 0; importBlip.ShowRoute = false; wantedLevelWarned = true; } } else { wantedLevelWarned = false; if (Game.PlayerPed.CurrentVehicle == deliveryCar) { if (!insideCar) { MissionHelper.DrawTaskSubtitle(String.Format(Strings.MISSION_DELIVERY_RETURN_TO_WAREHOUSE, vehicleLabel)); deliveryCar.AttachedBlip.Alpha = 0; deliveryCar.AttachedBlip.ShowRoute = false; importBlip.Alpha = 255; importBlip.ShowRoute = true; insideCar = true; } } else { if (insideCar) { MissionHelper.DrawTaskSubtitle(String.Format(Strings.MISSION_DELIVERY_RETURN_TO_VEHICLE, vehicleLabel)); deliveryCar.AttachedBlip.Alpha = 255; deliveryCar.AttachedBlip.ShowRoute = true; importBlip.Alpha = 0; importBlip.ShowRoute = false; insideCar = false; } } World.DrawMarker(MarkerType.VerticalCylinder, importPoint, Vector3.Zero, Vector3.Zero, new Vector3(3f, 3f, 3f), Color.FromArgb(127, 0, 0, 255)); if (World.GetDistance(deliveryCar.Position, importPoint) < 5f) { API.SetVehicleHalt(deliveryCar.Handle, 3f, 1, true); await WarehouseTeleporter.RequestTeleport(WarehouseTeleport.Inside); deliveryCar.Delete(); // TODO: Properly save WarehouseState.VehicleAmount++; Money.AddMoney(10000); MissionStarter.RequestStopCurrentMission(); } } }
public void AddMoneyUpdatesCurrentBalance() { // Arrange Money money = new Money(); // Act decimal result = money.AddMoney(10M); // Assert Assert.AreEqual(10M, result); }
public void AddMoneyOK(decimal amountTo, Currency currTo, decimal amountAdd, Currency currAdd, decimal result) { //Arrange Money moneyTo = new Money(amountTo, currTo); Money moneyAdd = new Money(amountAdd, currAdd); //Act moneyTo.AddMoney(moneyAdd); //Assert Assert.AreEqual(result, moneyTo.Amount); }
public void Correct() { // correct.Add(currentQuestion); double questionTime = elapsedTime; totalTime += elapsedTime; questionTracker.Correct(currentQuestion); isQuestionActive = false; Money.AddMoney(1); feedbackText.text = "Correct!"; // questionCount++; }
public void UpLevelTower() { if (currentTowerOnScene) { if (money.IsMoney(costUpLevel)) { TowerController tc = currentTowerOnScene.GetComponent <TowerController>(); tc.UpLevel(); levelTower.text = "Tower Level: " + tc.GetLevel().ToString(); money.AddMoney(-costUpLevel); } } }
private void OnTriggerEnter(Collider other) { if (other.tag != "Player") { var goName = other.gameObject.name; var text = GameObject.FindGameObjectWithTag("Money").GetComponent <Text>(); if (goName.Contains("Key")) { Destroy(other.gameObject, 1.0F); Money.AddMoney(10); text.text = Money.GetBalance().ToString(); } else if (goName.Contains("Nails")) { Destroy(other.gameObject, 1.0F); Money.AddMoney(10); text.text = Money.GetBalance().ToString(); } else if (goName.Contains("Barrel")) { Destroy(other.gameObject, 1.0F); Money.AddMoney(50); text.text = Money.GetBalance().ToString(); } else if (goName.Contains("Pallet")) { Destroy(other.gameObject, 1.0F); Money.AddMoney(20); text.text = Money.GetBalance().ToString(); } else if (goName.Contains("Stool")) { Destroy(other.gameObject, 1.0F); Money.AddMoney(40); text.text = Money.GetBalance().ToString(); } else if (goName.Contains("Wood")) { Destroy(other.gameObject, 1.0F); Money.AddMoney(40); text.text = Money.GetBalance().ToString(); } else if (goName.Contains("Junk")) { Destroy(other.gameObject, 1.0F); Money.AddMoney(1); text.text = Money.GetBalance().ToString(); } } }
//use layer collision matrix void OnTriggerEnter2D(Collider2D target) { if (target.gameObject.tag == "Player") { AudioPlayer.Instance.PlayCoinSFX(); //Money.amount += amountGained; Money.AddMoney(amountGained); Destroy(gameObject); // if (Input.GetKey("z")){ // } } }
/// <summary> /// Loads successful dialogue for Yes route /// </summary> /// <param name="dialogue"></param> public void DisplayChoiceYesSuccessSentences(Dialogue dialogue) { if (!gameOver) { dialogueSentences.Clear(); foreach (string sentence in dialogue.chooseYesSuccess) { dialogueSentences.Enqueue(sentence); } DisplaySentenceForChoices(); EndDialogue(); // apply stats money.AddMoney(dialogue.moneyYesSuccess); statManager.AddHealth(dialogue.healthYesSuccess); statManager.AddPsi(dialogue.psiYesSuccess); statManager.AddRadiation(dialogue.radiationYesSuccess); // generate loot if (dialogue.generateLootOnSuccess) { foreach (ItemDefinition item in dialogue.lootOnSuccess) { itemDrops.AddItemDrop(item); } } if (dialogue.randomLootOnSuccess) { itemDrops.GenerateRandomItems(dialogue.amountOfRandomLootOnSuccess); } } }
void Update() { // will have to set up ShopManager parent potentially if (Input.GetMouseButtonDown(1) && this.transform.parent.name == ("Deck")) { Deck.deckInstance.Remove(this.gameObject); Destroy(this.gameObject); if (GameManager.instance.RoundNumber == RoundBought) { Money.AddMoney(card.goldCost); } else { Money.AddMoney((int)0.5 * card.goldCost); } } }
static void Main(string[] args) { //1000 euro oluşturulur Money euroMoney = new Money(MoneyType.Euro, 1000); //600 dollar oluşturulu Money dollarMoney = new Money(MoneyType.Dollar, 600); //1000 euroya 600 doları ekleyelim. euroMoney.AddMoney(dollarMoney); //eouro muzu gbp ye convert edelim. Money gbpMoney = euroMoney.ConvertToMoney(MoneyType.GBP, 2); //gbp değerimizi yüzdelerimizi vererek 3 e bölelim List <Money> gbpMoneyList = gbpMoney.DivideMoney(3, 30, 40, 30); //dolarımız birinci gbp değerinden büyük mü kontrolünü yapalım. dollarMoney.isGreaterThan(gbpMoneyList[0]); }
private string spritepath; // 이미지 데이터 위치 void Start() { Screen.orientation = ScreenOrientation.Landscape; Screen.fullScreen = true; datapath = Application.dataPath + "/Resources/Files"; // 위치 지정 savepath = Application.persistentDataPath; // 위치 지정 spritepath = Application.dataPath + "/Resources/Sprites"; touch = GetComponent <Touch>(); // 터치 초기화 interfaceManager = GetComponent <InterfaceManager>(); // 인터페이스 초기화 LoadData(); if (money.money == 0) { money.AddMoney(10000); } money.MoneyUpdate(); watertank[0].volume = volume_parts[watertank[0].part.volume].size; watertank[1].volume = volume_parts[watertank[0].part.volume].size; }
/// <summary> /// 佣金提现,-转现金账户 /// </summary> public void TackAgentMoney() { int d = 0; int.TryParse(SYS.CommissionMoneyDays, out d); d = 0 - d; decimal money = 0; string money_ = Common.GetValue("select sum(Money) from Lebi_Agent_Money where User_id=" + CurrentUser.id + " and Type_id_AgentMoneyStatus=382 and Time_add<'" + System.DateTime.Now.AddDays(d) + "')"); decimal.TryParse(money_, out money); if (money > 0) { Money.AddMoney(CurrentUser, money, 191, null, "", ""); Response.Write("{\"msg\":\"OK\"}"); } string sql = "update Lebi_Agent_Money set Type_id_AgentMoneyStatus=384 where User_id=" + CurrentUser.id + " and Type_id_AgentMoneyStatus=382 and Time_add<'" + System.DateTime.Now.AddDays(d) + "')"; Common.ExecuteSql(sql); Response.Write("{\"msg\":\"" + Tag("金额不能为0") + "\"}"); return; }
public Money GetCurrentEarn() { Money earn = new Money(); int count = 0; for (int i = 0; i < 8; i++) { if (fm.GetIsPurchased()[i]) { count++; earn.AddMoney(new Money(fm.facEarn[i] * _facLevel[i])); } } earn.num = earn.num * Mathf.Pow(1.5f, count); earn.MoneyRule(); earn.num = earn.num * 13; earn.MoneyRule(); earn.num = earn.num * Mathf.Pow(2, _spoonLevel - 1); earn.MoneyRule(); return(earn); }
/// <summary> /// get a reward for a caught enemy /// </summary> public void RewardKillEnemy() { money.AddMoney(rewardForTheEnemy); }
private void SellItem(GameObject go) { Money.AddMoney(FactoryMachines.GetPrice(go, true)); Destroy(go); }
private void Action() { _money.AddMoney(income + additionalIncome); _anim.SetTrigger("Pulse"); _timer = 0; }
/// <summary> /// 余额购买其他内容 /// </summary> public void BuyOther() { int keyid = RequestTool.RequestInt("keyid"); string tablename = RequestTool.RequestSafeString("tablename"); decimal postmoney = RequestTool.RequestDecimal("money"); string paypwd = RequestTool.RequestSafeString("paypwd"); decimal money = 0; if (EX_User.MD5(paypwd) != CurrentUser.Pay_Password) { Response.Write("{\"msg\":\"" + Tag("支付密码错误") + "\"}"); return; } if (tablename == "Agent_Product_Level") { Lebi_Agent_Product_Level lev = B_Lebi_Agent_Product_Level.GetModel(keyid); if (lev == null) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } Lebi_Agent_Product_User user = B_Lebi_Agent_Product_User.GetModel("User_id=" + CurrentUser.id + ""); if (user == null) { //新购买的情况 money = lev.Price; if (money > CurrentUser.Money) { Response.Write("{\"msg\":\"" + Tag("余额不足") + "\"}"); return; } user = new Lebi_Agent_Product_User(); user.Agent_Product_Level_id = lev.id; user.Commission = lev.Commission; user.Count_Product = lev.Count_Product; user.Count_product_change = lev.Count_product_change; user.User_id = CurrentUser.id; user.User_UserName = CurrentUser.UserName; user.Time_end = System.DateTime.Now.AddYears(lev.Years); B_Lebi_Agent_Product_User.Add(user); } else { if (user.Agent_Product_Level_id == lev.id) { //续费的情况 money = lev.Price; if (money > CurrentUser.Money) { Response.Write("{\"msg\":\"" + Tag("余额不足") + "\"}"); return; } user.Time_end = user.Time_end.AddYears(lev.Years); B_Lebi_Agent_Product_User.Update(user); //更新代理商品的过期时间 } else { //升级的情况 Lebi_Agent_Product_Level userlev = B_Lebi_Agent_Product_Level.GetModel(user.Agent_Product_Level_id); if (userlev.Sort > lev.Sort) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } money = lev.Price - userlev.Price; if (money < 0) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } if (money > CurrentUser.Money) { Response.Write("{\"msg\":\"" + Tag("余额不足") + "\"}"); return; } user.Agent_Product_Level_id = lev.id; user.Commission = lev.Commission; user.Count_Product = lev.Count_Product; user.Count_product_change = lev.Count_product_change; B_Lebi_Agent_Product_User.Update(user); } } EX_User.GiveUserCard(CurrentUser, lev.CardOrder_id);//赠送代金券 Money.AddMoney(CurrentUser, 0 - money, 196, null, "", ""); } else if (tablename == "Agent_Area") { Lebi_Agent_Area area = B_Lebi_Agent_Area.GetModel(keyid); if (area == null) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } if (area.User_id > 0 && area.User_id != CurrentUser.id) { Response.Write("{\"msg\":\"" + Tag("不能代理此区域") + "\"}"); return; } money = area.Price; if (money > CurrentUser.Money) { Response.Write("{\"msg\":\"" + Tag("余额不足") + "\"}"); return; } if (area.User_id == 0) { //新购买的情况 area.User_id = CurrentUser.id; area.User_UserName = CurrentUser.UserName; area.Time_end = System.DateTime.Now.AddYears(1); area.IsFailure = 0; B_Lebi_Agent_Area.Update(area); } else { //续费的情况 area.Time_end = area.Time_end.AddYears(1); area.IsFailure = 0; B_Lebi_Agent_Area.Update(area); } EX_User.GiveUserCard(CurrentUser, area.CardOrder_id);//赠送代金券 Money.AddMoney(CurrentUser, 0 - money, 196, null, "", ""); } else if (tablename == "suppliermargin")//供应商保证金 { Lebi_Supplier supplier = B_Lebi_Supplier.GetModel("User_id=" + CurrentUser.id); if (supplier == null) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } //新购买的情况 money = supplier.Money_Margin - supplier.Money_Margin_pay; if (money > CurrentUser.Money) { Response.Write("{\"msg\":\"" + Tag("余额不足") + "\"}"); return; } supplier.Money_Margin_pay += money; B_Lebi_Supplier.Update(supplier); Money.AddMoney(CurrentUser, 0 - money, 197, null, "", ""); } else if (tablename == "suppliermargin")//供应商保证金 { Lebi_Supplier supplier = B_Lebi_Supplier.GetModel("User_id=" + CurrentUser.id); if (supplier == null) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } money = supplier.Money_Margin - supplier.Money_Margin_pay; if (money > CurrentUser.Money) { Response.Write("{\"msg\":\"" + Tag("余额不足") + "\"}"); return; } supplier.Money_Margin_pay += money; B_Lebi_Supplier.Update(supplier); Money.AddMoney(CurrentUser, 0 - money, 197, null, "", ""); } else if (tablename == "supplierservice")//供应商服务费 { Lebi_Supplier supplier = B_Lebi_Supplier.GetModel("User_id=" + CurrentUser.id); if (supplier == null) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } Lebi_Supplier_Group group = B_Lebi_Supplier_Group.GetModel("id=" + supplier.Supplier_Group_id); if (group == null) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } money = supplier.Money_Service; if (money > CurrentUser.Money) { Response.Write("{\"msg\":\"" + Tag("余额不足") + "\"}"); return; } supplier.Time_End = supplier.Time_End.AddDays(group.ServiceDays); B_Lebi_Supplier.Update(supplier); Money.AddMoney(CurrentUser, 0 - money, 198, null, "", ""); } Response.Write("{\"msg\":\"OK\"}"); }
/// <summary> /// 提现 /// </summary> public void TackMoney() { string PayType = RequestTool.RequestSafeString("PayType"); string CashAccount_Code = RequestTool.RequestSafeString("CashAccount_Code"); string CashAccount_Name = RequestTool.RequestSafeString("CashAccount_Name"); string CashAccount_Bank = RequestTool.RequestSafeString("CashAccount_Bank"); string Pay_Password = RequestTool.RequestSafeString("Pay_Password"); decimal RMoney = RequestTool.RequestDecimal("RMoney", 0); decimal Fee = RMoney * Convert.ToDecimal(SYS.WithdrawalFeeRate) / 100; int count = B_Lebi_Cash.Counts("User_id=" + CurrentUser.id + " and Type_id_CashStatus=401"); if (count > 0) { Response.Write("{\"msg\":\"" + Tag("请等待上次提现处理完毕") + "\"}"); return; } if (RMoney + CurrentUser.Money_fanxian > CurrentUser.Money) { Response.Write("{\"msg\":\"" + Tag("余额不足") + "\"}"); return; } decimal TakeMoneyLimit = 0; decimal.TryParse(SYS.TakeMoneyLimit, out TakeMoneyLimit); if (RMoney < TakeMoneyLimit) { Response.Write("{\"msg\":\"" + Tag("未达到最低提现要求") + "\"}"); return; } if (Pay_Password == "") { Response.Write("{\"msg\":\"" + Tag("请输入支付密码") + "\"}"); return; } else { if (EX_User.MD5(Pay_Password) != CurrentUser.Pay_Password) { Response.Write("{\"msg\":\"" + Tag("支付密码不正确") + "\"}"); return; } } CurrentUser.CashAccount_Code = CashAccount_Code; CurrentUser.CashAccount_Name = CashAccount_Name; CurrentUser.CashAccount_Bank = CashAccount_Bank; B_Lebi_User.Update(CurrentUser); Lebi_Cash model = new Lebi_Cash(); model.PayType = PayType; model.AccountName = CashAccount_Name; model.AccountCode = CashAccount_Code; model.Bank = CashAccount_Bank; model.User_id = CurrentUser.id; model.User_UserName = CurrentUser.UserName; model.Money = RMoney; model.Fee = Fee; model.Type_id_CashStatus = 401; B_Lebi_Cash.Add(model); //扣款 Money.AddMoney(CurrentUser, 0 - RMoney, 193, null, "", ""); Response.Write("{\"msg\":\"OK\"}"); }
public virtual void Kill() { //... money.AddMoney(50); Destroy(gameObject); }
/// <summary> /// 编辑会员资金 /// </summary> public void UserMoney_Edit() { int id = RequestTool.RequestInt("id", 0); SearchUser su = new SearchUser(CurrentAdmin, CurrentLanguage.Code); decimal money = RequestTool.RequestDecimal("Money", 0); int Type_id_MoneyType = RequestTool.RequestInt("Type_id_MoneyType", 0); string Remark = RequestTool.RequestString("Remark"); if (id > 0) { if (!EX_Admin.Power("user_money_edit", "编辑会员资金")) { AjaxNoPower(); return; } Lebi_User_Money model = B_Lebi_User_Money.GetModel(id); Lebi_User user = B_Lebi_User.GetModel(model.User_id); Log.Add("编辑会员资金", "User_Money", id.ToString(), CurrentAdmin, user.UserName); if (user == null) { Response.Write("{\"msg\":\"" + Tag("会员账号不存在") + "\"}"); return; } //model.Type_id_MoneyStatus = RequestTool.RequestInt("Type_id_MoneyStatus", 0); model.Type_id_MoneyType = Type_id_MoneyType; model.Admin_UserName = CurrentAdmin.UserName; model.Admin_id = CurrentAdmin.id; model.Remark = Remark; model.Time_Update = DateTime.Now; B_Lebi_User_Money.Update(model); //EX_User.UpdateUserMoney(user); } else { if (!EX_Admin.Power("user_money_add", "添加会员资金")) { AjaxNoPower(); return; } string Mode = RequestTool.RequestString("mode"); string User_Name_To = RequestTool.RequestString("User_Name_To"); string UserLevel_ids = RequestTool.RequestString("UserLevel_ids"); string User_ids = RequestTool.RequestString("User_ids"); string UserName_ids = RequestTool.RequestString("UserName_ids"); if (Mode == "user") { Lebi_User user = B_Lebi_User.GetModel("UserName = lbsql{'" + User_Name_To + "'}"); if (user == null) { Response.Write("{\"msg\":\"" + Tag("会员账号不存在") + "\"}"); return; } Lebi_User_Money model = new Lebi_User_Money(); Log.Add("添加会员资金", "User_Money", id.ToString(), CurrentAdmin, User_Name_To + " ->" + RequestTool.RequestDecimal("Money", 0)); Money.AddMoney(user, money, Type_id_MoneyType, CurrentAdmin, "", Remark); } else { string where = ""; if (User_ids == "") { where = "1=1 " + su.SQL; Log.Add("添加会员资金", "User_Money", "", CurrentAdmin, su.Description + " ->" + RequestTool.RequestDecimal("Money", 0)); } else { where = "id in (" + User_ids + ")"; Log.Add("添加会员资金", "User_Money", "", CurrentAdmin, UserName_ids + " ->" + RequestTool.RequestDecimal("Money", 0)); } List <Lebi_User> modellist = B_Lebi_User.GetList(where, ""); foreach (Lebi_User user in modellist) { Money.AddMoney(user, money, Type_id_MoneyType, CurrentAdmin, "", Remark); } } } string result = "{\"msg\":\"OK\"}"; Response.Write(result); }