-
Notifications
You must be signed in to change notification settings - Fork 0
/
ViewModel.swift
144 lines (130 loc) · 4.55 KB
/
ViewModel.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
//
// ViewModel.swift
//
//
// Created by Archit Anant on 05/02/24.
//
import SwiftUI
class ViewModel: ObservableObject {
@Published var drumColor:Color = BaseColor
@Published var pianoColor:Color = BaseColor
@Published var guitarColor:Color = BaseColor
@Published var showOvelay = false
@State private var currentPlayTime: TimeInterval = 0
func playGuitarMusic(){
if BaseSoundManager.instance.currAudio().contains("guitar") {
BaseSoundManager.instance.killAudio()
guitarColor = BaseColor
}
else {
BaseSoundManager.instance.playAudio(sound: .guitarbase)
guitarColor = BasePalletColor
drumColor = BaseColor
pianoColor = BaseColor
}
}
func playDrumMusic(){
if BaseSoundManager.instance.currAudio().contains("drumbeat") {
BaseSoundManager.instance.killAudio()
drumColor = BaseColor
}
else {
BaseSoundManager.instance.playAudio(sound: .drumbeat)
guitarColor = BaseColor
drumColor = BasePalletColor
pianoColor = BaseColor
}
}
func playPianoMusic(){
if BaseSoundManager.instance.currAudio().contains("piano") {
BaseSoundManager.instance.killAudio()
pianoColor = BaseColor
}
else {
BaseSoundManager.instance.playAudio(sound: .pianobase)
guitarColor = BaseColor
drumColor = BaseColor
pianoColor = BasePalletColor
}
}
func stopButton(){
BaseSoundManager.instance.killAudio()
BiteSoundManager.instance.killAudio()
GrateSoundManager.instance.killAudio()
HitSoundManager.instance.killAudio()
StabSoundManager.instance.killAudio()
guitarColor = BaseColor
drumColor = BaseColor
pianoColor = BaseColor
}
@Published var highHitSweetPotato : Color = fontColor
@Published var highStabCarrot : Color = fontColor
@Published var highHitPomelo : Color = fontColor
@Published var highGratePepper : Color = fontColor
@Published var highStabCabbage : Color = fontColor
@Published var playVid = false
@Published var tutorialArray = [
"Hit\nSweet Potato",
"Stab\nCarrot",
"Hit\nSweet Potato",
"Stab\nCarrot",
"Hit\nSweet Potato",
"Stab\nCarrot",
"Hit\nPomelo",
"Hit\nSweet Potato",
"Stab\nCarrot",
"Hit\nSweet Potato",
"Stab\nCarrot",
"Hit\nPomelo",
"Hit\nSweet Potato",
"Stab\nCarrot",
"Stab\nCarrot",
"Stab\nCarrot",
"Hit\nPomelo",
"Hit\nSweet Potato"
]
@Published var currIndex = 0
func highPepper(){
highGratePepper = .cyan
highHitPomelo = fontColor
highStabCarrot = fontColor
highHitSweetPotato = fontColor
highStabCabbage = fontColor
}
func highPomelo(){
highGratePepper = fontColor
highHitPomelo = .cyan
highStabCarrot = fontColor
highHitSweetPotato = fontColor
highStabCabbage = fontColor
}
func highCarrot(){
print("in c")
highGratePepper = fontColor
highHitPomelo = fontColor
highStabCarrot = .cyan
highHitSweetPotato = fontColor
highStabCabbage = fontColor
}
func highSweetPotato(){
highGratePepper = fontColor
highHitPomelo = fontColor
highStabCarrot = fontColor
highHitSweetPotato = .cyan
highStabCabbage = fontColor
}
func highCabbage(){
highGratePepper = fontColor
highHitPomelo = fontColor
highStabCarrot = fontColor
highHitSweetPotato = fontColor
highStabCabbage = .cyan
}
func resetAll(){
highGratePepper = fontColor
highHitPomelo = fontColor
highStabCarrot = fontColor
highHitSweetPotato = fontColor
highStabCabbage = fontColor
}
}