添加震动效果

This commit is contained in:
bluesea 2024-04-28 10:44:25 +08:00
parent 00ad890c02
commit c8ee119caa
2 changed files with 27 additions and 4 deletions

View File

@ -432,7 +432,7 @@ class CCSpatialVideoDisplayController: BaseController {
//
if(isScreenMirroring){
self.dealTaskWhenExternalScreenConnect()
customPlayer.currentED = 0//,ed0
customPlayer.currentED = -1//,ed0
CustomParamBoardView.exHidenBoard()
}else{
//

View File

@ -7,6 +7,7 @@
import Foundation
import UIKit
import AudioToolbox
typealias CustomSliderProcessChangeValueCallback = (_ currentValue:Float,_ isMoving:Bool)->Void
class ZZHCustomSlider: UIView {
@ -283,7 +284,7 @@ class CCSlider: UIView{
guard let callback else {
return
}
var currentValue = max(0, min(value, 1))
let currentValue = max(0, min(value, 1))
preValue = currentValue
callback(preValue,isMoving)
@ -324,7 +325,10 @@ class CustomParamBoardView: UIView {
var edSlider:CCSlider?
var edTitleLabel:UILabel?
//scale
var canScalePlaySound = true
//ed
var canEDPlaySound = true
//,,,
var isPlayingOnExternalScreen = false {
didSet {
@ -485,10 +489,21 @@ class CustomParamBoardView: UIView {
//
func updateScaleTitleWithValue(value:Float) {
let minValue = 0.3
let maxValue = 1.8
let resultValue = minValue + (maxValue - minValue) * Double(value)
let formattedValue = String(format: "\(NSLocalizedString("v1.6_缩放", comment: ""))%.f%%", (resultValue) * 100)
let fr = Int(resultValue*100)
if canScalePlaySound && fr == 100{
AudioServicesPlaySystemSound(1519)
canScalePlaySound = false//
}
if fr > 101 || fr < 99 {
canScalePlaySound = true
}
let formattedValue = String(format: "\(NSLocalizedString("v1.6_缩放", comment: ""))%d%%", fr)
self.scaleTitleLabel?.text = formattedValue
if let scaleCallback = self.scaleCallback {
scaleCallback(CGFloat(resultValue))
@ -497,6 +512,7 @@ class CustomParamBoardView: UIView {
//
func exUpdateScaleTitleWithValue(resultValue:CGFloat) {
let formattedValue = String(format: "\(NSLocalizedString("v1.6_缩放", comment: ""))%.f%%", (resultValue) * 100)
self.scaleTitleLabel?.text = formattedValue
let minValue = 0.3
@ -511,6 +527,13 @@ class CustomParamBoardView: UIView {
if let edCallback = self.edCallback {
edCallback(Int(currED))
}
if canEDPlaySound && currED == 0{
AudioServicesPlaySystemSound(1519)
canEDPlaySound = false//
}
if currED > 1 || currED < -1{
canEDPlaySound = true
}
let formattedValue = String(format: "\(NSLocalizedString("v1.6_瞳距", comment: ""))%dmm", currED)
self.edTitleLabel?.text = formattedValue
}