|
|
@@ -42,12 +42,10 @@ class LNCreateOrderPanel: LNPopupView {
|
|
|
countLabel.text = "x\(curCount)"
|
|
|
customCountLabel.text = "\(curCount)"
|
|
|
|
|
|
- if let discount = LNOrderManager.shared.discount,
|
|
|
- discount.hasChance,
|
|
|
- discount.eligiblePrice == price {
|
|
|
- costLabel.text = "\((price * Double(curCount) - (1 - discount.discountRate) * price).toDisplay)"
|
|
|
+ if let discount = LNOrderManager.shared.discountFor(price) {
|
|
|
+ costLabel.text = (price * Double(curCount) - (1 - discount) * price).toDisplay
|
|
|
} else {
|
|
|
- costLabel.text = "\((price * Double(curCount)).toDisplay)"
|
|
|
+ costLabel.text = (price * Double(curCount)).toDisplay
|
|
|
}
|
|
|
if curCount <= 1 {
|
|
|
minuButton.isEnabled = false
|
|
|
@@ -81,12 +79,10 @@ class LNCreateOrderPanel: LNPopupView {
|
|
|
nameLabel.text = detail.nickname
|
|
|
priceLabel.text = "\(detail.price.toDisplay)/\(detail.unit)"
|
|
|
|
|
|
- if let discount = LNOrderManager.shared.discount,
|
|
|
- discount.hasChance,
|
|
|
- discount.eligiblePrice == detail.price {
|
|
|
+ if let discount = LNOrderManager.shared.discountFor(detail.price) {
|
|
|
discountView.isHidden = false
|
|
|
- newbieView.update(1 - discount.discountRate)
|
|
|
- discountCoinLabel.text = "-\(detail.price * (1 - discount.discountRate))"
|
|
|
+ newbieView.update(1 - discount)
|
|
|
+ discountCoinLabel.text = "-\(detail.price * (1 - discount))"
|
|
|
} else {
|
|
|
discountView.isHidden = true
|
|
|
}
|
|
|
@@ -104,12 +100,10 @@ class LNCreateOrderPanel: LNPopupView {
|
|
|
nameLabel.text = user.nickname
|
|
|
priceLabel.text = "\(skill.price.toDisplay)/\(skill.unit)"
|
|
|
|
|
|
- if let discount = LNOrderManager.shared.discount,
|
|
|
- discount.hasChance,
|
|
|
- discount.eligiblePrice == skill.price {
|
|
|
+ if let discount = LNOrderManager.shared.discountFor(skill.price) {
|
|
|
discountView.isHidden = false
|
|
|
- newbieView.update(1 - discount.discountRate)
|
|
|
- discountCoinLabel.text = "-\(skill.price * (1 - discount.discountRate))"
|
|
|
+ newbieView.update(1 - discount)
|
|
|
+ discountCoinLabel.text = "-\(skill.price * (1 - discount))"
|
|
|
} else {
|
|
|
discountView.isHidden = true
|
|
|
}
|
|
|
@@ -125,12 +119,10 @@ class LNCreateOrderPanel: LNPopupView {
|
|
|
nameLabel.text = detail.nickname
|
|
|
priceLabel.text = "\(detail.price.toDisplay)/\(detail.unit)"
|
|
|
|
|
|
- if let discount = LNOrderManager.shared.discount,
|
|
|
- discount.hasChance,
|
|
|
- discount.eligiblePrice == detail.price {
|
|
|
+ if let discount = LNOrderManager.shared.discountFor(detail.price) {
|
|
|
discountView.isHidden = false
|
|
|
- newbieView.update(1 - discount.discountRate)
|
|
|
- discountCoinLabel.text = "-\(detail.price * (1 - discount.discountRate))"
|
|
|
+ newbieView.update(1 - discount)
|
|
|
+ discountCoinLabel.text = "-\(detail.price * (1 - discount))"
|
|
|
} else {
|
|
|
discountView.isHidden = true
|
|
|
}
|