| | |
| | | @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 |
| | | |
| | | 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) |