Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Better Together
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
ios-dev-group-i
Better Together
Commits
2eb32244
Commit
2eb32244
authored
Feb 10, 2021
by
lukasWoyke
Browse files
Options
Downloads
Patches
Plain Diff
More comments.
parent
bc068abe
No related branches found
No related tags found
2 merge requests
!60
Code cleanup lukas fix
,
!55
Code cleanup lukas
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Better Together/Better Together/UIViews/CharacterManager.swift
+7
-3
7 additions, 3 deletions
...r Together/Better Together/UIViews/CharacterManager.swift
with
7 additions
and
3 deletions
Better Together/Better Together/UIViews/CharacterManager.swift
+
7
−
3
View file @
2eb32244
...
...
@@ -9,6 +9,7 @@ import UIKit
import
MultipeerConnectivity
import
SpriteKit
/// Character Manager manages the preperation of customizations for loading, saving and sending.
class
CharacterManager
{
private
static
let
bodies
=
[
"BTBodiesImages.001"
,
"BTBodiesImages.002"
,
"BTBodiesImages.003"
,
"BTBodiesImages.004"
,
"BTBodiesImages.005"
,
"BTBodiesImages.006"
,
"BTBodiesImages.007"
]
...
...
@@ -18,6 +19,8 @@ class CharacterManager {
private
static
let
rightHands
=
[
"BTHandsRightImages.001"
,
"BTHandsRightImages.002"
,
"BTHandsRightImages.003"
,
"BTHandsRightImages.004"
,
"BTHandsRightImages.005"
,
"BTHandsRightImages.006"
]
private
static
let
rightGrabHands
=
[
"BTHandsRightImagesClosed.001"
,
"BTHandsRightImagesClosed.002"
,
"BTHandsRightImagesClosed.003"
,
"BTHandsRightImagesClosed.004"
,
"BTHandsRightImagesClosed.005"
,
"BTHandsRightImagesClosed.006"
]
private
static
let
flippedArms
=
[
"BTArmsImagesFlipped.002"
,
"BTArmsImagesFlipped.003"
,
"BTArmsImagesFlipped.004"
]
private
static
let
nintyDegrees
:
Float
=
1.5708
static
let
sharedInstance
:
CharacterManager
=
CharacterManager
()
// Contains the configuration of all other players.
...
...
@@ -25,10 +28,11 @@ class CharacterManager {
var
allOtherConfigurations
=
[[
String
]]()
// used on client side
var
preloadedTextures
=
[
SKTexture
]()
// MARK: - Save and load configuration of my own character
private
let
handKey
=
"handKey"
private
let
armKey
=
"ArmKey"
private
let
bodyKey
=
"bodyKey"
// private let personFace = "personFace"
func
saveHand
(
with
imageName
:
String
)
{
UserDefaults
.
standard
.
setValue
(
imageName
,
forKey
:
handKey
)
}
...
...
@@ -45,6 +49,8 @@ class CharacterManager {
saveHand
(
with
:
handName
)
}
// MARK: - Preperation of data for saving, loading and sending.
func
getMyConfigText
()
->
[
String
]?
{
guard
let
body
=
UserDefaults
.
standard
.
value
(
forKey
:
bodyKey
)
as?
String
else
{
return
nil
}
guard
let
arm
=
UserDefaults
.
standard
.
value
(
forKey
:
armKey
)
as?
String
else
{
return
nil
}
...
...
@@ -64,8 +70,6 @@ class CharacterManager {
return
nil
}
private
static
let
nintyDegrees
:
Float
=
1.5708
static
func
getCustomization
(
from
text
:
[
String
]?)
->
[
UIImage
]?
{
guard
text
!=
nil
else
{
return
nil
}
guard
text
!.
count
==
9
else
{
return
nil
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment