From 77041c81c325c0bc88c94dc28d732f656cc4c885 Mon Sep 17 00:00:00 2001 From: 无故事王国 <841720330@qq.com> Date: 星期二, 17 十月 2023 18:28:29 +0800 Subject: [PATCH] 修复BUG --- WanPai/Root/Games/View/GamesPayView.swift | 21 ++++++++++++++++++--- 1 files changed, 18 insertions(+), 3 deletions(-) diff --git a/WanPai/Root/Games/View/GamesPayView.swift b/WanPai/Root/Games/View/GamesPayView.swift index d9c8e98..8c9ff6e 100644 --- a/WanPai/Root/Games/View/GamesPayView.swift +++ b/WanPai/Root/Games/View/GamesPayView.swift @@ -13,33 +13,48 @@ @IBOutlet weak var view_container: UIView! @IBOutlet weak var label_price: UILabel! @IBOutlet weak var label_coin: UILabel! - + @IBOutlet weak var label_integral: UILabel! + private var price:Double = 0 private var coin:Int? + private var integral:Int? private var needPay:(()->Void)! override func awakeFromNib() { super.awakeFromNib() label_coin.isHidden = true + label_integral.isHidden = true + label_price.isHidden = true view_container.transform = CGAffineTransform(scaleX: 0.1, y: 0.1) alpha = 0 layoutIfNeeded() } - static func show(price:Double,coin:Int?,needPay: @escaping ()->Void){ + static func show(price:Double,coin:Int?,integral:Int? = nil,needPay: @escaping ()->Void){ let gamesPayView = GamesPayView.jq_loadNibView() gamesPayView.frame = sceneDelegate?.window?.frame ?? .zero gamesPayView.price = price gamesPayView.coin = coin + gamesPayView.integral = integral gamesPayView.needPay = needPay - gamesPayView.label_price.attributedText = AttributedStringbuilder.build().add(string: "游玩价格:", withFont: UIFont.systemFont(ofSize: 16, weight: .medium), withColor: .black.withAlphaComponent(0.8)).add(string: price.currency(), withFont: UIFont.systemFont(ofSize: 16, weight: .medium), withColor: Def_ThemeColor).mutableAttributedString + if price != 0{ + gamesPayView.label_price.isHidden = false + gamesPayView.label_price.attributedText = AttributedStringbuilder.build().add(string: "游玩价格:", withFont: UIFont.systemFont(ofSize: 16, weight: .medium), withColor: .black.withAlphaComponent(0.8)).add(string: price.currency(), withFont: UIFont.systemFont(ofSize: 16, weight: .medium), withColor: Def_ThemeColor).mutableAttributedString + } + if coin != nil{ gamesPayView.label_coin.isHidden = false gamesPayView.label_coin.attributedText = AttributedStringbuilder.build().add(string: "玩湃币:", withFont: UIFont.systemFont(ofSize: 16, weight: .medium), withColor: .black.withAlphaComponent(0.8)).add(string: "\(coin!)币", withFont: UIFont.systemFont(ofSize: 16, weight: .medium), withColor: Def_ThemeColor).mutableAttributedString } + if integral != nil{ + gamesPayView.label_integral.isHidden = false + gamesPayView.label_integral.attributedText = AttributedStringbuilder.build().add(string: "积分:", withFont: UIFont.systemFont(ofSize: 16, weight: .medium), withColor: .black.withAlphaComponent(0.8)).add(string: "\(integral!)", withFont: UIFont.systemFont(ofSize: 16, weight: .medium), withColor: Def_ThemeColor).mutableAttributedString + } + + sceneDelegate?.window?.addSubview(gamesPayView) UIView.animate(withDuration: 0.5) { gamesPayView.view_container.transform = CGAffineTransform(scaleX: 1.0, y: 1.0) -- Gitblit v1.7.1