Compare commits
1 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
0b15e10ebc |
|
|
@ -158,8 +158,8 @@ class ChatFontCell: ChatSettingBaseCell, CellConfigurable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
override init(reuseIdentifier: String?) {
|
||||||
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
super.init(reuseIdentifier: reuseIdentifier)
|
||||||
configureViews()
|
configureViews()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,9 +52,8 @@ class ChatResponseTokenCell: ChatSettingBaseCell, CellConfigurable {
|
||||||
countLab.text = row.count
|
countLab.text = row.count
|
||||||
}
|
}
|
||||||
|
|
||||||
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
override init(reuseIdentifier: String?) {
|
||||||
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
super.init(reuseIdentifier: reuseIdentifier)
|
||||||
|
|
||||||
configureViews()
|
configureViews()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
import UIKit
|
import UIKit
|
||||||
import SnapKit
|
import SnapKit
|
||||||
|
|
||||||
class ChatSettingBaseCell: UITableViewCell {
|
class ChatSettingBaseCell: UITableViewHeaderFooterView {
|
||||||
|
|
||||||
var containerHeightConstraint: Constraint?
|
var containerHeightConstraint: Constraint?
|
||||||
|
|
||||||
|
|
@ -19,9 +19,8 @@ class ChatSettingBaseCell: UITableViewCell {
|
||||||
return view
|
return view
|
||||||
}()
|
}()
|
||||||
|
|
||||||
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
override init(reuseIdentifier: String?) {
|
||||||
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
super.init(reuseIdentifier: reuseIdentifier)
|
||||||
|
|
||||||
setupViews()
|
setupViews()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -112,8 +112,8 @@ class ChatSwipeCell: ChatSettingBaseCell, CellConfigurable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
override init(reuseIdentifier: String?) {
|
||||||
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
super.init(reuseIdentifier: reuseIdentifier)
|
||||||
|
|
||||||
configureViews()
|
configureViews()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
//
|
||||||
|
// SectionTextCell.swift
|
||||||
|
// Visual_Novel_iOS
|
||||||
|
//
|
||||||
|
// Created by mh on 2025/11/13.
|
||||||
|
//
|
||||||
|
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
struct SectionTextRow: RowModel {
|
||||||
|
let title: String
|
||||||
|
var cellReuseID: String { "SectionTextCell" }
|
||||||
|
|
||||||
|
func cellHeight(tableWidth: CGFloat) -> CGFloat {
|
||||||
|
return UITableView.automaticDimension
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class SectionTextCell: UITableViewHeaderFooterView, CellConfigurable {
|
||||||
|
|
||||||
|
lazy var titleLab: UILabel = {
|
||||||
|
let lab = UILabel()
|
||||||
|
lab.font = UIFont.boldSystemFont(ofSize: 14)
|
||||||
|
lab.textColor = UIColor(hex: "#333333")
|
||||||
|
return lab
|
||||||
|
}()
|
||||||
|
|
||||||
|
override init(reuseIdentifier: String?) {
|
||||||
|
super.init(reuseIdentifier: reuseIdentifier)
|
||||||
|
configureViews()
|
||||||
|
}
|
||||||
|
|
||||||
|
required init?(coder: NSCoder) {
|
||||||
|
fatalError("init(coder:) has not been implemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
func configureViews() {
|
||||||
|
contentView.addSubview(titleLab)
|
||||||
|
|
||||||
|
titleLab.snp.makeConstraints { make in
|
||||||
|
make.left.equalToSuperview().inset(20)
|
||||||
|
make.top.equalToSuperview().inset(10)
|
||||||
|
make.centerY.equalToSuperview()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func configure(with row: any RowModel) {
|
||||||
|
guard let row = row as? SectionTextRow else { return }
|
||||||
|
titleLab.text = row.title
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -57,14 +57,20 @@ class ChatSettingSwipeView: CLContainer {
|
||||||
])
|
])
|
||||||
|
|
||||||
rows = [
|
rows = [
|
||||||
[modelRow, ImageRow(icon: "role_text_mode", title: "Short Text Mode", showAvatar: false, showArrow: false, showSwitch: true)],
|
[ImageRow(icon: "", title: "")],
|
||||||
[ImageRow(icon: "role_voice", title: "Voice actor", showAvatar: true, showArrow: true, showSwitch: false, voiceActorItems: createVoiceActorItems()), ImageRow(icon: "role_talk", title: "Play dialogue only", showAvatar: false, showArrow: false, showSwitch: true)],
|
[modelRow],
|
||||||
|
[ImageRow(icon: "role_text_mode", title: "Short Text Mode", showAvatar: false, showArrow: false, showSwitch: true)],
|
||||||
|
[ImageRow(icon: "role_voice", title: "Voice actor", showAvatar: true, showArrow: true, showSwitch: false, voiceActorItems: createVoiceActorItems())],
|
||||||
|
[ImageRow(icon: "role_talk", title: "Play dialogue only", showAvatar: false, showArrow: false, showSwitch: true)],
|
||||||
[TokenRow(count: "2500")],
|
[TokenRow(count: "2500")],
|
||||||
[FontRow(count: "20", icon: "role_font", title: "Font size"), ImageRow(icon: "role_chat_mode", title: "Chat Mode", showAvatar: false, showArrow: true, showSwitch: false, chatModeItems: createChatModeItems()), buttleRow],
|
[FontRow(count: "20", icon: "role_font", title: "Font size")],
|
||||||
|
[ImageRow(icon: "role_chat_mode", title: "Chat Mode", showAvatar: false, showArrow: true, showSwitch: false, chatModeItems: createChatModeItems())],
|
||||||
|
[buttleRow],
|
||||||
[BackgroundRow(count: 50)],
|
[BackgroundRow(count: 50)],
|
||||||
[HistoryRow(time: "", icon: "", title: "", itemCount: 30)]
|
[HistoryRow(time: "", icon: "", title: "", itemCount: 30)]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
setupViews()
|
setupViews()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -116,6 +122,7 @@ class ChatSettingSwipeView: CLContainer {
|
||||||
tableView.register(ChatButtleCollectionCell.self, forCellReuseIdentifier: "ChatButtleCollectionCell")
|
tableView.register(ChatButtleCollectionCell.self, forCellReuseIdentifier: "ChatButtleCollectionCell")
|
||||||
tableView.register(ChatModeContainerCell.self, forCellReuseIdentifier: "ChatModeContainerCell")
|
tableView.register(ChatModeContainerCell.self, forCellReuseIdentifier: "ChatModeContainerCell")
|
||||||
tableView.register(VoiceActorContainerCell.self, forCellReuseIdentifier: "VoiceActorContainerCell")
|
tableView.register(VoiceActorContainerCell.self, forCellReuseIdentifier: "VoiceActorContainerCell")
|
||||||
|
tableView.register(SectionTextCell.self, forHeaderFooterViewReuseIdentifier: "SectionTextCell")
|
||||||
tableView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
|
tableView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
|
||||||
return tableView
|
return tableView
|
||||||
}()
|
}()
|
||||||
|
|
@ -360,7 +367,10 @@ extension ChatSettingSwipeView: UITableViewDelegate, UITableViewDataSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||||
return rows[section].count
|
if let model = rows[section].first, model is ImageRow {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue