添加震动效果
This commit is contained in:
parent
00ad890c02
commit
c8ee119caa
@ -432,7 +432,7 @@ class CCSpatialVideoDisplayController: BaseController {
|
||||
//已连接
|
||||
if(isScreenMirroring){
|
||||
self.dealTaskWhenExternalScreenConnect()
|
||||
customPlayer.currentED = 0//串流中,就将ed默认设置为0
|
||||
customPlayer.currentED = -1//串流中,就将ed默认设置为0
|
||||
CustomParamBoardView.exHidenBoard()
|
||||
}else{
|
||||
//未连接
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user