Robert
4 天以前 bfe324e547c704b79b98ce5785686bd83def1daf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//
//  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()
        }
    }
}