private void LoadManagers(BusinessHandler business) { foreach (var manager in GameData.Managers.Where(t => t.BusinessId == business.BusinessInfo.Id)) { var newManager = Instantiate(ManagerPrefab); newManager.name = "ManagerPrefab"; var nameText = newManager.transform.Find("NameText").GetComponent <Text>(); nameText.text = manager.Name; var descriptionText = newManager.transform.Find("DescriptionText").GetComponent <Text>(); descriptionText.text = manager.Description.Replace("{0}", business.BusinessInfo.Name); var newSprite = Resources.Load <Sprite>(manager.ImageName); var image = newManager.transform.Find("Image").GetComponent <Image>(); image.sprite = newSprite; var costText = newManager.transform.Find("CostText").GetComponent <Text>(); costText.text = MoneyFormat.Default(manager.Cost); newManager.transform.SetParent(ManagerPanel.transform, false); Button unlockManagerButton = newManager.transform.Find("UnlockButton").GetComponent <Button>(); unlockManagerButton.onClick.AddListener(business.UnlockManager); BusinessUI businessUI = business.GetComponent <BusinessUI>(); businessUI.Manager = newManager; } }
private void LoadUpgrades(BusinessHandler business) { foreach (var upgrade in GameData.Upgrades.Where(t => t.BusinessId == business.BusinessInfo.Id)) { var newUpgrade = Instantiate(UpgradePrefab); newUpgrade.name = "UpgradePrefab"; var nameText = newUpgrade.transform.Find("NameText").GetComponent <Text>(); nameText.text = upgrade.Name; var descriptionText = newUpgrade.transform.Find("DescriptionText").GetComponent <Text>(); descriptionText.text = upgrade.Description.Replace("{0}", business.BusinessInfo.Name); var newSprite = Resources.Load <Sprite>(upgrade.ImageName); var image = newUpgrade.transform.Find("Image").GetComponent <Image>(); image.sprite = newSprite; var costText = newUpgrade.transform.Find("CostText").GetComponent <Text>(); costText.text = MoneyFormat.Default(upgrade.Cost); newUpgrade.transform.SetParent(UpgradePanel.transform, false); Button unlockUpgradeButton = newUpgrade.transform.Find("UnlockButton").GetComponent <Button>(); unlockUpgradeButton.onClick.AddListener(business.UnlockUpgrade); BusinessUI businessUI = business.GetComponent <BusinessUI>(); businessUI.Upgrade = newUpgrade; } }
private void UpdateBuyButton() { var money = MoneyFormat.GetMoney(Business.NextStoreCost); BuyButtonText.text = "$ " + money.FormattedNumber; BuyButtonScaleText.text = money.Scale; }
public static string FormatMoney <TAmount>( MoneyFormat spec, TAmount amount, string currencyCode, NumberFormatInfo nfi) where TAmount : IFormattable { Debug.Assert(nfi != null); var format = 'N' + spec.DecimalPlaces?.ToString(CultureInfo.InvariantCulture); string value = amount.ToString(format, nfi); // Uppercase it (ASCII letter only). switch (spec.MainFormat & 0xDF) { case 'N': // Numeric. Does not include any information about the currency. return(value); case 'L': // Left (Currency code placed on the). return(currencyCode + NO_BREAK_SPACE + value); case 'R': case 'G': // General (default) or Right (Currency code placed on the). return(value + NO_BREAK_SPACE + currencyCode); default: throw new FormatException( Format.Current(Strings_Money.Money_BadMainSpecifier, spec.MainFormat)); } }
public override View GetView(int position, View convertView, ViewGroup parent) { View view; if (this._OrderList.Count == 0) { view = convertView ?? _activity.LayoutInflater.Inflate(Resource.Layout.NoPaymentTrackerItem1, null, false); } else { view = convertView ?? _activity.LayoutInflater.Inflate(Resource.Layout.InstalmentSummaryList, parent, false); var tv_Date = view.FindViewById <TextView>(Resource.Id.tv_Date); var tv_Amount = view.FindViewById <TextView>(Resource.Id.tv_Amount); var linearLayout = view.FindViewById <LinearLayout>(Resource.Id.layout_middle); tv_Date.Text = _OrderList[position].PaymentDate; var amount = _OrderList[position].Amount; tv_Amount.Text = MoneyFormat.Convert(decimal.Parse(amount.ToString())); if (position % 2 == 0) { linearLayout.SetBackgroundColor(Color.ParseColor("#EDEDED")); } else { linearLayout.SetBackgroundColor(Color.ParseColor("#FFFFFF")); } } return(view); }
public override Android.Views.View OnCreateView(Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Android.OS.Bundle savedInstanceState) { this.HasOptionsMenu = true; var ignored = base.OnCreateView(inflater, container, savedInstanceState); var view = inflater.Inflate(Resource.Layout.MainContentLayout2, null); tv_AccountNumber = view.FindViewById <TextView>(Resource.Id.tv_ClientAccountNumber); tv_AccountNumber.Text = Settings.ClientAccountNumber; tv_OurClient = view.FindViewById <TextView>(Resource.Id.tv_OurClient); tv_OurClient.Text = Settings.OurClient; tv_RefNumber = view.FindViewById <TextView>(Resource.Id.tv_RefNumber); tv_RefNumber.Text = Settings.RefNumber; tv_OutStanding = view.FindViewById <TextView>(Resource.Id.tv_OutStanding); tv_OutStanding.Text = MoneyFormat.Convert(Settings.TotalOutstanding); tv_NextInstalment = view.FindViewById <TextView>(Resource.Id.tv_NextInstalment); ll_NextInstalment = view.FindViewById <LinearLayout>(Resource.Id.ll_NextInstalment_0); if (Settings.NextPaymentInstallment > 0) { tv_NextInstalment.Text = MoneyFormat.Convert(Settings.NextPaymentInstallment); } else { ll_NextInstalment.Visibility = ViewStates.Invisible; } ln_make_payment = view.FindViewById <LinearLayout>(Resource.Id.ln_make_payment); ln_make_payment.Touch += ln_make_paymentTouch; ln_payment_tracker = view.FindViewById <LinearLayout>(Resource.Id.ln_payment_tracker); ln_payment_tracker.Touch += Ln_payment_tracker_Touch; ln_installment_info = view.FindViewById <LinearLayout>(Resource.Id.ln_instalment_info); ln_installment_info.Touch += Ln_installment_Info; ln_defer_payment = view.FindViewById <LinearLayout>(Resource.Id.ln_defer_payment); ln_defer_payment.Touch += Ln_defer_payment_Touch; ln_schedule_callback = view.FindViewById <LinearLayout>(Resource.Id.ln_schedule_callback); ln_schedule_callback.Touch += Ln_schedule_callback_Touch; ln_inbox = view.FindViewById <LinearLayout>(Resource.Id.ln_inbox); ln_inbox.Touch += Ln_inbox_Touch; return(view); }
public void WelcomeBack(double diffInSeconds, double idleAmount) { var time = TimeSpan.FromSeconds(diffInSeconds); var timeText = string.Format("{0:D2}:{1:D2}:{2:D2}", time.Hours, time.Minutes, time.Seconds); var offlineText = DialogPanels.transform.Find("WelcomeBackPanel/Text").GetComponent <Text>(); offlineText.text = "You earned\n" + MoneyFormat.Default(idleAmount) + "\nwhile you were offline for\n" + timeText; CurrentState = State.WelcomeBackPanel; ShowDialog(); }
private double LoadBusinesses(double idleTime) { var idleAmount = 0d; foreach (Transform eachChild in BusinessPanel.transform) { if (eachChild.name == "BusinessPrefab") { Destroy(eachChild.gameObject); } } foreach (Transform eachChild in ManagerPanel.transform) { if (eachChild.name == "ManagerPrefab") { Destroy(eachChild.gameObject); } } foreach (Transform eachChild in UpgradePanel.transform) { if (eachChild.name == "UpgradePrefab") { Destroy(eachChild.gameObject); } } foreach (var element in GameData.Businesses) { var newBusiness = Instantiate(BusinessPrefab); newBusiness.name = "BusinessPrefab"; var currentBusiness = newBusiness.GetComponent <BusinessHandler>(); if (element.TimerCurrent > 0 || element.ManagerUnlocked == true) { if (element.TimerCurrent + idleTime >= element.TimerInSeconds) { var businessStoreProfit = ((element.BaseProfit * element.BusinessCount) * element.ProfitMultiplier) * element.CostMultiplier; if (element.ManagerUnlocked) { idleAmount = businessStoreProfit * (idleTime / element.TimerInSeconds); element.TimerCurrent = (float)(idleTime % (element.TimerInSeconds - element.TimerCurrent)) + element.TimerCurrent; } else { idleAmount = businessStoreProfit; element.TimerCurrent = 0; } } else { var result = (float)idleTime; if (float.IsPositiveInfinity(result)) { result = float.MaxValue; } element.TimerCurrent = (element.TimerCurrent + result); } } currentBusiness.BusinessInfo = element; LoadManagers(currentBusiness); LoadUpgrades(currentBusiness); var nameText = newBusiness.transform.Find("PurchasedPanel/StoreNameText").GetComponent <Text>(); nameText.text = element.Name; nameText = newBusiness.transform.Find("PurchasePanel/BuyBusinessButton/StoreNameText").GetComponent <Text>(); nameText.text = "Unlock " + "\"" + element.Name + "\""; var newSprite = Resources.Load <Sprite>(element.ImageName); var image = newBusiness.transform.Find("PurchasedPanel/StoreBackImageButton/StoreImage").GetComponent <Image>(); image.sprite = newSprite; var storeCostText = newBusiness.transform.Find("PurchasePanel/BuyBusinessButton/StoreCostText").GetComponent <Text>(); storeCostText.text = MoneyFormat.Default((element.BaseCost * Mathf.Pow(element.CostMultiplier, element.BusinessCount))); var nextProfitText = currentBusiness.transform.Find("PurchasedPanel/NextProfitText").GetComponent <Text>(); nextProfitText.text = MoneyFormat.Default((currentBusiness.BusinessInfo.BaseProfit * currentBusiness.BusinessInfo.BusinessCount)); newBusiness.transform.SetParent(BusinessPanel.transform, false); } return(idleAmount); }
public string Money(decimal amount, MoneyFormat format = MoneyFormat.WithCurrencySymbol, WebManagerSession session = null) { return(amount.ToString()); //todo Implement }
/// <summary> /// Converts financial amount to string per portal /// </summary> public abstract string AmountToString(Financial.Amount amount, MoneyFormat format = MoneyFormat.WithCurrencySymbol, ISession session = null);
/// <summary> /// Converts financial amount in portals.default currency to string per portal /// </summary> public virtual string AmountToString(decimal amount, MoneyFormat format = MoneyFormat.WithCurrencySymbol, ISession session = null) { return AmountToString(new Financial.Amount(this.DefauISOCurrency, amount), format, session); }
private void UpdateStoreProfit() { StoreProfitText.text = MoneyFormat.Default(((Business.BusinessInfo.BaseProfit * Business.BusinessInfo.BusinessCount) * Business.BusinessInfo.ProfitMultiplier)); }
private void LoadData() { AndHUD.Shared.Show(this, "Please wait ...", -1, MaskType.Clear); string url = Settings.InstanceURL; var url2 = url + "/Api/GetArrangeDetails"; var json = new { Item = new { ReferenceNumber = Settings.RefNumber } }; try { string results = ConnectWebAPI.Request(url2, json); if (string.IsNullOrEmpty(results)) { AndHUD.Shared.Dismiss(); this.RunOnUiThread(() => alert = new Alert(this, "Error", Resources.GetString(Resource.String.NoServer))); this.RunOnUiThread(() => alert.Show()); } var ObjectReturn = new ArrangeDetails(); ObjectReturn = Newtonsoft.Json.JsonConvert.DeserializeObject <ArrangeDetails>(results); AndHUD.Shared.Dismiss(); if (ObjectReturn.IsSuccess) { this.tv_Amount.Text = MoneyFormat.Convert(ObjectReturn.ArrangeAmount); this.tv_Paid.Text = MoneyFormat.Convert(ObjectReturn.PaidAmount); this.tv_Status.Text = ObjectReturn.Status; this.tv_Overdue.Text = MoneyFormat.Convert(ObjectReturn.OverdueAmount); this.tv_Frequency.Text = ObjectReturn.Frequency; this.tv_Remaining.Text = MoneyFormat.Convert(ObjectReturn.LeftToPay); this.tv_NextPayment.Text = ObjectReturn.NextInstalmentDate; Settings.TotalPaid = ObjectReturn.PaidAmount; Settings.TotalOverDue = ObjectReturn.OverdueAmount; pieChartView = this.createChart(); ln_Chart.AddView(pieChartView); ln_right.AddView(this.createLegend()); } else { //Hide Top View var params_Top = this.ln_top.LayoutParameters; params_Top.Height = 0; this.ln_top.LayoutParameters = params_Top; ln_top.Visibility = ViewStates.Invisible; //Hide Left View LinearLayout.LayoutParams params_Left = new LinearLayout.LayoutParams(0, 0, 0); this.ln_left.LayoutParameters = params_Left; ln_left.Visibility = ViewStates.Invisible; //Add label into Middle View var aLabel = new TextView(this); aLabel.Text = Resources.GetString(Resource.String.NoArrangement); aLabel.Gravity = GravityFlags.Center; aLabel.SetTextColor(Color.ParseColor("#006571")); aLabel.SetTextSize(Android.Util.ComplexUnitType.Dip, 20); this.ln_Chart.AddView(aLabel); //Add button into Left View var aButton = new Button(this); aButton.Text = "Make a Payment"; aButton.SetTextColor(Color.White); aButton.SetBackgroundColor(Color.ParseColor("#006571")); aButton.Click += Bt_Make_Payment_Click; //Make this Left view big as parent this.ln_right.AddView(aButton); this.ln_right.WeightSum = 0; var param_Bottom = this.ln_BottomChart.LayoutParameters; param_Bottom.Height = 0; this.ln_BottomChart.LayoutParameters = param_Bottom; } } catch (Exception ee) { AndHUD.Shared.Dismiss(); } }
//public string GetItemName(int position) //{ // return _OrderList[position].StockName; //} public override View GetView(int position, View convertView, ViewGroup parent) { View view; if (this._OrderList.Count == 0) { if (this.type == "Defer") { view = convertView ?? _activity.LayoutInflater.Inflate(Resource.Layout.NoPaymentDeferItem, null, false); } else if (this.type == "Schedule") { view = convertView ?? _activity.LayoutInflater.Inflate(Resource.Layout.NoPaymentTrackerItem1, null, false); } else { view = convertView ?? _activity.LayoutInflater.Inflate(Resource.Layout.NoPaymentTrackerItem2, null, false); } } else { view = convertView ?? _activity.LayoutInflater.Inflate(Resource.Layout.PaymentTrackerList, parent, false); var tv_Date = view.FindViewById <TextView>(Resource.Id.tv_Date); var tv_Amount = view.FindViewById <TextView>(Resource.Id.tv_Amount); var iv_Status = view.FindViewById <ImageView>(Resource.Id.iv_Status); var linearLayout = view.FindViewById <LinearLayout>(Resource.Id.layout_middle); if (this.type == "Schedule") { tv_Date.Text = _OrderList[position].InstalmentDate; var amount = _OrderList[position].InstalmentAmount; tv_Amount.Text = MoneyFormat.Convert(decimal.Parse(amount)); var DueDate = DateTime.ParseExact(tv_Date.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture); if (DueDate < DateTime.Today) { iv_Status.SetBackgroundResource(Resource.Drawable.red); } else { iv_Status.SetBackgroundResource(Resource.Color.transparent); } } else if (this.type == "History") { tv_Date.Text = _OrderList[position].HistInstalDate; var amount = _OrderList[position].HistInstalAmount; tv_Amount.Text = MoneyFormat.Convert(decimal.Parse(amount)); //var DueDate = DateTime.ParseExact(tv_Date.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture); //var PayDate = DateTime.ParseExact(tv_Date.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture); var dueAmount = decimal.Parse(amount); decimal deferAmount = 0; if (!string.IsNullOrEmpty(_OrderList[position].HistDeferredAmount)) { deferAmount = decimal.Parse(_OrderList[position].HistDeferredAmount); } decimal payAmount = 0; if (!string.IsNullOrEmpty(_OrderList[position].HistPaymentAmount)) { payAmount = decimal.Parse(_OrderList[position].HistPaymentAmount); } var payDate = _OrderList[position].HistPaymentDate; if (decimal.Parse(amount) <= 0) { iv_Status.SetBackgroundResource(Resource.Drawable.red); } else if (deferAmount > 0) { iv_Status.SetBackgroundResource(Resource.Drawable.yellow); } else if (payAmount == 0 && string.IsNullOrEmpty(payDate)) { iv_Status.SetBackgroundResource(Resource.Drawable.red); } else if (dueAmount < Settings.NextPaymentInstallment) { iv_Status.SetBackgroundResource(Resource.Drawable.red); } else { iv_Status.SetBackgroundResource(Resource.Drawable.blue); } } else if (this.type == "Defer") { tv_Date.Text = _OrderList[position].HistInstalDate; var amount = _OrderList[position].HistInstalAmount; tv_Amount.Text = MoneyFormat.Convert(decimal.Parse(amount)); iv_Status.SetBackgroundResource(Resource.Drawable.red); } if (position % 2 == 0) { linearLayout.SetBackgroundColor(Color.ParseColor("#EDEDED")); } else { linearLayout.SetBackgroundColor(Color.ParseColor("#FFFFFF")); } } return(view); }
/// <summary> /// Converts financial amount in portals.default currency to string per portal /// </summary> public virtual string AmountToString(decimal amount, MoneyFormat format = MoneyFormat.WithCurrencySymbol, ISession session = null) { return(AmountToString(new Financial.Amount(this.DefauISOCurrency, amount), format, session)); }
/// <summary> /// Converts financial amount to string per portal /// </summary> public abstract string AmountToString(Financial.Amount amount, MoneyFormat format = MoneyFormat.WithCurrencySymbol, ISession session = null);
public void UpdateUI() { CurrentBalanceText.text = MoneyFormat.Default(GameHandler.instance.CurrentBalance); }