We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import UIKit import SnapKit import BarrageRenderer class DanmakuView: UIView { private let avatarImageView: UIImageView = { let imageView = UIImageView() imageView.contentMode = .scaleAspectFit imageView.layer.cornerRadius = 14 imageView.clipsToBounds = true return imageView }() private let nameLabel: UILabel = { let label = UILabel() label.font = UIFont.boldSystemFont(ofSize: 14) return label }() private let contentLabel: UILabel = { let label = UILabel() label.numberOfLines = 0 label.font = UIFont.systemFont(ofSize: 12) return label }() init(avatar: UIImage?, name: String, content: String) { super.init(frame: .zero) avatarImageView.image = avatar nameLabel.text = name contentLabel.text = content setupSubviews() } override func sizeThatFits(_ size: CGSize) -> CGSize { return CGSize(width: 200, height: 100) } required init?(coder: NSCoder) { super.init(coder: coder) } private func setupSubviews() { addSubview(avatarImageView) addSubview(nameLabel) addSubview(contentLabel) avatarImageView.snp.makeConstraints { make in make.leading.equalToSuperview() make.top.equalToSuperview() make.width.equalTo(28) make.height.equalTo(28) } nameLabel.snp.makeConstraints { make in make.leading.equalTo(avatarImageView.snp.trailing).offset(8) make.top.equalToSuperview() } contentLabel.snp.makeConstraints { make in make.leading.equalTo(avatarImageView.snp.trailing).offset(8) make.top.equalTo(nameLabel.snp.bottom).offset(4) make.trailing.lessThanOrEqualToSuperview() make.width.lessThanOrEqualTo(100) make.bottom.equalToSuperview() } } class func avatarBarrageViewSpriteDescriptor(withDirection direction: BarrageWalkDirection, side: BarrageWalkSide) -> BarrageDescriptor { let titles1: [String] = ["♪└|°з°|┐♪", "♪└|°ε°|┘♪", "♪┌|°з°|┘♪", "♪┌|°ε°|┐♪"] let titles2: [String] = ["ʕ•̫͡•ʔ", "ʕ•̫͡•̫͡•ʔ", "ʕ•̫͡•=•̫͡•ʔ", "ʕ•̫͡•ʔ ʕ•̫͡•ʔ", "ʕ•̫͡•ʔ ʕ•̫͡•̫͡•ʔ", "ʕ•̫͡•ʔ ʕ•̫͡•=•̫͡•ʔ", "ʕ•̫͡•ʔ ʕ•̫͡•ʔ ʕ•̫͡•ʔ", "ʕ•̫͡•ʔ ʕ•̫͡•=•̫͡•ʔ", "ʕ•̫͡•ʔ ʕ•̫͡•̫͡•ʔ", "ʕ•̫͡•ʔ ʕ•̫͡•ʔ", "ʕ•̫͡•=•̫͡•ʔ", "ʕ•̫͡•̫͡•ʔ", "ʕ•̫͡•ʔ"] let descriptor = BarrageDescriptor() descriptor.spriteName = NSStringFromClass(BarrageWalkSprite.self) descriptor.params["speed"] = NSNumber(value: 100 * Double.random(in: 0...1) + 50) descriptor.params["direction"] = NSNumber(value: direction.rawValue) descriptor.params["side"] = NSNumber(value: side.rawValue) descriptor.params["viewClassName"] = NSStringFromClass(XQRelaxRoomDanmuCell.self) descriptor.params["titles"] = titles2 // weak var render = _renderer // descriptor.params["clickAction"] = { [weak render] params in //// render?.removeSprite(withIdentifier: params["identifier"] as? String) // } return descriptor } } // MARK: BarrageViewProtocol extension DanmakuView: BarrageViewProtocol { override func configure(withParams params: [AnyHashable : Any]!) { super.configure(withParams: params) avatarImageView.image = nil nameLabel.text = "dsadsad" contentLabel.text = "xxxxx" } // override func prepareForReuse() { super.prepareForReuse() } // override func update(withTime time: TimeInterval) { // super.update(withTime: time) // } // // }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The text was updated successfully, but these errors were encountered: