-
Notifications
You must be signed in to change notification settings - Fork 0
/
SetView.swift
135 lines (134 loc) · 7.49 KB
/
SetView.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
import SwiftUI
import AVFoundation
let moves = ["Opponent","Random","You"]
let bgName = ["Blue","Green","Yellow","Red","Pink"]
let songs = ["01. Dreaming Days","02. BLUE CLAPPER","03. 至上主義アドトラック","04. STARDUST SONG","05. 百花繚乱花吹雪","06. でいり~だいあり~!","07. 今宵はHalloween Night!","08. Suspect","09. Candy-Go-Round","10. あすいろClearSky","11. 大切フォトグラフ","12. Shiny Smily Story","13. 夢見る空へ","14. キラメキライダー☆"]
struct SetView: View {
@AppStorage("firstMove") var firstMove: Int = 0
@AppStorage("background") var background: Int = 0
@AppStorage("group") var group: Int = 0
@AppStorage("music") var music: Int = 0
@Binding var set: Bool
var body: some View {
RoundedRectangle(cornerRadius: 25)
.fill(Color(red: 0.945, green: 0.98, blue: 0.933))
.frame(width: 440, height: 600, alignment: .center)
.overlay(RoundedRectangle(cornerRadius: 25).stroke(Color(red: 0.1137, green: 0.2078, blue: 0.3412), lineWidth: 10))
.overlay(alignment: .topTrailing) {
Button {
AVPlayer.crossBtnPlayer.playFromStart()
set = false
} label: {
Image(systemName: "xmark.circle.fill")
.resizable()
.foregroundColor(Color(red: 0.902, green: 0.224, blue: 0.275))
.frame(width: 30, height: 30)
.padding(10)
}
}
.overlay(alignment: .center) {
VStack {
Text("SETTINGS").foregroundColor(Color(red: 0.2706, green: 0.4824, blue: 0.6157))
.font(.title)
.bold()
.offset(x: 0, y: 10.0)
Spacer()
HStack {
Text("First Move").bold().foregroundColor(Color(red: 0.1137, green: 0.2078, blue: 0.3412))
Spacer()
Image(systemName: "arrowshape.left.fill")
.onTapGesture {
AVPlayer.arrowBtnPlayer.playFromStart()
if firstMove == -1 {firstMove = 1}
else {firstMove -= 1}
}
RoundedRectangle(cornerRadius: 10)
.frame(width: 150, height: 30)
.foregroundColor(Color(red: 0.6588, green: 0.8549, blue: 0.8627))
.overlay(alignment: .center) {
Text(moves[firstMove+1])
.foregroundColor(Color(red: 0.902, green: 0.224, blue: 0.275))
}
Image(systemName: "arrowshape.right.fill")
.onTapGesture {
AVPlayer.arrowBtnPlayer.playFromStart()
if firstMove == 1 {firstMove = -1}
else {firstMove += 1}
}
}.padding(20)
HStack {
Text("Background").bold().foregroundColor(Color(red: 0.1137, green: 0.2078, blue: 0.3412))
Spacer()
Image(systemName: "arrowshape.left.fill")
.onTapGesture {
AVPlayer.arrowBtnPlayer.playFromStart()
if background == 0 {background = 4}
else {background -= 1}
}
Image("Bg\(bgName[background])")
.resizable()
.scaledToFit()
.frame(width: 150, height: 90)
.clipShape(RoundedRectangle(cornerRadius: 10))
Image(systemName: "arrowshape.right.fill")
.onTapGesture {
AVPlayer.arrowBtnPlayer.playFromStart()
background = (background + 1) % bgName.count
}
}.padding(20)
HStack {
Text("Group").bold().foregroundColor(Color(red: 0.1137, green: 0.2078, blue: 0.3412))
Spacer()
Image(systemName: "arrowshape.left.fill")
.onTapGesture {
AVPlayer.arrowBtnPlayer.playFromStart()
if group == 0 {group = 6}
else {group -= 1}
}
HStack(spacing: 0) {
Image("\(group)1").resizable().frame(width: 30, height: 30)
Image("\(group)2").resizable().frame(width: 30, height: 30)
Image("\(group)3").resizable().frame(width: 30, height: 30)
Image("\(group)4").resizable().frame(width: 30, height: 30)
Image("\(group)5").resizable().frame(width: 30, height: 30)
}
Image(systemName: "arrowshape.right.fill")
.onTapGesture {
AVPlayer.arrowBtnPlayer.playFromStart()
if group == 6 {group = 0}
else {group += 1}
}
}.padding(20)
HStack {
Text("Music").bold().foregroundColor(Color(red: 0.1137, green: 0.2078, blue: 0.3412))
Spacer()
Image(systemName: "arrowshape.left.fill")
.onTapGesture {
AVPlayer.arrowBtnPlayer.playFromStart()
if music == 0 {music = 13}
else {music -= 1}
guard let url = Bundle.main.url(forResource: songs[music], withExtension: "mp3") else { fatalError("Failed to find sound file.") }
let item = AVPlayerItem(url: url)
AVPlayer.bgQueuePlayer.replaceCurrentItem(with: item)
}
RoundedRectangle(cornerRadius: 10)
.frame(width: 150, height: 60)
.foregroundColor(Color(red: 0.6588, green: 0.8549, blue: 0.8627))
.overlay(alignment: .center) {
Text(songs[music])
.foregroundColor(Color(red: 0.902, green: 0.224, blue: 0.275))
}
Image(systemName: "arrowshape.right.fill")
.onTapGesture {
AVPlayer.arrowBtnPlayer.playFromStart()
music = (music + 1) % songs.count
guard let url = Bundle.main.url(forResource: songs[music], withExtension: "mp3") else { fatalError("Failed to find sound file.") }
let item = AVPlayerItem(url: url)
AVPlayer.bgQueuePlayer.replaceCurrentItem(with: item)
}
}.padding(20)
Spacer()
}
}
}
}