Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rounded buttons #10

Open
wants to merge 6 commits into
base: dev3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions pennapps-2020.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
13AC1041250CC122003512FA /* LobbyPlayerTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13AC1040250CC122003512FA /* LobbyPlayerTableViewCell.swift */; };
76346068250C883900A24D75 /* LobbyVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76346067250C883900A24D75 /* LobbyVC.swift */; };
7634606E250D1DAE00A24D75 /* GameVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7634606D250D1DAE00A24D75 /* GameVC.swift */; };
76989E07250D6557000F5948 /* GamePlayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76989E06250D6557000F5948 /* GamePlayer.swift */; };
76989E0A250D65B7000F5948 /* Flargio.scnassets in Resources */ = {isa = PBXBuildFile; fileRef = 76989E09250D65B7000F5948 /* Flargio.scnassets */; };
E810E093250C9A6B00942D72 /* LobbyViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = E810E091250C9A6B00942D72 /* LobbyViewModel.swift */; };
E810E094250C9A6B00942D72 /* LobbyPlayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = E810E092250C9A6B00942D72 /* LobbyPlayer.swift */; };
Expand All @@ -46,12 +45,8 @@
54C428A97DB3A55B6DE43E7F /* Pods-pennapps-2020.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-pennapps-2020.debug.xcconfig"; path = "Target Support Files/Pods-pennapps-2020/Pods-pennapps-2020.debug.xcconfig"; sourceTree = "<group>"; };
76346067250C883900A24D75 /* LobbyVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LobbyVC.swift; sourceTree = "<group>"; };
7634606D250D1DAE00A24D75 /* GameVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameVC.swift; sourceTree = "<group>"; };

76989E06250D6557000F5948 /* GamePlayer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GamePlayer.swift; sourceTree = "<group>"; };
76989E09250D65B7000F5948 /* Flargio.scnassets */ = {isa = PBXFileReference; lastKnownFileType = wrapper.scnassets; path = Flargio.scnassets; sourceTree = "<group>"; };
844C4D806B4F875F9ECA09A8 /* Pods_pennapps_2020.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_pennapps_2020.framework; sourceTree = BUILT_PRODUCTS_DIR; };
DAC17A8D30BF73C28BB1FAD7 /* Pods-pennapps-2020.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-pennapps-2020.release.xcconfig"; path = "Target Support Files/Pods-pennapps-2020/Pods-pennapps-2020.release.xcconfig"; sourceTree = "<group>"; };

E810E091250C9A6B00942D72 /* LobbyViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LobbyViewModel.swift; sourceTree = "<group>"; };
E810E092250C9A6B00942D72 /* LobbyPlayer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LobbyPlayer.swift; sourceTree = "<group>"; };
FA4F6298250D5F3600653A62 /* GameViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameViewModel.swift; sourceTree = "<group>"; };
Expand All @@ -77,6 +72,8 @@
137A5E70250C3CD4003EAD14 /* Products */,
9C7443281B792A62262A04E8 /* Pods */,
7058A40AFAA52444D88DF6C3 /* Frameworks */,
FA4F629D250D74CB00653A62 /* Recovered References */,

);
sourceTree = "<group>";
};
Expand Down Expand Up @@ -138,10 +135,8 @@
isa = PBXGroup;
children = (
7634606D250D1DAE00A24D75 /* GameVC.swift */,

FA4F6298250D5F3600653A62 /* GameViewModel.swift */,
FA4F629A250D646600653A62 /* GamePlayer.swift */,

);
path = Game;
sourceTree = "<group>";
Expand All @@ -164,6 +159,14 @@
path = Pods;
sourceTree = "<group>";
};
FA4F629D250D74CB00653A62 /* Recovered References */ = {
isa = PBXGroup;
children = (
76989E06250D6557000F5948 /* GamePlayer.swift */,
);
name = "Recovered References";
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -291,7 +294,6 @@
13052713250C6AF300529A64 /* HomeScreenViewModel.swift in Sources */,
E810E094250C9A6B00942D72 /* LobbyPlayer.swift in Sources */,
13AC1041250CC122003512FA /* LobbyPlayerTableViewCell.swift in Sources */,
76989E07250D6557000F5948 /* GamePlayer.swift in Sources */,
7634606E250D1DAE00A24D75 /* GameVC.swift in Sources */,
76346068250C883900A24D75 /* LobbyVC.swift in Sources */,
);
Expand Down Expand Up @@ -369,7 +371,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
IPHONEOS_DEPLOYMENT_TARGET = 13.1;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down Expand Up @@ -423,7 +425,8 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
IPHONEOS_DEPLOYMENT_TARGET = 13.1;

MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
Expand All @@ -440,8 +443,9 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 3456953M9M;
DEVELOPMENT_TEAM = LFFFF46AX3;
INFOPLIST_FILE = "pennapps-2020/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -462,6 +466,7 @@
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = LFFFF46AX3;
INFOPLIST_FILE = "pennapps-2020/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down
36 changes: 18 additions & 18 deletions pennapps-2020/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="16096" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="zOT-fQ-Mgr">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="16097.3" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="zOT-fQ-Mgr">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
Expand All @@ -15,8 +15,8 @@
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="LtC-vZ-DWe">
<rect key="frame" x="30" y="388" width="354" height="207"/>
<button opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="LtC-vZ-DWe">
<rect key="frame" x="30" y="458" width="354" height="166"/>
<color key="backgroundColor" systemColor="systemIndigoColor" red="0.34509803919999998" green="0.33725490200000002" blue="0.83921568629999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="40"/>
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
Expand All @@ -25,8 +25,8 @@
<action selector="joinPressedWithSender:" destination="BYZ-38-t0r" eventType="touchUpInside" id="wyd-UK-juo"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="F8r-WS-pot">
<rect key="frame" x="30" y="625" width="354" height="207"/>
<button opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="F8r-WS-pot">
<rect key="frame" x="30" y="667" width="354" height="165"/>
<color key="backgroundColor" systemColor="systemPinkColor" red="1" green="0.1764705882" blue="0.33333333329999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="40"/>
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
Expand All @@ -35,30 +35,24 @@
<action selector="createPressedWithSender:" destination="BYZ-38-t0r" eventType="touchUpInside" id="Rms-FJ-rDO"/>
</connections>
</button>
<textField opaque="NO" contentMode="scaleToFill" verticalHuggingPriority="251" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Enter a Username" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="3fp-WN-fc5">
<rect key="frame" x="50" y="288" width="314" height="50"/>
<textField opaque="NO" contentMode="scaleToFill" verticalHuggingPriority="251" misplaced="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Enter a Username" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="3fp-WN-fc5">
<rect key="frame" x="50" y="370" width="314" height="50"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="H7x-v5-Kto"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="24"/>
<textInputTraits key="textInputTraits"/>
</textField>
<textField opaque="NO" contentMode="scaleToFill" verticalHuggingPriority="251" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Room ID" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="OS2-k1-CHP">
<rect key="frame" x="50" y="208" width="314" height="50"/>
<textField opaque="NO" contentMode="scaleToFill" verticalHuggingPriority="251" misplaced="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Room ID" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="OS2-k1-CHP">
<rect key="frame" x="50" y="291" width="314" height="50"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="ekH-ul-ThN"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="24"/>
<textInputTraits key="textInputTraits"/>
</textField>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="&quot;Please Enter A Valid Room ID&quot;" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lx7-Jw-nvy">
<rect key="frame" x="50" y="260" width="314" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" systemColor="systemRedColor" red="1" green="0.23137254900000001" blue="0.18823529410000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="&quot;Please Enter A Valid Username&quot;" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Crw-Tc-X2r">
<rect key="frame" x="50" y="340" width="314" height="19"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="&quot;Please Enter A Valid Room ID&quot;" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lx7-Jw-nvy">
<rect key="frame" x="50" y="341" width="314" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" systemColor="systemRedColor" red="1" green="0.23137254900000001" blue="0.18823529410000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
Expand All @@ -71,6 +65,12 @@
<segue destination="A1B-gN-lRl" kind="show" id="whE-R1-Km4"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="&quot;Please Enter A Valid Username&quot;" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Crw-Tc-X2r">
<rect key="frame" x="50" y="421" width="314" height="19"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" systemColor="systemRedColor" red="1" green="0.23137254900000001" blue="0.18823529410000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<constraints>
Expand Down Expand Up @@ -316,7 +316,7 @@
</scene>
</scenes>
<inferredMetricsTieBreakers>
<segue reference="wAY-hV-vUa"/>
<segue reference="whE-R1-Km4"/>
<segue reference="iuH-qO-jTh"/>
</inferredMetricsTieBreakers>
</document>
10 changes: 8 additions & 2 deletions pennapps-2020/Game/GameVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,19 @@ extension GameVC: ARSessionDelegate {
self.xPos.text = "\(pos.x)"
self.yPos.text = "\(pos.y)"
self.zPos.text = "\(pos.z)"
print(viewModel.userId)
// print(viewModel.userId)
viewModel.updatePosition(userId: viewModel.userId, x: Double(pos.x), z: Double(pos.z)) { (error) in
if error != nil {
print(error)
}
}

print("updated pos func done")
viewModel.observeGamePlayers { (error) in
if error != nil {
print(error)
}
}
print("updated game players func done")

}
}
22 changes: 20 additions & 2 deletions pennapps-2020/Game/GameViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ class GameViewModel {
var ROOM_ID: String
var userId: String!
var hostId: String!
var gamePlayers: [GamePlayer]!
var gamePlayers: [String:GamePlayer]!

init(roomId: String, ref: DatabaseReference!, userId: String, hostId: String, gamePlayers: [GamePlayer]) {
init(roomId: String, ref: DatabaseReference!, userId: String, hostId: String, gamePlayers: [String:GamePlayer]) {
self.ROOM_ID = roomId
self.ref = ref
self.userId = userId
Expand All @@ -32,4 +32,22 @@ class GameViewModel {
ref.child("\(self.PLAY_ROOMS_DB)/\(self.ROOM_ID)/players/\(userId)/x").setValue(x)
ref.child("\(self.PLAY_ROOMS_DB)/\(self.ROOM_ID)/players/\(userId)/z").setValue(z)
}

func observeGamePlayers(handler: @escaping (String?) -> Void) {
print("Observer Game Playersss-------------")
print(hostId)
ref.child("\(self.PLAY_ROOMS_DB)/\(self.ROOM_ID)/players/").observe(.childChanged) {(snapshot) in
guard var data = snapshot.value as? [String: GamePlayer] else {
handler("player was invalid")
return
}
print("observeGamePlayers")
let newPos = data["nickname"]
self.gamePlayers[snapshot.key] = newPos
print(snapshot.key)
print(data["nickname"])
print(data["x"])
print(data["z"])
}
}
}
4 changes: 3 additions & 1 deletion pennapps-2020/HomeScreen/HomeScreenVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ class HomeScreenVC: UIViewController, UITextFieldDelegate {
super.viewDidLoad()
// Do any additional setup after loading the view.
self.viewModel = HomeScreenViewModel(ref: Database.database().reference())


joinButton.layer.cornerRadius = 8.0
createButton.layer.cornerRadius = 8.0
roomLabel.isHidden = true
nicknameLabel.isHidden = true
nicknameTextField.delegate = self
Expand Down
6 changes: 5 additions & 1 deletion pennapps-2020/Lobby/LobbyVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,11 @@ class LobbyVC: UIViewController, UITableViewDelegate, UITableViewDataSource {

let vc = segue.destination as! GameVC
vc.delegate = self
vc.viewModel = GameViewModel(roomId: viewModel.ROOM_ID, ref: viewModel.ref, userId: viewModel.userId, hostId: viewModel.hostId, gamePlayers: viewModel.getGamePlayers())
var gpMap:[String:GamePlayer] = [:]
for player in viewModel.getGamePlayers() {
gpMap[player.userId] = player
}
vc.viewModel = GameViewModel(roomId: viewModel.ROOM_ID, ref: viewModel.ref, userId: viewModel.userId, hostId: viewModel.hostId, gamePlayers: gpMap)
}

}