//
|
// EndGameAlertView.swift
|
// WanPai
|
//
|
// Created by Robert on 2025/8/14.
|
//
|
|
import UIKit
|
import JQTools
|
|
class EndGameAlertView: UIView,JQNibView {
|
|
|
@IBOutlet weak var tf_red: UITextField!
|
|
@IBOutlet weak var tf_blue: UITextField!
|
|
@IBOutlet weak var btn_cannel: UIButton!
|
|
@IBOutlet weak var btn_sure: UIButton!
|
|
private var clouse:((String,String)->Void)!
|
|
override func awakeFromNib() {
|
super.awakeFromNib()
|
alpha = 0
|
}
|
|
static func show(clouse:@escaping (String,String) -> Void){
|
|
let alertView = EndGameAlertView.jq_loadNibView()
|
alertView.clouse = clouse
|
alertView.frame = sceneDelegate?.window?.frame ?? .zero
|
sceneDelegate?.window?.addSubview(alertView)
|
UIView.animate(withDuration: 0.4) {
|
alertView.layoutIfNeeded()
|
alertView.alpha = 1
|
} completion: { _ in
|
|
}
|
}
|
|
@IBAction func sureAction(_ sender: Any) {
|
|
if tf_red.text?.count == 0 {
|
alert(msg: "输入红队比分")
|
return
|
}
|
if tf_blue.text?.count == 0 {
|
alert(msg: "输入蓝队比分")
|
return
|
}
|
UIView.animate(withDuration: 0.4) {
|
self.alpha = 0
|
self.layoutIfNeeded()
|
} completion: { _ in
|
self.removeFromSuperview()
|
}
|
clouse(tf_red.text!,tf_blue.text!)
|
}
|
|
@IBAction func cannelAction(_ sender: Any) {
|
UIView.animate(withDuration: 0.4) {
|
self.alpha = 0
|
self.layoutIfNeeded()
|
} completion: { _ in
|
self.removeFromSuperview()
|
}
|
}
|
}
|