This repository has been archived by the owner on Nov 21, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gem.swift
101 lines (93 loc) · 2.68 KB
/
Gem.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
//
// Gem.swift
// GemAuction
//
// Created by Connor Wybranowski on 7/16/15.
// Copyright (c) 2015 Wybro. All rights reserved.
//
import UIKit
let blueDiamond = "Cerulean Diamond"
let orangeDiamond = "Coral Diamond"
let redDiamond = "Vermilion Diamond"
let greenDiamond = "Viridescent Diamond"
let ruby = "Cardinal Ruby"
let sapphire = "Stormy Sapphire"
class Gem: NSObject {
var name: String = ""
var rarity: Int = 0
var image: UIImage = UIImage()
// init(gemName: String, gemRarity: Int, gemImage: UIImage){
// self.name = gemName
// self.rarity = gemRarity
// self.image = gemImage
// }
init(gemNumber: Int, size: String){
switch gemNumber {
case 1:
self.name = blueDiamond
self.rarity = 300
if size == "normal"{
self.image = UIImage(named: "ceruleanDiamond")!
}
else {
self.image = UIImage(named: "ceruleanDiamond-Small")!
}
case 2:
self.name = orangeDiamond
self.rarity = 250
if size == "normal"{
self.image = UIImage(named: "coralDiamond")!
}
else {
self.image = UIImage(named: "coralDiamond-Small")!
}
case 3:
self.name = redDiamond
self.rarity = 200
if size == "normal"{
self.image = UIImage(named: "vermilionDiamond")!
}
else {
self.image = UIImage(named: "vermilionDiamond-Small")!
}
case 4:
self.name = greenDiamond
self.rarity = 150
if size == "normal"{
self.image = UIImage(named: "viridescentDiamond")!
}
else {
self.image = UIImage(named: "viridescentDiamond-Small")!
}
case 5:
self.name = ruby
self.rarity = 100
if size == "normal"{
self.image = UIImage(named: "cardinalRuby")!
}
else {
self.image = UIImage(named: "cardinalRuby-Small")!
}
case 6:
self.name = sapphire
self.rarity = 50
if size == "normal"{
self.image = UIImage(named: "stormySapphire")!
}
else {
self.image = UIImage(named: "stormySapphire-Small")!
}
default:
break
}
}
func getName() -> String {
return self.name
}
func getRarity() -> String {
return self.rarity.description
}
func getImage() -> UIImage {
return self.image
}
}