Visual_Novel_iOS/crush/Crush/Src/Components/UI/Dialog/RoleIntroBrowseDialogContro...

149 lines
5.4 KiB
Swift

//
// RoleIntroBrowseDialogController.swift
// Crush
//
// Created by Leon on 2025/7/25.
//
import UIKit
///
class RoleIntroBrowseDialogController: BaseMaskPopDialogController {
var bgImageView: CLImageView!
var effectView: UIVisualEffectView!
var contentContainer: UIView!
// var contentStackV: UIStackView!
var scrollContainer: LTScrollContainer!
var titleLabel: UILabel!
var descLabel: LineSpaceLabel!
/// Config
var introduction: String?
var imageUrl : String?
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
setupViews()
setupDats()
setupEvents()
}
private func setupViews() {
navigationView.isHidden = true
bgMaskView.alpha = 0
// block.backgroundColor = .black.withAlphaComponent(0.65)
block.backgroundColor = .clear
block.snp.remakeConstraints { make in
make.edges.equalToSuperview()
}
bgImageView = {
let v = CLImageView()
view.insertSubview(v, at: 0)
v.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
return v
}()
closeButton.update(radius: .round, iconSize: .large, iconCode: .delete)
closeButton.snp.remakeConstraints { make in
make.centerX.equalToSuperview()
make.bottom.equalToSuperview().offset(-UIWindow.safeAreaBottom - 24)
}
effectView = {
let v = UIVisualEffectView(effect: UIBlurEffect(style: .dark))
v.alpha = 0.9
block.addSubview(v)
v.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
return v
}()
contentContainer = {
let v = UIView()
v.backgroundColor = .clear
block.addSubview(v)
v.snp.makeConstraints { make in
make.leading.trailing.equalToSuperview()
make.top.equalToSuperview().offset(UIWindow.navBarTotalHeight + 48)
make.bottom.equalToSuperview().offset(-UIWindow.safeAreaBottom - 24 - 48 - 24 - 48)
}
return v
}()
// contentStackV = {
// let v = UIStackView()
// v.axis = .vertical
// v.spacing = 24
// v.alignment = .center
// contentContainer.addSubview(v)
// v.snp.makeConstraints { make in
// make.leading.equalToSuperview().offset(48)
// make.trailing.equalToSuperview().offset(-48)
// make.center.equalToSuperview()
// make.top.greaterThanOrEqualToSuperview()
// make.bottom.lessThanOrEqualToSuperview()
// }
// return v
// }()
scrollContainer = {
let v = LTScrollContainer()
v.stack.spacing = 24
v.stack.alignment = .center
v.stackEdge = UIEdgeInsets(top: 0, left: 48, bottom: 0, right: 48)
contentContainer.addSubview(v)
v.snp.makeConstraints { make in
make.leading.equalToSuperview()//.offset(48)
make.trailing.equalToSuperview()//.offset(-48)
make.top.bottom.equalToSuperview()
}
return v
}()
titleLabel = {
let v = UILabel()
v.textColor = .text
v.font = .t.ttm
scrollContainer.stack.addArrangedSubview(v)
return v
}()
descLabel = {
let v = LineSpaceLabel()
v.textColor = .text
let typo = CLSystemToken.typography(token: .tbl)
v.config(typo)
scrollContainer.stack.addArrangedSubview(v)
return v
}()
block.bringSubviewToFront(closeButton)
titleLabel.text = "Intro"
}
private func setupDats() {
descLabel.text = introduction
bgImageView.loadImage(imageUrl)
// #warning("test")
// testData()
}
private func testData() {
descLabel.text = "She is a new intern teacher and has just graduated. You are the most rebellious student of the whole school workers. In order to prove her ability, she took the initiative to apply to be your class teacher. In the upcoming college entrance\nShe is a new intern teacher and has just graduated. You are the most rebellious student of the whole school workers. In order to prove her ability, she took the initiative to apply to be your class teacher. In the upcoming college entrance\nShe is a new intern teacher and has just graduated. You are the most rebellious student of the whole school workers. In order to prove her ability, she took the initiative to apply to be your class teacher. In the upcoming college entrance\nShe is a new intern teacher and has just graduated. You are the most rebellious student of the whole school workers. In order to prove her ability, she took the initiative to apply to be your class teacher. In the upcoming college entrance."
// descLabel.text = "She is a new intern teacher and has just graduated. You are the most rebellious student of the whole school workers. In order to prove her ability, she took the initiative to apply to be your class teacher. In the upcoming college entrance"
}
private func setupEvents() {
}
}