Skip to content

Commit

Permalink
Add rankview and player stats view
Browse files Browse the repository at this point in the history
  • Loading branch information
sp4ce-cowboy committed Apr 20, 2024
1 parent 2bd4cd9 commit 18d7157
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 124 deletions.
4 changes: 0 additions & 4 deletions TowerForge/TowerForge.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@
BA2F5AC92BC81BDB00CBD8E9 /* StatisticsEngine.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA2F5AC82BC81BDB00CBD8E9 /* StatisticsEngine.swift */; };
BA2F5ACB2BC82CCC00CBD8E9 /* EventStatisticLinkDatabase.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA2F5ACA2BC82CCC00CBD8E9 /* EventStatisticLinkDatabase.swift */; };
BA2F5ACD2BC8313900CBD8E9 /* StatisticUpdateLinkDatabase.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA2F5ACC2BC8313900CBD8E9 /* StatisticUpdateLinkDatabase.swift */; };
BA436ADD2BD1BC3300BE3E4F /* RankView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA436ADC2BD1BC3300BE3E4F /* RankView.swift */; };
BA443D3D2BAD9557009F0FFB /* RemoveSystem.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA443D3C2BAD9557009F0FFB /* RemoveSystem.swift */; };
BA443D3F2BAD9774009F0FFB /* RemoveEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA443D3E2BAD9774009F0FFB /* RemoveEvent.swift */; };
BA443D422BAD9885009F0FFB /* DamageEventTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA443D412BAD9885009F0FFB /* DamageEventTests.swift */; };
Expand Down Expand Up @@ -459,7 +458,6 @@
BA2F5AC82BC81BDB00CBD8E9 /* StatisticsEngine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatisticsEngine.swift; sourceTree = "<group>"; };
BA2F5ACA2BC82CCC00CBD8E9 /* EventStatisticLinkDatabase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventStatisticLinkDatabase.swift; sourceTree = "<group>"; };
BA2F5ACC2BC8313900CBD8E9 /* StatisticUpdateLinkDatabase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatisticUpdateLinkDatabase.swift; sourceTree = "<group>"; };
BA436ADC2BD1BC3300BE3E4F /* RankView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RankView.swift; sourceTree = "<group>"; };
BA443D3C2BAD9557009F0FFB /* RemoveSystem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RemoveSystem.swift; sourceTree = "<group>"; };
BA443D3E2BAD9774009F0FFB /* RemoveEvent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RemoveEvent.swift; sourceTree = "<group>"; };
BA443D412BAD9885009F0FFB /* DamageEventTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DamageEventTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1012,7 +1010,6 @@
isa = PBXGroup;
children = (
BAEC99FF2BD1A4B700E0C437 /* CustomAchievementCell.swift */,
BA436ADC2BD1BC3300BE3E4F /* RankView.swift */,
);
path = Views;
sourceTree = "<group>";
Expand Down Expand Up @@ -1767,7 +1764,6 @@
527A07742BB3D8E800CD9D08 /* GameModeFactory.swift in Sources */,
5240D0AF2BB3B415004F1486 /* LifeEvent.swift in Sources */,
5295A2072BAA02FD005018A8 /* TFButtonNode.swift in Sources */,
BA436ADD2BD1BC3300BE3E4F /* RankView.swift in Sources */,
BAFFB96A2BB9A64000D8301F /* ObjectSet.swift in Sources */,
BA82C7902BCD2FAF000515A0 /* TotalDamageDealtStatistic.swift in Sources */,
3CD37AA32BBEC0F900222D8A /* FirebaseRemoteEventPublisher.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,60 +221,48 @@
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="NpB-F0-9hb" customClass="RankUIView" customModule="TowerForge" customModuleProvider="target">
<rect key="frame" x="100" y="120" width="366" height="95"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Rank Name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="WyF-VS-BYE">
<rect key="frame" x="175" y="37" width="87.5" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="pA1-QA-x6J">
<rect key="frame" x="0.0" y="0.0" width="95" height="95"/>
<constraints>
<constraint firstAttribute="width" secondItem="pA1-QA-x6J" secondAttribute="height" multiplier="1:1" id="PNU-JI-Xyy"/>
</constraints>
</imageView>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="WyF-VS-BYE" firstAttribute="centerY" secondItem="NpB-F0-9hb" secondAttribute="centerY" id="O6o-wC-50W"/>
<constraint firstItem="pA1-QA-x6J" firstAttribute="leading" secondItem="NpB-F0-9hb" secondAttribute="leading" id="OLx-1Y-h0B"/>
<constraint firstItem="pA1-QA-x6J" firstAttribute="centerY" secondItem="NpB-F0-9hb" secondAttribute="centerY" id="S3e-5N-3wA"/>
<constraint firstItem="pA1-QA-x6J" firstAttribute="height" secondItem="NpB-F0-9hb" secondAttribute="height" id="dFO-oh-Dur"/>
<constraint firstItem="WyF-VS-BYE" firstAttribute="leading" secondItem="pA1-QA-x6J" secondAttribute="trailing" constant="80" id="fFn-hb-GLJ"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="WyF-VS-BYE" secondAttribute="trailing" constant="20" symbolic="YES" id="lu8-r1-EdH"/>
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="CHARACTER" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3F5-6P-B3x">
<rect key="frame" x="192.5" y="50" width="181" height="35"/>
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="30"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Rank:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dNC-ad-u17">
<rect key="frame" x="193" y="135" width="180" height="27"/>
<fontDescription key="fontDescription" type="system" pointSize="22"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="1aZ-FF-wKr">
<rect key="frame" x="100" y="329" width="362" height="367"/>
</imageView>
</subviews>
<viewLayoutGuide key="safeArea" id="dJD-fA-97D"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="WUz-SV-r2V" firstAttribute="top" secondItem="dJD-fA-97D" secondAttribute="top" constant="50" id="1oQ-Pi-llg"/>
<constraint firstItem="dJD-fA-97D" firstAttribute="trailing" secondItem="WUz-SV-r2V" secondAttribute="trailing" constant="50" id="DRg-wA-jye" userLabel="Safe Area.trailing = Achievements View.trailing + 100"/>
<constraint firstItem="NpB-F0-9hb" firstAttribute="leading" secondItem="dJD-fA-97D" secondAttribute="leading" constant="100" id="F81-fa-345"/>
<constraint firstItem="NpB-F0-9hb" firstAttribute="top" secondItem="3fc-40-3P4" secondAttribute="topMargin" constant="50" id="NT2-xd-pIF"/>
<constraint firstItem="3F5-6P-B3x" firstAttribute="leading" secondItem="dJD-fA-97D" secondAttribute="leading" constant="192.5" id="GJK-R8-g2s"/>
<constraint firstItem="1aZ-FF-wKr" firstAttribute="width" secondItem="3F5-6P-B3x" secondAttribute="width" multiplier="2" id="Js1-7X-i1y"/>
<constraint firstItem="1aZ-FF-wKr" firstAttribute="height" secondItem="3fc-40-3P4" secondAttribute="height" multiplier="0.358398" id="MRg-w3-49j"/>
<constraint firstItem="1aZ-FF-wKr" firstAttribute="leading" secondItem="dJD-fA-97D" secondAttribute="leading" constant="100" id="Thr-sW-NdB"/>
<constraint firstItem="dNC-ad-u17" firstAttribute="centerX" secondItem="3F5-6P-B3x" secondAttribute="centerX" id="VH0-eK-jvU"/>
<constraint firstItem="WUz-SV-r2V" firstAttribute="leading" secondItem="dJD-fA-97D" secondAttribute="leading" constant="600" id="XPS-6r-Omy" userLabel="Achievements View.leading = Safe Area.leading + 100"/>
<constraint firstItem="JkC-L0-7EL" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="3F5-6P-B3x" secondAttribute="trailing" constant="8" symbolic="YES" id="YfM-tm-sUN"/>
<constraint firstItem="JkC-L0-7EL" firstAttribute="centerX" secondItem="WUz-SV-r2V" secondAttribute="centerX" id="Zc2-0C-Ik0"/>
<constraint firstItem="dJD-fA-97D" firstAttribute="bottom" secondItem="NpB-F0-9hb" secondAttribute="bottom" constant="759" id="jNT-xy-4bk"/>
<constraint firstItem="dNC-ad-u17" firstAttribute="leading" secondItem="dJD-fA-97D" secondAttribute="leading" constant="193" id="ajN-x8-Lfg"/>
<constraint firstItem="3F5-6P-B3x" firstAttribute="centerY" secondItem="JkC-L0-7EL" secondAttribute="centerY" id="cbu-gR-dM8"/>
<constraint firstItem="1aZ-FF-wKr" firstAttribute="top" secondItem="3F5-6P-B3x" secondAttribute="bottom" constant="244" id="miC-34-FU6"/>
<constraint firstItem="WUz-SV-r2V" firstAttribute="top" secondItem="JkC-L0-7EL" secondAttribute="bottom" constant="35" id="n9F-jB-a5V"/>
<constraint firstItem="3F5-6P-B3x" firstAttribute="centerX" secondItem="NpB-F0-9hb" secondAttribute="centerX" id="oJV-XL-yaH"/>
<constraint firstItem="dNC-ad-u17" firstAttribute="top" secondItem="3F5-6P-B3x" secondAttribute="bottom" constant="50" id="u5H-tG-c8m"/>
<constraint firstItem="dJD-fA-97D" firstAttribute="bottom" secondItem="WUz-SV-r2V" secondAttribute="bottom" constant="400" id="ui2-Tq-XqP"/>
<constraint firstItem="dJD-fA-97D" firstAttribute="trailing" secondItem="NpB-F0-9hb" secondAttribute="trailing" constant="900" id="xZ0-K1-UAx"/>
<constraint firstItem="NpB-F0-9hb" firstAttribute="top" secondItem="3F5-6P-B3x" secondAttribute="bottom" constant="35" id="yDO-3l-eig"/>
</constraints>
</view>
<navigationItem key="navigationItem" id="oa5-Be-lEU"/>
<connections>
<outlet property="achievementsView" destination="WUz-SV-r2V" id="oXa-Af-QSO"/>
<outlet property="rankingView" destination="NpB-F0-9hb" id="MbN-I6-Rtk"/>
<outlet property="characterImage" destination="1aZ-FF-wKr" id="e8E-ss-pzX"/>
<outlet property="rankNameLabel" destination="dNC-ad-u17" id="We1-CA-8OY"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Vmv-iU-woV" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,11 @@
import Foundation
import UIKit

class RankUIView: UIView {
@IBOutlet var rankImageView: UIImageView!
@IBOutlet var rankNameLabel: UILabel!

// You can add methods here to configure the view
func configure(with rank: Rank) {
rankImageView = UIImageView(image: UIImage(named: rank.imageIdentifer))
var rankLabel = UILabel()
rankLabel.text = rank.rawValue
rankNameLabel = rankLabel
}
}

class PlayerStatsViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {

@IBOutlet private var achievementsView: UITableView!
@IBOutlet var rankingView: RankUIView!
@IBOutlet private var rankNameLabel: UILabel!
@IBOutlet private var characterImage: UIImageView!

var achievements: AchievementsDatabase = getAchievements()
var rank: Rank = getRank()
Expand All @@ -47,9 +35,11 @@ class PlayerStatsViewController: UIViewController, UITableViewDataSource, UITabl

achievementsView.delegate = self
achievementsView.dataSource = self
self.rank = Self.getRank()
// rankImageView.image = UIImage(named: currentRank.imageIdentifer)
rankNameLabel.text = String("--- Rank: \(rank.rawValue) ---")

let rank = Self.getRank()
rankingView.configure(with: rank)
characterImage.image = UIImage(named: "melee-1")
reloadAchievements()
}

Expand All @@ -63,21 +53,6 @@ class PlayerStatsViewController: UIViewController, UITableViewDataSource, UITabl
achievements.count
}

/*func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)

// Sort achievements if necessary and configure the cell
let achievementPair = achievements.asSortedArray[indexPath.row]
let achievement = achievementPair.value

cell.textLabel?.text = achievement.name

let permanentValue = achievement.currentProgressRates
cell.detailTextLabel?.text = String(describing: permanentValue)

return cell
}*/

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCell(withIdentifier: "cell",
for: indexPath) as? CustomAchievementCell else {
Expand All @@ -101,6 +76,7 @@ class PlayerStatsViewController: UIViewController, UITableViewDataSource, UITabl

func reloadAchievements() {
achievementsView.reloadData()
rankNameLabel.reloadInputViews()
}

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
Expand Down
56 changes: 0 additions & 56 deletions TowerForge/TowerForge/Views/RankView.swift

This file was deleted.

0 comments on commit 18d7157

Please sign in to comment.