라이브 방
- 하트 애니메이션 추가
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
//
|
||||
// LiveRoomHeartView.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 10/24/24.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct LiveRoomHeartView: View {
|
||||
let heart: Heart
|
||||
|
||||
var body: some View {
|
||||
Image("ic_heart_pink")
|
||||
.resizable()
|
||||
.frame(width: 24 * heart.scale, height: 24 * heart.scale) // 크기 조절
|
||||
.shadow(radius: 10)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
LiveRoomHeartView(
|
||||
heart: Heart(
|
||||
id: UUID(),
|
||||
offsetX: 0,
|
||||
offsetY: 0,
|
||||
opacity: 1.0,
|
||||
speed: 1.0,
|
||||
scale: 0.5,
|
||||
direction: "left"
|
||||
)
|
||||
)
|
||||
}
|
18
SodaLive/Sources/Live/Room/V2/Heart.swift
Normal file
18
SodaLive/Sources/Live/Room/V2/Heart.swift
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// Heart.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 10/24/24.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
struct Heart: Identifiable {
|
||||
let id: UUID
|
||||
var offsetX: CGFloat // X축 위치
|
||||
var offsetY: CGFloat // Y축 위치
|
||||
var opacity: Double // 투명도
|
||||
var speed: CGFloat // 이동 속도
|
||||
var scale: CGFloat // 크기
|
||||
var direction: String
|
||||
}
|
@@ -178,12 +178,20 @@ struct LiveRoomViewV2: View {
|
||||
VStack(alignment: .trailing, spacing: 0) {
|
||||
Spacer()
|
||||
|
||||
LiveRoomRightBottomButton(
|
||||
imageName: viewModel.isSpeakerMute ? "ic_speaker_off" : "ic_speaker_on",
|
||||
onClick: { viewModel.toggleSpeakerMute() }
|
||||
)
|
||||
.padding(.bottom, 40)
|
||||
.padding(.trailing, 13.3)
|
||||
ZStack(alignment: .bottom) {
|
||||
LiveRoomRightBottomButton(
|
||||
imageName: viewModel.isSpeakerMute ? "ic_speaker_off" : "ic_speaker_on",
|
||||
onClick: { viewModel.toggleSpeakerMute() }
|
||||
)
|
||||
.padding(.bottom, 40)
|
||||
.padding(.trailing, 13.3)
|
||||
|
||||
ForEach(viewModel.hearts) { heart in
|
||||
LiveRoomHeartView(heart: heart)
|
||||
.offset(x: heart.offsetX, y: heart.offsetY)
|
||||
.opacity(heart.opacity)
|
||||
}
|
||||
}
|
||||
|
||||
HStack(alignment: .bottom, spacing: 0) {
|
||||
LiveRoomInputChatView {
|
||||
@@ -201,11 +209,18 @@ struct LiveRoomViewV2: View {
|
||||
imageName: "ic_roulette_settings",
|
||||
onClick: { viewModel.isShowRouletteSettings = true }
|
||||
)
|
||||
} else if liveRoomInfo.creatorId != UserDefaults.int(forKey: .userId) && viewModel.isActiveRoulette {
|
||||
} else {
|
||||
LiveRoomRightBottomButton(
|
||||
imageName: "ic_roulette",
|
||||
onClick: { viewModel.showRoulette() }
|
||||
imageName: "ic_heart_pink",
|
||||
onClick: { viewModel.likeHeart() }
|
||||
)
|
||||
|
||||
if viewModel.isActiveRoulette {
|
||||
LiveRoomRightBottomButton(
|
||||
imageName: "ic_roulette",
|
||||
onClick: { viewModel.showRoulette() }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
LiveRoomRightBottomButton(
|
||||
@@ -414,6 +429,17 @@ struct LiveRoomViewV2: View {
|
||||
)
|
||||
}
|
||||
|
||||
if viewModel.isShowNoticeLikeHeart {
|
||||
SodaDialog(
|
||||
title: "안내",
|
||||
desc: "'좋아해요'는 유료 후원입니다.\n" +
|
||||
"클릭시 1캔이 소진됩니다.",
|
||||
confirmButtonTitle: "확인"
|
||||
) {
|
||||
viewModel.isShowNoticeLikeHeart = false
|
||||
}
|
||||
}
|
||||
|
||||
if viewModel.isShowQuitPopup {
|
||||
SodaDialog(
|
||||
title: "라이브 나가기",
|
||||
|
Reference in New Issue
Block a user