Skip to content

Commit

Permalink
Merge pull request #1 from FlipByBlink/v1.1
Browse files Browse the repository at this point in the history
v1.1 / Rename to "PersonasFlip" from "PersonaReversi"
  • Loading branch information
FlipByBlink authored Jan 5, 2025
2 parents 501edf0 + b0eba48 commit cdfb4bf
Show file tree
Hide file tree
Showing 89 changed files with 350 additions and 223 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>RealityKitContent.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>2</integer>
</dict>
</dict>
</dict>
</plist>

This file was deleted.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array/>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1601FF032B4AA8BA0050457E"
BuildableName = "PersonaReversi.app"
BlueprintName = "PersonaReversi"
ReferencedContainer = "container:PersonaReversi.xcodeproj">
BuildableName = "PersonasFlip.app"
BlueprintName = "PersonasFlip"
ReferencedContainer = "container:PersonasFlip.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
Expand All @@ -44,9 +44,9 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1601FF032B4AA8BA0050457E"
BuildableName = "PersonaReversi.app"
BlueprintName = "PersonaReversi"
ReferencedContainer = "container:PersonaReversi.xcodeproj">
BuildableName = "PersonasFlip.app"
BlueprintName = "PersonasFlip"
ReferencedContainer = "container:PersonasFlip.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
Expand All @@ -61,9 +61,9 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1601FF032B4AA8BA0050457E"
BuildableName = "PersonaReversi.app"
BlueprintName = "PersonaReversi"
ReferencedContainer = "container:PersonaReversi.xcodeproj">
BuildableName = "PersonasFlip.app"
BlueprintName = "PersonasFlip"
ReferencedContainer = "container:PersonasFlip.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "16CDEE9F2B4D0FBF00664815"
BuildableName = "PersonaReversi.app"
BuildableName = "PersonasFlip.app"
BlueprintName = "iOS for debug"
ReferencedContainer = "container:PersonaReversi.xcodeproj">
ReferencedContainer = "container:PersonasFlip.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
Expand All @@ -45,9 +45,9 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "16CDEE9F2B4D0FBF00664815"
BuildableName = "PersonaReversi.app"
BuildableName = "PersonasFlip.app"
BlueprintName = "iOS for debug"
ReferencedContainer = "container:PersonaReversi.xcodeproj">
ReferencedContainer = "container:PersonasFlip.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
Expand All @@ -62,9 +62,9 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "16CDEE9F2B4D0FBF00664815"
BuildableName = "PersonaReversi.app"
BuildableName = "PersonasFlip.app"
BlueprintName = "iOS for debug"
ReferencedContainer = "container:PersonaReversi.xcodeproj">
ReferencedContainer = "container:PersonasFlip.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>PersonasFlip.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
<key>iOS for debug.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
</dict>
</dict>
</dict>
</plist>
3 changes: 2 additions & 1 deletion PersonaReversi/App.swift → PersonasFlip/App.swift
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import SwiftUI

@main
struct PersonaReversiApp: App {
struct PersonasFlipApp: App {
@StateObject private var model = 🥽AppModel()
var body: some Scene {
WindowGroup {
ContentView()
.environmentObject(self.model)
}
.windowStyle(.volumetric)
.volumeWorldAlignment(.gravityAligned)
.defaultSize(width: Size.window,
height: Size.window,
depth: Size.window)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ struct ContentView: View {
var body: some View {
RealityView { content, attachments in
content.add(attachments.entity(for: "guide")!)
content.add(attachments.entity(for: "reversi")!)
content.add(attachments.entity(for: "game")!)
} attachments: {
Attachment(id: "guide") { GuideView() }
Attachment(id: "reversi") { ReversiView() }
Attachment(id: "game") { GameView() }
}
.task { self.model.configureGroupSessions() }
.task { 👤Registration.execute() }
.volumeBaseplateVisibility(.hidden)
.frame(width: Size.window,
height: Size.window)
.frame(depth: Size.window)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ struct PieceView: View {
} placeholder: {
Color.clear
}
.rotation3DEffect(self.piece.angle, axis: .y)
.rotation3DEffect(.init(angle: self.piece.angle, axis: .y))
.offset(z: self.piece.zOffset)
.padding(12)
.background {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import SwiftUI
import RealityKit

struct ReversiView: View {
struct GameView: View {
@EnvironmentObject var model: 🥽AppModel
@Environment(\.physicalMetrics) var physicalMetrics
var body: some View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ private extension ResultView {
}
.font(.system(size: 200))
.frame(depth: 200)
.rotation3DEffect(.degrees(context.date.timeIntervalSince(self.showedDate) * 8),
axis: .y)
.rotation3DEffect(.init(angle: .degrees(context.date.timeIntervalSince(self.showedDate) * 8),
axis: .y))
}
.offset(y: self.yOffset)
.offset(y: -600)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import SwiftUI
import GroupActivities

struct ToolbarsView: View {
var body: some View {
Expand All @@ -22,8 +23,7 @@ struct ToolbarsView: View {
private extension ToolbarsView {
private struct ContentView: View {
@EnvironmentObject var model: 🥽AppModel
@Environment(\.dismissImmersiveSpace) var dismissImmersiveSpace
@State private var showSharePlaySubMenu: Bool = false
@State private var isPresentedSharePlaySubMenu: Bool = false
var body: some View {
HStack(spacing: 24) {
HStack(spacing: 24) {
Expand Down Expand Up @@ -59,49 +59,71 @@ private extension ToolbarsView {
.font(.title)
}
.buttonStyle(.plain)
if self.isSharePlaying {
Button {
self.showSharePlaySubMenu = true
} label: {
Image(systemName: "shareplay")
.padding()
.opacity(self.showSharePlaySubMenu ? 0.5 : 1)
.overlay {
if self.model.groupSession?.state == .waiting {
ProgressView()
}
}
}
.font(.title)
.buttonBorderShape(.circle)
.buttonStyle(.plain)
if let groupSession = self.model.groupSession {
Self.SharePlaySubMenuButton(groupSession: groupSession,
isPresented: self.$isPresentedSharePlaySubMenu)
}
}
.padding(12)
.padding(.horizontal, 40)
.frame(height: Size.toolbarHeight)
.glassBackgroundEffect()
}
.rotation3DEffect(.degrees(20), axis: .x)
.rotation3DEffect(.init(angle: .degrees(20), axis: .x))
.overlay(alignment: .bottom) {
if self.showSharePlaySubMenu { self.sharePlaySubMenu() }
if self.isPresentedSharePlaySubMenu { self.sharePlaySubMenu() }
}
.animation(.default, value: self.isPresentedSharePlaySubMenu)
}
private struct SharePlaySubMenuButton: View {
@EnvironmentObject var model: 🥽AppModel
@ObservedObject var groupSession: GroupSession<👤GroupActivity>
@Binding var isPresented: Bool
var body: some View {
if [.waiting, .joined].contains(self.groupSession.state) {
Button {
self.isPresented = true
} label: {
Image(systemName: "shareplay")
.padding()
.opacity(self.isPresented ? 0.5 : 1)
.overlay {
if self.groupSession.state == .waiting {
ProgressView()
}
}
}
.font(.title)
.buttonBorderShape(.circle)
.buttonStyle(.plain)
.animation(.default, value: self.isPresented)
}
}
.animation(.default, value: self.isSharePlaying)
.animation(.default, value: self.showSharePlaySubMenu)
}
private var isSharePlaying: Bool {
#if targetEnvironment(simulator)
true
// false
#else
[.waiting, .joined].contains(self.model.groupSession?.state)
#endif
private struct SharePlayStateView: View {
@ObservedObject var groupSession: GroupSession<👤GroupActivity>
var body: some View {
Text({
switch self.groupSession.state {
case .waiting:
"waiting"
case .joined:
"joined"
case .invalidated(reason: let error):
"invalidated, (\(error.localizedDescription))"
@unknown default:
"unknown"
}
}() as LocalizedStringKey)
.scaleEffect(0.8)
.foregroundStyle(.secondary)
}
}
private func sharePlaySubMenu() -> some View {
VStack {
HStack {
Button {
self.showSharePlaySubMenu = false
self.isPresentedSharePlaySubMenu = false
} label: {
Image(systemName: "xmark.circle.fill")
.imageScale(.large)
Expand All @@ -111,22 +133,9 @@ private extension ToolbarsView {
.buttonStyle(.plain)
Spacer()
Text("SharePlay state:")
Text({
switch self.model.groupSession?.state {
case .waiting:
"waiting"
case .joined:
"joined"
case .invalidated(reason: let error):
"invalidated, (\(error.localizedDescription))"
case .none:
"none"
@unknown default:
"unknown"
}
}() as LocalizedStringKey)
.scaleEffect(0.8)
.foregroundStyle(.secondary)
if let groupSession = model.groupSession {
SharePlayStateView(groupSession: groupSession)
}
}
.font(.subheadline)
.padding(.horizontal)
Expand All @@ -135,7 +144,7 @@ private extension ToolbarsView {
VStack {
Button {
self.model.groupSession?.leave()
self.showSharePlaySubMenu = false
self.isPresentedSharePlaySubMenu = false
} label: {
Text("Leave the activity")
}
Expand All @@ -148,7 +157,7 @@ private extension ToolbarsView {
VStack {
Button("End the activity") {
self.model.groupSession?.end()
self.showSharePlaySubMenu = false
self.isPresentedSharePlaySubMenu = false
}
Text("Everyone will leave the activity.")
.font(.subheadline)
Expand Down
Loading

0 comments on commit cdfb4bf

Please sign in to comment.